is possible add on delete cascade
table after has been created?
my schema follows:
create table skills(name varchar, skill varchar, level int, foreign key(name) references runners(name), primary key(name, skill));
and cascade if foreign key deleted.
sqlite's alter table
command cannot want.
however, possible bypass sql interpreter , change internal table definition directly. sqlite stores table definitions textual copy of create table
command in sqlite_master
table; check out result of query:
select sql sqlite_master type='table' , name='skills';
add cascade specification string, enable write access sqlite_master
pragma writable_schema=1;
, write new table definition it:
update sqlite_master set sql='...' type='table' , name='skills';
then reopen database.
warning: works changes not change on-disk format of table. if make change changes record format (such adding/removing fields, or modifying rowid
), database blow horribly.
Comments
Post a Comment