Page 1 of 1

SqLite: enable foreign key

PostPosted: Sat Aug 13, 2016 12:52 pm
by gianks
HI all,
i'm using SqLite as backend driver for my application and i've noticed (after a segfault :mrgreen: ) that FK are not enforced as expected in the tables definition, at least in the schema generated in my case.

How can i enable tha creation of the FKs? Shall i put the class creation group of statements in a single transaction?
Reading the comments seems that create_table is not intended for production usage, is this still true? The example query provided in the doc doesn't say anything about FK!

Is possible to create on the fly the entire DB schema without preparing it externally?

Thanks
Gianks

Re: SqLite: enable foreign key

PostPosted: Tue Aug 16, 2016 7:31 am
by qxorm
Hello,

Reading the comments seems that create_table is not intended for production usage, is this still true?

Yes, qx::dao::create_table() function is just here to create prototypes or samples.

You can use QxEntityEditor with its DDL export plugin to create a database schema.
Or you can design your schema with a tool dedicated for your SGBD, for example SQLite Manager in your case.

You can also use the introspection engine of QxOrm library to iterate over all persistent classes to generate the schema.
You can find an example here : https://www.qxorm.com/qxorm_en/manual.html#manual_470

Re: SqLite: enable foreign key

PostPosted: Mon Aug 22, 2016 8:02 pm
by gianks
Thanks for the info.

Kind regards