similar to #6
also delete MANY_MANY relations before delete()
will not support this. DBMS should defiine foreign key behavior.
Hi cebe, just stumbled upon this :)
How to handle SQLite then? Maybe you can define the constraints (eg. DELETE CASCADE) in the behavior.
Would love to hear your thoughts about this.
Whats the problem with it? http://www.sqlite.org/foreignkeys.html#fk_actions
Hmm, sorry, it seems I am getting old 👴 ... http://www.sqlite.org/releaselog/3_6_19.html
And I also mixed it up with: http://www.yiiframework.com/doc/api/1.1/CSqliteSchema/#addForeignKey-detail
I'd have some use-cases, where I want to add FK to existing tables, also if they are SQLite.
Any ideas how to work around this limitation, besides overriding this method with some code which creates a new table with FKs and copies all records?
Yeah, guess you should update then ;)
You can define foreign key directly in table definition:
'col1' => 'type',
'FOREIGN KEY (col1) REFERENCES othertable(id) ON DELETE ... ON UPDATE ...'
Sure, I meant for adding FKs later to a SQLite table.
You'd have to setup a temporary table with the correct createTable statement including ON DELETE.
Then copy all values to the temp table, remove the originial one and then rename the temp table.
Can't see a better way...