Compare commits

...

2 Commits

Author SHA1 Message Date
c18098cb8a clicks are deleted when connected links are
fixes #7
2021-04-01 09:59:07 +02:00
2bad759547 Revert "format migration"
as migrations store a hash it is not possible to change the
migrationfiles afterwards.

This reverts commit fdcc89ec1f.
2021-04-01 09:59:07 +02:00
2 changed files with 27 additions and 4 deletions

View File

@ -1,5 +1,4 @@
-- Add migration script here
ALTER TABLE
users
ADD
COLUMN language Text NOT NULL DEFAULT "en";
ALTER TABLE users
ADD COLUMN language Text NOT NULL DEFAULT "en";

View File

@ -0,0 +1,24 @@
-- 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;