aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--src/database.nim15
1 files changed, 15 insertions, 0 deletions
diff --git a/src/database.nim b/src/database.nim
index 004d7c4..3cf1e40 100644
--- a/src/database.nim
+++ b/src/database.nim
@@ -18,6 +18,21 @@ const migrations = [
expires DATE
);
CREATE UNIQUE INDEX idx_url_token ON url(token);
+ """,
+ """
+ CREATE TABLE url2 (
+ id INTEGER PRIMARY KEY,
+ token TEXT NOT NULL UNIQUE,
+ title TEXT NOT NULL,
+ url TEXT NOT NULL,
+ created DATE NOT NULL,
+ expires DATE NOT NULL
+ );
+ INSERT INTO url2(id, token, title, url, created, expires)
+ SELECT id, token, title, url, created, expires FROM url;
+ DROP TABLE url;
+ ALTER TABLE url2 RENAME TO url;
+ CREATE UNIQUE INDEX idx_url_token ON url(token);
"""
]
const latestVersion = migrations.len