From 81ae1a2555370da8738226946ef333d2541689bf Mon Sep 17 00:00:00 2001 From: Jef Roosens Date: Thu, 15 Apr 2021 18:05:02 +0200 Subject: [PATCH] [#24] Added first ivago migration --- Makefile | 4 ++++ migrations/2021-04-15-155511_ivago_search/down.sql | 2 ++ migrations/2021-04-15-155511_ivago_search/up.sql | 9 +++++++++ src/schema.rs | 0 4 files changed, 15 insertions(+) create mode 100644 migrations/2021-04-15-155511_ivago_search/down.sql create mode 100644 migrations/2021-04-15-155511_ivago_search/up.sql create mode 100644 src/schema.rs diff --git a/Makefile b/Makefile index 820f893..5d8c22e 100644 --- a/Makefile +++ b/Makefile @@ -50,6 +50,10 @@ sh: @ docker exec -it fej sh .PHONY: sh +# Starts a psql session in the database container +dbsh: + @ docker exec -it fej_db psql -U fej -d fej + # Builds the debug version, and runs the tests (but doesn't detach). test: @ ./build -m dev -a run -l -- test --no-fail-fast diff --git a/migrations/2021-04-15-155511_ivago_search/down.sql b/migrations/2021-04-15-155511_ivago_search/down.sql new file mode 100644 index 0000000..9d9d004 --- /dev/null +++ b/migrations/2021-04-15-155511_ivago_search/down.sql @@ -0,0 +1,2 @@ +-- This file should undo anything in `up.sql` +DROP SCHEMA ivago CASCADE; diff --git a/migrations/2021-04-15-155511_ivago_search/up.sql b/migrations/2021-04-15-155511_ivago_search/up.sql new file mode 100644 index 0000000..f33eff1 --- /dev/null +++ b/migrations/2021-04-15-155511_ivago_search/up.sql @@ -0,0 +1,9 @@ +-- Your SQL goes here +CREATE SCHEMA ivago; + +CREATE TABLE ivago.streets ( + name TEXT NOT NULL, + city TEXT NOT NULL, + + PRIMARY KEY (name, city) +); diff --git a/src/schema.rs b/src/schema.rs new file mode 100644 index 0000000..e69de29