From 1597c23f84346dfa44da9605286863b11006bdb5 Mon Sep 17 00:00:00 2001
From: Alexander Kavon <hawk@alexkavon.com>
Date: Tue, 28 Nov 2023 18:32:19 -0500
Subject: added migrations via tern, updated db package to connect to pgsql db,
 updated config to build db connection string, updated example .newsstand.toml
 config, new pgx dependency

---
 migrations/002_create_users_table.sql | 16 ++++++++++++++++
 1 file changed, 16 insertions(+)
 create mode 100644 migrations/002_create_users_table.sql

(limited to 'migrations/002_create_users_table.sql')

diff --git a/migrations/002_create_users_table.sql b/migrations/002_create_users_table.sql
new file mode 100644
index 0000000..a561a05
--- /dev/null
+++ b/migrations/002_create_users_table.sql
@@ -0,0 +1,16 @@
+CREATE TABLE users(
+    id SERIAL NOT NULL PRIMARY KEY,
+    username VARCHAR(50) NOT NULL,
+    secret VARCHAR(255) NOT NULL,
+    created_at TIMESTAMPTZ NOT NULL DEFAULT NOW(),
+    updated_at TIMESTAMPTZ NOT NULL DEFAULT NOW()
+);
+
+CREATE TRIGGER set_timestamp
+BEFORE UPDATE ON users
+FOR EACH ROW
+EXECUTE PROCEDURE trigger_set_timestamp();
+
+---- create above / drop below ----
+
+DROP TABLE users;
-- 
cgit v1.2.3

