Skip to content

Commit

Permalink
Update ReCapProjectDB.sql
Browse files Browse the repository at this point in the history
  • Loading branch information
semihshn authored Mar 29, 2021
1 parent c3f32c1 commit b208ea0
Showing 1 changed file with 12 additions and 5 deletions.
17 changes: 12 additions & 5 deletions ReCapProjectDB.sql
Original file line number Diff line number Diff line change
@@ -1,4 +1,8 @@
CREATE TABLE [dbo].[Brands] (
CREATE DATABASE reCapDatabase;

USE reCapDatabase

CREATE TABLE [dbo].[Brands] (
[Id] INT IDENTITY (1, 1) NOT NULL,
[Name] NVARCHAR (25) NOT NULL,
PRIMARY KEY CLUSTERED ([Id] ASC)
Expand All @@ -13,6 +17,7 @@ CREATE TABLE [dbo].[Colors] (
CREATE TABLE [dbo].[Models] (
[Id] INT IDENTITY (1, 1) NOT NULL,
[BrandId] INT NOT NULL,
[Name] NVARCHAR (30) NOT NULL,
PRIMARY KEY CLUSTERED ([Id] ASC),
CONSTRAINT [FK_Colors_Brands] FOREIGN KEY ([BrandId]) REFERENCES [dbo].[Brands] ([Id])
);
Expand All @@ -25,6 +30,7 @@ CREATE TABLE [dbo].[Cars] (
[DailyPrice] DECIMAL (18) NOT NULL,
[ModelYear] SMALLINT NOT NULL,
[Description] NVARCHAR (50) NULL,
[FindeksScore] INT NULL,
PRIMARY KEY CLUSTERED ([Id] ASC),
CONSTRAINT [FK_Cars_Brands] FOREIGN KEY ([BrandId]) REFERENCES [dbo].[Brands] ([Id]),
CONSTRAINT [FK_Cars_Colors] FOREIGN KEY ([ColorId]) REFERENCES [dbo].[Colors] ([Id]),
Expand All @@ -39,14 +45,15 @@ CREATE TABLE [dbo].[Users] (
[PasswordHash] VARBINARY(500) NOT NULL,
[PasswordSalt] VARBINARY(500) NOT NULL,
[Status] BIT NOT NULL,
[Age] DATETIME NOT NULL,
[Age] DATETIME NULL,
PRIMARY KEY CLUSTERED ([Id] ASC)
);

CREATE TABLE [dbo].[Customers] (
[Id] INT IDENTITY (1, 1) NOT NULL,
[UserId] INT NOT NULL,
[CompanyName] NCHAR (50) NULL,
[CompanyName] NVARCHAR (50) NULL,
[FindeksScore] INT NULL,
PRIMARY KEY CLUSTERED ([Id] ASC),
CONSTRAINT [FK_Customers_Users] FOREIGN KEY ([UserId]) REFERENCES [dbo].[Users] ([Id])
);
Expand All @@ -55,7 +62,7 @@ CREATE TABLE [dbo].[Rentals] (
[Id] INT IDENTITY (1, 1) NOT NULL,
[CarId] INT NOT NULL,
[CustomerId] INT NOT NULL,
[RentDate] DATETIME NOT NULL,
[RentDate] DATETIME NULL,
[ReturnDate] DATETIME NULL,
PRIMARY KEY CLUSTERED ([Id] ASC),
CONSTRAINT [FK_Rentals_Cars] FOREIGN KEY ([CarId]) REFERENCES [dbo].[Cars] ([Id]),
Expand Down Expand Up @@ -86,4 +93,4 @@ CREATE TABLE [dbo].[UserOperationClaims] (
PRIMARY KEY CLUSTERED ([Id] ASC),
CONSTRAINT [FK_UserOperationClaims_Users] FOREIGN KEY ([UserId]) REFERENCES [dbo].[Users] ([Id]),
CONSTRAINT [FK_UserOperationClaims_OperationClaims] FOREIGN KEY ([OperationClaimId]) REFERENCES [dbo].[OperationClaims] ([Id])
);
);

0 comments on commit b208ea0

Please sign in to comment.