Initial commmit
This commit is contained in:
commit
88383f90e5
1174 changed files with 227188 additions and 0 deletions
3
migrations/2022-11-01-1922_create-users/down.sql
Normal file
3
migrations/2022-11-01-1922_create-users/down.sql
Normal file
|
@ -0,0 +1,3 @@
|
|||
use movienight;
|
||||
|
||||
DROP TABLE users;
|
12
migrations/2022-11-01-1922_create-users/up.sql
Normal file
12
migrations/2022-11-01-1922_create-users/up.sql
Normal file
|
@ -0,0 +1,12 @@
|
|||
USE movienight;
|
||||
|
||||
CREATE TABLE IF NOT EXISTS users
|
||||
(
|
||||
id INTEGER AUTO_INCREMENT PRIMARY KEY,
|
||||
name VARCHAR(255) NOT NULL,
|
||||
email VARCHAR(255) NOT NULL UNIQUE,
|
||||
password VARCHAR(255) NOT NULL,
|
||||
username VARCHAR(255) NOT NULL,
|
||||
token VARCHAR(255) UNIQUE,
|
||||
token_expiration DATETIME
|
||||
);
|
1
migrations/2022-11-02-033724_create_movies/down.sql
Normal file
1
migrations/2022-11-02-033724_create_movies/down.sql
Normal file
|
@ -0,0 +1 @@
|
|||
DROP TABLE movies
|
22
migrations/2022-11-02-033724_create_movies/up.sql
Normal file
22
migrations/2022-11-02-033724_create_movies/up.sql
Normal file
|
@ -0,0 +1,22 @@
|
|||
CREATE DATABASE IF NOT EXISTS movienight;
|
||||
USE movienight;
|
||||
|
||||
CREATE TABLE IF NOT EXISTS movies
|
||||
(
|
||||
id INTEGER AUTO_INCREMENT PRIMARY KEY,
|
||||
title TEXT NOT NULL,
|
||||
imdb_id VARCHAR(255),
|
||||
year SMALLINT UNSIGNED,
|
||||
critic_score VARCHAR(255),
|
||||
genre VARCHAR(255),
|
||||
director VARCHAR(255),
|
||||
actors VARCHAR(255),
|
||||
plot TEXT,
|
||||
poster VARCHAR(500),
|
||||
is_good BOOLEAN,
|
||||
added_by VARCHAR(255),
|
||||
last_watched DATETIME,
|
||||
created_at DATETIME NOT NULL,
|
||||
updated_at DATETIME NOT NULL,
|
||||
deleted_at DATETIME
|
||||
);
|
3
migrations/2022-11-03-2239_create-movielists/down.sql
Normal file
3
migrations/2022-11-03-2239_create-movielists/down.sql
Normal file
|
@ -0,0 +1,3 @@
|
|||
use movienight;
|
||||
|
||||
DROP TABLE movie_lists
|
13
migrations/2022-11-03-2239_create-movielists/up.sql
Normal file
13
migrations/2022-11-03-2239_create-movielists/up.sql
Normal file
|
@ -0,0 +1,13 @@
|
|||
USE movienight;
|
||||
|
||||
CREATE TABLE IF NOT EXISTS movie_lists
|
||||
(
|
||||
id INTEGER AUTO_INCREMENT PRIMARY KEY,
|
||||
name TEXT NOT NULL,
|
||||
public BOOLEAN NOT NULL,
|
||||
owner INTEGER NOT NULL,
|
||||
created_at DATETIME NOT NULL,
|
||||
updated_at DATETIME NOT NULL,
|
||||
deleted_at DATETIME,
|
||||
FOREIGN KEY (owner) REFERENCES users (id)
|
||||
);
|
|
@ -0,0 +1,3 @@
|
|||
use movienight;
|
||||
|
||||
DROP TABLE movielist_movie
|
11
migrations/2022-11-04-2353_create-movielists-movie/up.sql
Normal file
11
migrations/2022-11-04-2353_create-movielists-movie/up.sql
Normal file
|
@ -0,0 +1,11 @@
|
|||
USE movienight;
|
||||
|
||||
CREATE TABLE IF NOT EXISTS movielist_movie
|
||||
(
|
||||
id INTEGER AUTO_INCREMENT PRIMARY KEY,
|
||||
movielist_id INTEGER NOT NULL,
|
||||
movie_id INTEGER NOT NULL,
|
||||
FOREIGN KEY (movie_id) REFERENCES movies (id),
|
||||
FOREIGN KEY (movielist_id) REFERENCES movie_lists (id),
|
||||
unique (movielist_id, movie_id)
|
||||
);
|
3
migrations/2022-11-15-2030_create-schedules/down.sql
Normal file
3
migrations/2022-11-15-2030_create-schedules/down.sql
Normal file
|
@ -0,0 +1,3 @@
|
|||
use movienight;
|
||||
|
||||
DROP TABLE schedules;
|
14
migrations/2022-11-15-2030_create-schedules/up.sql
Normal file
14
migrations/2022-11-15-2030_create-schedules/up.sql
Normal file
|
@ -0,0 +1,14 @@
|
|||
USE movienight;
|
||||
|
||||
CREATE TABLE IF NOT EXISTS schedules
|
||||
(
|
||||
id INTEGER AUTO_INCREMENT PRIMARY KEY,
|
||||
name VARCHAR(255),
|
||||
is_public BOOLEAN,
|
||||
slug VARCHAR(255) UNIQUE,
|
||||
owner INTEGER,
|
||||
created_at DATETIME NOT NULL,
|
||||
updated_at DATETIME NOT NULL,
|
||||
deleted_at DATETIME,
|
||||
FOREIGN KEY (owner) REFERENCES users (id)
|
||||
);
|
3
migrations/2022-11-15-2045_create-showings/down.sql
Normal file
3
migrations/2022-11-15-2045_create-showings/down.sql
Normal file
|
@ -0,0 +1,3 @@
|
|||
use movienight;
|
||||
|
||||
DROP TABLE sessions;
|
17
migrations/2022-11-15-2045_create-showings/up.sql
Normal file
17
migrations/2022-11-15-2045_create-showings/up.sql
Normal file
|
@ -0,0 +1,17 @@
|
|||
USE movienight;
|
||||
|
||||
CREATE TABLE IF NOT EXISTS showings
|
||||
(
|
||||
id INTEGER AUTO_INCREMENT PRIMARY KEY,
|
||||
schedule_id INTEGER,
|
||||
movie_id INTEGER,
|
||||
showtime DATETIME,
|
||||
public BOOL default FALSE,
|
||||
owner INTEGER NOT NULL,
|
||||
created_at DATETIME NOT NULL,
|
||||
updated_at DATETIME NOT NULL,
|
||||
deleted_at DATETIME,
|
||||
FOREIGN KEY (movie_id) REFERENCES movies (id),
|
||||
FOREIGN KEY (schedule_id) REFERENCES schedules (id),
|
||||
FOREIGN KEY (owner) REFERENCES users (id)
|
||||
);
|
3
migrations/2022-11-23-1750_create-sessions/down.sql
Normal file
3
migrations/2022-11-23-1750_create-sessions/down.sql
Normal file
|
@ -0,0 +1,3 @@
|
|||
use movienight;
|
||||
|
||||
DROP TABLE showings;
|
10
migrations/2022-11-23-1750_create-sessions/up.sql
Normal file
10
migrations/2022-11-23-1750_create-sessions/up.sql
Normal file
|
@ -0,0 +1,10 @@
|
|||
USE movienight;
|
||||
|
||||
CREATE TABLE IF NOT EXISTS sessions
|
||||
(
|
||||
id INTEGER UNSIGNED AUTO_INCREMENT PRIMARY KEY,
|
||||
user_id INTEGER NOT NULL,
|
||||
token VARCHAR(255) NOT NULL UNIQUE,
|
||||
FOREIGN KEY (user_id) REFERENCES users (id),
|
||||
expiration DATETIME NOT NULL
|
||||
);
|
|
@ -0,0 +1,5 @@
|
|||
USE movienight;
|
||||
|
||||
ALTER TABLE users
|
||||
DROP COLUMN token,
|
||||
DROP COLUMN token_expiration;
|
|
@ -0,0 +1,8 @@
|
|||
USE movienight;
|
||||
|
||||
ALTER TABLE users
|
||||
ADD COLUMN IF NOT EXISTS (
|
||||
created_at DATETIME NOT NULL,
|
||||
updated_at DATETIME NOT NULL,
|
||||
deleted_at DATETIME
|
||||
);
|
Loading…
Add table
Add a link
Reference in a new issue