slovocast/sql/03-channels.sql

22 lines
686 B
MySQL
Raw Normal View History

CREATE TABLE channels (
id INT(11) UNSIGNED NOT NULL AUTO_INCREMENT,
name VARCHAR(255) NOT NULL,
description TEXT NOT NULL,
link VARCHAR(255) NULL,
language VARCHAR(2) NOT NULL,
copyright VARCHAR(255) NULL,
explicit BOOLEAN DEFAULT false,
category VARCHAR(255),
owner_id INT(11) UNSIGNED NOT NULL,
image_id INT(11) UNSIGNED NOT NULL,
created_at DATETIME NOT NULL DEFAULT CURRENT_TIMESTAMP,
updated_at TIMESTAMP DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP,
PRIMARY KEY(`id`),
FOREIGN KEY(`owner_id`) REFERENCES users(`id`),
FOREIGN KEY(`image_id`) REFERENCES images(`id`),
UNIQUE KEY(`name`)
) Engine=InnoDb;