add database schema and update docker-compose for initialization

This commit is contained in:
2026-01-11 14:22:46 +00:00
parent 550bba62f7
commit c12e1f7623
2 changed files with 17 additions and 1 deletions

15
db/sql/01_schema.sql Normal file
View File

@@ -0,0 +1,15 @@
CREATE SCHEMA IF NOT EXISTS ethnograph;
CREATE TABLE IF NOT EXISTS ethnograph.users (
id SERIAL PRIMARY KEY,
username VARCHAR(255) UNIQUE NOT NULL,
created_utc TIMESTAMP NOT NULL,
karma INTEGER
);
CREATE TABLE IF NOT EXISTS ethnograph.posts (
id SERIAL PRIMARY KEY,
user_id INTEGER REFERENCES ethnograph.users(id),
content TEXT NOT NULL,
created_utc TIMESTAMP NOT NULL
);