juunil/migrations/2023-08-07-063249_create_posts/up.sql

21 lines
484 B
MySQL
Raw Normal View History

2023-08-07 06:34:20 +00:00
CREATE TABLE post (
id BIGINT PRIMARY KEY NOT NULL,
description TEXT NOT NULL,
posted_date DATETIME NOT NULL,
crawled_date DATETIME NOT NULL
);
CREATE TABLE image (
id INTEGER PRIMARY KEY AUTOINCREMENT NOT NULL,
post_id BIGINT NOT NULL,
url TEXT NOT NULL,
FOREIGN KEY (post_id) REFERENCES post(id)
);
2023-08-08 06:07:41 +00:00
CREATE TABLE video (
id INTEGER PRIMARY KEY AUTOINCREMENT NOT NULL,
post_id BIGINT NOT NULL,
url TEXT NOT NULL,
FOREIGN KEY (post_id) REFERENCES post(id)
);