only store one snake with the same type and move Calculations into moves as the array<json> type
This commit is contained in:
+3
-13
@@ -34,10 +34,8 @@ module default {
|
|||||||
readonly := true;
|
readonly := true;
|
||||||
on source delete delete target;
|
on source delete delete target;
|
||||||
}
|
}
|
||||||
single snake: Snake {
|
required single snake: Snake {
|
||||||
readonly := true;
|
readonly := true;
|
||||||
on source delete delete target;
|
|
||||||
on target delete allow;
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -68,7 +66,7 @@ module default {
|
|||||||
required type: str {
|
required type: str {
|
||||||
readonly := true;
|
readonly := true;
|
||||||
}
|
}
|
||||||
#constraint exclusive on .type;
|
constraint exclusive on ( .type );
|
||||||
}
|
}
|
||||||
|
|
||||||
type Moves {
|
type Moves {
|
||||||
@@ -81,15 +79,7 @@ module default {
|
|||||||
required game_board: json {
|
required game_board: json {
|
||||||
readonly := true;
|
readonly := true;
|
||||||
}
|
}
|
||||||
single calculations: Calculations {
|
calculations: array<json> {
|
||||||
readonly := true;
|
|
||||||
on source delete delete target;
|
|
||||||
on target delete allow;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
type Calculations {
|
|
||||||
required data: array<json> {
|
|
||||||
readonly := true;
|
readonly := true;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -47,11 +47,7 @@ class EdgeDB:
|
|||||||
turn := data.turn,
|
turn := data.turn,
|
||||||
snake_move := data.`move`,
|
snake_move := data.`move`,
|
||||||
game_board := data.game_board,
|
game_board := data.game_board,
|
||||||
calculations := (
|
calculations := data.calculations
|
||||||
insert Calculations {
|
|
||||||
data := data.calculations
|
|
||||||
}
|
|
||||||
)
|
|
||||||
}
|
}
|
||||||
),
|
),
|
||||||
type := (
|
type := (
|
||||||
@@ -70,7 +66,7 @@ class EdgeDB:
|
|||||||
snake := (
|
snake := (
|
||||||
insert Snake {
|
insert Snake {
|
||||||
type := <str>$snake_type
|
type := <str>$snake_type
|
||||||
}
|
} unless conflict on .type else Snake
|
||||||
)
|
)
|
||||||
}""",
|
}""",
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user