|
@ -4,7 +4,7 @@ GO |
|
|
USE [CompaniesDB]; |
|
|
USE [CompaniesDB]; |
|
|
GO |
|
|
GO |
|
|
|
|
|
|
|
|
CREATE TABLE [Companies] ( |
|
|
CREATE TABLE [Company] ( |
|
|
[CompanyId] int NOT NULL IDENTITY, |
|
|
[CompanyId] int NOT NULL IDENTITY, |
|
|
[Name] nvarchar(max) NOT NULL, |
|
|
[Name] nvarchar(max) NOT NULL, |
|
|
[ContractStatus] int NOT NULL CHECK ([ContractStatus] IN(0, 1, 2)), |
|
|
[ContractStatus] int NOT NULL CHECK ([ContractStatus] IN(0, 1, 2)), |
|
@ -19,11 +19,11 @@ CREATE TABLE [Users] ( |
|
|
[Login] nvarchar(max) NOT NULL, |
|
|
[Login] nvarchar(max) NOT NULL, |
|
|
[Password] nvarchar(max) NOT NULL, |
|
|
[Password] nvarchar(max) NOT NULL, |
|
|
CONSTRAINT [PK_UserId] PRIMARY KEY ([UserId]), |
|
|
CONSTRAINT [PK_UserId] PRIMARY KEY ([UserId]), |
|
|
CONSTRAINT [FK_Users_Companies] FOREIGN KEY (CompanyID) REFERENCES [Companies] (CompanyId) ON DELETE CASCADE |
|
|
CONSTRAINT [FK_Users_Company] FOREIGN KEY (CompanyID) REFERENCES [Company] (CompanyId) ON DELETE CASCADE |
|
|
); |
|
|
); |
|
|
GO |
|
|
GO |
|
|
|
|
|
|
|
|
INSERT INTO [Companies] (Name, ContractStatus) VALUES |
|
|
INSERT INTO [Company] (Name, ContractStatus) VALUES |
|
|
('Defend Studio', '0'), |
|
|
('Defend Studio', '0'), |
|
|
('Yandex Music', '1') |
|
|
('Yandex Music', '1') |
|
|
GO |
|
|
GO |