Add ON DELETE CASCADE behavior to an sqlite3 table after it has been created
问题 Is it possible to add an ON DELETE CASCADE to a table after it has been created? My schema is as follows: CREATE TABLE skills(name varchar, skill varchar, level int, foreign key(name) references runners(name), primary key(name, skill)); And I would like to cascade if the foreign key is deleted. 回答1: SQLite's ALTER TABLE command cannot do what you want. However, it is possible to bypass the SQL interpreter and change the internal table definition directly. SQLite stores table definitions as a