nimblog/schema.sql

16 lines
415 B
MySQL
Raw Normal View History

2022-04-13 15:14:13 +00:00
CREATE TABLE users (
id INTEGER PRIMARY KEY AUTOINCREMENT,
displayname TEXT NOT NULL,
username TEXT UNIQUE NOT NULL,
password TEXT NOT NULL
);
CREATE TABLE posts (
id INTEGER PRIMARY KEY AUTOINCREMENT,
author_id INTEGER NOT NULL,
created TIMESTAMP NOT NULL DEFAULT CURRENT_TIMESTAMP,
title TEXT NOT NULL,
body TEXT NOT NULL,
FOREIGN KEY (author_id) REFERENCES users (id)
);