Page 1 of 1

Create all the tables in the database at once

PostPosted: Sat Dec 17, 2011 11:17 am
by wcdmaxp
Hi, I think it would be great if we could create all the tables in the database at once. Like: qx::dao::createTables(). What you think?


Best regards,

Re: Create all the tables in the database at once

PostPosted: Sat Dec 17, 2011 6:07 pm
by QxOrm admin
Hi,

Because tables creation is very specific for each database, I strongly recommend to create your own script or SQL schema : using introspection engine of QxOrm library, it's very easy to create it.

There is a Question&Response into the FAQ of QxOrm library with an example of code for a PostgreSQL database (How to build SQL schema (create and update tables) based on C++ persistents classes registered into QxOrm context ?) :
http://www.qxorm.com/qxorm_en/faq.html#faq_230

QxOrm library provides also an example of a C++ function : based on this function, you can create your own function to build SQL schema.
This QxOrm function is written in the file ./src/QxRegister/QxClassX.cpp and is called QString qx::QxClassX::dumpSqlSchema() :
http://www.qxorm.com/qxorm_en/resource/ ... chema.html