catalog_by_category
(
video_access_number int8 NOT NULL,
category varchar(50) NOT NULL,
CONSTRAINT by_category_pk PRIMARY KEY (video_access_number, category),
CONSTRAINT category FOREIGN KEY (video_access_number)
REFERENCES video (video_access_number)
CONSTRAINT video_access_number FOREIGN KEY (video_access_number)
REFERENCES video (video_access_number)
)
catalog_by_language
(
video_access_number int8 NOT NULL,
"language" varchar NOT NULL,
CONSTRAINT by_language_pk PRIMARY KEY (video_access_number, "language"),
CONSTRAINT "language" FOREIGN KEY ("language")
REFERENCES "language" ("language")
CONSTRAINT video_access_number FOREIGN KEY (video_access_number)
REFERENCES video (video_access_number)
)
category
(
category_title varchar(50) NOT NULL,
CONSTRAINT category_pk PRIMARY KEY (category_title)
)
comments
(
video_access_number int8 NOT NULL,
"comment" varchar(500) NOT NULL,
CONSTRAINT comment_pk PRIMARY KEY (video_access_number, "comment"),
CONSTRAINT video_access_number FOREIGN KEY (video_access_number)
REFERENCES video (video_access_number)
)
format
(
format_code varchar(20) NOT NULL,
file_extension varchar(10) NOT NULL,
pixel_width int8 NOT NULL,
pixel_height int8 NOT NULL,
CONSTRAINT format_pk PRIMARY KEY (format_code),
CONSTRAINT format_uk UNIQUE (file_extension, pixel_width, pixel_height)
)
friendship
(
myself varchar(50) NOT NULL,
friend varchar(50) NOT NULL,
CONSTRAINT friendship_pk PRIMARY KEY (myself, friend),
CONSTRAINT friend_username FOREIGN KEY (friend)
REFERENCES subscriber (username)
CONSTRAINT myself_username FOREIGN KEY (myself)
REFERENCES subscriber (username)
)
"language"
(
"language" varchar(30) NOT NULL,
CONSTRAINT language_pk PRIMARY KEY ("language")
)
ownership
(
username varchar(50) NOT NULL,
video_access_number int8 NOT NULL,
CONSTRAINT ownership_pk PRIMARY KEY (username, video_access_number),
CONSTRAINT username FOREIGN KEY (username)
REFERENCES subscriber (username)
CONSTRAINT video_access_number FOREIGN KEY (video_access_number)
REFERENCES video (video_access_number)
)
subscriber
(
username varchar(50) NOT NULL, -- unique user identifier
"password" varchar(32) NOT NULL, -- user password
CONSTRAINT subscriber_pk PRIMARY KEY (username)
)
video
(
video_access_number int8 NOT NULL,
content bytea NOT NULL,
is_private bool NOT NULL,
is_free bool NOT NULL,
video_title varchar(200) NOT NULL,
is_flagged bool NOT NULL,
date_uploaded date NOT NULL,
view_hits int8 NOT NULL DEFAULT 0,
download_hits int8 NOT NULL DEFAULT 0,
thumbnail bytea NOT NULL,
CONSTRAINT video_pk PRIMARY KEY (video_access_number),
CONSTRAINT video_uk UNIQUE (content)
)
0 Comments:
Post a Comment
<< Home