-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
16 changed files
with
117 additions
and
10 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,58 @@ | ||
-- Create "Ingredients" table | ||
CREATE TABLE [Ingredients] ( | ||
[id] int IDENTITY (1, 1) NOT NULL, | ||
[name] nvarchar(255) COLLATE SQL_Latin1_General_CP1_CI_AS NOT NULL, | ||
[createdAt] datetimeoffset(7) NOT NULL, | ||
[updatedAt] datetimeoffset(7) NOT NULL, | ||
[deletedAt] datetimeoffset(7) NULL, | ||
CONSTRAINT [PK_Ingredients] PRIMARY KEY CLUSTERED ([id] ASC) | ||
); | ||
-- Create "RecipeIngredients" table | ||
CREATE TABLE [RecipeIngredients] ( | ||
[recipeId] int NOT NULL, | ||
[ingredientId] int NOT NULL, | ||
[meassurementAmount] int NOT NULL, | ||
[meassurementType] nvarchar(255) COLLATE SQL_Latin1_General_CP1_CI_AS NOT NULL, | ||
[createdAt] datetimeoffset(7) NOT NULL, | ||
[updatedAt] datetimeoffset(7) NOT NULL, | ||
[deletedAt] datetimeoffset(7) NULL, | ||
CONSTRAINT [PK_RecipeIngredients] PRIMARY KEY CLUSTERED ([ingredientId] ASC) | ||
); | ||
-- Create index "recipe_ingredients_meassurement_type_meassurement_amount" to table: "RecipeIngredients" | ||
CREATE UNIQUE NONCLUSTERED INDEX [recipe_ingredients_meassurement_type_meassurement_amount] ON [RecipeIngredients] ([meassurementType] ASC, [meassurementAmount] ASC); | ||
-- Create "Recipes" table | ||
CREATE TABLE [Recipes] ( | ||
[id] int IDENTITY (1, 1) NOT NULL, | ||
[title] nvarchar(255) COLLATE SQL_Latin1_General_CP1_CI_AS NOT NULL, | ||
[description] nvarchar(MAX) COLLATE SQL_Latin1_General_CP1_CI_AS NOT NULL, | ||
[instructions] nvarchar(MAX) COLLATE SQL_Latin1_General_CP1_CI_AS NOT NULL, | ||
[userId] int NOT NULL, | ||
[meal] varchar(255) COLLATE SQL_Latin1_General_CP1_CI_AS NULL, | ||
[createdAt] datetimeoffset(7) NOT NULL, | ||
[updatedAt] datetimeoffset(7) NOT NULL, | ||
[deletedAt] datetimeoffset(7) NULL, | ||
CONSTRAINT [PK_Recipes] PRIMARY KEY CLUSTERED ([id] ASC), | ||
CONSTRAINT [CK__Recipes__meal__24B26D99] CHECK ([meal]=N'dessert' OR [meal]=N'dinner' OR [meal]=N'lunch' OR [meal]=N'breakfast') | ||
); | ||
-- Create "Users" table | ||
CREATE TABLE [Users] ( | ||
[id] int IDENTITY (1, 1) NOT NULL, | ||
[name] nvarchar(255) COLLATE SQL_Latin1_General_CP1_CI_AS NOT NULL, | ||
[recipeId] int NOT NULL, | ||
[createdAt] datetimeoffset(7) NOT NULL, | ||
[updatedAt] datetimeoffset(7) NOT NULL, | ||
[deletedAt] datetimeoffset(7) NULL, | ||
CONSTRAINT [PK_Users] PRIMARY KEY CLUSTERED ([id] ASC) | ||
); | ||
-- Modify "RecipeIngredients" table | ||
ALTER TABLE [RecipeIngredients] ADD | ||
CONSTRAINT [FK__RecipeIng__ingre__2882FE7D] FOREIGN KEY ([ingredientId]) REFERENCES [Ingredients] ([id]) ON UPDATE NO ACTION ON DELETE CASCADE; | ||
-- Modify "RecipeIngredients" table | ||
ALTER TABLE [RecipeIngredients] ADD | ||
CONSTRAINT [FK__RecipeIng__recip__278EDA44] FOREIGN KEY ([recipeId]) REFERENCES [Recipes] ([id]) ON UPDATE NO ACTION ON DELETE CASCADE; | ||
-- Modify "Recipes" table | ||
ALTER TABLE [Recipes] ADD | ||
CONSTRAINT [FK__Recipes__userId__297722B6] FOREIGN KEY ([userId]) REFERENCES [Users] ([id]) ON UPDATE NO ACTION ON DELETE CASCADE; | ||
-- Modify "Users" table | ||
ALTER TABLE [Users] ADD | ||
CONSTRAINT [FK__Users__recipeId__2A6B46EF] FOREIGN KEY ([recipeId]) REFERENCES [Recipes] ([id]) ON UPDATE NO ACTION ON DELETE NO ACTION; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,2 @@ | ||
h1:t50PTQpKOaHIuiXnAubYw31bV1R/qE41TJW+02+yO0Q= | ||
20240125063717.sql h1:S5GLiSBdZWdEANYRKyFROvOxU1i3szOlcfhO8R3qJDs= |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,2 +1,2 @@ | ||
h1:OgZsNGmgX9py3k61Yf+DCuyflbFmgILvTDvwJBdVvho= | ||
20231225122102.sql h1:ClhnG2UKDb5t+dwNFT6lcEGeXAG9AXvlwUzq4RwWnUQ= | ||
h1:ZMbeDJy9/UBOrkKW6GTUOpxw4xCokB8VnOcX/dKx4Ok= | ||
20231225122102.sql h1:Gkocec7Hymg6mDLibLeLshwK/qvMWyOJN6MQNcUc67M= |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,2 +1,2 @@ | ||
h1:kv5cFbgcvOA0iW5aiYEf+uQBNZWzgW7SQ3ESNF8G7AM= | ||
20231225122022.sql h1:vB3ZaP+BqXaKCVjtxtuH++OOA1r/EvpuPf7t88i5QJ8= | ||
h1:hXrIihYHMGg9tBMY5e9sKtwvu/T/tFFvXHC9BHi40To= | ||
20231225122022.sql h1:ckN+59j8Sq8OgJjgVVdPdLsWGgAp8Xb4fjuC+YlX2vM= |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,2 +1,2 @@ | ||
h1:tInqZl0Eg+lKPRULTifvfDQozfbKgzUDFbipWDlVw/w= | ||
20231225122837.sql h1:x4/DEpFPl2hmd78T7wgkaxcUwYkyD5kqyaqjXOkOCIs= | ||
h1:1O5jNja57eN4F511oqxrd6evCvvIDyM6kaqzRygx7hg= | ||
20231225122837.sql h1:8nxlw6ktQ/RbpEBPSYv8JqdEUATjPOBVIZt2tro5Ock= |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,35 @@ | ||
-- Create "contact" table | ||
CREATE TABLE [contact] ( | ||
[id] int IDENTITY (1, 1) NOT NULL, | ||
[name] nvarchar(45) COLLATE SQL_Latin1_General_CP1_CI_AS NOT NULL, | ||
[alias] nvarchar(45) COLLATE SQL_Latin1_General_CP1_CI_AS NOT NULL, | ||
[created_at] datetimeoffset(7) NOT NULL, | ||
[updated_at] datetimeoffset(7) NOT NULL, | ||
CONSTRAINT [PK_contact] PRIMARY KEY CLUSTERED ([id] ASC) | ||
); | ||
-- Create index "name-alias" to table: "contact" | ||
CREATE UNIQUE NONCLUSTERED INDEX [name-alias] ON [contact] ([name] ASC, [alias] ASC); | ||
-- Create "email" table | ||
CREATE TABLE [email] ( | ||
[id] int IDENTITY (1, 1) NOT NULL, | ||
[email] nvarchar(60) COLLATE SQL_Latin1_General_CP1_CI_AS NOT NULL, | ||
[subscription] varchar(255) COLLATE SQL_Latin1_General_CP1_CI_AS NULL, | ||
[contact_id] int NOT NULL, | ||
[created_at] datetimeoffset(7) NOT NULL, | ||
[updated_at] datetimeoffset(7) NOT NULL, | ||
CONSTRAINT [PK_email] PRIMARY KEY CLUSTERED ([id] ASC), | ||
|
||
CONSTRAINT [FK__email__contact_i__23BE4960] FOREIGN KEY ([contact_id]) REFERENCES [contact] ([id]) ON UPDATE NO ACTION ON DELETE CASCADE, | ||
CONSTRAINT [CK__email__subscript__22CA2527] CHECK ([subscription]=N'premium' OR [subscription]=N'basic' OR [subscription]=N'free') | ||
); | ||
-- Create "phone" table | ||
CREATE TABLE [phone] ( | ||
[id] int IDENTITY (1, 1) NOT NULL, | ||
[phone] nvarchar(20) COLLATE SQL_Latin1_General_CP1_CI_AS NOT NULL, | ||
[contact_id] int NOT NULL, | ||
[created_at] datetimeoffset(7) NOT NULL, | ||
[updated_at] datetimeoffset(7) NOT NULL, | ||
CONSTRAINT [PK_phone] PRIMARY KEY CLUSTERED ([id] ASC), | ||
|
||
CONSTRAINT [FK__phone__contact_i__269AB60B] FOREIGN KEY ([contact_id]) REFERENCES [contact] ([id]) ON UPDATE NO ACTION ON DELETE CASCADE | ||
); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,2 @@ | ||
h1:TPNUI1REUblqUeMJvck7gUOqKsgdW3rQFOSCO4o+Rcc= | ||
20240125063755.sql h1:P2/Rns5QC+V8A/DzmleyT5/dyTh66pAbKF4cVpz2RIU= |