It's all about the answers!

Ask a question

How does "repotools -addTables" work?


David Weber (761810) | asked May 28 '09, 12:38 p.m.
How does '-addTables' decide for a given package of "extension point="org.eclipse.emf.ecore.generated_package", if the database already contains the table(s) or if they need to be added?

I ask because of a scenario that doesn't seem to work:
1) Created ecore package and deployed to server
2) Ran repotools -addTables.... table was properly created in DB
3) Updated the ecore package (interface inheriting from EPackage) to add additional tables to the schema
4) Deployed the updated code to the server. Note that the plugin.xml did not change since it already contained the reference to the ecore package
5) Ran repotools -addTables.
6) New tables were NOT created

If -addTables does not handle this scenario, how should I handle it?

Thanks in advance,

Dave

4 answers



permanent link
Balaji Krish (1.8k12) | answered May 29 '09, 4:53 p.m.
JAZZ DEVELOPER
addTables does not handle the scenario you described below.

It is used only to create new tables if the schema does not exist in the database.

For your scenario, you have to write a migration handler to migrate the data present in the old tables to the new tables (repotools -export and repotools -import)

--- Balaji
Jazz Server Team

How does '-addTables' decide for a given package of "extension point="org.eclipse.emf.ecore.generated_package", if the database already contains the table(s) or if they need to be added?

I ask because of a scenario that doesn't seem to work:
1) Created ecore package and deployed to server
2) Ran repotools -addTables.... table was properly created in DB
3) Updated the ecore package (interface inheriting from EPackage) to add additional tables to the schema
4) Deployed the updated code to the server. Note that the plugin.xml did not change since it already contained the reference to the ecore package
5) Ran repotools -addTables.
6) New tables were NOT created

If -addTables does not handle this scenario, how should I handle it?

Thanks in advance,

Dave

permanent link
David Weber (761810) | answered Jun 01 '09, 9:52 a.m.
In this scenario, if I don't have any data in this schema that I care about (since we are not in production yet), I can just delete the schema from the database, and run repotools -addTables again... then it should work. correct?




addTables does not handle the scenario you described below.

It is used only to create new tables if the schema does not exist in the database.

For your scenario, you have to write a migration handler to migrate the data present in the old tables to the new tables (repotools -export and repotools -import)

--- Balaji
Jazz Server Team

How does '-addTables' decide for a given package of "extension point="org.eclipse.emf.ecore.generated_package", if the database already contains the table(s) or if they need to be added?

I ask because of a scenario that doesn't seem to work:
1) Created ecore package and deployed to server
2) Ran repotools -addTables.... table was properly created in DB
3) Updated the ecore package (interface inheriting from EPackage) to add additional tables to the schema
4) Deployed the updated code to the server. Note that the plugin.xml did not change since it already contained the reference to the ecore package
5) Ran repotools -addTables.
6) New tables were NOT created

If -addTables does not handle this scenario, how should I handle it?

Thanks in advance,

Dave

permanent link
David Weber (761810) | answered Jun 02 '09, 11:06 a.m.
ok... my attempt to delete the schema and re-run 'addTables' didn't work. The schema did not get recreated.

Looking further into the jazz database, I see two tables under the JAZZ schema that appear to keep mapping information between components and DB schemas. THe mapping information is still in the DB for my component, so that is probably why addTables didn't recreate my schema... it thought my schema already existed.

So addTables does not look at the DB to see if the schema exists... it looks at the JAZZ tables (PACKAGE_MAP, TABLE_MAP) to determine if it has any work to do.

So, can someone give me the procedure to 'clean out' the component/schema mapping information in these tables? So I can recreate the schema with addTables?

Thanks in advance,


In this scenario, if I don't have any data in this schema that I care about (since we are not in production yet), I can just delete the schema from the database, and run repotools -addTables again... then it should work. correct?




addTables does not handle the scenario you described below.

It is used only to create new tables if the schema does not exist in the database.

For your scenario, you have to write a migration handler to migrate the data present in the old tables to the new tables (repotools -export and repotools -import)

--- Balaji
Jazz Server Team

How does '-addTables' decide for a given package of "extension point="org.eclipse.emf.ecore.generated_package", if the database already contains the table(s) or if they need to be added?

I ask because of a scenario that doesn't seem to work:
1) Created ecore package and deployed to server
2) Ran repotools -addTables.... table was properly created in DB
3) Updated the ecore package (interface inheriting from EPackage) to add additional tables to the schema
4) Deployed the updated code to the server. Note that the plugin.xml did not change since it already contained the reference to the ecore package
5) Ran repotools -addTables.
6) New tables were NOT created

If -addTables does not handle this scenario, how should I handle it?

Thanks in advance,

Dave

permanent link
Balaji Krish (1.8k12) | answered Jun 09 '09, 11:27 a.m.
JAZZ DEVELOPER
You are right. We maintain information in Package Map and ServerVersionRecord to track the different tables and schemas present in the db.

You have 2 options :
1. Export the database contents using repotools -export. Import it using repotools that does not contain the new component. After importing, add the new component via provisioning and then run repotools -addTables to add the new schema.

2. Export the database contents using repotools -export. If necessary, write a migration handler to migrate the contents of your old schema to new schema. Then do a repotools -import to import to the new component schema.


--- Balaji
Jazz Server Team


ok... my attempt to delete the schema and re-run 'addTables' didn't work. The schema did not get recreated.

Looking further into the jazz database, I see two tables under the JAZZ schema that appear to keep mapping information between components and DB schemas. THe mapping information is still in the DB for my component, so that is probably why addTables didn't recreate my schema... it thought my schema already existed.

So addTables does not look at the DB to see if the schema exists... it looks at the JAZZ tables (PACKAGE_MAP, TABLE_MAP) to determine if it has any work to do.

So, can someone give me the procedure to 'clean out' the component/schema mapping information in these tables? So I can recreate the schema with addTables?

Thanks in advance,


In this scenario, if I don't have any data in this schema that I care about (since we are not in production yet), I can just delete the schema from the database, and run repotools -addTables again... then it should work. correct?




addTables does not handle the scenario you described below.

It is used only to create new tables if the schema does not exist in the database.

For your scenario, you have to write a migration handler to migrate the data present in the old tables to the new tables (repotools -export and repotools -import)

--- Balaji
Jazz Server Team

How does '-addTables' decide for a given package of "extension point="org.eclipse.emf.ecore.generated_package", if the database already contains the table(s) or if they need to be added?

I ask because of a scenario that doesn't seem to work:
1) Created ecore package and deployed to server
2) Ran repotools -addTables.... table was properly created in DB
3) Updated the ecore package (interface inheriting from EPackage) to add additional tables to the schema
4) Deployed the updated code to the server. Note that the plugin.xml did not change since it already contained the reference to the ecore package
5) Ran repotools -addTables.
6) New tables were NOT created

If -addTables does not handle this scenario, how should I handle it?

Thanks in advance,

Dave

Your answer


Register or to post your answer.


Dashboards and work items are no longer publicly available, so some links may be invalid. We now provide similar information through other means. Learn more here.