[ 
https://issues.apache.org/cayenne/browse/CAY-1193?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel
 ]

Andrus Adamchik updated CAY-1193:
---------------------------------

    Description: 
This feature would allow Cayenne to bootstrap the DB schema on startup if 
needed. I can see the following options for schema update:

1. Skip schema update. This is the current behavior.
2. Create if no existing tables are found. This is the most reliable but less 
powerful option. It will skip schema creation if at least one of the tables 
modeled in Cayenne already exist in DB. No exceptions will be thrown (maybe 
just an INFO log message). This will use DbGenerator.
3. Create if no existing tables are found ; throw if partial schema detected. 
This will check for schema changes compared to the model and throw an exception 
if differences are found in the tables mapped in the DataMap (i.e. if there are 
more tables than mapped in Cayenne, it will NOT throw). This will use the merge 
package.

(I wonder if "4. Attempt to merge schema changes" makes any sense at all)

This will have a modeler component - a dropdown at the DataNode level listing 
schema generation strategies. It will be saved in the XML as 
"schema-update-strategy" attribute for the "node" element. 

Runtime component will consist of strategy instantiation, and an intercept of 
DB operations run through the DataNode, passing it to an appropriate strategy. 
Still undecided whether the strategy should be a DataNode attribute or a 
DbAdapter attribute (prolly DataNode).

  was:
This feature would allow Cayenne to bootstrap the DB schema on startup if 
needed. I can see the following options for schema update:

1. Skip schema update. This is the current behavior.
2. Create if no existing tables are found. This is the most reliable but less 
powerful option. It will skip schema creation if at least one of the tables 
modeled in Cayenne already exist in DB. No exceptions will be thrown (maybe 
just an INFO log message). This will use DbGenerator.
3. Throw if partial schema detected. This will check for schema changes 
compared to the model and throw an exception if differences are found in the 
tables mapped in the DataMap (i.e. if there are more tables than mapped in 
Cayenne, it will NOT throw). This will use the merge package.

(I wonder if "4. Attempt to merge schema changes" makes any sense at all)

This will have a modeler component - a dropdown at the DataNode level listing 
schema generation strategies. It will be saved in the XML as 
"schema-update-strategy" attribute for the "node" element. 

Runtime component will consist of strategy instantiation, and an intercept of 
DB operations run through the DataNode, passing it to an appropriate strategy. 
Still undecided whether the strategy should be a DataNode attribute or a 
DbAdapter attribute (prolly DataNode).


> Auto load schema on startup
> ---------------------------
>
>                 Key: CAY-1193
>                 URL: https://issues.apache.org/cayenne/browse/CAY-1193
>             Project: Cayenne
>          Issue Type: New Feature
>          Components: Cayenne Core Library, CayenneModeler GUI
>    Affects Versions: 3.0M5
>            Reporter: Andrus Adamchik
>            Assignee: Andrus Adamchik
>
> This feature would allow Cayenne to bootstrap the DB schema on startup if 
> needed. I can see the following options for schema update:
> 1. Skip schema update. This is the current behavior.
> 2. Create if no existing tables are found. This is the most reliable but less 
> powerful option. It will skip schema creation if at least one of the tables 
> modeled in Cayenne already exist in DB. No exceptions will be thrown (maybe 
> just an INFO log message). This will use DbGenerator.
> 3. Create if no existing tables are found ; throw if partial schema detected. 
> This will check for schema changes compared to the model and throw an 
> exception if differences are found in the tables mapped in the DataMap (i.e. 
> if there are more tables than mapped in Cayenne, it will NOT throw). This 
> will use the merge package.
> (I wonder if "4. Attempt to merge schema changes" makes any sense at all)
> This will have a modeler component - a dropdown at the DataNode level listing 
> schema generation strategies. It will be saved in the XML as 
> "schema-update-strategy" attribute for the "node" element. 
> Runtime component will consist of strategy instantiation, and an intercept of 
> DB operations run through the DataNode, passing it to an appropriate 
> strategy. Still undecided whether the strategy should be a DataNode attribute 
> or a DbAdapter attribute (prolly DataNode).

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.

Reply via email to