first commit

This commit is contained in:
Elias Renman
2025-03-16 21:54:32 +01:00
commit c39af75112
35 changed files with 2524 additions and 0 deletions

0
migrations/.keep Normal file
View File

View File

@@ -0,0 +1,4 @@
-- This file should undo anything in `up.sql`
DROP TRIGGER url_update_at_trigger;
DROP TABLE url;

View File

@@ -0,0 +1,19 @@
-- Your SQL goes here
CREATE TABLE urls (
url TEXT PRIMARY KEY NOT NULL,
destination_url TEXT NOT NULL,
ttl DATETIME,
owned_by TEXT,
created_at DATETIME DEFAULT CURRENT_TIMESTAMP,
updated_at DATETIME DEFAULT CURRENT_TIMESTAMP
);
CREATE TRIGGER urls_update_at_trigger AFTER
UPDATE On urls BEGIN
UPDATE urls
SET
updated_at = STRFTIME ('%Y-%m-%d %H:%M:%f', 'NOW')
WHERE
URLS = NEW.URLS;
END;