How to mapclass additional tables and create them in Wt::Dbo ?
Added by Rathnadhar K V about 4 years ago
Namaskara,
I have 3 classes that I have mapclass'd .
Eg:
mapClass("table_1");
mapClass("table_2");
mapClass("table_3");
I then execute createTables() to successfully create 3 tables;
NOW
I want to add and create another table..
mapclass("table_4");
and createTables();
I cannot ...since it would throw exception stating that table_1 has already been created...
How to achieve mapping and creation of additional tables?
Regards
Rathnadhar K V
Replies (4)
RE: How to mapclass additional tables and create them in Wt::Dbo ? - Added by Wim Dumon about 4 years ago
Hello,
Dbo can only create tables from scratch. It has no built-in support for migrations. You can for example use flyway to organize migrations.
Wim.
RE: How to mapclass additional tables and create them in Wt::Dbo ? - Added by Rathnadhar K V almost 4 years ago
Namaskara Wim,
Thanks for the reply.
My requirement is here not of migration. Its about creation of new tables....where, earlier tables have been created ......
in my example above table_1, table_2 and table_3 have already been created and has some data. Say 100 records each.
After that I have to create another table (4) and then have to use that along with others table_1...3....
How is that done?
Perhaps we can have a function...createtable(table_name).....or createtable(table_name);
which mapclass and then an additional (new) table.
Regards
Rathnadhar K V
RE: How to mapclass additional tables and create them in Wt::Dbo ? - Added by Wim Dumon almost 4 years ago
Hi,
I used the term 'migration' to reflect any changes to the db, including creation of new tables. So the answer remains the same, it's not in the scope of what Dbo currently does.
What I usually do is run the createTables on a temporary (empty) database, copy the statements of interest that are printed in the log files, and apply them on the existing db.
Best regards,
Wim.
RE: How to mapclass additional tables and create them in Wt::Dbo ? - Added by Rathnadhar K V almost 4 years ago
Namaskara,
Thanks for the reply...I will do that this time.
However in future, as a roadmap, can you please include the createtable<typename>(table_name);
That is more helpful.
It should create and map the class...
Regards
Rathnadhar K V