CREATE TABLE subscription_table
( id INT AUTO_INCREMENT NOT NULL,
user_id INT NOT NULL,
media_id INT DEFAULT NULL,
created DATETIME NOT NULL,
duration INT NOT NULL,
method VARCHAR(255) NOT NULL,
pack VARCHAR(255) NOT NULL,
infos LONGTEXT DEFAULT NULL,
status VARCHAR(255) NOT NULL,
currency VARCHAR(255) NOT NULL,
price DOUBLE NOT NULL,
transaction VARCHAR(255) DEFAULT NULL,
email VARCHAR(255) DEFAULT NULL,
started DATETIME DEFAULT NULL,
expired DATETIME DEFAULT NULL,
INDEX IDX_C118E35A76ED395 (user_id),
INDEX IDX_C118E35EA9FDD75 (media_id),
PRIMARY KEY(id)
)
DEFAULT CHARACTER SET utf8 COLLATE utf8_unicode_ci ENGINE = InnoDB;
Then
CREATE TABLE pack_table
(
id INT AUTO_INCREMENT NOT NULL,
title VARCHAR(255) NOT NULL,
description VARCHAR(255) DEFAULT NULL,
discount VARCHAR(255) DEFAULT NULL,
price DOUBLE NOT NULL,
duration INT NOT NULL,
PRIMARY KEY(id)
)
DEFAULT CHARACTER SET utf8 COLLATE utf8_unicode_ci ENGINE = InnoDB;
Then
CREATE TABLE items_table
(
id INT AUTO_INCREMENT NOT NULL,
poster_id INT DEFAULT NULL,
channel_id INT DEFAULT NULL,
user_id INT NOT NULL,
position INT NOT NULL,
INDEX IDX_F2F545FD5BB66C05 (poster_id),
INDEX IDX_F2F545FD72F5A1AA (channel_id),
INDEX IDX_F2F545FDA76ED395 (user_id),
PRIMARY KEY(id)
)
DEFAULT CHARACTER SET utf8 COLLATE utf8_unicode_ci ENGINE = InnoDB;
Then
ALTER TABLE subscription_table
ADD CONSTRAINT FK_C118E35A76ED395 FOREIGN KEY (user_id) REFERENCES fos_user_table (id);
Then
ALTER TABLE subscription_table
ADD CONSTRAINT FK_C118E35EA9FDD75 FOREIGN KEY (media_id) REFERENCES media_table (id);
Then
ALTER TABLE items_table
ADD CONSTRAINT FK_F2F545FD5BB66C05 FOREIGN KEY (poster_id) REFERENCES poster_table (id);
Then
ALTER TABLE items_table
ADD CONSTRAINT FK_F2F545FD72F5A1AA FOREIGN KEY (channel_id) REFERENCES channel_table (id);
Then
ALTER TABLE items_table
ADD CONSTRAINT FK_F2F545FDA76ED395 FOREIGN KEY (user_id) REFERENCES fos_user_table (id);
Then
ALTER TABLE settings_table
ADD logo_id INT DEFAULT NULL,
ADD favicon_id INT DEFAULT NULL,
ADD title VARCHAR(255) DEFAULT NULL,
ADD subtitle VARCHAR(255) DEFAULT NULL,
ADD sitedescription VARCHAR(255) DEFAULT NULL,
ADD sitekeywords VARCHAR(255) DEFAULT NULL,
ADD login TINYINT(1) NOT NULL,
ADD currency VARCHAR(255) DEFAULT NULL,
ADD cashaccount LONGTEXT DEFAULT NULL,
ADD paypalclientid VARCHAR(255) DEFAULT NULL,
ADD paypalclientsecret VARCHAR(255) DEFAULT NULL,
ADD paypalaccount VARCHAR(255) DEFAULT NULL,
ADD stripeapikey LONGTEXT DEFAULT NULL,
ADD manual TINYINT(1) NOT NULL,
ADD stripe TINYINT(1) NOT NULL,
ADD paypal TINYINT(1) NOT NULL,
ADD gpay TINYINT(1) NOT NULL,
ADD stripepublickey LONGTEXT DEFAULT NULL,
ADD paypalsandbox TINYINT(1) NOT NULL,
ADD refundpolicy LONGTEXT DEFAULT NULL,
ADD faq LONGTEXT DEFAULT NULL,
ADD homebanner VARCHAR(255) DEFAULT NULL,
ADD homebannertype VARCHAR(255) DEFAULT NULL,
ADD moviebanner VARCHAR(255) DEFAULT NULL,
ADD moviebannertype VARCHAR(255) DEFAULT NULL,
ADD seriebanner VARCHAR(255) DEFAULT NULL,
ADD seriebannertype VARCHAR(255) DEFAULT NULL,
ADD channelbanner VARCHAR(255) DEFAULT NULL,
ADD channelbannertype VARCHAR(255) DEFAULT NULL,
ADD themoviedbkey VARCHAR(255) DEFAULT NULL,
ADD themoviedblang VARCHAR(255) DEFAULT NULL,
ADD header LONGTEXT DEFAULT NULL;
Then
ALTER TABLE settings_table
ADD CONSTRAINT FK_4EF0C90FF98F144A FOREIGN KEY (logo_id) REFERENCES media_table (id);
Then
ALTER TABLE settings_table
ADD CONSTRAINT FK_4EF0C90FD78119FD FOREIGN KEY (favicon_id) REFERENCES media_table (id);
Then
CREATE INDEX IDX_4EF0C90FF98F144A ON settings_table (logo_id);
CREATE INDEX IDX_4EF0C90FD78119FD ON settings_table (favicon_id);
Then
ALTER TABLE poster_table
ADD slug VARCHAR(255) NOT NULL,
ADD label VARCHAR(255) DEFAULT NULL,
ADD sublabel VARCHAR(255) DEFAULT NULL;
Then
UPDATE poster_table SET slug = id;
CREATE UNIQUE INDEX UNIQ_2AD2483989D9B62 ON poster_table (slug);
Then
ALTER TABLE actor_table
ADD slug VARCHAR(255) NOT NULL;
UPDATE actor_table SET slug = id;
Then
CREATE UNIQUE INDEX UNIQ_D2AD64D2989D9B62 ON actor_table (slug);
Then
ALTER TABLE episode_table
ADD slug VARCHAR(255) NOT NULL;
UPDATE episode_table SET slug = id;
Then
CREATE UNIQUE INDEX UNIQ_CD237912989D9B62 ON episode_table (slug);
ALTER TABLE channel_table
ADD slug VARCHAR(255) NOT NULL,
ADD label VARCHAR(255) NOT NULL,
ADD sublabel VARCHAR(255) NOT NULL;
UPDATE channel_table SET slug = id;
CREATE UNIQUE INDEX UNIQ_410887DE989D9B62 ON channel_table (slug);
Then
ALTER TABLE source_table
ADD quality VARCHAR(255) DEFAULT NULL,
ADD title VARCHAR(255) DEFAULT NULL,
ADD size VARCHAR(255) DEFAULT NULL,
ADD kind VARCHAR(255) DEFAULT NULL,
ADD external TINYINT(1) DEFAULT NULL,
ADD premium VARCHAR(255) DEFAULT NULL, CHANGE type type VARCHAR(255) DEFAULT NULL;
Then
UPDATE source_table SET title = type ;
UPDATE source_table SET premium = 1 ;
UPDATE source_table SET external = 0 ;
UPDATE source_table SET kind = "both" ;
Then
ALTER TABLE fos_user_table
ADD theme VARCHAR(255) DEFAULT NULL,
DROP expires_at,
DROP credentials_expire_at,
CHANGE username username VARCHAR(180) NOT NULL,
CHANGE username_canonical username_canonical VARCHAR(180) NOT NULL,
CHANGE email email VARCHAR(180) NOT NULL,
CHANGE email_canonical email_canonical VARCHAR(180) NOT NULL,
CHANGE salt salt VARCHAR(255) DEFAULT NULL,
CHANGE confirmation_token confirmation_token VARCHAR(180) DEFAULT NULL;
Then
CREATE UNIQUE INDEX UNIQ_C3D4D4BDC05FB297 ON fos_user_table (confirmation_token);