This repository has been archived on 2023-07-09. You can view files and clone it, but cannot push or open issues or pull requests.
sudoscientist-go-backend/migrations/000001_create_initial_tables.up.sql

35 lines
664 B
MySQL
Raw Normal View History

2020-01-15 03:40:32 +00:00
BEGIN;
CREATE TABLE IF NOT EXISTS users (
username text PRIMARY KEY,
email text,
password text,
admin boolean
);
CREATE TABLE IF NOT EXISTS user_profiles (
id SERIAL PRIMARY KEY,
username text REFERENCES users (username),
email text,
location text,
bio text
);
CREATE TABLE IF NOT EXISTS posts (
id SERIAL PRIMARY KEY,
title text,
slug text,
author text REFERENCES users (username),
content text,
time_published timestamp,
modified bool,
last_modified timestamp
);
CREATE TABLE IF NOT EXISTS tags (
id SERIAL PRIMARY KEY,
tag text,
article_id int REFERENCES posts (id)
);
COMMIT;