Move from the hand.

This commit is contained in:
2023-02-01 22:49:28 -06:00
parent e2eff4f8b5
commit 3bf9aa3ee3
29 changed files with 248 additions and 133 deletions

View File

@@ -4,12 +4,19 @@
[SessionId] BIGINT NOT NULL,
[To] VARCHAR(2) NOT NULL,
[From] VARCHAR(2) NULL,
[IsPromotion] BIT NULL,
[PieceIdFromHand] INT NULL
[PieceIdFromHand] INT NULL,
[IsPromotion] BIT DEFAULT 0
CONSTRAINT [Cannot end where you start]
CHECK ([From] <> [To]),
CONSTRAINT [Move cannot start from two places]
CHECK (
( [From] IS NOT NULL AND [PieceIdFromHand] IS NULL )
OR
( [From] IS NULL AND [PieceIdFromhand] IS NOT NULL )
),
CONSTRAINT FK_Move_Session FOREIGN KEY (SessionId) REFERENCES [session].[Session] (Id)
ON DELETE CASCADE
ON UPDATE CASCADE,