Skip to content

Commit

Permalink
Add descriptions
Browse files Browse the repository at this point in the history
  • Loading branch information
madhead committed May 1, 2023
1 parent 64aea7a commit 5f4f246
Show file tree
Hide file tree
Showing 3 changed files with 34 additions and 0 deletions.
2 changes: 2 additions & 0 deletions lambda/lambda/neonbranch.py
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,7 @@ def handle(event: dict, context):
}

winner = row[2]
description = row[3]

return {
"statusCode": 200,
Expand All @@ -46,5 +47,6 @@ def handle(event: dict, context):
"player_1": player_1,
"player_2": player_2,
"winner": winner,
"description": description,
}),
}
2 changes: 2 additions & 0 deletions migrations/src/main/sql/descriptions.down.sql
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
ALTER TABLE rules
DROP COLUMN description;
30 changes: 30 additions & 0 deletions migrations/src/main/sql/descriptions.up.sql
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
ALTER TABLE rules
ADD COLUMN description VARCHAR(32);

UPDATE rules
SET description = 'It''s a tie'
WHERE player1 = 'rock' AND player2 = 'rock';
UPDATE rules
SET description = 'Paper covers rock'
WHERE player1 = 'rock' AND player2 = 'paper';
UPDATE rules
SET description = 'Rock crushes scissors'
WHERE player1 = 'rock' AND player2 = 'scissors';
UPDATE rules
SET description = 'Paper covers rock'
WHERE player1 = 'paper' AND player2 = 'rock';
UPDATE rules
SET description = 'It''s a tie'
WHERE player1 = 'paper' AND player2 = 'paper';
UPDATE rules
SET description = 'Scissors cuts paper'
WHERE player1 = 'paper' AND player2 = 'scissors';
UPDATE rules
SET description = 'Rock crushes scissors'
WHERE player1 = 'scissors' AND player2 = 'rock';
UPDATE rules
SET description = 'Scissors cuts paper'
WHERE player1 = 'scissors' AND player2 = 'paper';
UPDATE rules
SET description = 'It''s a tie'
WHERE player1 = 'scissors' AND player2 = 'scissors';

0 comments on commit 5f4f246

Please sign in to comment.