[deepamehta-devel] some newbie dev migrations questions
carolina
carolina at sindominio.net
Di Feb 11 00:36:56 CET 2014
-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1
Hello :)
>>> You can't add new child types to an existing type with a
>>> declarative migration (JSON). You would need an imperative
>>> migration for that (Java, DM Core API). But see note below.
>>
>> so in declarative migrations, it would only make sense to have
>> different migration files for defining different types? i.e.
>> define an event, define a location, etc ..?
>
> You can create several things in a single declarative migration.
Yes, I've seen it in the contacts plugin
The
> general migration concept is: A migration represents a certain
> version of your data model that is compatible with a certain
> version of your plugin logic. Currently your plugin contains no
> logic (but just a data model), so this might be why you are
> confused. For differentiating declarative and imperative migrations
> see also the note below.
>
> Read about DM migrations also here:
> https://trac.deepamehta.de/wiki/PluginDevelopmentGuide#Migrations
> Don't hesitate to tell me where this explanation could be
> improved.
I think that my confusion comes from using the terminology "migration"
for declarative migrations when you can just do one operation once,
somehow I guess I would see declarative migrations as db schemas that
are loaded once, sorry I'm doing the equivalences with RoR, which has
those 2 concepts (though in RoR db-schema gets generated/updated while
doing migrations but then you can load it on its own without running
the migrations)
>> 1.- Downloading the code twice and run them in different ports?
>
> This would be the most flexible solution as you could run both DM
> instances at the same time.
I've decided for this option, so now I have 2 DM running :D
>> 2.- Defining 2 DB folders, one for dev and the other working
>> copy?
>
> This is a reasonable approach too. You can configure the DB folder
> via the <dm4.database.path> property in your global POM (in the DM
> home directory). Changes take effect after restarting DM.
>
> IMPORTANT: only deploy stable versions of your plugin in your
> "production" instance. That is in particular: once a certain
> migration has run in your production instance you must make NO
> changes to that migration. There is no way to run that migration
> again. The only way to modify things created by a declarative
> migration is an imperative migration. See also the note below.
ok
>> 3.- ....any other.....
>>
>>> Note: resetting the DB is a pragmatic way while development. In
>>> a production environment this is not an option of course. To
>>> add new child types to an existing type in a production
>>> environment you MUST use an imperative migration (Java code,
>>> not JSON).
>>
>> yes, for sure I'll have to move to use imperative migrations.
>
> Only imperative migrations provides you with a full set of create,
> modify, delete operations as you might be familiar with from RoR
> migrations. But in DM you have to code migrations in Java. To free
> a developer from resorting to program in Java when she just want
> define a data model, DM introduces the concept of declarative
> migrations. Those allow you to define a data model declaratively
> (hence the name), namely in JSON. However, declarative DM
> migrations provide not the full expressiveness as the (imperative)
> Java language. With a declarative migration you can (currently)
> only *create* things, but not modify or delete things.
>
> For an example of how to write an imperative migration see here:
> https://trac.deepamehta.de/wiki/PluginDevelopmentGuide#Writinganimperativemigration
>
>
There a child type is added to an existing parent type (a modify >
operation). This is exactly the scenario you described originally with
> your Event (parent) type and Title and Text (child) types.
>
>> For developing in Java I was planning to set it up in Emacs,
>> that is what I use, I've seen
>>
>> http://www.emacswiki.org/emacs/JavaDevelopmentEnvironment
>>
>> has anybody used it? or makes more sense to use other IDE, like
>> netbeans or...?
>
> Bare bones Emacs (with several buffers open at once), a command
> line for building, plus the DM API Docs open in a browser window is
> all you need. But that's just my taste :-)
:-D
> DM API Docs: http://api.deepamehta.de/deepamehta/4.2-SNAPSHOT/
ups ... I had not seen it
Which of the plugins would be a good start to read code?
best
C
- --
>> Donde la pinten, salto
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.11 (GNU/Linux)
Comment: Using GnuPG with Thunderbird - http://www.enigmail.net/
iQEcBAEBAgAGBQJS+WKKAAoJEOQV1Jy26HIvgiEH/2ApfAF/y3v7JVLqzgs75Auq
J1vhU3FdpjDCYw4fov8rhbzFg3nNowa2y1ER9kK/uibn84Nvnl0E7RUOyEzoS9al
RN/m4z7XDjUdPE3Nx5FKPK6xMkFCfl+lkHBe6wwwgZI55ikv5vOrxCpyaO8/IgHH
vIteWq9pUz6Cc5hxXovQNZBUErVQkcxcdDjdhkdZcNMtLC1IrXYmWy0SGfhEnhCQ
4RE4+Jjppy18FCLXgtvZLwe4Kjw3CasjohPYqsFx17JAjUjT8Eg4C69/cLPcl4TA
oTOqJBWIF1RmyR0XrixazxShQAsO6jKXwfz19Wg5pnNqsAJgbsQHulOeiLg6jLo=
=DMU1
-----END PGP SIGNATURE-----
Mehr Informationen über die Mailingliste devel