From 4dc18e3691127e058833fd9c7a5bbee333c3a66c Mon Sep 17 00:00:00 2001
From: Max
Date: Wed, 17 Apr 2019 09:44:56 +0200
Subject: Initial commit.

---
 schema.sql | 40 ++++++++++++++++++++++++++++++++++++++++
 1 file changed, 40 insertions(+)
 create mode 100644 schema.sql

(limited to 'schema.sql')

diff --git a/schema.sql b/schema.sql
new file mode 100644
index 0000000..7048798
--- /dev/null
+++ b/schema.sql
@@ -0,0 +1,40 @@
+CREATE TABLE IF NOT EXISTS platform (
+	id INT PRIMARY KEY AUTO_INCREMENT,
+	name VARCHAR(255) UNIQUE NOT NULL,
+	url VARCHAR(255) UNIQUE NOT NULL
+) CHARSET=utf8;
+
+CREATE TABLE IF NOT EXISTS language (
+	id INT PRIMARY KEY AUTO_INCREMENT,
+	name VARCHAR(255) UNIQUE NOT NULL
+) CHARSET=utf8;
+
+CREATE TABLE IF NOT EXISTS update_period (
+	id INT PRIMARY KEY AUTO_INCREMENT,
+	name VARCHAR(255) UNIQUE NOT NULL
+) CHARSET=utf8;
+
+CREATE TABLE IF NOT EXISTS owner (
+	id INT PRIMARY KEY AUTO_INCREMENT,
+	name VARCHAR(255) NOT NULL,
+	url VARCHAR(255) NOT NULL UNIQUE,
+	platform INT NOT NULL,
+	CONSTRAINT fk_owner_platform FOREIGN KEY (platform) REFERENCES platform(id)
+) CHARSET=utf8;
+
+CREATE TABLE IF NOT EXISTS entry (
+	id INT PRIMARY KEY AUTO_INCREMENT,
+	title VARCHAR(255) NOT NULL,
+	synopsis VARCHAR(255) NOT NULL,
+	owner INT NOT NULL,
+	platform INT NOT NULL,
+	url VARCHAR(255) UNIQUE NOT NULL,
+	language INT NOT NULL,
+	stars VARCHAR(255) NOT NULL,
+	update_period INT NOT NULL,
+	created_at TIMESTAMP NOT NULL,
+	CONSTRAINT fk_entry_owner FOREIGN KEY (owner) REFERENCES owner(id),
+	CONSTRAINT fk_entry_platform FOREIGN KEY (platform) REFERENCES platform(id),
+	CONSTRAINT fk_entry_language FOREIGN KEY (language) REFERENCES language(id),
+	CONSTRAINT fk_entry_period FOREIGN KEY (update_period) REFERENCES update_period(id)
+) CHARSET=utf8;
-- 
cgit v1.2.3

