From 820ae78563c634f8d402c7fb764eaeabf92367ac Mon Sep 17 00:00:00 2001
From: viktorstrate <viktorstrate@gmail.com>
Date: Sun, 10 Jan 2021 18:29:33 +0100
Subject: [PATCH] Delete old migrations

---
 .../migrations/001_initial_setup.down.sql     |   9 --
 .../migrations/001_initial_setup.up.sql       | 120 ------------------
 .../002_site_info_more_settings.down.sql      |   4 -
 .../002_site_info_more_settings.up.sql        |   4 -
 .../003_sar_side_car_files.down.sql           |   4 -
 .../migrations/003_sar_side_car_files.up.sql  |   4 -
 6 files changed, 145 deletions(-)
 delete mode 100644 api/database/migrations/001_initial_setup.down.sql
 delete mode 100644 api/database/migrations/001_initial_setup.up.sql
 delete mode 100644 api/database/migrations/002_site_info_more_settings.down.sql
 delete mode 100644 api/database/migrations/002_site_info_more_settings.up.sql
 delete mode 100644 api/database/migrations/003_sar_side_car_files.down.sql
 delete mode 100644 api/database/migrations/003_sar_side_car_files.up.sql

diff --git a/api/database/migrations/001_initial_setup.down.sql b/api/database/migrations/001_initial_setup.down.sql
deleted file mode 100644
index de50d7d..0000000
--- a/api/database/migrations/001_initial_setup.down.sql
+++ /dev/null
@@ -1,9 +0,0 @@
-DROP TABLE IF EXISTS site_info;
-DROP TABLE IF EXISTS access_token;
-DROP TABLE IF EXISTS media_url;
-DROP TABLE IF EXISTS share_token;
-DROP TABLE IF EXISTS media;
-DROP TABLE IF EXISTS video_metadata;
-DROP TABLE IF EXISTS media_exif;
-DROP TABLE IF EXISTS album;
-DROP TABLE IF EXISTS user;
diff --git a/api/database/migrations/001_initial_setup.up.sql b/api/database/migrations/001_initial_setup.up.sql
deleted file mode 100644
index 893545b..0000000
--- a/api/database/migrations/001_initial_setup.up.sql
+++ /dev/null
@@ -1,120 +0,0 @@
--- Users and authentication
-CREATE TABLE IF NOT EXISTS user (
-  user_id int NOT NULL AUTO_INCREMENT,
-  username varchar(128) NOT NULL UNIQUE,
-  password varchar(256),
-  root_path varchar(512),
-  admin boolean NOT NULL DEFAULT 0,
-
-  PRIMARY KEY (user_id)
-) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci;
-
-CREATE TABLE IF NOT EXISTS access_token (
-	token_id int NOT NULL AUTO_INCREMENT,
-  user_id int NOT NULL,
-	value char(24) NOT NULL UNIQUE,
-	expire timestamp NOT NULL,
-
-	PRIMARY KEY (token_id),
-  FOREIGN KEY (user_id) REFERENCES user(user_id) ON DELETE CASCADE
-) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci;
-
-CREATE TABLE IF NOT EXISTS site_info (
-  initial_setup boolean NOT NULL DEFAULT TRUE
-) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci;
-
--- Video related
-CREATE TABLE IF NOT EXISTS video_metadata (
-  metadata_id int NOT NULL AUTO_INCREMENT,
-
-  width int(6) NOT NULL,
-  height int(6) NOT NULL,
-  duration double NOT NULL,
-  codec varchar(128),
-  framerate double,
-  bitrate int(24),
-  color_profile varchar(128),
-  audio varchar(128),
-
-  PRIMARY KEY (metadata_id)
-) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci;
-
--- Media related
-CREATE TABLE IF NOT EXISTS album (
-  album_id int NOT NULL AUTO_INCREMENT,
-  title varchar(256) NOT NULL,
-  parent_album int,
-  owner_id int NOT NULL,
-  path varchar(1024) NOT NULL,
-  path_hash varchar(32) NOT NULL UNIQUE,
-
-  PRIMARY KEY (album_id),
-  FOREIGN KEY (parent_album) REFERENCES album(album_id) ON DELETE CASCADE,
-  FOREIGN KEY (owner_id) REFERENCES user(user_id) ON DELETE CASCADE
-) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci;
-
-CREATE TABLE IF NOT EXISTS media_exif (
-  exif_id int NOT NULL AUTO_INCREMENT,
-  camera varchar(256),
-  maker varchar(256),
-  lens varchar(256),
-  date_shot timestamp NULL,
-  exposure varchar(256),
-  aperture float,
-  iso int(6),
-  focal_length float,
-  flash varchar(256),
-  orientation int(1),
-  exposure_program int(1),
-  gps_latitude float,
-  gps_longitude float,
-
-  PRIMARY KEY (exif_id)
-) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci;
-
-CREATE TABLE IF NOT EXISTS media (
-  media_id int NOT NULL AUTO_INCREMENT,
-  title varchar(256) NOT NULL,
-  path varchar(1024) NOT NULL,
-  path_hash varchar(32) NOT NULL UNIQUE,
-  album_id int NOT NULL,
-  exif_id int,
-  date_shot datetime NOT NULL,
-  date_imported datetime NOT NULL DEFAULT CURRENT_TIMESTAMP,
-  favorite boolean DEFAULT FALSE,
-  media_type varchar(64) NOT NULL,
-  video_metadata_id int,
-
-  PRIMARY KEY (media_id),
-  FOREIGN KEY (album_id) REFERENCES album(album_id) ON DELETE CASCADE,
-  FOREIGN KEY (exif_id) REFERENCES media_exif(exif_id) ON DELETE CASCADE,
-  FOREIGN KEY (video_metadata_id) REFERENCES video_metadata(metadata_id) ON DELETE CASCADE
-) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci;
-
-CREATE TABLE IF NOT EXISTS media_url (
-  url_id int NOT NULL AUTO_INCREMENT,
-  media_id int NOT NULL,
-  media_name varchar(512) NOT NULL,
-  width int NOT NULL,
-  height int NOT NULL,
-  purpose varchar(64) NOT NULL,
-  content_type varchar(64) NOT NULL,
-  file_size int NOT NULL,
-
-  PRIMARY KEY (url_id),
-  FOREIGN KEY (media_id) REFERENCES media(media_id) ON DELETE CASCADE
-) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci;
-
--- Public shares
-CREATE TABLE IF NOT EXISTS share_token (
-  token_id int AUTO_INCREMENT,
-  value char(24) NOT NULL UNIQUE,
-  owner_id int NOT NULL,
-  expire timestamp NULL DEFAULT NULL,
-  password varchar(256),
-  album_id int,
-  media_id int,
-
-  PRIMARY KEY (token_id)
-  -- CHECK (album_id IS NOT NULL OR media_id IS NOT NULL)
-) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci;
diff --git a/api/database/migrations/002_site_info_more_settings.down.sql b/api/database/migrations/002_site_info_more_settings.down.sql
deleted file mode 100644
index 1e441e5..0000000
--- a/api/database/migrations/002_site_info_more_settings.down.sql
+++ /dev/null
@@ -1,4 +0,0 @@
-
-ALTER TABLE site_info
-  DROP COLUMN IF EXISTS periodic_scan_interval,
-  DROP COLUMN IF EXISTS concurrent_workers;
diff --git a/api/database/migrations/002_site_info_more_settings.up.sql b/api/database/migrations/002_site_info_more_settings.up.sql
deleted file mode 100644
index 272bbfe..0000000
--- a/api/database/migrations/002_site_info_more_settings.up.sql
+++ /dev/null
@@ -1,4 +0,0 @@
-
-ALTER TABLE site_info
-  ADD COLUMN IF NOT EXISTS periodic_scan_interval int(8) NOT NULL DEFAULT 0,
-  ADD COLUMN IF NOT EXISTS concurrent_workers int(8) NOT NULL DEFAULT 3;
diff --git a/api/database/migrations/003_sar_side_car_files.down.sql b/api/database/migrations/003_sar_side_car_files.down.sql
deleted file mode 100644
index 12005bf..0000000
--- a/api/database/migrations/003_sar_side_car_files.down.sql
+++ /dev/null
@@ -1,4 +0,0 @@
-
-ALTER TABLE media
-  DROP COLUMN IF EXISTS side_car_path,
-  DROP COLUMN IF EXISTS side_car_hash;
diff --git a/api/database/migrations/003_sar_side_car_files.up.sql b/api/database/migrations/003_sar_side_car_files.up.sql
deleted file mode 100644
index 635f351..0000000
--- a/api/database/migrations/003_sar_side_car_files.up.sql
+++ /dev/null
@@ -1,4 +0,0 @@
-
-ALTER TABLE media
-  ADD COLUMN IF NOT EXISTS side_car_path varchar(1024) DEFAULT NULL,
-  ADD COLUMN IF NOT EXISTS side_car_hash varchar(32) DEFAULT NULL;
