Skip to content

Commit

Permalink
Updated metamodels and models to article terminology (#114)
Browse files Browse the repository at this point in the history
  • Loading branch information
suarezgpablo authored Dec 5, 2024
1 parent 4dcfb4b commit b31029c
Show file tree
Hide file tree
Showing 67 changed files with 287 additions and 306 deletions.
4 changes: 2 additions & 2 deletions modevo-script/dat/bmk/testCustomV9RemovePK-script.cql
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
FOR $1,$2,$3 = SELECT idAuthor, idBook, title FROM table1BeforeChange
INSERT INTO table1(idAuthor, idBook, title) VALUES ($1, $2, $3);
FOR $1,$2 = SELECT idAuthor, idBook FROM table1BeforeChange
INSERT INTO table1(idAuthor, idBook) VALUES ($1, $2);
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@
import giis.modevo.model.schema.Schema;
import giis.modevo.model.schema.Table;
import giis.modevo.model.schemaevolution.CriteriaSplit;
import giis.modevo.model.schemaevolution.JoinColumn;
import giis.modevo.model.schemaevolution.MergeColumn;
import giis.modevo.model.schemaevolution.SchemaChange;
import giis.modevo.model.schemaevolution.SchemaEvolution;
import giis.modevo.model.schemaevolution.SplitColumn;
Expand Down Expand Up @@ -86,7 +86,7 @@ private Script migrationJoinColumn(Schema schema, SchemaEvolution se, MigrationT
log.info("Join Column Script. Target table: %s", mt.getName());
Script script = new Script ();
for (SchemaChange sc : se.getChanges()) {
if (sc instanceof JoinColumn spc) {
if (sc instanceof MergeColumn spc) {
List<Column> sourceColumns = spc.getSourceColumns();
Column newColumn = spc.getC();
Table t = schema.getTable(mt.getName());
Expand Down Expand Up @@ -184,17 +184,17 @@ private Script migrationFromSeveralTables(Schema schema, SchemaEvolution se, Mig
*/
for (MigrationColumn mc: migrationColumnsWithKey) {
log.info(MIGRATION_FOR_COLUMN, mc.getName());
String nameTable = mc.getColFrom().getTable();
String nameTable = mc.getMigrateFrom().getTable();
if (select.getTable() == null) {
select.setTable(mu.findTable(schema, se, nameTable));
}
String nameColumn = mc.getColTo().getData(); //nameOfColumn where data will be migrated
String[] keyColumnTo = mc.getColTo().getKey();
String[] keyColumnFrom = mc.getColFrom().getKey();
String nameColumn = mc.getMigrateTo().getData(); //nameOfColumn where data will be migrated
String[] keyColumnTo = mc.getMigrateTo().getKey();
String[] keyColumnFrom = mc.getMigrateFrom().getKey();
Table from = schema.getTable(nameTable);
Column c= mu.findColumn (schema,se,from.getName(),nameColumn);
Select selectInside = script.insertSelect(c, from, keyColumnFrom, schema);
Column target = mu.findColumn(schema, se, mc.getColTo().getTable(), mc.getColTo().getData());
Column target = mu.findColumn(schema, se, mc.getMigrateTo().getTable(), mc.getMigrateTo().getData());
//Includes the information required to insert the data queries by 'select' in an iteration into 'target'.
insert.addColumnValue (c, selectInside, keyColumnTo, target);
}
Expand Down Expand Up @@ -222,16 +222,15 @@ private Script migrationNewTableAll(Schema schema, SchemaEvolution se, Migration
//Association in the Insert statement and SELECT statement of the columns that will get the data from the SELECT statement this SELECT statement
for (MigrationColumn mc: migrationColumnsWithoutKey) {
log.info(MIGRATION_FOR_COLUMN, mc.getName());
String nameColumn = mc.getColFrom().getData();
String nameTable = mc.getColFrom().getTable();
String nameColumn = mc.getMigrateFrom().getData();
String nameTable = mc.getMigrateFrom().getTable();
Column c= mu.findColumn (schema,se,nameTable,nameColumn);
if (s.getTable() == null) {
s.setTable(mu.findTable(schema, se, nameTable));
}
//Includes the information required to obtain data from column 'c'
s.addColumnSearch (schema, se, nameTable, c);
Column target = mu.findColumn(schema, se, mc.getColTo().getTable(), mc.getColTo().getData());

Column target = mu.findColumn(schema, se, mc.getMigrateTo().getTable(), mc.getMigrateTo().getData());
//Includes the information required to insert the data queries by 's' in an iteration into 'c'
insert.addColumnValue (c, s, null, target);
}
Expand Down Expand Up @@ -288,15 +287,15 @@ private Script migrationNewColumn(Schema schema, SchemaEvolution se, MigrationTa
Table sourceTable = schema.getTable(nameTable);
for (MigrationColumn mc : keysTarget) {
log.info(MIGRATION_FOR_COLUMN, mc.getName());
String nameColumn = mc.getColFrom().getData(); //nameOfColumn where data will be migrated
String[] keyColumnTo = mc.getColTo().getKey();
String[] keyColumnFrom = mc.getColFrom().getKey();
String nameColumn = mc.getMigrateFrom().getData(); //nameOfColumn where data will be migrated
String[] keyColumnTo = mc.getMigrateTo().getKey();
String[] keyColumnFrom = mc.getMigrateFrom().getKey();
Column c= mu.findColumn (schema,se,sourceTable.getName(),nameColumn);
Select select = script.insertSelect(c, sourceTable, keyColumnFrom, schema);
if (!forSourceKey.getSelectsInsideFor().contains(select)) {
forSourceKey.getSelectsInsideFor().add(select);
}
Column target = mu.findColumn(schema, se, mc.getColTo().getTable(), mc.getColTo().getData());
Column target = mu.findColumn(schema, se, mc.getMigrateTo().getTable(), mc.getMigrateTo().getData());
insertTarget.addColumnValue(c, select, keyColumnTo, target);
}
script.getInserts().add(insertTarget);
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
<?xml version="1.0" encoding="ISO-8859-1"?>
<MigrationTable xmi:version="2.0" xmlns:xmi="http://www.omg.org/XMI" xmlns="DataMigration" name="table2">
<migcol>
<ColTo Data="title" Key="idBook" DataTable="table2"/>
<ColFrom Data="title" Key="idBook" DataTable="table1"/>
<MigrateTo Data="title" Key="idBook" DataTable="table2"/>
<MigrateFrom Data="title" Key="idBook" DataTable="table1"/>
</migcol>
</MigrationTable>
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
<?xml version="1.0" encoding="ISO-8859-1"?>
<MigrationTable xmi:version="2.0" xmlns:xmi="http://www.omg.org/XMI" xmlns="DataMigration" name="table2">
<migcol>
<ColTo Data="title" Key="idBook" DataTable="table2"/>
<ColFrom Data="title" Key="idBook" DataTable="table1"/>
<MigrateTo Data="title" Key="idBook" DataTable="table2"/>
<MigrateFrom Data="title" Key="idBook" DataTable="table1"/>
</migcol>
<migcol>
<ColTo Data="publisher" Key="idBook" DataTable="table2"/>
<ColFrom Data="publisher" Key="idBook" DataTable="table3"/>
<MigrateTo Data="publisher" Key="idBook" DataTable="table2"/>
<MigrateFrom Data="publisher" Key="idBook" DataTable="table3"/>
</migcol>
</MigrationTable>
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
<?xml version="1.0" encoding="ISO-8859-1"?>
<MigrationTable xmi:version="2.0" xmlns:xmi="http://www.omg.org/XMI" xmlns="DataMigration" name="table2">
<migcol>
<ColTo Data="title" Key="idAuthor" DataTable="table2" NewTableName="table2New"/>
<ColFrom Data="title" Key="idAuthor" DataTable="table1"/>
<MigrateTo Data="title" Key="idAuthor" DataTable="table2" NewTableName="table2New"/>
<MigrateFrom Data="title" Key="idAuthor" DataTable="table1"/>
</migcol>
<migcol>
<ColTo Data="idBook" Key="idAuthor" DataTable="table2" NewTableName="table2New"/>
<ColFrom Data="idBook" Key="idAuthor" DataTable="table1"/>
<MigrateTo Data="idBook" Key="idAuthor" DataTable="table2" NewTableName="table2New"/>
<MigrateFrom Data="idBook" Key="idAuthor" DataTable="table1"/>
</migcol>
</MigrationTable>
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
<?xml version="1.0" encoding="ISO-8859-1"?>
<MigrationTable xmi:version="2.0" xmlns:xmi="http://www.omg.org/XMI" xmlns="DataMigration" name="table2">
<migcol>
<ColTo Data="idBook" Key="idAuthor" DataTable="table1" NewTableName="table2new"/>
<ColFrom Data="idBook" Key="idAuthor" DataTable="table1"/>
<MigrateTo Data="idBook" Key="idAuthor" DataTable="table1" NewTableName="table2new"/>
<MigrateFrom Data="idBook" Key="idAuthor" DataTable="table1"/>
</migcol>
<migcol>
<ColTo Data="title" Key="idAuthor" DataTable="table1" NewTableName="table2new"/>
<ColFrom Data="title" Key="idAuthor" DataTable="table1"/>
<MigrateTo Data="title" Key="idAuthor" DataTable="table1" NewTableName="table2new"/>
<MigrateFrom Data="title" Key="idAuthor" DataTable="table1"/>
</migcol>
</MigrationTable>
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
<?xml version="1.0" encoding="ISO-8859-1"?>
<MigrationTable xmi:version="2.0" xmlns:xmi="http://www.omg.org/XMI" xmlns="DataMigration" name="table2">
<migcol>
<ColTo Data="title" Key="idBook" DataTable="table1"/>
<ColFrom Data="title" Key="idBook" DataTable="table1"/>
<MigrateTo Data="title" Key="idBook" DataTable="table1"/>
<MigrateFrom Data="title" Key="idBook" DataTable="table1"/>
</migcol>
</MigrationTable>
12 changes: 6 additions & 6 deletions modevo-transform/dat/bmk/testCustomV6CopyTable-dataMigration.xmi
Original file line number Diff line number Diff line change
@@ -1,15 +1,15 @@
<?xml version="1.0" encoding="ISO-8859-1"?>
<MigrationTable xmi:version="2.0" xmlns:xmi="http://www.omg.org/XMI" xmlns="DataMigration" name="table1Copied">
<migcol>
<ColTo Data="idAuthor" DataTable="table1Copied"/>
<ColFrom Data="idAuthor" DataTable="table1"/>
<MigrateTo Data="idAuthor" DataTable="table1Copied"/>
<MigrateFrom Data="idAuthor" DataTable="table1"/>
</migcol>
<migcol>
<ColTo Data="idBook" DataTable="table1Copied"/>
<ColFrom Data="idBook" DataTable="table1"/>
<MigrateTo Data="idBook" DataTable="table1Copied"/>
<MigrateFrom Data="idBook" DataTable="table1"/>
</migcol>
<migcol>
<ColTo Data="title" DataTable="table1Copied"/>
<ColFrom Data="title" DataTable="table1"/>
<MigrateTo Data="title" DataTable="table1Copied"/>
<MigrateFrom Data="title" DataTable="table1"/>
</migcol>
</MigrationTable>
Original file line number Diff line number Diff line change
Expand Up @@ -3,18 +3,18 @@
<ContainerMigrations migrations="/1"/>
<MigrationTable name="table1Copied1">
<migcol>
<ColTo Data="idBook" DataTable="table1Copied1"/>
<ColFrom Data="idBook" DataTable="table1"/>
<MigrateTo Data="idBook" DataTable="table1Copied1"/>
<MigrateFrom Data="idBook" DataTable="table1"/>
</migcol>
<migcol>
<ColTo Data="title" DataTable="table1Copied1"/>
<ColFrom Data="title" DataTable="table1"/>
<MigrateTo Data="title" DataTable="table1Copied1"/>
<MigrateFrom Data="title" DataTable="table1"/>
</migcol>
</MigrationTable>
<MigrationTable name="table1Copied2">
<migcol>
<ColTo Data="idAuthor" DataTable="table1Copied2"/>
<ColFrom Data="idAuthor" DataTable="table1"/>
<MigrateTo Data="idAuthor" DataTable="table1Copied2"/>
<MigrateFrom Data="idAuthor" DataTable="table1"/>
</migcol>
</MigrationTable>
</xmi:XMI>
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
<?xml version="1.0" encoding="ISO-8859-1"?>
<xmi:XMI xmi:version="2.0" xmlns:xmi="http://www.omg.org/XMI" xmlns="DataMigration">
<MigrationTable name="table1" joincol="/1"/>
<JoinColumn ColTarget="completetitle" ColSource="title , subtitle"/>
<MergeColumn ColTarget="completetitle" ColSource="title , subtitle"/>
</xmi:XMI>
12 changes: 4 additions & 8 deletions modevo-transform/dat/bmk/testCustomV9RemovePK-dataMigration.xmi
Original file line number Diff line number Diff line change
@@ -1,15 +1,11 @@
<?xml version="1.0" encoding="ISO-8859-1"?>
<MigrationTable xmi:version="2.0" xmlns:xmi="http://www.omg.org/XMI" xmlns="DataMigration" name="table1">
<migcol>
<ColTo Data="idAuthor" DataTable="table1BeforeChange"/>
<ColFrom Data="idAuthor" DataTable="table1BeforeChange"/>
<MigrateTo Data="idAuthor" DataTable="table1"/>
<MigrateFrom Data="idAuthor" DataTable="table1BeforeChange"/>
</migcol>
<migcol>
<ColTo Data="idBook" DataTable="table1BeforeChange"/>
<ColFrom Data="idBook" DataTable="table1BeforeChange"/>
</migcol>
<migcol>
<ColTo Data="title" DataTable="table1BeforeChange"/>
<ColFrom Data="title" DataTable="table1BeforeChange"/>
<MigrateTo Data="idBook" DataTable="table1"/>
<MigrateFrom Data="idBook" DataTable="table1BeforeChange"/>
</migcol>
</MigrationTable>
Original file line number Diff line number Diff line change
@@ -1,12 +1,12 @@
<?xml version="1.0" encoding="ISO-8859-1"?>
<MigrationTable xmi:version="2.0" xmlns:xmi="http://www.omg.org/XMI" xmlns="DataMigration" name="hidden_hashtags">
<migcol>
<ColTo Data="hashtag" DataTable="hidden_hashtags"/>
<ColFrom Data="hashtag" DataTable="user_hashtags"/>
<MigrateTo Data="hashtag" DataTable="hidden_hashtags"/>
<MigrateFrom Data="hashtag" DataTable="user_hashtags"/>
</migcol>
<migcol>
<ColTo Data="admin_guid" DataTable="hidden_hashtags"/>
<ColFrom Data="user_guid" DataTable="user_hashtags"/>
<MigrateTo Data="admin_guid" DataTable="hidden_hashtags"/>
<MigrateFrom Data="user_guid" DataTable="user_hashtags"/>
</migcol>
<migcol Description="It is not possible to migrate data to the column hidden_since as it is storing new data that is not stored in another table"/>
</MigrationTable>
Original file line number Diff line number Diff line change
@@ -1,16 +1,16 @@
<?xml version="1.0" encoding="ISO-8859-1"?>
<MigrationTable xmi:version="2.0" xmlns:xmi="http://www.omg.org/XMI" xmlns="DataMigration" name="wire_support_tiers">
<migcol>
<ColTo Data="entity_guid" DataTable="wire_support_tiers"/>
<ColFrom Data="entity_guid" DataTable="wire"/>
<MigrateTo Data="entity_guid" DataTable="wire_support_tiers"/>
<MigrateFrom Data="entity_guid" DataTable="wire"/>
</migcol>
<migcol>
<ColTo Data="guid" DataTable="wire_support_tiers"/>
<ColFrom Data="wire_guid" DataTable="wire"/>
<MigrateTo Data="guid" DataTable="wire_support_tiers"/>
<MigrateFrom Data="wire_guid" DataTable="wire"/>
</migcol>
<migcol>
<ColTo Data="amount" DataTable="wire_support_tiers"/>
<ColFrom Data="amount" DataTable="wire"/>
<MigrateTo Data="amount" DataTable="wire_support_tiers"/>
<MigrateFrom Data="amount" DataTable="wire"/>
</migcol>
<migcol Description="It is not possible to migrate data to the column currency as it is storing new data that is not stored in another table"/>
<migcol Description="It is not possible to migrate data to the column name as it is storing new data that is not stored in another table"/>
Expand Down
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
<?xml version="1.0" encoding="ISO-8859-1"?>
<MigrationTable xmi:version="2.0" xmlns:xmi="http://www.omg.org/XMI" xmlns="DataMigration" name="wire_support_tiers">
<migcol>
<ColTo Data="address" DataTable="wire_support_tiers"/>
<ColFrom Data="wallet_address" DataTable="withholdings"/>
<MigrateTo Data="address" DataTable="wire_support_tiers"/>
<MigrateFrom Data="wallet_address" DataTable="withholdings"/>
</migcol>
<migcol>
<ColTo Data="user_guid" DataTable="wire_support_tiers"/>
<ColFrom Data="user_guid" DataTable="withholdings"/>
<MigrateTo Data="user_guid" DataTable="wire_support_tiers"/>
<MigrateFrom Data="user_guid" DataTable="withholdings"/>
</migcol>
</MigrationTable>
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
<?xml version="1.0" encoding="ISO-8859-1"?>
<MigrationTable xmi:version="2.0" xmlns:xmi="http://www.omg.org/XMI" xmlns="DataMigration" name="comments">
<migcol Description="Migration needs to be performed from the old To Column to the From Column according to the deverloper's criteria">
<ColFrom Data="parent_guid" DataTable="comments"/>
<ColToSplit Data="parent_guid_c1" DataTable="comments"/>
<ColToSplit Data="parent_guid_c2" DataTable="comments"/>
<ColToSplit Data="parent_guid_c3" DataTable="comments"/>
<MigrateFrom Data="parent_guid" DataTable="comments"/>
<MigrateToSplit Data="parent_guid_c1" DataTable="comments"/>
<MigrateToSplit Data="parent_guid_c2" DataTable="comments"/>
<MigrateToSplit Data="parent_guid_c3" DataTable="comments"/>
</migcol>
</MigrationTable>
Original file line number Diff line number Diff line change
@@ -1,12 +1,12 @@
<?xml version="1.0" encoding="ISO-8859-1"?>
<MigrationTable xmi:version="2.0" xmlns:xmi="http://www.omg.org/XMI" xmlns="DataMigration" name="notifications">
<migcol>
<ColTo Data="to_guid" DataTable="notifications"/>
<ColFrom Data="owner_guid" DataTable="notificationsPrev"/>
<MigrateTo Data="to_guid" DataTable="notifications"/>
<MigrateFrom Data="owner_guid" DataTable="notificationsPrev"/>
</migcol>
<migcol>
<ColTo Data="from_guid" DataTable="notifications"/>
<ColFrom Data="owner_guid" DataTable="notificationsPrev"/>
<MigrateTo Data="from_guid" DataTable="notifications"/>
<MigrateFrom Data="owner_guid" DataTable="notificationsPrev"/>
</migcol>
<migcol Description="It is not possible to migrate data to the column uuid as it is storing new data that is not stored in another table"/>
<migcol Description="It is not possible to migrate data to the column type_ground as it is storing new data that is not stored in another table"/>
Expand Down
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
<?xml version="1.0" encoding="ISO-8859-1"?>
<MigrationTable xmi:version="2.0" xmlns:xmi="http://www.omg.org/XMI" xmlns="DataMigration" name="sendwyre_accounts">
<migcol>
<ColTo Data="user_guid" DataTable="sendwyre_accounts"/>
<ColFrom Data="key" DataTable="user"/>
<MigrateTo Data="user_guid" DataTable="sendwyre_accounts"/>
<MigrateFrom Data="key" DataTable="user"/>
</migcol>
<migcol Description="It is not possible to migrate data to the column sendwyre_account_id as it is storing new data that is not stored in another table"/>
</MigrationTable>
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
<?xml version="1.0" encoding="ISO-8859-1"?>
<MigrationTable xmi:version="2.0" xmlns:xmi="http://www.omg.org/XMI" xmlns="DataMigration" name="entity_view">
<migcol multipleMigration="true">
<ColTo Data="dev_type" Key="tenant_id , customer_id" DataTable="entity_view"/>
<ColFrom Data="type" Key="tenant_id , customer_id" DataTable="device"/>
<MigrateTo Data="dev_type" Key="tenant_id , customer_id" DataTable="entity_view"/>
<MigrateFrom Data="type" Key="tenant_id , customer_id" DataTable="device"/>
</migcol>
</MigrationTable>
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
<?xml version="1.0" encoding="ISO-8859-1"?>
<MigrationTable xmi:version="2.0" xmlns:xmi="http://www.omg.org/XMI" xmlns="DataMigration" name="entity_view2_old">
<migcol multipleMigration="true">
<ColTo Data="dev_type" Key="tenant_id , customer_id" DataTable="entity_view2_old" NewTableName="entity_view2"/>
<ColFrom Data="type" Key="tenant_id , customer_id" DataTable="device"/>
<MigrateTo Data="dev_type" Key="tenant_id , customer_id" DataTable="entity_view2_old" NewTableName="entity_view2"/>
<MigrateFrom Data="type" Key="tenant_id , customer_id" DataTable="device"/>
</migcol>
</MigrationTable>
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
<?xml version="1.0" encoding="ISO-8859-1"?>
<MigrationTable xmi:version="2.0" xmlns:xmi="http://www.omg.org/XMI" xmlns="DataMigration" name="entity_view_devpk">
<migcol>
<ColTo Data="dev_type" Key="device_id" DataTable="entity_view_devpk"/>
<ColFrom Data="type" Key="id" DataTable="device"/>
<MigrateTo Data="dev_type" Key="device_id" DataTable="entity_view_devpk"/>
<MigrateFrom Data="type" Key="id" DataTable="device"/>
</migcol>
</MigrationTable>
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
<?xml version="1.0" encoding="ISO-8859-1"?>
<MigrationTable xmi:version="2.0" xmlns:xmi="http://www.omg.org/XMI" xmlns="DataMigration" name="billing_team_member">
<migcol>
<ColTo Data="team" DataTable="billing_team_member"/>
<ColFrom Data="team" DataTable="user_team"/>
<MigrateTo Data="team" DataTable="billing_team_member"/>
<MigrateFrom Data="team" DataTable="user_team"/>
</migcol>
<migcol>
<ColTo Data="user" DataTable="billing_team_member"/>
<ColFrom Data="user" DataTable="user_team"/>
<MigrateTo Data="user" DataTable="billing_team_member"/>
<MigrateFrom Data="user" DataTable="user_team"/>
</migcol>
</MigrationTable>
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
<?xml version="1.0" encoding="ISO-8859-1"?>
<MigrationTable xmi:version="2.0" xmlns:xmi="http://www.omg.org/XMI" xmlns="DataMigration" name="scim_user_times">
<migcol>
<ColTo Data="uid" DataTable="scim_user_times"/>
<ColFrom Data="id" DataTable="scim_user"/>
<MigrateTo Data="uid" DataTable="scim_user_times"/>
<MigrateFrom Data="id" DataTable="scim_user"/>
</migcol>
<migcol Description="It is not possible to migrate data to the column created_at as it is storing new data that is not stored in another table"/>
<migcol Description="It is not possible to migrate data to the column last_updated_at as it is storing new data that is not stored in another table"/>
Expand Down
Loading

0 comments on commit b31029c

Please sign in to comment.