· 6 years ago · Aug 17, 2019, 05:50 AM
1-- +goose Up
2-- SQL in this section is executed when the migration is applied.
3CREATE TABLE IF NOT EXISTS books
4(
5 id INT UNSIGNED NOT NULL AUTO_INCREMENT,
6 title VARCHAR(255) NOT NULL,
7 author VARCHAR(255) NOT NULL,
8 published_date DATE NOT NULL,
9 image_url VARCHAR(255) NULL,
10 description TEXT NULL,
11 created_at TIMESTAMP NOT NULL,
12 updated_at TIMESTAMP NULL,
13 deleted_at TIMESTAMP NULL,
14 PRIMARY KEY (id)
15);
16
17-- +goose Down
18-- SQL in this section is executed when the migration is rolled back.
19DROP TABLE IF EXISTS books;