mirror of
https://github.com/DanielnetoDotCom/YouPHPTube
synced 2025-10-03 01:39:24 +02:00
Correct Subscribers tables
adding video statics index for faster results
This commit is contained in:
parent
c5989549cf
commit
7475570167
1 changed files with 10 additions and 0 deletions
|
@ -236,9 +236,12 @@ CREATE TABLE IF NOT EXISTS `videos_statistics` (
|
|||
`created` DATETIME NULL DEFAULT NULL,
|
||||
`modified` DATETIME NULL DEFAULT NULL,
|
||||
`lastVideoTime` INT(11) NULL DEFAULT NULL,
|
||||
`session_id` VARCHAR(45) NOT NULL
|
||||
PRIMARY KEY (`id`),
|
||||
INDEX `fk_videos_statistics_users1_idx` (`users_id` ASC),
|
||||
INDEX `fk_videos_statistics_videos1_idx` (`videos_id` ASC),
|
||||
INDEX `when_statisci` (`when` ASC),
|
||||
INDEX `session_id_statistics` (`session_id` ASC)
|
||||
CONSTRAINT `fk_videos_statistics_users1`
|
||||
FOREIGN KEY (`users_id`)
|
||||
REFERENCES `users` (`id`)
|
||||
|
@ -346,12 +349,19 @@ CREATE TABLE IF NOT EXISTS `subscribes` (
|
|||
`ip` VARCHAR(45) NULL,
|
||||
`users_id` INT NOT NULL DEFAULT 1 COMMENT 'subscribes to user channel',
|
||||
`notify` TINYINT(1) NOT NULL DEFAULT 1,
|
||||
`subscriber_users_id` INT(11) NOT NULL,
|
||||
PRIMARY KEY (`id`),
|
||||
INDEX `fk_subscribes_users1_idx` (`users_id` ASC),
|
||||
INDEX `fk_subscribes_users2_idx` (`subscriber_users_id` ASC),
|
||||
CONSTRAINT `fk_subscribes_users1`
|
||||
FOREIGN KEY (`users_id`)
|
||||
REFERENCES `users` (`id`)
|
||||
ON DELETE CASCADE
|
||||
ON UPDATE CASCADE,
|
||||
CONSTRAINT `fk_subscribes_users2`
|
||||
FOREIGN KEY (`subscriber_users_id`)
|
||||
REFERENCES `users` (`id`)
|
||||
ON DELETE CASCADE
|
||||
ON UPDATE CASCADE)
|
||||
ENGINE = InnoDB;
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue