| 421 | As you've already learned, migrations serve different (but related) purposes: some just //create// new type definitions and others //modify// existing type definitions and/or transform existing database content. To support the developer with these different tasks DeepaMehta offers two kinds of migrations: |
| 422 | |
| 423 | Declarative migration:: a declarative migration is a JSON file that declares 4 kinds of things: topic types, association types, topics, associations. Use a declarative migration to let DeepaMehta create new types and instances in the database. Use a declarative migration to let your plugin setup the initial type definitions. |
| 424 | |
| 425 | With a declarative migration you can only create new things. You can't modify existing things. All you do with a declarative migration you could achieve with an imperative migration as well, but as long as you just want create new things, it is more convenient to do it declaratively. |
| 426 | |
| 427 | Imperative migration:: an imperative migration is a Java class that has access to the //DeepaMehta Core Service//. Thus, you can perform arbitrary database operations like creation, retrieval, update, deletion. Use an imperative migration when (a later version of) your plugin needs to modify existing type definitions and/or transform existing database content. |
| 428 | |