yep
This commit is contained in:
@@ -1,14 +1,14 @@
|
||||
CREATE PROCEDURE [session].[CreateSession]
|
||||
@InitialBoardStateDocument [session].[JsonDocument]
|
||||
@InitialBoardStateDocument [session].[JsonDocument],
|
||||
@Player1Name [user].[UserName]
|
||||
AS
|
||||
BEGIN
|
||||
SET NOCOUNT ON
|
||||
|
||||
INSERT INTO [session].[Session] ([Name], BoardState, Player1Id)
|
||||
INSERT INTO [session].[Session] (BoardState, Player1Id)
|
||||
SELECT
|
||||
JSON_VALUE(@InitialBoardStateDocument, '$.Name'),
|
||||
@InitialBoardStateDocument,
|
||||
Id
|
||||
FROM [user].[User]
|
||||
WHERE [Name] = JSON_VALUE(@InitialBoardStateDocument, '$.Player1');
|
||||
WHERE [Name] = @Player1Name
|
||||
END
|
||||
@@ -6,7 +6,6 @@ BEGIN
|
||||
|
||||
SELECT
|
||||
sess.[Name],
|
||||
GameOver,
|
||||
BoardState,
|
||||
p1.[Name] as Player1,
|
||||
p2.[Name] as Player2
|
||||
|
||||
@@ -2,12 +2,12 @@
|
||||
(
|
||||
Id BIGINT NOT NULL PRIMARY KEY IDENTITY,
|
||||
Created DATETIMEOFFSET NOT NULL DEFAULT SYSDATETIMEOFFSET(),
|
||||
DomainDocument [session].[JsonDocument] NOT NULL,
|
||||
[Name] AS JSON_VALUE(DomainDocument, '$.Name') UNIQUE,
|
||||
Player1Id BIGINT NOT NULL,
|
||||
Player2Id BIGINT NULL,
|
||||
BoardState [session].[JsonDocument] NOT NULL,
|
||||
[Name] AS JSON_VALUE(BoardState, '$.Name') UNIQUE,
|
||||
|
||||
CONSTRAINT [BoardState must be json] CHECK (isjson(DomainDocument)=1),
|
||||
CONSTRAINT [BoardState must be json] CHECK (isjson(BoardState)=1),
|
||||
CONSTRAINT FK_Player1_User FOREIGN KEY (Player1Id) REFERENCES [user].[User] (Id)
|
||||
ON DELETE CASCADE
|
||||
ON UPDATE CASCADE,
|
||||
|
||||
Reference in New Issue
Block a user