surwiki/migrations/20170820204425_add_articles/up.sql

17 lines
367 B
MySQL
Raw Permalink Normal View History

2017-08-21 00:44:52 +03:00
CREATE TABLE articles (
id INTEGER PRIMARY KEY NOT NULL
);
CREATE TABLE article_revisions (
article_id INTEGER NOT NULL,
revision INTEGER NOT NULL,
created TIMESTAMP NOT NULL DEFAULT CURRENT_TIMESTAMP,
title TEXT NOT NULL,
body TEXT NOT NULL,
PRIMARY KEY (article_id, revision),
FOREIGN KEY (article_id) REFERENCES articles(id)
);