Pslink/pslink/migrations/20210401070030_on_delete_cascade.sql
Dietrich fc9b18141f Working user and link list, (big)restructure
This is now a workspace consisting of:
  * the pslink app (a wasm frontend for the admin interface)
  * the pslink binary
  * shared - modules for communication between the two above.
2021-08-12 15:48:02 +02:00

24 lines
399 B
SQL

-- Add migration script here
PRAGMA foreign_keys = off;
CREATE TABLE new_clicks (
id INTEGER PRIMARY KEY NOT NULL,
link INT NOT NULL,
created_at TIMESTAMP NOT NULL,
FOREIGN KEY (link) REFERENCES links (id) ON DELETE CASCADE
);
INSERT INTO
new_clicks
SELECT
*
FROM
clicks;
DROP TABLE clicks;
ALTER TABLE
new_clicks RENAME TO clicks;
PRAGMA foreign_keys = on;