aboutsummaryrefslogtreecommitdiff
path: root/migrations
diff options
context:
space:
mode:
authorAlexander Kavon <me+git@alexkavon.com>2024-01-22 21:30:19 -0500
committerAlexander Kavon <me+git@alexkavon.com>2024-01-22 21:30:19 -0500
commit0cdc7a2e84ac5c460569a26a1dd8e3070cea487e (patch)
treedd1f1f67e9dad99b21fd4d2f817beb846e1fe611 /migrations
parent481b799f9eced5432fdc0c66d2bf04226cdc723b (diff)
add posts table migration, add sqlboiler post model, post routes: create, store, get, post create ui template, remove email from user create route
Diffstat (limited to 'migrations')
-rw-r--r--migrations/003_create_posts_table.sql.sql17
1 files changed, 17 insertions, 0 deletions
diff --git a/migrations/003_create_posts_table.sql.sql b/migrations/003_create_posts_table.sql.sql
new file mode 100644
index 0000000..81dab8f
--- /dev/null
+++ b/migrations/003_create_posts_table.sql.sql
@@ -0,0 +1,17 @@
+CREATE TABLE posts(
+ id SERIAL NOT NULL PRIMARY KEY,
+ title VARCHAR(100) NOT NULL,
+ description TEXT NOT NULL,
+ url VARCHAR(255) UNIQUE,
+ created_at TIMESTAMPTZ NOT NULL DEFAULT NOW(),
+ updated_at TIMESTAMPTZ NOT NULL DEFAULT NOW()
+);
+
+CREATE TRIGGER set_timestamp
+BEFORE UPDATE ON posts
+FOR EACH ROW
+EXECUTE PROCEDURE trigger_set_timestamp();
+
+---- create above / drop below ----
+
+DROP TABLE posts;