5 ms·
I just sucked the existing table into RAM and recreated the table. I did it on a transaction so there was no risk of data loss. In my case the data was always
by gwbas1c 6y ago
I just sucked the existing table into RAM and recreated the table. I did it on a transaction so there was no risk of data loss.
In my case the data was always 10s of MBs.
Remember, the point of SQLite is a replacement for generating a file format. Although it's a database, it lets us (developers) re-use our knowledge of databases when doing basic file I/O.
- 72deluxe 6y agoHow does dropping the existing table and recreating it affect FKs pointing to the table that is being dropped?? Do the FK relationships get destroyed??
- kcolford 6y agoYou gotta redo the foreign key constraints in the same transaction that you rebuild the table
- 72deluxe 6y agoOh so specify the FKs from table B to A (if we were dropping and rebuilding A) in a begin/end transaction block? Thank you
- gwbas1c 6y agoIn my case foreign keys were enforced in the application business logic. The schema was extremely simple.