Skip to content

Commit 781a52e

Browse files
committed
Setup sql seed and migrations
1 parent b410f8f commit 781a52e

File tree

4 files changed

+19
-0
lines changed

4 files changed

+19
-0
lines changed

migrations/1_init.down.sql

+1
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
DROP TABLE `gopher`;

migrations/1_init.up.sql

+10
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
CREATE TABLE `gopher` (
2+
`id` INT UNSIGNED AUTO_INCREMENT,
3+
`full_name` VARCHAR(255) NOT NULL,
4+
`headline` VARCHAR(255) NOT NULL,
5+
`avatar_url` VARCHAR(255) NOT NULL,
6+
`created_at` DATETIME NOT NULL,
7+
`updated_at` DATETIME NOT NULL,
8+
PRIMARY KEY (`id`)
9+
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4;
10+

seed/1_seed.down.sql

+1
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
DELETE FROM `gopher` WHERE id IN (1, 2, 3);

seed/1_seed.up.sql

+7
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
INSERT INTO `gopher` (`id`, `full_name`, `headline`, `avatar_url`, `created_at`, `updated_at`)
2+
VALUES (1, "Sasha Varlamov", "CEO @EXLskills", "https://s3-us-west-2.amazonaws.com/exlskills-instructor-profiles/svarlamov.jpg", NOW(), NOW());
3+
INSERT INTO `gopher` (`id`, `full_name`, `headline`, `avatar_url`, `created_at`, `updated_at`)
4+
VALUES (2, "Elliott Saslow", "Python @EXLskills", "https://s3-us-west-2.amazonaws.com/exlskills-instructor-profiles/swelliott.jpg", NOW(), NOW());
5+
INSERT INTO `gopher` (`id`, `full_name`, `headline`, `avatar_url`, `created_at`, `updated_at`)
6+
VALUES (3, "Keenan Olsen", "SQL @EXLskills", "https://s3-us-west-2.amazonaws.com/exlskills-instructor-profiles/keeno12.jpeg", NOW(), NOW());
7+

0 commit comments

Comments
 (0)