Changes between Version 12 and Version 13 of PluginDevelopmentGuide


Ignore:
Timestamp:
09.04.2013 23:17:56 (12 years ago)
Author:
jri
Comment:

Explain the 2 migration kinds

Legend:

Unmodified
Added
Removed
Modified
  • PluginDevelopmentGuide

    v12 v13  
    419419=== Writing migrations === 
    420420 
     421As 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 
    421429==== Declarative migrations ==== 
    422430 
    423 In a declarative migration you can define 4 things: topic types, association types, topics, associations. The general format is: 
     431A declarative migration is a JSON file with exactly one JSON Object in it. In a declarative migration you can define 4 things: topic types, association types, topics, associations. The general format is: 
    424432 
    425433{{{ 
     
    491499}}} 
    492500 
    493 This migration defines 3 topic types: the 2 simple types //Title// and //Text//, and the composite type //Note// that combines the former two. That is, a Note is composed of a Title and a Text.  
     501As you see, this migration defines 3 topic types (and no other things): the 2 simple types //Title// and //Text//, and the composite type //Note//. A Note is composed of a Title and a Text. 
    494502 
    495503==== Imperative migrations ====