forked from WWBN/AVideo
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathupdateDb.v1.4.sql
58 lines (47 loc) · 3 KB
/
updateDb.v1.4.sql
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
SET @OLD_UNIQUE_CHECKS=@@UNIQUE_CHECKS, UNIQUE_CHECKS=0;
SET @OLD_FOREIGN_KEY_CHECKS=@@FOREIGN_KEY_CHECKS, FOREIGN_KEY_CHECKS=0;
SET @OLD_SQL_MODE=@@SQL_MODE, SQL_MODE='TRADITIONAL,ALLOW_INVALID_DATES';
ALTER SCHEMA `youPHPTube` DEFAULT CHARACTER SET utf8 DEFAULT COLLATE utf8_general_ci ;
ALTER TABLE `users`
CHANGE COLUMN `user` `user` VARCHAR(45) NOT NULL ,
CHANGE COLUMN `name` `name` VARCHAR(45) NULL DEFAULT NULL ,
CHANGE COLUMN `email` `email` VARCHAR(45) NULL DEFAULT NULL ,
CHANGE COLUMN `password` `password` VARCHAR(45) NOT NULL ;
ALTER TABLE `videos`
CHANGE COLUMN `title` `title` VARCHAR(255) NOT NULL ,
CHANGE COLUMN `clean_title` `clean_title` VARCHAR(255) NOT NULL ,
CHANGE COLUMN `status` `status` ENUM('a', 'i', 'e', 'x', 'd') NOT NULL DEFAULT 'e' COMMENT 'a = active\ni = inactive\ne = encoding\nx = encoding error\nd = downloading' ,
CHANGE COLUMN `duration` `duration` VARCHAR(15) NOT NULL ,
CHANGE COLUMN `type` `type` ENUM('audio', 'video') NOT NULL DEFAULT 'video' ;
ALTER TABLE `comments`
CHANGE COLUMN `comment` `comment` VARCHAR(255) NOT NULL ;
ALTER TABLE `categories`
CHANGE COLUMN `name` `name` VARCHAR(45) NOT NULL ,
CHANGE COLUMN `clean_name` `clean_name` VARCHAR(45) NOT NULL ,
CHANGE COLUMN `created` `created` DATETIME NOT NULL DEFAULT now() ,
CHANGE COLUMN `modified` `modified` DATETIME NOT NULL DEFAULT now() ;
ALTER TABLE `configurations`
CHANGE COLUMN `video_resolution` `video_resolution` VARCHAR(12) NOT NULL ,
CHANGE COLUMN `version` `version` VARCHAR(10) NOT NULL ,
CHANGE COLUMN `webSiteTitle` `webSiteTitle` VARCHAR(45) NOT NULL DEFAULT 'YouPHPTube' ,
CHANGE COLUMN `language` `language` VARCHAR(6) NOT NULL DEFAULT 'en' ,
CHANGE COLUMN `contactEmail` `contactEmail` VARCHAR(45) NOT NULL ,
CHANGE COLUMN `modified` `modified` DATETIME NOT NULL DEFAULT now() ,
CHANGE COLUMN `created` `created` DATETIME NOT NULL DEFAULT now() ,
ADD COLUMN `authGoogle_id` VARCHAR(255) NULL DEFAULT NULL AFTER `created`,
ADD COLUMN `authGoogle_key` VARCHAR(255) NULL DEFAULT NULL AFTER `authGoogle_id`,
ADD COLUMN `authGoogle_enabled` TINYINT(1) NOT NULL DEFAULT 0 AFTER `authGoogle_key`,
ADD COLUMN `authFacebook_id` VARCHAR(255) NULL DEFAULT NULL AFTER `authGoogle_enabled`,
ADD COLUMN `authFacebook_key` VARCHAR(255) NULL DEFAULT NULL AFTER `authFacebook_id`,
ADD COLUMN `authFacebook_enabled` TINYINT(1) NOT NULL DEFAULT 0 AFTER `authFacebook_key`,
ADD COLUMN `authCanUploadVideos` TINYINT(1) NOT NULL DEFAULT 0 AFTER `authFacebook_enabled`,
ADD COLUMN `authCanComment` TINYINT(1) NOT NULL DEFAULT 1 AFTER `authCanUploadVideos`;
ALTER TABLE `users`
ADD COLUMN `status` ENUM('a', 'i') NOT NULL DEFAULT 'a' AFTER `isAdmin`,
ADD COLUMN `photoURL` VARCHAR(255) NULL DEFAULT NULL AFTER `status`,
ADD COLUMN `lastLogin` DATETIME NULL DEFAULT NULL AFTER `photoURL` ,
ADD COLUMN `recoverPass` VARCHAR(255) NULL DEFAULT NULL AFTER `lastLogin`;
UPDATE configurations SET version = '1.4', modified = now() WHERE id = 1;
SET SQL_MODE=@OLD_SQL_MODE;
SET FOREIGN_KEY_CHECKS=@OLD_FOREIGN_KEY_CHECKS;
SET UNIQUE_CHECKS=@OLD_UNIQUE_CHECKS;