diff --git a/sample/database/migrations/210206002058_hello_world/down.sql b/sample/database/migrations/210206002058_create_tag/down.sql similarity index 73% rename from sample/database/migrations/210206002058_hello_world/down.sql rename to sample/database/migrations/210206002058_create_tag/down.sql index 17e9f2a..a62ee50 100644 --- a/sample/database/migrations/210206002058_hello_world/down.sql +++ b/sample/database/migrations/210206002058_create_tag/down.sql @@ -1,2 +1,3 @@ -- This file should undo anything in `up.sql` +DROP TABLE tags; diff --git a/sample/database/migrations/210206002058_create_tag/up.sql b/sample/database/migrations/210206002058_create_tag/up.sql new file mode 100644 index 0000000..c47eb5b --- /dev/null +++ b/sample/database/migrations/210206002058_create_tag/up.sql @@ -0,0 +1,7 @@ +-- Your SQL goes here + +CREATE TABLE tags ( + id serial PRIMARY KEY, + name text NOT NULL UNIQUE CHECK(length(name) > 0), + created_at timestamp NOT NULL DEFAULT current_timestamp +); diff --git a/sample/database/migrations/210206002058_hello_world/up.sql b/sample/database/migrations/210206002058_hello_world/up.sql deleted file mode 100644 index 495311a..0000000 --- a/sample/database/migrations/210206002058_hello_world/up.sql +++ /dev/null @@ -1,2 +0,0 @@ --- Your SQL goes here - diff --git a/sample/database/migrations/210206002359_second_migration/down.sql b/sample/database/migrations/210206002359_second_migration/down.sql deleted file mode 100644 index 17e9f2a..0000000 --- a/sample/database/migrations/210206002359_second_migration/down.sql +++ /dev/null @@ -1,2 +0,0 @@ --- This file should undo anything in `up.sql` - diff --git a/sample/database/migrations/210206002359_second_migration/up.sql b/sample/database/migrations/210206002359_second_migration/up.sql deleted file mode 100644 index 495311a..0000000 --- a/sample/database/migrations/210206002359_second_migration/up.sql +++ /dev/null @@ -1,2 +0,0 @@ --- Your SQL goes here -