Skip to content

Instantly share code, notes, and snippets.

@tudormunteanu
Last active August 29, 2015 14:20
Show Gist options
  • Select an option

  • Save tudormunteanu/aac8e876e73efbd9eef6 to your computer and use it in GitHub Desktop.

Select an option

Save tudormunteanu/aac8e876e73efbd9eef6 to your computer and use it in GitHub Desktop.
Steak SQL queries
/* User creation */
/* 15:07:36 46.101.30.40 */
INSERT INTO `user` (`fbid`, `firstname`, `lastname`, `nickname`, `email`, `dob`, `password`, `photo`, `wallet`, `accuracy`, `totalPoints`, `totalPredictions`, `correctScores`, `correctResults`, `maxWager`, `maxDeposit`, `sportsmansBetting`, `accountblock`, `facebook`, `verified`, `resetkey`, `id`, `createdAt`, `updatedAt`)
VALUES (NULL, 'Tudor', 'Test1', 'test1', 'tudor@mowowstudios.com', NULL, '15c734fe69c4aa8e31491f439d04811a', '/images/dummyphoto.jpg', '0', '0', '0', '0', '0', '0', '0', '0', '0', NULL, '0', '0', NULL, NULL, '2015-05-05 05:05:05', '2015-05-05 05:05:05');
/* The "id" column from the previous query will be used for the other. Will be known as <user.id>
/* Match creation */
/* 16:16:06 46.101.30.40 */
INSERT INTO `match` (`home`, `away`, `enetpulseid`, `startdate`, `status`, `homescore`, `awayscore`, `createdAt`, `updatedAt`)
VALUES ('Southampton', 'Swansea City', '1', '2015-05-01 16:00:00', 'notstarted', '0', '0', NULL, NULL);
/* After the insert, the "id" column will be populated. Will be known as <match.id> from now on.*/
/* Game Creation */
/* 15:42:10 46.101.30.40 */
INSERT INTO `game` (`name`, `owner`, `wager`, `finished`, `paid`, `crest`, `id`, `createdAt`, `updatedAt`)
VALUES ('Test Game 2', '<user.id>', '0', '0', '0', '3', NULL, '2015-05-05 05:05:05', '2015-05-05 05:05:05');
/* After the insert, the "id" column will be populated. This id will be known as <game.id> from now on.
/* 15:57:59 46.101.30.40 */
INSERT INTO `game_players__user_id` (`id`, `game_players`, `user_id`)
VALUES (NULL, '<game.id>', '<user.id>');
/* 15:58:32 46.101.30.40 */
INSERT INTO `game_id__user_games` (`id`, `user_games`, `game_id`)
VALUES (NULL, '<user.id>', '<game.id>');
/* 16:25:49 46.101.30.40 */
INSERT INTO `prediction` (`user`, `game`, `match`, `home`, `away`, `id`, `createdAt`, `updatedAt`)
VALUES ('<user.id>', '<game.id>', '<match.id>', '0', '1', NULL, '2015-05-05 05:05:05', '2015-05-05 05:05:05');
/* 16:33:56 46.101.30.40 */
INSERT INTO `game_matches__match_id` (`id`, `game_matches`, `match_id`)
VALUES (NULL, '<game.id>', '<match.id>');
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment