On 19 Sep 2013, at 3:50am, Bao Niu <[email protected]> wrote: > After a thorough trial I've finally got this firefox add-on to work > properly. And it's great! It basically provides everything that I needed, > except for one: changing foreign key constraints from the gui. Is it > possible to do it from sqlite manager add-on?
FOREIGN KEYs are a relatively new addition to SQLite. A lot of apps which work with SQLite haven't been updated to cope with them yet. > And more generally, when a database is already in production and loaded > with records, is it possible to add/remove a foreign key constraint on it? SQL does not allow any such thing as 'in production and loaded'. You can make all the kinds of changes at any time, unless they would put the database in an inconsistent state. So, for example, you can add a UNIQUE index after your database has lots of data in it ... unless some of that data means that two entries in that index would have the same data. And you can delete a table at any time ... unless a foreign key points to that table. However, FOREIGN KEYs are part of the table definition. There's no way to delete them without deleting the table. To fake it, the same way that GUI fakes changing a column definition, you'd have to define a new table, copy the data across, delete the old table, then rename the new table to the old name. Simon. _______________________________________________ sqlite-users mailing list [email protected] http://sqlite.org:8080/cgi-bin/mailman/listinfo/sqlite-users

