From 7dc1477f1f1cbdf1a2ea056c7ef47f0cff49162d Mon Sep 17 00:00:00 2001 From: Dmitriy Pleshevskiy Date: Mon, 22 Feb 2021 16:27:27 +0300 Subject: [PATCH] chore: update migration content for sample db --- .../down.sql | 1 + sample/database/migrations/210206002058_create_tag/up.sql | 7 +++++++ sample/database/migrations/210206002058_hello_world/up.sql | 2 -- .../migrations/210206002359_second_migration/down.sql | 2 -- .../migrations/210206002359_second_migration/up.sql | 2 -- 5 files changed, 8 insertions(+), 6 deletions(-) rename sample/database/migrations/{210206002058_hello_world => 210206002058_create_tag}/down.sql (73%) create mode 100644 sample/database/migrations/210206002058_create_tag/up.sql delete mode 100644 sample/database/migrations/210206002058_hello_world/up.sql delete mode 100644 sample/database/migrations/210206002359_second_migration/down.sql delete mode 100644 sample/database/migrations/210206002359_second_migration/up.sql 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 -