You can rename the current table, create a โdeletedโ column in it, and then create a view with the same name as the current table, selecting everything where deleted = 0. Thus, you do not have to change all your queries. The view will be updatable if you specify a default value for the delete column. _
CREATE TABLE my_new_table (col1 INTEGER, col2 INTEGER, col3 INTEGER, deleted INTEGER NOT NULL DEFAULT 0); INSERT INTO my_new_table (col1, col2, col3) SELECT (col1, col2, col3) FROM my_table; DROP TABLE my_table; CREATE VIEW my_table (col1, col2, col3) AS SELECT (col1, col2, col3) FROM my_new_table WHERE deleted = 0;
Brian hooper
source share