Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- CREATE TABLE Release (
- id INT PRIMARY KEY IDENTITY,
- categoryName VARCHAR(100) NOT NULL,
- ownerId INT NOT NULL,
- releaseName VARCHAR(200) NOT NULL,
- releaseDescription VARCHAR(2000),
- imgLocation VARCHAR(200) NOT NULL,
- releaseDate DateTime NOT NULL,
- creationDate DateTime NOT NULL DEFAULT GETDATE(),
- followerCount INT NOT NULL DEFAULT 0
- );
- CREATE TABLE Category (
- categoryName VARCHAR(100) PRIMARY KEY,
- imgLocation VARCHAR(200) NOT NULL
- );
- CREATE TABLE Comment(
- id INT PRIMARY KEY IDENTITY,
- releaseId INT NOT NULL,
- userId INT NOT NULL,
- postDate DateTime NOT NULL DEFAULT GETDATE(),
- replyId INT,
- commentText VARCHAR(1000) NOT NULL
- );
- CREATE TABLE releaseUser(
- id INT PRIMARY KEY IDENTITY,
- username VARCHAR(20) NOT NULL,
- passHash VARCHAR(200) NOT NULL,
- imgLocation VARCHAR(200),
- accountCreationDate DateTime NOT NULL DEFAULT GETDATE()
- );
- CREATE TABLE User_Release(
- userId INT NOT NULL,
- releaseId INT NOT NULL
- );
- ALTER TABLE Release
- ADD FOREIGN KEY (categoryName) REFERENCES Category(categoryName);
- ALTER TABLE Release
- ADD FOREIGN KEY (ownerId) REFERENCES releaseUser(id);
- ALTER TABLE Comment
- ADD FOREIGN KEY (releaseId) REFERENCES Release(id);
- ALTER TABLE Comment
- ADD FOREIGN KEY (userId) REFERENCES releaseUser(id);
- ALTER TABLE User_Release
- ADD FOREIGN KEY (userId) REFERENCES releaseUser(id);
- ALTER TABLE User_Release
- ADD FOREIGN KEY (releaseId) REFERENCES Release(id);
- ALTER TABLE User_Release ADD PRIMARY KEY(userId, releaseId);
- ALTER TABLE dbo.releaseUser ADD authToken VARCHAR(100);
- ALTER TABLE dbo.releaseUser ADD salt VARCHAR(100);
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement