... | ... | @@ -95,30 +95,13 @@ CREATE TABLE user ( |
|
|
ALTER TABLE user ADD CONSTRAINT PK_user PRIMARY KEY (idUser);
|
|
|
|
|
|
|
|
|
CREATE TABLE user_achiviement (
|
|
|
CREATE TABLE user_achievement (
|
|
|
idUser VARCHAR(100) NOT NULL,
|
|
|
idAchievement INT NOT NULL,
|
|
|
currentScore INT NOT NULL
|
|
|
);
|
|
|
|
|
|
ALTER TABLE user_achiviement ADD CONSTRAINT PK_user_achiviement PRIMARY KEY (idUser,idAchievement);
|
|
|
|
|
|
|
|
|
CREATE TABLE user_plataform (
|
|
|
idUser VARCHAR(100) NOT NULL,
|
|
|
idPlataform INT NOT NULL
|
|
|
);
|
|
|
|
|
|
ALTER TABLE user_plataform ADD CONSTRAINT PK_user_plataform PRIMARY KEY (idUser,idPlataform);
|
|
|
|
|
|
|
|
|
CREATE TABLE user_tag (
|
|
|
idUser VARCHAR(100) NOT NULL,
|
|
|
idTag INT NOT NULL,
|
|
|
totalPoints INT
|
|
|
);
|
|
|
|
|
|
ALTER TABLE user_tag ADD CONSTRAINT PK_user_tag PRIMARY KEY (idUser,idTag);
|
|
|
ALTER TABLE user_achievement ADD CONSTRAINT PK_user_achievement PRIMARY KEY (idUser,idAchievement);
|
|
|
|
|
|
|
|
|
CREATE TABLE achievement_tag (
|
... | ... | @@ -162,6 +145,23 @@ CREATE TABLE movie_tag ( |
|
|
ALTER TABLE movie_tag ADD CONSTRAINT PK_movie_tag PRIMARY KEY (idTag,idMovie);
|
|
|
|
|
|
|
|
|
CREATE TABLE preference_plataform (
|
|
|
idUser VARCHAR(100) NOT NULL,
|
|
|
idPlataform INT NOT NULL
|
|
|
);
|
|
|
|
|
|
ALTER TABLE preference_plataform ADD CONSTRAINT PK_preference_plataform PRIMARY KEY (idUser,idPlataform);
|
|
|
|
|
|
|
|
|
CREATE TABLE preference_tag (
|
|
|
idUser VARCHAR(100) NOT NULL,
|
|
|
idTag INT NOT NULL,
|
|
|
pontuacaoTotal INT
|
|
|
);
|
|
|
|
|
|
ALTER TABLE preference_tag ADD CONSTRAINT PK_preference_tag PRIMARY KEY (idUser,idTag);
|
|
|
|
|
|
|
|
|
CREATE TABLE user_movie (
|
|
|
idUser VARCHAR(100) NOT NULL,
|
|
|
idMovie INT NOT NULL,
|
... | ... | @@ -188,16 +188,8 @@ CREATE TABLE cast ( |
|
|
ALTER TABLE cast ADD CONSTRAINT PK_cast PRIMARY KEY (idMovie,idActor);
|
|
|
|
|
|
|
|
|
ALTER TABLE user_achiviement ADD CONSTRAINT FK_user_achiviement_0 FOREIGN KEY (idUser) REFERENCES user (idUser);
|
|
|
ALTER TABLE user_achiviement ADD CONSTRAINT FK_user_achiviement_1 FOREIGN KEY (idAchievement) REFERENCES achivievement (idAchievement);
|
|
|
|
|
|
|
|
|
ALTER TABLE user_plataform ADD CONSTRAINT FK_user_plataform_0 FOREIGN KEY (idUser) REFERENCES user (idUser);
|
|
|
ALTER TABLE user_plataform ADD CONSTRAINT FK_user_plataform_1 FOREIGN KEY (idPlataform) REFERENCES plataform (idPlataform);
|
|
|
|
|
|
|
|
|
ALTER TABLE user_tag ADD CONSTRAINT FK_user_tag_0 FOREIGN KEY (idUser) REFERENCES user (idUser);
|
|
|
ALTER TABLE user_tag ADD CONSTRAINT FK_user_tag_1 FOREIGN KEY (idTag) REFERENCES tag (idTag);
|
|
|
ALTER TABLE user_achievement ADD CONSTRAINT FK_user_achievement_0 FOREIGN KEY (idUser) REFERENCES user (idUser);
|
|
|
ALTER TABLE user_achievement ADD CONSTRAINT FK_user_achievement_1 FOREIGN KEY (idAchievement) REFERENCES achivievement (idAchievement);
|
|
|
|
|
|
|
|
|
ALTER TABLE achievement_tag ADD CONSTRAINT FK_achievement_tag_0 FOREIGN KEY (idAchievement) REFERENCES achivievement (idAchievement);
|
... | ... | @@ -212,6 +204,14 @@ ALTER TABLE movie_tag ADD CONSTRAINT FK_movie_tag_0 FOREIGN KEY (idTag) REFERENC |
|
|
ALTER TABLE movie_tag ADD CONSTRAINT FK_movie_tag_1 FOREIGN KEY (idMovie) REFERENCES movie (idMovie);
|
|
|
|
|
|
|
|
|
ALTER TABLE preference_plataform ADD CONSTRAINT FK_preference_plataform_0 FOREIGN KEY (idUser) REFERENCES user (idUser);
|
|
|
ALTER TABLE preference_plataform ADD CONSTRAINT FK_preference_plataform_1 FOREIGN KEY (idPlataform) REFERENCES plataform (idPlataform);
|
|
|
|
|
|
|
|
|
ALTER TABLE preference_tag ADD CONSTRAINT FK_preference_tag_0 FOREIGN KEY (idUser) REFERENCES user (idUser);
|
|
|
ALTER TABLE preference_tag ADD CONSTRAINT FK_preference_tag_1 FOREIGN KEY (idTag) REFERENCES tag (idTag);
|
|
|
|
|
|
|
|
|
ALTER TABLE user_movie ADD CONSTRAINT FK_user_movie_0 FOREIGN KEY (idUser) REFERENCES user (idUser);
|
|
|
ALTER TABLE user_movie ADD CONSTRAINT FK_user_movie_1 FOREIGN KEY (idMovie) REFERENCES movie (idMovie);
|
|
|
|
... | ... | |