SqLite: enable foreign key

Forum for posting problems using QxOrm library

SqLite: enable foreign key

Postby gianks » Sat Aug 13, 2016 12:52 pm

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
gianks
 
Posts: 45
Joined: Mon Jul 04, 2016 1:04 pm

Re: SqLite: enable foreign key

Postby qxorm » Tue Aug 16, 2016 7:31 am

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
qxorm
Site Admin
 
Posts: 481
Joined: Mon Apr 12, 2010 7:45 am

Re: SqLite: enable foreign key

Postby gianks » Mon Aug 22, 2016 8:02 pm

Thanks for the info.

Kind regards
gianks
 
Posts: 45
Joined: Mon Jul 04, 2016 1:04 pm


Return to QxOrm - Help

Who is online

Users browsing this forum: No registered users and 3 guests

cron