From c8d2f47529ebc03f8e061fa41e282e724d073dab Mon Sep 17 00:00:00 2001 From: hackerman <3372410+aeneasr@users.noreply.github.com> Date: Tue, 23 Jun 2020 08:28:35 +0200 Subject: [PATCH] Handle foreign keys and indices properly in SQLite and add e2e tests (#94) This patch resolves issues with `change_column` and `drop_column` which previously caused duplicate or missing indices and foreign keys. To prevent future regressions and help debugging, a new e2e-test pipeline has been added to the project and the CI. Documentation for running the tests has been added to the README. End-to-end tests currently support MySQL, PostgreSQL, and SQLite and do not yet cover other SQL dialects. During review, please help ensure that the SQL fixtures are not missing something :) Closes #92 --- .github/workflows/tests.yml | 104 ++++++++- README.md | 17 ++ database.yml | 2 + go.mod | 11 +- go.sum | 212 ++++++++++++++++++ internal/e2e/cockroach_test.go | 20 ++ internal/e2e/fixtures/cockroach/down/0.sql | 5 + internal/e2e/fixtures/cockroach/down/1.sql | 13 ++ internal/e2e/fixtures/cockroach/down/2.sql | 30 +++ internal/e2e/fixtures/cockroach/down/3.sql | 28 +++ internal/e2e/fixtures/cockroach/down/4.sql | 30 +++ internal/e2e/fixtures/cockroach/down/5.sql | 30 +++ internal/e2e/fixtures/cockroach/down/6.sql | 30 +++ internal/e2e/fixtures/cockroach/up/0.sql | 13 ++ internal/e2e/fixtures/cockroach/up/1.sql | 30 +++ internal/e2e/fixtures/cockroach/up/2.sql | 28 +++ internal/e2e/fixtures/cockroach/up/3.sql | 29 +++ internal/e2e/fixtures/cockroach/up/4.sql | 29 +++ internal/e2e/fixtures/cockroach/up/5.sql | 30 +++ internal/e2e/fixtures/cockroach/up/6.sql | 30 +++ internal/e2e/fixtures/mysql/down/0.sql | 40 ++++ internal/e2e/fixtures/mysql/down/1.sql | 55 +++++ internal/e2e/fixtures/mysql/down/2.sql | 74 ++++++ internal/e2e/fixtures/mysql/down/3.sql | 72 ++++++ internal/e2e/fixtures/mysql/down/4.sql | 74 ++++++ internal/e2e/fixtures/mysql/down/5.sql | 74 ++++++ internal/e2e/fixtures/mysql/down/6.sql | 74 ++++++ internal/e2e/fixtures/mysql/up/0.sql | 55 +++++ internal/e2e/fixtures/mysql/up/1.sql | 74 ++++++ internal/e2e/fixtures/mysql/up/2.sql | 72 ++++++ internal/e2e/fixtures/mysql/up/3.sql | 73 ++++++ internal/e2e/fixtures/mysql/up/4.sql | 73 ++++++ internal/e2e/fixtures/mysql/up/5.sql | 74 ++++++ internal/e2e/fixtures/mysql/up/6.sql | 74 ++++++ internal/e2e/fixtures/postgres/down/0.sql | 42 ++++ internal/e2e/fixtures/postgres/down/1.sql | 63 ++++++ internal/e2e/fixtures/postgres/down/2.sql | 107 +++++++++ internal/e2e/fixtures/postgres/down/3.sql | 99 ++++++++ internal/e2e/fixtures/postgres/down/4.sql | 107 +++++++++ internal/e2e/fixtures/postgres/down/5.sql | 107 +++++++++ internal/e2e/fixtures/postgres/down/6.sql | 107 +++++++++ internal/e2e/fixtures/postgres/up/0.sql | 63 ++++++ internal/e2e/fixtures/postgres/up/1.sql | 107 +++++++++ internal/e2e/fixtures/postgres/up/2.sql | 99 ++++++++ internal/e2e/fixtures/postgres/up/3.sql | 100 +++++++++ internal/e2e/fixtures/postgres/up/4.sql | 100 +++++++++ internal/e2e/fixtures/postgres/up/5.sql | 107 +++++++++ internal/e2e/fixtures/postgres/up/6.sql | 107 +++++++++ internal/e2e/fixtures/sqlite3/down/0.sql | 4 + internal/e2e/fixtures/sqlite3/down/1.sql | 9 + internal/e2e/fixtures/sqlite3/down/2.sql | 16 ++ internal/e2e/fixtures/sqlite3/down/3.sql | 15 ++ internal/e2e/fixtures/sqlite3/down/4.sql | 17 ++ internal/e2e/fixtures/sqlite3/down/5.sql | 17 ++ internal/e2e/fixtures/sqlite3/down/6.sql | 17 ++ internal/e2e/fixtures/sqlite3/up/0.sql | 9 + internal/e2e/fixtures/sqlite3/up/1.sql | 18 ++ internal/e2e/fixtures/sqlite3/up/2.sql | 16 ++ internal/e2e/fixtures/sqlite3/up/3.sql | 16 ++ internal/e2e/fixtures/sqlite3/up/4.sql | 16 ++ internal/e2e/fixtures/sqlite3/up/5.sql | 17 ++ internal/e2e/fixtures/sqlite3/up/6.sql | 17 ++ internal/e2e/integration_test.go | 31 +++ .../migrations/20191100000001_users.down.fizz | 1 + .../migrations/20191100000001_users.up.fizz | 3 + .../20191100000002_user_notes.down.fizz | 1 + .../20191100000002_user_notes.up.fizz | 13 ++ ...1100000003_user_notes_drop_title.down.fizz | 2 + ...191100000003_user_notes_drop_title.up.fizz | 1 + ...191100000004_user_notes_add_slug.down.fizz | 1 + ...20191100000004_user_notes_add_slug.up.fizz | 1 + ...191100000005_user_notes_add_slug.down.fizz | 0 ...20191100000005_user_notes_add_slug.up.fizz | 1 + ...191100000006_user_notes_add_slug.down.fizz | 0 ...20191100000006_user_notes_add_slug.up.fizz | 2 + ...20191100000007_user_notes_rename.down.fizz | 1 + .../20191100000007_user_notes_rename.up.fizz | 1 + internal/e2e/migrator_test.go | 167 ++++++++++++++ internal/e2e/mysql_test.go | 20 ++ internal/e2e/postgres_test.go | 20 ++ internal/e2e/sqlite3_test.go | 26 +++ tables.go | 10 +- tables_private_test.go | 17 ++ test.sh | 11 +- testdata/migrations/.gitignore | 1 + translators/sqlite.go | 22 +- translators/sqlite_meta.go | 58 +++++ translators/sqlite_test.go | 47 ++++ 88 files changed, 3646 insertions(+), 10 deletions(-) create mode 100644 internal/e2e/cockroach_test.go create mode 100644 internal/e2e/fixtures/cockroach/down/0.sql create mode 100644 internal/e2e/fixtures/cockroach/down/1.sql create mode 100644 internal/e2e/fixtures/cockroach/down/2.sql create mode 100644 internal/e2e/fixtures/cockroach/down/3.sql create mode 100644 internal/e2e/fixtures/cockroach/down/4.sql create mode 100644 internal/e2e/fixtures/cockroach/down/5.sql create mode 100644 internal/e2e/fixtures/cockroach/down/6.sql create mode 100644 internal/e2e/fixtures/cockroach/up/0.sql create mode 100644 internal/e2e/fixtures/cockroach/up/1.sql create mode 100644 internal/e2e/fixtures/cockroach/up/2.sql create mode 100644 internal/e2e/fixtures/cockroach/up/3.sql create mode 100644 internal/e2e/fixtures/cockroach/up/4.sql create mode 100644 internal/e2e/fixtures/cockroach/up/5.sql create mode 100644 internal/e2e/fixtures/cockroach/up/6.sql create mode 100644 internal/e2e/fixtures/mysql/down/0.sql create mode 100644 internal/e2e/fixtures/mysql/down/1.sql create mode 100644 internal/e2e/fixtures/mysql/down/2.sql create mode 100644 internal/e2e/fixtures/mysql/down/3.sql create mode 100644 internal/e2e/fixtures/mysql/down/4.sql create mode 100644 internal/e2e/fixtures/mysql/down/5.sql create mode 100644 internal/e2e/fixtures/mysql/down/6.sql create mode 100644 internal/e2e/fixtures/mysql/up/0.sql create mode 100644 internal/e2e/fixtures/mysql/up/1.sql create mode 100644 internal/e2e/fixtures/mysql/up/2.sql create mode 100644 internal/e2e/fixtures/mysql/up/3.sql create mode 100644 internal/e2e/fixtures/mysql/up/4.sql create mode 100644 internal/e2e/fixtures/mysql/up/5.sql create mode 100644 internal/e2e/fixtures/mysql/up/6.sql create mode 100644 internal/e2e/fixtures/postgres/down/0.sql create mode 100644 internal/e2e/fixtures/postgres/down/1.sql create mode 100644 internal/e2e/fixtures/postgres/down/2.sql create mode 100644 internal/e2e/fixtures/postgres/down/3.sql create mode 100644 internal/e2e/fixtures/postgres/down/4.sql create mode 100644 internal/e2e/fixtures/postgres/down/5.sql create mode 100644 internal/e2e/fixtures/postgres/down/6.sql create mode 100644 internal/e2e/fixtures/postgres/up/0.sql create mode 100644 internal/e2e/fixtures/postgres/up/1.sql create mode 100644 internal/e2e/fixtures/postgres/up/2.sql create mode 100644 internal/e2e/fixtures/postgres/up/3.sql create mode 100644 internal/e2e/fixtures/postgres/up/4.sql create mode 100644 internal/e2e/fixtures/postgres/up/5.sql create mode 100644 internal/e2e/fixtures/postgres/up/6.sql create mode 100644 internal/e2e/fixtures/sqlite3/down/0.sql create mode 100644 internal/e2e/fixtures/sqlite3/down/1.sql create mode 100644 internal/e2e/fixtures/sqlite3/down/2.sql create mode 100644 internal/e2e/fixtures/sqlite3/down/3.sql create mode 100644 internal/e2e/fixtures/sqlite3/down/4.sql create mode 100644 internal/e2e/fixtures/sqlite3/down/5.sql create mode 100644 internal/e2e/fixtures/sqlite3/down/6.sql create mode 100644 internal/e2e/fixtures/sqlite3/up/0.sql create mode 100644 internal/e2e/fixtures/sqlite3/up/1.sql create mode 100644 internal/e2e/fixtures/sqlite3/up/2.sql create mode 100644 internal/e2e/fixtures/sqlite3/up/3.sql create mode 100644 internal/e2e/fixtures/sqlite3/up/4.sql create mode 100644 internal/e2e/fixtures/sqlite3/up/5.sql create mode 100644 internal/e2e/fixtures/sqlite3/up/6.sql create mode 100644 internal/e2e/integration_test.go create mode 100644 internal/e2e/migrations/20191100000001_users.down.fizz create mode 100644 internal/e2e/migrations/20191100000001_users.up.fizz create mode 100644 internal/e2e/migrations/20191100000002_user_notes.down.fizz create mode 100644 internal/e2e/migrations/20191100000002_user_notes.up.fizz create mode 100644 internal/e2e/migrations/20191100000003_user_notes_drop_title.down.fizz create mode 100644 internal/e2e/migrations/20191100000003_user_notes_drop_title.up.fizz create mode 100644 internal/e2e/migrations/20191100000004_user_notes_add_slug.down.fizz create mode 100644 internal/e2e/migrations/20191100000004_user_notes_add_slug.up.fizz create mode 100644 internal/e2e/migrations/20191100000005_user_notes_add_slug.down.fizz create mode 100644 internal/e2e/migrations/20191100000005_user_notes_add_slug.up.fizz create mode 100644 internal/e2e/migrations/20191100000006_user_notes_add_slug.down.fizz create mode 100644 internal/e2e/migrations/20191100000006_user_notes_add_slug.up.fizz create mode 100644 internal/e2e/migrations/20191100000007_user_notes_rename.down.fizz create mode 100644 internal/e2e/migrations/20191100000007_user_notes_rename.up.fizz create mode 100644 internal/e2e/migrator_test.go create mode 100644 internal/e2e/mysql_test.go create mode 100644 internal/e2e/postgres_test.go create mode 100644 internal/e2e/sqlite3_test.go create mode 100644 tables_private_test.go create mode 100644 testdata/migrations/.gitignore diff --git a/.github/workflows/tests.yml b/.github/workflows/tests.yml index 1b234b66..22305216 100644 --- a/.github/workflows/tests.yml +++ b/.github/workflows/tests.yml @@ -51,6 +51,18 @@ jobs: MYSQL_PORT: 3307 run: | go test -tags sqlite -race ./... + - name: Reset soda + env: + SODA_DIALECT: "sqlite" + run: | + $HOME/go/bin/soda drop -e $SODA_DIALECT -p ./testdata/migrations + $HOME/go/bin/soda create -e $SODA_DIALECT -p ./testdata/migrations + shell: bash + - name: Run e2e + env: + SODA_DIALECT: "sqlite" + run: | + go test -tags sqlite,e2e -race ./internal/e2e/... pg-tests: name: PostgreSQL tests @@ -102,6 +114,18 @@ jobs: POSTGRESQL_URL: "postgres://postgres:postgres@${{job.services.postgres.host}}:${{ job.services.postgres.ports[5432] }}/pop_test?sslmode=disable" run: | go test -tags sqlite -race ./... + - name: Reset soda + env: + SODA_DIALECT: "sqlite" + run: | + $HOME/go/bin/soda drop -e $SODA_DIALECT -p ./testdata/migrations + $HOME/go/bin/soda create -e $SODA_DIALECT -p ./testdata/migrations + shell: bash + - name: Run e2e + env: + SODA_DIALECT: "sqlite" + run: | + go test -tags sqlite,e2e -race ./internal/e2e/... crdb-tests: name: Cockroach tests @@ -147,13 +171,79 @@ jobs: SODA_DIALECT: "cockroach" run: | go test -tags sqlite -race ./... + - name: Reset soda + env: + SODA_DIALECT: "sqlite" + run: | + $HOME/go/bin/soda drop -e $SODA_DIALECT -p ./testdata/migrations + $HOME/go/bin/soda create -e $SODA_DIALECT -p ./testdata/migrations + shell: bash + - name: Run e2e + env: + SODA_DIALECT: "sqlite" + run: | + go test -tags sqlite,e2e -race ./internal/e2e/... + + sqlite-tests-windows: + name: SQLite tests + runs-on: ${{ matrix.os }} + strategy: + matrix: + os: [windows-latest] + steps: + - name: Install sqlite3 + run: choco install sqlite + - name: Set up Go + uses: actions/setup-go@v1 + with: + go-version: 1.13 + id: go + - name: Checkout Code + uses: actions/checkout@v1 + with: + fetch-depth: 1 + - name: Get dependencies + run: | + go get -v -tags sqlite -t -d ./... + - name: Install soda + env: + GO111MODULE: "off" + run: | + mkdir -p "$HOME/go/bin" + go get -v -tags sqlite github.com/gobuffalo/soda + shell: bash + - name: Run soda + env: + SODA_DIALECT: "sqlite" + run: | + $HOME/go/bin/soda drop -e $SODA_DIALECT -p ./testdata/migrations + $HOME/go/bin/soda create -e $SODA_DIALECT -p ./testdata/migrations + $HOME/go/bin/soda migrate -e $SODA_DIALECT -p ./testdata/migrations + shell: bash + - name: Test + env: + SODA_DIALECT: "sqlite" + run: | + go test -tags sqlite -race ./... + - name: Reset soda + env: + SODA_DIALECT: "sqlite" + run: | + $HOME/go/bin/soda drop -e $SODA_DIALECT -p ./testdata/migrations + $HOME/go/bin/soda create -e $SODA_DIALECT -p ./testdata/migrations + shell: bash + - name: Run e2e + env: + SODA_DIALECT: "sqlite" + run: | + go test -tags sqlite,e2e -race ./internal/e2e/... sqlite-tests: name: SQLite tests runs-on: ${{ matrix.os }} strategy: matrix: - os: [ubuntu-latest, macOS-latest, windows-latest] + os: [ubuntu-latest, macOS-latest] steps: - name: Set up Go @@ -188,3 +278,15 @@ jobs: SODA_DIALECT: "sqlite" run: | go test -tags sqlite -race ./... + - name: Reset soda + env: + SODA_DIALECT: "sqlite" + run: | + $HOME/go/bin/soda drop -e $SODA_DIALECT -p ./testdata/migrations + $HOME/go/bin/soda create -e $SODA_DIALECT -p ./testdata/migrations + shell: bash + - name: Run e2e + env: + SODA_DIALECT: "sqlite" + run: | + go test -tags sqlite,e2e -race ./internal/e2e/... diff --git a/README.md b/README.md index 18b536fd..0dd4ea17 100644 --- a/README.md +++ b/README.md @@ -197,3 +197,20 @@ Sometimes during a migration you need to shell out to an external command. ```javascript exec("echo hello") ``` + +## Development + +### Testing + +To run end-to-end tests, use + +``` +make test +``` + +If you made changes to the end-to-end tests and want to update the fixtures, +run: + +``` +REFRESH_FIXTURES=true make test +``` \ No newline at end of file diff --git a/database.yml b/database.yml index c877e101..4ee63b38 100644 --- a/database.yml +++ b/database.yml @@ -32,4 +32,6 @@ sqlserver: sqlite: dialect: "sqlite3" database: "./sql_scripts/sqlite/test.sqlite" + options: + mode: rwc diff --git a/go.mod b/go.mod index 352ec21f..46a22b75 100644 --- a/go.mod +++ b/go.mod @@ -6,10 +6,11 @@ require ( github.com/Masterminds/semver/v3 v3.0.3 github.com/go-sql-driver/mysql v1.5.0 github.com/gobuffalo/plush/v4 v4.0.0 + github.com/gobuffalo/pop/v5 v5.2.0 + github.com/jackc/pgx/v4 v4.6.0 github.com/kballard/go-shellquote v0.0.0-20180428030007-95032a82bc51 - github.com/kr/pretty v0.2.0 // indirect - github.com/stretchr/testify v1.4.0 - golang.org/x/net v0.0.0-20190813141303-74dc4d7220e7 // indirect - gopkg.in/check.v1 v1.0.0-20190902080502-41f04d3bba15 // indirect - gopkg.in/yaml.v2 v2.2.8 // indirect + github.com/stretchr/testify v1.5.1 + golang.org/x/crypto v0.0.0-20200604202706-70a84ac30bf9 // indirect + golang.org/x/text v0.3.3 // indirect + golang.org/x/xerrors v0.0.0-20191204190536-9bdfabe68543 // indirect ) diff --git a/go.sum b/go.sum index 288ab3db..be85d16a 100644 --- a/go.sum +++ b/go.sum @@ -1,64 +1,276 @@ +github.com/BurntSushi/toml v0.3.1/go.mod h1:xHWCNGjB5oqiDr8zfno3MHue2Ht5sIBksp03qcyfWMU= github.com/Masterminds/semver/v3 v3.0.3 h1:znjIyLfpXEDQjOIEWh+ehwpTU14UzUPub3c3sm36u14= github.com/Masterminds/semver/v3 v3.0.3/go.mod h1:VPu/7SZ7ePZ3QOrcuXROw5FAcLl4a0cBrbBpGY/8hQs= +github.com/armon/consul-api v0.0.0-20180202201655-eb2c6b5be1b6/go.mod h1:grANhF5doyWs3UAsr3K4I6qtAmlQcZDesFNEHPZAzj8= +github.com/cockroachdb/apd v1.1.0 h1:3LFP3629v+1aKXU5Q37mxmRxX/pIu1nijXydLShEq5I= +github.com/cockroachdb/apd v1.1.0/go.mod h1:8Sl8LxpKi29FqWXR16WEFZRNSz3SoPzUzeMeY4+DwBQ= +github.com/coreos/etcd v3.3.10+incompatible/go.mod h1:uF7uidLiAD3TWHmW31ZFd/JWoc32PjwdhPthX9715RE= +github.com/coreos/go-etcd v2.0.0+incompatible/go.mod h1:Jez6KQU2B/sWsbdaef3ED8NzMklzPG4d5KIOhIy30Tk= +github.com/coreos/go-semver v0.2.0/go.mod h1:nnelYz7RCh+5ahJtPPxZlU+153eP4D4r3EedlOD2RNk= +github.com/coreos/go-systemd v0.0.0-20190321100706-95778dfbb74e/go.mod h1:F5haX7vjVVG0kc13fIWeqUViNPyEJxv/OmvnBo0Yme4= +github.com/coreos/go-systemd v0.0.0-20190719114852-fd7a80b32e1f/go.mod h1:F5haX7vjVVG0kc13fIWeqUViNPyEJxv/OmvnBo0Yme4= +github.com/cpuguy83/go-md2man v1.0.10/go.mod h1:SmD6nW6nTyfqj6ABTjUi3V3JVMnlJmwcJI5acqYI6dE= +github.com/creack/pty v1.1.7/go.mod h1:lj5s0c3V2DBrqTV7llrYr5NG6My20zk30Fl46Y7DoTY= github.com/davecgh/go-spew v1.1.0/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38= github.com/davecgh/go-spew v1.1.1 h1:vj9j/u1bqnvCEfJOwUhtlOARqs3+rkHYY13jYWTU97c= github.com/davecgh/go-spew v1.1.1/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38= +github.com/fatih/color v1.9.0 h1:8xPHl4/q1VyqGIPif1F+1V3Y3lSmrq01EabUW3CoW5s= +github.com/fatih/color v1.9.0/go.mod h1:eQcE1qtQxscV5RaZvpXrrb8Drkc3/DdQ+uUYCNjL+zU= github.com/fatih/structs v1.1.0 h1:Q7juDM0QtcnhCpeyLGQKyg4TOIghuNXrkL32pHAUMxo= github.com/fatih/structs v1.1.0/go.mod h1:9NiDSp5zOcgEDl+j00MP/WkGVPOlPRLejGD8Ga6PJ7M= +github.com/fsnotify/fsnotify v1.4.7/go.mod h1:jwhsz4b93w/PPRr/qN1Yymfu8t87LnFCMoQvtojpjFo= +github.com/go-sql-driver/mysql v1.4.0/go.mod h1:zAC/RDZ24gD3HViQzih4MyKcchzm+sOG5ZlKdlhCg5w= github.com/go-sql-driver/mysql v1.5.0 h1:ozyZYNQW3x3HtqT1jira07DN2PArx2v7/mN66gGcHOs= github.com/go-sql-driver/mysql v1.5.0/go.mod h1:DCzpHaOWr8IXmIStZouvnhqoel9Qv2LBy8hT2VhHyBg= +github.com/go-stack/stack v1.8.0/go.mod h1:v0f6uXyyMGvRgIKkXu+yp6POWl0qKG85gN/melR3HDY= +github.com/gobuffalo/attrs v0.1.0/go.mod h1:fmNpaWyHM0tRm8gCZWKx8yY9fvaNLo2PyzBNSrBZ5Hw= +github.com/gobuffalo/envy v1.7.0/go.mod h1:n7DRkBerg/aorDM8kbduw5dN3oXGswK5liaSCx4T5NI= +github.com/gobuffalo/envy v1.7.1/go.mod h1:FurDp9+EDPE4aIUS3ZLyD+7/9fpx7YRt/ukY6jIHf0w= +github.com/gobuffalo/envy v1.8.1 h1:RUr68liRvs0TS1D5qdW3mQv2SjAsu1QWMCx1tG4kDjs= +github.com/gobuffalo/envy v1.8.1/go.mod h1:FurDp9+EDPE4aIUS3ZLyD+7/9fpx7YRt/ukY6jIHf0w= +github.com/gobuffalo/fizz v1.10.0/go.mod h1:J2XGPO0AfJ1zKw7+2BA+6FEGAkyEsdCOLvN93WCT2WI= +github.com/gobuffalo/flect v0.1.5/go.mod h1:W3K3X9ksuZfir8f/LrfVtWmCDQFfayuylOJ7sz/Fj80= github.com/gobuffalo/flect v0.2.0 h1:EWCvMGGxOjsgwlWaP+f4+Hh6yrrte7JeFL2S6b+0hdM= github.com/gobuffalo/flect v0.2.0/go.mod h1:W3K3X9ksuZfir8f/LrfVtWmCDQFfayuylOJ7sz/Fj80= +github.com/gobuffalo/flect v0.2.1 h1:GPoRjEN0QObosV4XwuoWvSd5uSiL0N3e91/xqyY4crQ= +github.com/gobuffalo/flect v0.2.1/go.mod h1:vmkQwuZYhN5Pc4ljYQZzP+1sq+NEkK+lh20jmEmX3jc= +github.com/gobuffalo/genny/v2 v2.0.5/go.mod h1:kRkJuAw9mdI37AiEYjV4Dl+TgkBDYf8HZVjLkqe5eBg= github.com/gobuffalo/github_flavored_markdown v1.1.0 h1:8Zzj4fTRl/OP2R7sGerzSf6g2nEJnaBEJe7UAOiEvbQ= github.com/gobuffalo/github_flavored_markdown v1.1.0/go.mod h1:TSpTKWcRTI0+v7W3x8dkSKMLJSUpuVitlptCkpeY8ic= github.com/gobuffalo/helpers v0.6.0 h1:CL1xOSGeKCaKD1IUpo4RfrkDU83kmkMG4H3dXAS7dw0= github.com/gobuffalo/helpers v0.6.0/go.mod h1:pncVrer7x/KRvnL5aJABLAuT/RhKRR9klL6dkUOhyv8= +github.com/gobuffalo/helpers v0.6.1 h1:LLcL4BsiyDQYtMRUUpyFdBFvFXQ6hNYOpwrcYeilVWM= +github.com/gobuffalo/helpers v0.6.1/go.mod h1:wInbDi0vTJKZBviURTLRMFLE4+nF2uRuuL2fnlYo7w4= +github.com/gobuffalo/logger v1.0.1/go.mod h1:2zbswyIUa45I+c+FLXuWl9zSWEiVuthsk8ze5s8JvPs= +github.com/gobuffalo/logger v1.0.3 h1:YaXOTHNPCvkqqA7w05A4v0k2tCdpr+sgFlgINbQ6gqc= +github.com/gobuffalo/logger v1.0.3/go.mod h1:SoeejUwldiS7ZsyCBphOGURmWdwUFXs0J7TCjEhjKxM= +github.com/gobuffalo/nulls v0.2.0 h1:7R0Uec6JlZI02TR29zrs3KFIuUV8Sqe/s/j3yLvs+gc= +github.com/gobuffalo/nulls v0.2.0/go.mod h1:w4q8RoSCEt87Q0K0sRIZWYeIxkxog5mh3eN3C/n+dUc= +github.com/gobuffalo/packd v0.3.0 h1:eMwymTkA1uXsqxS0Tpoop3Lc0u3kTfiMBE6nKtQU4g4= +github.com/gobuffalo/packd v0.3.0/go.mod h1:zC7QkmNkYVGKPw4tHpBQ+ml7W/3tIebgeo1b36chA3Q= +github.com/gobuffalo/packr/v2 v2.7.1 h1:n3CIW5T17T8v4GGK5sWXLVWJhCz7b5aNLSxW6gYim4o= +github.com/gobuffalo/packr/v2 v2.7.1/go.mod h1:qYEvAazPaVxy7Y7KR0W8qYEE+RymX74kETFqjFoFlOc= github.com/gobuffalo/plush/v4 v4.0.0 h1:ZHdmfr2R7DQ77XzWZK2PGKJOXm9NRy21EZ6Rw7FhuNw= github.com/gobuffalo/plush/v4 v4.0.0/go.mod h1:ErFS3UxKqEb8fpFJT7lYErfN/Nw6vHGiDMTjxpk5bQ0= +github.com/gobuffalo/pop/v5 v5.2.0 h1:b5WDmlv5ZnOj0ZQ6SShBpwrolPCdbOXHM+SzRE//Nzs= +github.com/gobuffalo/pop/v5 v5.2.0/go.mod h1:Hj586Cr7FoTFNmvzyNdUcajv3r0A+W+bkil4RIX/zKo= github.com/gobuffalo/tags/v3 v3.0.2 h1:gxE6c6fA5radwQeg59aPIeYgCG8YA8AZd3Oh6fh5UXA= github.com/gobuffalo/tags/v3 v3.0.2/go.mod h1:ZQeN6TCTiwAFnS0dNcbDtSgZDwNKSpqajvVtt6mlYpA= +github.com/gobuffalo/tags/v3 v3.1.0 h1:mzdCYooN2VsLRr8KIAdEZ1lh1Py7JSMsiEGCGata2AQ= +github.com/gobuffalo/tags/v3 v3.1.0/go.mod h1:ZQeN6TCTiwAFnS0dNcbDtSgZDwNKSpqajvVtt6mlYpA= github.com/gobuffalo/validate/v3 v3.0.0 h1:dF7Bg8NMF9Zv8bZvUMXYJXxZdj+eSZ8z/lGM7/jVFUE= github.com/gobuffalo/validate/v3 v3.0.0/go.mod h1:HFpjq+AIiA2RHoQnQVTFKF/ZpUPXwyw82LgyDPxQ9r0= +github.com/gobuffalo/validate/v3 v3.1.0 h1:/QQN920PciCfBs3aywtJTvDTHmBFMKoiwkshUWa/HLQ= +github.com/gobuffalo/validate/v3 v3.1.0/go.mod h1:HFpjq+AIiA2RHoQnQVTFKF/ZpUPXwyw82LgyDPxQ9r0= github.com/gofrs/uuid v3.2.0+incompatible h1:y12jRkkFxsd7GpqdSZ+/KCs/fJbqpEXSGd4+jfEaewE= github.com/gofrs/uuid v3.2.0+incompatible/go.mod h1:b2aQJv3Z4Fp6yNu3cdSllBxTCLRxnplIgP/c0N/04lM= +github.com/hashicorp/hcl v1.0.0/go.mod h1:E5yfLk+7swimpb2L/Alb/PJmXilQ/rhwaUYs4T20WEQ= +github.com/inconshreveable/mousetrap v1.0.0/go.mod h1:PxqpIevigyE2G7u3NXJIT2ANytuPF1OarO4DADm73n8= +github.com/jackc/chunkreader v1.0.0 h1:4s39bBR8ByfqH+DKm8rQA3E1LHZWB9XWcrz8fqaZbe0= +github.com/jackc/chunkreader v1.0.0/go.mod h1:RT6O25fNZIuasFJRyZ4R/Y2BbhasbmZXF9QQ7T3kePo= +github.com/jackc/chunkreader/v2 v2.0.0/go.mod h1:odVSm741yZoC3dpHEUXIqA9tQRhFrgOHwnPIn9lDKlk= +github.com/jackc/chunkreader/v2 v2.0.1 h1:i+RDz65UE+mmpjTfyz0MoVTnzeYxroil2G82ki7MGG8= +github.com/jackc/chunkreader/v2 v2.0.1/go.mod h1:odVSm741yZoC3dpHEUXIqA9tQRhFrgOHwnPIn9lDKlk= +github.com/jackc/pgconn v0.0.0-20190420214824-7e0022ef6ba3/go.mod h1:jkELnwuX+w9qN5YIfX0fl88Ehu4XC3keFuOJJk9pcnA= +github.com/jackc/pgconn v0.0.0-20190824142844-760dd75542eb/go.mod h1:lLjNuW/+OfW9/pnVKPazfWOgNfH2aPem8YQ7ilXGvJE= +github.com/jackc/pgconn v0.0.0-20190831204454-2fabfa3c18b7/go.mod h1:ZJKsE/KZfsUgOEh9hBm+xYTstcNHg7UPMVJqRfQxq4s= +github.com/jackc/pgconn v1.5.0 h1:oFSOilzIZkyg787M1fEmyMfOUUvwj0daqYMfaWwNL4o= +github.com/jackc/pgconn v1.5.0/go.mod h1:QeD3lBfpTFe8WUnPZWN5KY/mB8FGMIYRdd8P8Jr0fAI= +github.com/jackc/pgconn v1.6.0 h1:8FiBxMxS/Z0eQ9BeE1HhL6pzPL1R5x+ZuQ+T86WgZ4I= +github.com/jackc/pgconn v1.6.0/go.mod h1:yeseQo4xhQbgyJs2c87RAXOH2i624N0Fh1KSPJya7qo= +github.com/jackc/pgio v1.0.0 h1:g12B9UwVnzGhueNavwioyEEpAmqMe1E/BN9ES+8ovkE= +github.com/jackc/pgio v1.0.0/go.mod h1:oP+2QK2wFfUWgr+gxjoBH9KGBb31Eio69xUb0w5bYf8= +github.com/jackc/pgmock v0.0.0-20190831213851-13a1b77aafa2 h1:JVX6jT/XfzNqIjye4717ITLaNwV9mWbJx0dLCpcRzdA= +github.com/jackc/pgmock v0.0.0-20190831213851-13a1b77aafa2/go.mod h1:fGZlG77KXmcq05nJLRkk0+p82V8B8Dw8KN2/V9c/OAE= +github.com/jackc/pgpassfile v1.0.0 h1:/6Hmqy13Ss2zCq62VdNG8tM1wchn8zjSGOBJ6icpsIM= +github.com/jackc/pgpassfile v1.0.0/go.mod h1:CEx0iS5ambNFdcRtxPj5JhEz+xB6uRky5eyVu/W2HEg= +github.com/jackc/pgproto3 v1.1.0 h1:FYYE4yRw+AgI8wXIinMlNjBbp/UitDJwfj5LqqewP1A= +github.com/jackc/pgproto3 v1.1.0/go.mod h1:eR5FA3leWg7p9aeAqi37XOTgTIbkABlvcPB3E5rlc78= +github.com/jackc/pgproto3/v2 v2.0.0-alpha1.0.20190420180111-c116219b62db/go.mod h1:bhq50y+xrl9n5mRYyCBFKkpRVTLYJVWeCc+mEAI3yXA= +github.com/jackc/pgproto3/v2 v2.0.0-alpha1.0.20190609003834-432c2951c711/go.mod h1:uH0AWtUmuShn0bcesswc4aBTWGvw0cAxIJp+6OB//Wg= +github.com/jackc/pgproto3/v2 v2.0.0-rc3/go.mod h1:ryONWYqW6dqSg1Lw6vXNMXoBJhpzvWKnT95C46ckYeM= +github.com/jackc/pgproto3/v2 v2.0.0-rc3.0.20190831210041-4c03ce451f29/go.mod h1:ryONWYqW6dqSg1Lw6vXNMXoBJhpzvWKnT95C46ckYeM= +github.com/jackc/pgproto3/v2 v2.0.1 h1:Rdjp4NFjwHnEslx2b66FfCI2S0LhO4itac3hXz6WX9M= +github.com/jackc/pgproto3/v2 v2.0.1/go.mod h1:WfJCnwN3HIg9Ish/j3sgWXnAfK8A9Y0bwXYU5xKaEdA= +github.com/jackc/pgproto3/v2 v2.0.2 h1:q1Hsy66zh4vuNsajBUF2PNqfAMMfxU5mk594lPE9vjY= +github.com/jackc/pgproto3/v2 v2.0.2/go.mod h1:WfJCnwN3HIg9Ish/j3sgWXnAfK8A9Y0bwXYU5xKaEdA= +github.com/jackc/pgservicefile v0.0.0-20200307190119-3430c5407db8 h1:Q3tB+ExeflWUW7AFcAhXqk40s9mnNYLk1nOkKNZ5GnU= +github.com/jackc/pgservicefile v0.0.0-20200307190119-3430c5407db8/go.mod h1:vsD4gTJCa9TptPL8sPkXrLZ+hDuNrZCnj29CQpr4X1E= +github.com/jackc/pgtype v0.0.0-20190421001408-4ed0de4755e0/go.mod h1:hdSHsc1V01CGwFsrv11mJRHWJ6aifDLfdV3aVjFF0zg= +github.com/jackc/pgtype v0.0.0-20190824184912-ab885b375b90/go.mod h1:KcahbBH1nCMSo2DXpzsoWOAfFkdEtEJpPbVLq8eE+mc= +github.com/jackc/pgtype v0.0.0-20190828014616-a8802b16cc59 h1:xOamcCJ9MFJTxR5bvw3ZXmiP8evQMohdt2VJ57C0W8Q= +github.com/jackc/pgtype v0.0.0-20190828014616-a8802b16cc59/go.mod h1:MWlu30kVJrUS8lot6TQqcg7mtthZ9T0EoIBFiJcmcyw= +github.com/jackc/pgtype v1.3.0 h1:l8JvKrby3RI7Kg3bYEeU9TA4vqC38QDpFCfcrC7KuN0= +github.com/jackc/pgtype v1.3.0/go.mod h1:b0JqxHvPmljG+HQ5IsvQ0yqeSi4nGcDTVjFoiLDb0Ik= +github.com/jackc/pgx v3.6.2+incompatible h1:2zP5OD7kiyR3xzRYMhOcXVvkDZsImVXfj+yIyTQf3/o= +github.com/jackc/pgx v3.6.2+incompatible/go.mod h1:0ZGrqGqkRlliWnWB4zKnWtjbSWbGkVEFm4TeybAXq+I= +github.com/jackc/pgx/v4 v4.0.0-20190420224344-cc3461e65d96/go.mod h1:mdxmSJJuR08CZQyj1PVQBHy9XOp5p8/SHH6a0psbY9Y= +github.com/jackc/pgx/v4 v4.0.0-20190421002000-1b8f0016e912/go.mod h1:no/Y67Jkk/9WuGR0JG/JseM9irFbnEPbuWV2EELPNuM= +github.com/jackc/pgx/v4 v4.0.0-pre1.0.20190824185557-6972a5742186 h1:ZQM8qLT/E/CGD6XX0E6q9FAwxJYmWpJufzmLMaFuzgQ= +github.com/jackc/pgx/v4 v4.0.0-pre1.0.20190824185557-6972a5742186/go.mod h1:X+GQnOEnf1dqHGpw7JmHqHc1NxDoalibchSk9/RWuDc= +github.com/jackc/pgx/v4 v4.6.0 h1:Fh0O9GdlG4gYpjpwOqjdEodJUQM9jzN3Hdv7PN0xmm0= +github.com/jackc/pgx/v4 v4.6.0/go.mod h1:vPh43ZzxijXUVJ+t/EmXBtFmbFVO72cuneCT9oAlxAg= +github.com/jackc/puddle v0.0.0-20190413234325-e4ced69a3a2b/go.mod h1:m4B5Dj62Y0fbyuIc15OsIqK0+JU8nkqQjsgx7dvjSWk= +github.com/jackc/puddle v0.0.0-20190608224051-11cab39313c9/go.mod h1:m4B5Dj62Y0fbyuIc15OsIqK0+JU8nkqQjsgx7dvjSWk= +github.com/jackc/puddle v1.1.0/go.mod h1:m4B5Dj62Y0fbyuIc15OsIqK0+JU8nkqQjsgx7dvjSWk= +github.com/jmoiron/sqlx v1.2.0 h1:41Ip0zITnmWNR/vHV+S4m+VoUivnWY5E4OJfLZjCJMA= +github.com/jmoiron/sqlx v1.2.0/go.mod h1:1FEQNm3xlJgrMD+FBdI9+xvCksHtbpVBBw5dYhBSsks= +github.com/joho/godotenv v1.3.0 h1:Zjp+RcGpHhGlrMbJzXTrZZPrWj+1vfm90La1wgB6Bhc= +github.com/joho/godotenv v1.3.0/go.mod h1:7hK45KPybAkOC6peb+G5yklZfMxEjkZhHbwpqxOKXbg= github.com/kballard/go-shellquote v0.0.0-20180428030007-95032a82bc51 h1:Z9n2FFNUXsshfwJMBgNA0RU6/i7WVaAegv3PtuIHPMs= github.com/kballard/go-shellquote v0.0.0-20180428030007-95032a82bc51/go.mod h1:CzGEWj7cYgsdH8dAjBGEr58BoE7ScuLd+fwFZ44+/x8= +github.com/konsorten/go-windows-terminal-sequences v1.0.1/go.mod h1:T0+1ngSBFLxvqU3pZ+m/2kptfBszLMUkC4ZK/EgS/cQ= +github.com/konsorten/go-windows-terminal-sequences v1.0.2 h1:DB17ag19krx9CFsz4o3enTrPXyIXCl+2iCXH/aMAp9s= +github.com/konsorten/go-windows-terminal-sequences v1.0.2/go.mod h1:T0+1ngSBFLxvqU3pZ+m/2kptfBszLMUkC4ZK/EgS/cQ= github.com/kr/pretty v0.1.0 h1:L/CwN0zerZDmRFUapSPitk6f+Q3+0za1rQkzVuMiMFI= github.com/kr/pretty v0.1.0/go.mod h1:dAy3ld7l9f0ibDNOQOHHMYYIIbhfbHSm3C4ZsoJORNo= github.com/kr/pretty v0.2.0 h1:s5hAObm+yFO5uHYt5dYjxi2rXrsnmRpJx4OYvIWUaQs= github.com/kr/pretty v0.2.0/go.mod h1:ipq/a2n7PKx3OHsz4KJII5eveXtPO4qwEXGdVfWzfnI= github.com/kr/pty v1.1.1/go.mod h1:pFQYn66WHrOpPYNljwOMqo10TkYh1fy3cYio2l3bCsQ= +github.com/kr/pty v1.1.8/go.mod h1:O1sed60cT9XZ5uDucP5qwvh+TE3NnUj51EiZO/lmSfw= github.com/kr/text v0.1.0 h1:45sCR5RtlFHMR4UwH9sdQ5TC8v0qDQCHnXt+kaKSTVE= github.com/kr/text v0.1.0/go.mod h1:4Jbv+DJW3UT/LiOwJeYQe1efqtUx/iVham/4vfdArNI= +github.com/lib/pq v1.0.0/go.mod h1:5WUZQaWbwv1U+lTReE5YruASi9Al49XbQIvNi/34Woo= +github.com/lib/pq v1.1.0/go.mod h1:5WUZQaWbwv1U+lTReE5YruASi9Al49XbQIvNi/34Woo= +github.com/lib/pq v1.2.0/go.mod h1:5WUZQaWbwv1U+lTReE5YruASi9Al49XbQIvNi/34Woo= +github.com/lib/pq v1.3.0 h1:/qkRGz8zljWiDcFvgpwUpwIAPu3r07TDvs3Rws+o/pU= +github.com/lib/pq v1.3.0/go.mod h1:5WUZQaWbwv1U+lTReE5YruASi9Al49XbQIvNi/34Woo= +github.com/magiconair/properties v1.8.0/go.mod h1:PppfXfuXeibc/6YijjN8zIbojt8czPbwD3XqdrwzmxQ= +github.com/markbates/oncer v1.0.0/go.mod h1:Z59JA581E9GP6w96jai+TGqafHPW+cPfRxz2aSZ0mcI= +github.com/markbates/safe v1.0.1/go.mod h1:nAqgmRi7cY2nqMc92/bSEeQA+R4OheNU2T1kNSCBdG0= +github.com/mattn/go-colorable v0.1.1/go.mod h1:FuOcm+DKB9mbwrcAfNl7/TZVBZ6rcnceauSikq3lYCQ= +github.com/mattn/go-colorable v0.1.2/go.mod h1:U0ppj6V5qS13XJ6of8GYAs25YV2eR4EVcfRqFIhoBtE= +github.com/mattn/go-colorable v0.1.4 h1:snbPLB8fVfU9iwbbo30TPtbLRzwWu6aJS6Xh4eaaviA= +github.com/mattn/go-colorable v0.1.4/go.mod h1:U0ppj6V5qS13XJ6of8GYAs25YV2eR4EVcfRqFIhoBtE= +github.com/mattn/go-isatty v0.0.5/go.mod h1:Iq45c/XA43vh69/j3iqttzPXn0bhXyGjM0Hdxcsrc5s= +github.com/mattn/go-isatty v0.0.7/go.mod h1:Iq45c/XA43vh69/j3iqttzPXn0bhXyGjM0Hdxcsrc5s= +github.com/mattn/go-isatty v0.0.8/go.mod h1:Iq45c/XA43vh69/j3iqttzPXn0bhXyGjM0Hdxcsrc5s= +github.com/mattn/go-isatty v0.0.9/go.mod h1:YNRxwqDuOph6SZLI9vUUz6OYw3QyUt7WiY2yME+cCiQ= +github.com/mattn/go-isatty v0.0.11 h1:FxPOTFNqGkuDUGi3H/qkUbQO4ZiBa2brKq5r0l8TGeM= +github.com/mattn/go-isatty v0.0.11/go.mod h1:PhnuNfih5lzO57/f3n+odYbM4JtupLOxQOAqxQCu2WE= +github.com/mattn/go-sqlite3 v1.9.0/go.mod h1:FPy6KqzDD04eiIsT53CuJW3U88zkxoIYsOqkbpncsNc= +github.com/mattn/go-sqlite3 v2.0.3+incompatible h1:gXHsfypPkaMZrKbD5209QV9jbUTJKjyR5WD3HYQSd+U= +github.com/mattn/go-sqlite3 v2.0.3+incompatible/go.mod h1:FPy6KqzDD04eiIsT53CuJW3U88zkxoIYsOqkbpncsNc= github.com/microcosm-cc/bluemonday v1.0.2 h1:5lPfLTTAvAbtS0VqT+94yOtFnGfUWYyx0+iToC3Os3s= github.com/microcosm-cc/bluemonday v1.0.2/go.mod h1:iVP4YcDBq+n/5fb23BhYFvIMq/leAFZyRl6bYmGDlGc= +github.com/mitchellh/go-homedir v1.1.0/go.mod h1:SfyaCUpYCn1Vlf4IUYiD9fPX4A5wJrkLzIz1N1q0pr0= +github.com/mitchellh/mapstructure v1.1.2/go.mod h1:FVVH3fgwuzCH5S8UJGiWEs2h04kUh9fWfEaFds41c1Y= +github.com/pelletier/go-toml v1.2.0/go.mod h1:5z9KED0ma1S8pY6P1sdut58dfprrGBbd/94hg7ilaic= +github.com/pkg/errors v0.8.1/go.mod h1:bwawxfHBFNV+L2hUp1rHADufV3IMtnDRdf1r5NINEl0= +github.com/pkg/errors v0.9.1 h1:FEBLx1zS214owpjy7qsBeixbURkuhQAwrK5UwLGTwt4= +github.com/pkg/errors v0.9.1/go.mod h1:bwawxfHBFNV+L2hUp1rHADufV3IMtnDRdf1r5NINEl0= github.com/pmezard/go-difflib v1.0.0 h1:4DBwDE0NGyQoBHbLQYPwSUPoCMWR5BEzIk/f1lZbAQM= github.com/pmezard/go-difflib v1.0.0/go.mod h1:iKH77koFhYxTK1pcRnkKkqfTogsbg7gZNVY4sRDYZ/4= +github.com/rogpeppe/go-internal v1.1.0/go.mod h1:M8bDsm7K2OlrFYOpmOWEs/qY81heoFRclV5y23lUDJ4= +github.com/rogpeppe/go-internal v1.3.0/go.mod h1:M8bDsm7K2OlrFYOpmOWEs/qY81heoFRclV5y23lUDJ4= +github.com/rogpeppe/go-internal v1.3.2/go.mod h1:xXDCJY+GAPziupqXw64V24skbSoqbTEfhy4qGm1nDQc= +github.com/rogpeppe/go-internal v1.4.0/go.mod h1:xXDCJY+GAPziupqXw64V24skbSoqbTEfhy4qGm1nDQc= +github.com/rogpeppe/go-internal v1.5.2 h1:qLvObTrvO/XRCqmkKxUlOBc48bI3efyDuAZe25QiF0w= +github.com/rogpeppe/go-internal v1.5.2/go.mod h1:xXDCJY+GAPziupqXw64V24skbSoqbTEfhy4qGm1nDQc= +github.com/rs/xid v1.2.1/go.mod h1:+uKXf+4Djp6Md1KODXJxgGQPKngRmWyn10oCKFzNHOQ= +github.com/rs/zerolog v1.13.0/go.mod h1:YbFCdg8HfsridGWAh22vktObvhZbQsZXe4/zB0OKkWU= +github.com/rs/zerolog v1.15.0/go.mod h1:xYTKnLHcpfU2225ny5qZjxnj9NvkumZYjJHlAThCjNc= +github.com/russross/blackfriday v1.5.2/go.mod h1:JO/DiYxRf+HjHt06OyowR9PTA263kcR/rfWxYHBV53g= +github.com/satori/go.uuid v1.2.0/go.mod h1:dA0hQrYB0VpLJoorglMZABFdXlWrHn1NEOzdhQKdks0= github.com/sergi/go-diff v1.0.0 h1:Kpca3qRNrduNnOQeazBd0ysaKrUJiIuISHxogkT9RPQ= github.com/sergi/go-diff v1.0.0/go.mod h1:0CfEIISq7TuYL3j771MWULgwwjU+GofnZX9QAmXWZgo= +github.com/sergi/go-diff v1.1.0 h1:we8PVUC3FE2uYfodKH/nBHMSetSfHDR6scGdBi+erh0= +github.com/sergi/go-diff v1.1.0/go.mod h1:STckp+ISIX8hZLjrqAeVduY0gWCT9IjLuqbuNXdaHfM= +github.com/shopspring/decimal v0.0.0-20180709203117-cd690d0c9e24 h1:pntxY8Ary0t43dCZ5dqY4YTJCObLY1kIXl0uzMv+7DE= +github.com/shopspring/decimal v0.0.0-20180709203117-cd690d0c9e24/go.mod h1:M+9NzErvs504Cn4c5DxATwIqPbtswREoFCre64PpcG4= +github.com/sirupsen/logrus v1.4.1/go.mod h1:ni0Sbl8bgC9z8RoU9G6nDWqqs/fq4eDPysMBDgk/93Q= +github.com/sirupsen/logrus v1.4.2 h1:SPIRibHv4MatM3XXNO2BJeFLZwZ2LvZgfQ5+UNI2im4= +github.com/sirupsen/logrus v1.4.2/go.mod h1:tLMulIdttU9McNUspp0xgXVQah82FyeX6MwdIuYE2rE= github.com/sourcegraph/annotate v0.0.0-20160123013949-f4cad6c6324d h1:yKm7XZV6j9Ev6lojP2XaIshpT4ymkqhMeSghO5Ps00E= github.com/sourcegraph/annotate v0.0.0-20160123013949-f4cad6c6324d/go.mod h1:UdhH50NIW0fCiwBSr0co2m7BnFLdv4fQTgdqdJTHFeE= github.com/sourcegraph/syntaxhighlight v0.0.0-20170531221838-bd320f5d308e h1:qpG93cPwA5f7s/ZPBJnGOYQNK/vKsaDaseuKT5Asee8= github.com/sourcegraph/syntaxhighlight v0.0.0-20170531221838-bd320f5d308e/go.mod h1:HuIsMU8RRBOtsCgI77wP899iHVBQpCmg4ErYMZB+2IA= +github.com/spf13/afero v1.1.2/go.mod h1:j4pytiNVoe2o6bmDsKpLACNPDBIoEAkihy7loJ1B0CQ= +github.com/spf13/cast v1.3.0/go.mod h1:Qx5cxh0v+4UWYiBimWS+eyWzqEqokIECu5etghLkUJE= +github.com/spf13/cobra v0.0.5/go.mod h1:3K3wKZymM7VvHMDS9+Akkh4K60UwM26emMESw8tLCHU= +github.com/spf13/jwalterweatherman v1.0.0/go.mod h1:cQK4TGJAtQXfYWX+Ddv3mKDzgVb68N+wFjFa4jdeBTo= +github.com/spf13/pflag v1.0.3/go.mod h1:DYY7MBk1bdzusC3SYhjObp+wFpr4gzcvqqNjLnInEg4= +github.com/spf13/viper v1.3.2/go.mod h1:ZiWeW+zYFKm7srdB9IoDzzZXaJaI5eL9QjNiN/DMA2s= github.com/stretchr/objx v0.1.0/go.mod h1:HFkY916IF+rwdDfMAkV7OtwuqBVzrE8GR6GFx+wExME= +github.com/stretchr/objx v0.1.1/go.mod h1:HFkY916IF+rwdDfMAkV7OtwuqBVzrE8GR6GFx+wExME= +github.com/stretchr/objx v0.2.0/go.mod h1:qt09Ya8vawLte6SNmTgCsAVtYtaKzEcn8ATUoHMkEqE= +github.com/stretchr/testify v1.2.2/go.mod h1:a8OnRcib4nhh0OaRAV+Yts87kKdq0PP7pXfy6kDkUVs= github.com/stretchr/testify v1.3.0/go.mod h1:M5WIy9Dh21IEIfnGCwXGc5bZfKNJtfHm1UVUgZn+9EI= github.com/stretchr/testify v1.4.0 h1:2E4SXV/wtOkTonXsotYi4li6zVWxYlZuYNCXe9XRJyk= github.com/stretchr/testify v1.4.0/go.mod h1:j7eGeouHqKxXV5pUuKE4zz7dFj8WfuZ+81PSLYec5m4= +github.com/stretchr/testify v1.5.1 h1:nOGnQDM7FYENwehXlg/kFVnos3rEvtKTjRvOWSzb6H4= +github.com/stretchr/testify v1.5.1/go.mod h1:5W2xD1RspED5o8YsWQXVCued0rvSQ+mT+I5cxcmMvtA= +github.com/ugorji/go/codec v0.0.0-20181204163529-d75b2dcb6bc8/go.mod h1:VFNgLljTbGfSG7qAOspJ7OScBnGdDN/yBr0sguwnwf0= +github.com/xordataexchange/crypt v0.0.3-0.20170626215501-b2862e3d0a77/go.mod h1:aYKd//L2LvnjZzWKhF00oedf4jCCReLcmhLdhm1A27Q= +github.com/zenazn/goji v0.9.0/go.mod h1:7S9M489iMyHBNxwZnk9/EHS098H4/F6TATF2mIxtB1Q= +go.uber.org/atomic v1.3.2/go.mod h1:gD2HeocX3+yG+ygLZcrzQJaqmWj9AIm7n08wl/qW/PE= +go.uber.org/atomic v1.4.0/go.mod h1:gD2HeocX3+yG+ygLZcrzQJaqmWj9AIm7n08wl/qW/PE= +go.uber.org/multierr v1.1.0/go.mod h1:wR5kodmAFQ0UK8QlbwjlSNy0Z68gJhDJUG5sjR94q/0= +go.uber.org/zap v1.9.1/go.mod h1:vwi/ZaCAaUcBkycHslxD9B2zi4UTXhF60s6SWpuDF0Q= +go.uber.org/zap v1.10.0/go.mod h1:vwi/ZaCAaUcBkycHslxD9B2zi4UTXhF60s6SWpuDF0Q= +golang.org/x/crypto v0.0.0-20181203042331-505ab145d0a9/go.mod h1:6SG95UA2DQfeDnfUPMdvaQW0Q7yPrPDi9nlGo2tz2b4= golang.org/x/crypto v0.0.0-20190308221718-c2843e01d9a2/go.mod h1:djNgcEr1/C05ACkg1iLfiJU5Ep61QUkGW8qpdssI0+w= +golang.org/x/crypto v0.0.0-20190411191339-88737f569e3a/go.mod h1:WFFai1msRO1wXaEeE5yQxYXgSfI8pQAWXbQop6sCtWE= +golang.org/x/crypto v0.0.0-20190621222207-cc06ce4a13d4/go.mod h1:yigFU9vqHzYiE8UmvKecakEJjdnWj3jj499lnFckfCI= +golang.org/x/crypto v0.0.0-20190820162420-60c769a6c586/go.mod h1:yigFU9vqHzYiE8UmvKecakEJjdnWj3jj499lnFckfCI= +golang.org/x/crypto v0.0.0-20191011191535-87dc89f01550/go.mod h1:yigFU9vqHzYiE8UmvKecakEJjdnWj3jj499lnFckfCI= +golang.org/x/crypto v0.0.0-20191122220453-ac88ee75c92c h1:/nJuwDLoL/zrqY6gf57vxC+Pi+pZ8bfhpPkicO5H7W4= +golang.org/x/crypto v0.0.0-20191122220453-ac88ee75c92c/go.mod h1:LzIPMQfyMNhhGPhUkYOs5KpL4U8rLKemX1yGLhDgUto= +golang.org/x/crypto v0.0.0-20200323165209-0ec3e9974c59 h1:3zb4D3T4G8jdExgVU/95+vQXfpEPiMdCaZgmGVxjNHM= +golang.org/x/crypto v0.0.0-20200323165209-0ec3e9974c59/go.mod h1:LzIPMQfyMNhhGPhUkYOs5KpL4U8rLKemX1yGLhDgUto= +golang.org/x/crypto v0.0.0-20200604202706-70a84ac30bf9 h1:vEg9joUBmeBcK9iSJftGNf3coIG4HqZElCPehJsfAYM= +golang.org/x/crypto v0.0.0-20200604202706-70a84ac30bf9/go.mod h1:LzIPMQfyMNhhGPhUkYOs5KpL4U8rLKemX1yGLhDgUto= +golang.org/x/mod v0.1.1-0.20191105210325-c90efee705ee/go.mod h1:QqPTAvyqsEbceGzBzNggFXnrqF1CaUcvgkdR5Ot7KZg= golang.org/x/net v0.0.0-20181220203305-927f97764cc3/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4= +golang.org/x/net v0.0.0-20190311183353-d8887717615a/go.mod h1:t9HGtf8HONx5eT2rtn7q6eTqICYqUVnKs3thJo3Qplg= +golang.org/x/net v0.0.0-20190404232315-eb5bcb51f2a3/go.mod h1:t9HGtf8HONx5eT2rtn7q6eTqICYqUVnKs3thJo3Qplg= golang.org/x/net v0.0.0-20190613194153-d28f0bde5980 h1:dfGZHvZk057jK2MCeWus/TowKpJ8y4AmooUzdBSR9GU= golang.org/x/net v0.0.0-20190613194153-d28f0bde5980/go.mod h1:z5CRVTTTmAJ677TzLLGU+0bjPO0LkuOLi4/5GtJWs/s= +golang.org/x/net v0.0.0-20190620200207-3b0461eec859/go.mod h1:z5CRVTTTmAJ677TzLLGU+0bjPO0LkuOLi4/5GtJWs/s= golang.org/x/net v0.0.0-20190813141303-74dc4d7220e7 h1:fHDIZ2oxGnUZRN6WgWFCbYBjH9uqVPRCUVUDhs0wnbA= golang.org/x/net v0.0.0-20190813141303-74dc4d7220e7/go.mod h1:z5CRVTTTmAJ677TzLLGU+0bjPO0LkuOLi4/5GtJWs/s= +golang.org/x/net v0.0.0-20200202094626-16171245cfb2/go.mod h1:z5CRVTTTmAJ677TzLLGU+0bjPO0LkuOLi4/5GtJWs/s= +golang.org/x/net v0.0.0-20200219183655-46282727080f h1:dB42wwhNuwPvh8f+5zZWNcU+F2Xs/B9wXXwvUCOH7r8= +golang.org/x/net v0.0.0-20200219183655-46282727080f/go.mod h1:z5CRVTTTmAJ677TzLLGU+0bjPO0LkuOLi4/5GtJWs/s= +golang.org/x/sync v0.0.0-20190423024810-112230192c58/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= golang.org/x/sync v0.0.0-20190911185100-cd5d95a43a6e h1:vcxGaoTs7kV8m5Np9uUNQin4BrLOthgV7252N8V+FwY= golang.org/x/sync v0.0.0-20190911185100-cd5d95a43a6e/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= +golang.org/x/sys v0.0.0-20180905080454-ebe1bf3edb33/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY= +golang.org/x/sys v0.0.0-20181205085412-a5c9d58dba9a/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY= golang.org/x/sys v0.0.0-20190215142949-d0b11bdaac8a/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY= +golang.org/x/sys v0.0.0-20190222072716-a9d3bda3a223/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY= +golang.org/x/sys v0.0.0-20190403152447-81d4e9dc473e/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= +golang.org/x/sys v0.0.0-20190412213103-97732733099d/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= +golang.org/x/sys v0.0.0-20190422165155-953cdadca894/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= +golang.org/x/sys v0.0.0-20190515120540-06a5c4944438/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= +golang.org/x/sys v0.0.0-20190813064441-fde4db37ae7a/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= +golang.org/x/sys v0.0.0-20190826190057-c7b8b68b1456/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= +golang.org/x/sys v0.0.0-20191026070338-33540a1f6037 h1:YyJpGZS1sBuBCzLAR1VEpK193GlqGZbnPFnPV/5Rsb4= +golang.org/x/sys v0.0.0-20191026070338-33540a1f6037/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/text v0.3.0/go.mod h1:NqM8EUOU14njkJ3fqMW+pc6Ldnwhi/IjpwHt7yyuwOQ= +golang.org/x/text v0.3.2 h1:tW2bmiBqwgJj/UpqtC8EpXEZVYOwU0yG4iWbprSVAcs= +golang.org/x/text v0.3.2/go.mod h1:bEr9sfX3Q8Zfm5fL9x+3itogRgK3+ptLWKqgva+5dAk= +golang.org/x/text v0.3.3 h1:cokOdA+Jmi5PJGXLlLllQSgYigAEfHXJAERHVMaCc2k= +golang.org/x/text v0.3.3/go.mod h1:5Zoc/QRtKVWzQhOtBMvqHzDpF6irO9z98xDceosuGiQ= +golang.org/x/tools v0.0.0-20180917221912-90fa682c2a6e/go.mod h1:n7NCudcB/nEzxVGmLbDWY5pfWTLqBcC2KZ6jyYvM4mQ= +golang.org/x/tools v0.0.0-20190425163242-31fd60d6bfdc/go.mod h1:RgjU9mgBXZiqYHBnxXauZ1Gv1EHHAz9KjViQ78xBX0Q= +golang.org/x/tools v0.0.0-20190823170909-c4a336ef6a2f/go.mod h1:b+2E5dAYhXwXZwtnZ6UAqBI28+e2cm9otk0dWdXHAEo= +golang.org/x/tools v0.0.0-20191004055002-72853e10c5a3/go.mod h1:b+2E5dAYhXwXZwtnZ6UAqBI28+e2cm9otk0dWdXHAEo= +golang.org/x/tools v0.0.0-20200117220505-0cba7a3a9ee9/go.mod h1:TB2adYChydJhpapKDTa4BR/hXlZSLoq2Wpct/0txZ28= +golang.org/x/xerrors v0.0.0-20190410155217-1f06c39b4373/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0= +golang.org/x/xerrors v0.0.0-20190513163551-3ee3066db522/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0= +golang.org/x/xerrors v0.0.0-20190717185122-a985d3407aa7/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0= +golang.org/x/xerrors v0.0.0-20191011141410-1b5146add898 h1:/atklqdjdhuosWIl6AIbOeHJjicWYPqR9bpxqxYG2pA= +golang.org/x/xerrors v0.0.0-20191011141410-1b5146add898/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0= +golang.org/x/xerrors v0.0.0-20191204190536-9bdfabe68543 h1:E7g+9GITq07hpfrRu66IVDexMakfv52eLZ2CXBWiKr4= +golang.org/x/xerrors v0.0.0-20191204190536-9bdfabe68543/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0= gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0= gopkg.in/check.v1 v1.0.0-20180628173108-788fd7840127 h1:qIbj1fsPNlZgppZ+VLlY7N33q108Sa+fhmuc+sWQYwY= gopkg.in/check.v1 v1.0.0-20180628173108-788fd7840127/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0= gopkg.in/check.v1 v1.0.0-20190902080502-41f04d3bba15 h1:YR8cESwS4TdDjEe65xsg0ogRM/Nc3DYOhEAlW+xobZo= gopkg.in/check.v1 v1.0.0-20190902080502-41f04d3bba15/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0= +gopkg.in/errgo.v2 v2.1.0/go.mod h1:hNsd1EY+bozCKY1Ytp96fpM3vjJbqLJn88ws8XvfDNI= +gopkg.in/inconshreveable/log15.v2 v2.0.0-20180818164646-67afb5ed74ec/go.mod h1:aPpfJ7XW+gOuirDoZ8gHhLh3kZ1B08FtV2bbmy7Jv3s= gopkg.in/yaml.v2 v2.2.2 h1:ZCJp+EgiOT7lHqUV2J862kp8Qj64Jo6az82+3Td9dZw= gopkg.in/yaml.v2 v2.2.2/go.mod h1:hI93XBmqTisBFMUTm0b8Fm+jr3Dg1NNxqwp+5A1VGuI= gopkg.in/yaml.v2 v2.2.4/go.mod h1:hI93XBmqTisBFMUTm0b8Fm+jr3Dg1NNxqwp+5A1VGuI= diff --git a/internal/e2e/cockroach_test.go b/internal/e2e/cockroach_test.go new file mode 100644 index 00000000..dc21b932 --- /dev/null +++ b/internal/e2e/cockroach_test.go @@ -0,0 +1,20 @@ +package e2e_test + +import ( + "github.com/gobuffalo/pop/v5" + "github.com/stretchr/testify/suite" +) + +type CockroachSuite struct { + suite.Suite +} + +func (s *CockroachSuite) Test_Cockroach_MigrationSteps() { + r := s.Require() + + c, err := pop.Connect("cockroach") + r.NoError(err) + r.NoError(retryOpen(c)) + + run(&s.Suite, c, runTestData(&s.Suite, c, true)) +} diff --git a/internal/e2e/fixtures/cockroach/down/0.sql b/internal/e2e/fixtures/cockroach/down/0.sql new file mode 100644 index 00000000..4e370dec --- /dev/null +++ b/internal/e2e/fixtures/cockroach/down/0.sql @@ -0,0 +1,5 @@ +CREATE TABLE schema_migration ( + version VARCHAR(14) NOT NULL, + UNIQUE INDEX schema_migration_version_idx (version ASC), + FAMILY "primary" (version, rowid) +); diff --git a/internal/e2e/fixtures/cockroach/down/1.sql b/internal/e2e/fixtures/cockroach/down/1.sql new file mode 100644 index 00000000..34399249 --- /dev/null +++ b/internal/e2e/fixtures/cockroach/down/1.sql @@ -0,0 +1,13 @@ +CREATE TABLE e2e_users ( + id UUID NOT NULL, + created_at TIMESTAMP NOT NULL, + updated_at TIMESTAMP NOT NULL, + CONSTRAINT "primary" PRIMARY KEY (id ASC), + FAMILY "primary" (id, created_at, updated_at) +); + +CREATE TABLE schema_migration ( + version VARCHAR(14) NOT NULL, + UNIQUE INDEX schema_migration_version_idx (version ASC), + FAMILY "primary" (version, rowid) +); diff --git a/internal/e2e/fixtures/cockroach/down/2.sql b/internal/e2e/fixtures/cockroach/down/2.sql new file mode 100644 index 00000000..2650d570 --- /dev/null +++ b/internal/e2e/fixtures/cockroach/down/2.sql @@ -0,0 +1,30 @@ +CREATE TABLE e2e_users ( + id UUID NOT NULL, + created_at TIMESTAMP NOT NULL, + updated_at TIMESTAMP NOT NULL, + CONSTRAINT "primary" PRIMARY KEY (id ASC), + FAMILY "primary" (id, created_at, updated_at) +); + +CREATE TABLE e2e_user_notes ( + id UUID NOT NULL, + notes VARCHAR(255) NULL, + user_id UUID NOT NULL, + title VARCHAR(64) NOT NULL DEFAULT '':::STRING, + CONSTRAINT "primary" PRIMARY KEY (id ASC), + INDEX e2e_user_notes_auto_index_e2e_user_notes_e2e_users_id_fk (user_id ASC), + INDEX e2e_user_notes_user_id_idx (user_id ASC), + INDEX e2e_user_notes_title_idx (title ASC), + FAMILY "primary" (id, notes, user_id, title) +); + +CREATE TABLE schema_migration ( + version VARCHAR(14) NOT NULL, + UNIQUE INDEX schema_migration_version_idx (version ASC), + FAMILY "primary" (version, rowid) +); + +ALTER TABLE e2e_user_notes ADD CONSTRAINT e2e_user_notes_e2e_users_id_fk FOREIGN KEY (user_id) REFERENCES e2e_users (id) ON DELETE CASCADE; + +-- Validate foreign key constraints. These can fail if there was unvalidated data during the dump. +ALTER TABLE e2e_user_notes VALIDATE CONSTRAINT e2e_user_notes_e2e_users_id_fk; diff --git a/internal/e2e/fixtures/cockroach/down/3.sql b/internal/e2e/fixtures/cockroach/down/3.sql new file mode 100644 index 00000000..f1acc221 --- /dev/null +++ b/internal/e2e/fixtures/cockroach/down/3.sql @@ -0,0 +1,28 @@ +CREATE TABLE e2e_users ( + id UUID NOT NULL, + created_at TIMESTAMP NOT NULL, + updated_at TIMESTAMP NOT NULL, + CONSTRAINT "primary" PRIMARY KEY (id ASC), + FAMILY "primary" (id, created_at, updated_at) +); + +CREATE TABLE e2e_user_notes ( + id UUID NOT NULL, + notes VARCHAR(255) NULL, + user_id UUID NOT NULL, + CONSTRAINT "primary" PRIMARY KEY (id ASC), + INDEX e2e_user_notes_auto_index_e2e_user_notes_e2e_users_id_fk (user_id ASC), + INDEX e2e_user_notes_user_id_idx (user_id ASC), + FAMILY "primary" (id, notes, user_id) +); + +CREATE TABLE schema_migration ( + version VARCHAR(14) NOT NULL, + UNIQUE INDEX schema_migration_version_idx (version ASC), + FAMILY "primary" (version, rowid) +); + +ALTER TABLE e2e_user_notes ADD CONSTRAINT e2e_user_notes_e2e_users_id_fk FOREIGN KEY (user_id) REFERENCES e2e_users (id) ON DELETE CASCADE; + +-- Validate foreign key constraints. These can fail if there was unvalidated data during the dump. +ALTER TABLE e2e_user_notes VALIDATE CONSTRAINT e2e_user_notes_e2e_users_id_fk; diff --git a/internal/e2e/fixtures/cockroach/down/4.sql b/internal/e2e/fixtures/cockroach/down/4.sql new file mode 100644 index 00000000..cbee1d77 --- /dev/null +++ b/internal/e2e/fixtures/cockroach/down/4.sql @@ -0,0 +1,30 @@ +CREATE TABLE e2e_users ( + id UUID NOT NULL, + created_at TIMESTAMP NOT NULL, + updated_at TIMESTAMP NOT NULL, + CONSTRAINT "primary" PRIMARY KEY (id ASC), + FAMILY "primary" (id, created_at, updated_at) +); + +CREATE TABLE e2e_user_notes ( + id UUID NOT NULL, + notes VARCHAR(255) NULL, + user_id UUID NOT NULL, + slug VARCHAR(64) NOT NULL, + CONSTRAINT "primary" PRIMARY KEY (id ASC), + INDEX e2e_user_notes_auto_index_e2e_user_notes_e2e_users_id_fk (user_id ASC), + INDEX e2e_user_notes_user_id_idx (user_id ASC), + UNIQUE INDEX e2e_user_notes_slug_idx (slug ASC), + FAMILY "primary" (id, notes, user_id, slug) +); + +CREATE TABLE schema_migration ( + version VARCHAR(14) NOT NULL, + UNIQUE INDEX schema_migration_version_idx (version ASC), + FAMILY "primary" (version, rowid) +); + +ALTER TABLE e2e_user_notes ADD CONSTRAINT e2e_user_notes_e2e_users_id_fk FOREIGN KEY (user_id) REFERENCES e2e_users (id) ON DELETE CASCADE; + +-- Validate foreign key constraints. These can fail if there was unvalidated data during the dump. +ALTER TABLE e2e_user_notes VALIDATE CONSTRAINT e2e_user_notes_e2e_users_id_fk; diff --git a/internal/e2e/fixtures/cockroach/down/5.sql b/internal/e2e/fixtures/cockroach/down/5.sql new file mode 100644 index 00000000..cbee1d77 --- /dev/null +++ b/internal/e2e/fixtures/cockroach/down/5.sql @@ -0,0 +1,30 @@ +CREATE TABLE e2e_users ( + id UUID NOT NULL, + created_at TIMESTAMP NOT NULL, + updated_at TIMESTAMP NOT NULL, + CONSTRAINT "primary" PRIMARY KEY (id ASC), + FAMILY "primary" (id, created_at, updated_at) +); + +CREATE TABLE e2e_user_notes ( + id UUID NOT NULL, + notes VARCHAR(255) NULL, + user_id UUID NOT NULL, + slug VARCHAR(64) NOT NULL, + CONSTRAINT "primary" PRIMARY KEY (id ASC), + INDEX e2e_user_notes_auto_index_e2e_user_notes_e2e_users_id_fk (user_id ASC), + INDEX e2e_user_notes_user_id_idx (user_id ASC), + UNIQUE INDEX e2e_user_notes_slug_idx (slug ASC), + FAMILY "primary" (id, notes, user_id, slug) +); + +CREATE TABLE schema_migration ( + version VARCHAR(14) NOT NULL, + UNIQUE INDEX schema_migration_version_idx (version ASC), + FAMILY "primary" (version, rowid) +); + +ALTER TABLE e2e_user_notes ADD CONSTRAINT e2e_user_notes_e2e_users_id_fk FOREIGN KEY (user_id) REFERENCES e2e_users (id) ON DELETE CASCADE; + +-- Validate foreign key constraints. These can fail if there was unvalidated data during the dump. +ALTER TABLE e2e_user_notes VALIDATE CONSTRAINT e2e_user_notes_e2e_users_id_fk; diff --git a/internal/e2e/fixtures/cockroach/down/6.sql b/internal/e2e/fixtures/cockroach/down/6.sql new file mode 100644 index 00000000..cbee1d77 --- /dev/null +++ b/internal/e2e/fixtures/cockroach/down/6.sql @@ -0,0 +1,30 @@ +CREATE TABLE e2e_users ( + id UUID NOT NULL, + created_at TIMESTAMP NOT NULL, + updated_at TIMESTAMP NOT NULL, + CONSTRAINT "primary" PRIMARY KEY (id ASC), + FAMILY "primary" (id, created_at, updated_at) +); + +CREATE TABLE e2e_user_notes ( + id UUID NOT NULL, + notes VARCHAR(255) NULL, + user_id UUID NOT NULL, + slug VARCHAR(64) NOT NULL, + CONSTRAINT "primary" PRIMARY KEY (id ASC), + INDEX e2e_user_notes_auto_index_e2e_user_notes_e2e_users_id_fk (user_id ASC), + INDEX e2e_user_notes_user_id_idx (user_id ASC), + UNIQUE INDEX e2e_user_notes_slug_idx (slug ASC), + FAMILY "primary" (id, notes, user_id, slug) +); + +CREATE TABLE schema_migration ( + version VARCHAR(14) NOT NULL, + UNIQUE INDEX schema_migration_version_idx (version ASC), + FAMILY "primary" (version, rowid) +); + +ALTER TABLE e2e_user_notes ADD CONSTRAINT e2e_user_notes_e2e_users_id_fk FOREIGN KEY (user_id) REFERENCES e2e_users (id) ON DELETE CASCADE; + +-- Validate foreign key constraints. These can fail if there was unvalidated data during the dump. +ALTER TABLE e2e_user_notes VALIDATE CONSTRAINT e2e_user_notes_e2e_users_id_fk; diff --git a/internal/e2e/fixtures/cockroach/up/0.sql b/internal/e2e/fixtures/cockroach/up/0.sql new file mode 100644 index 00000000..34399249 --- /dev/null +++ b/internal/e2e/fixtures/cockroach/up/0.sql @@ -0,0 +1,13 @@ +CREATE TABLE e2e_users ( + id UUID NOT NULL, + created_at TIMESTAMP NOT NULL, + updated_at TIMESTAMP NOT NULL, + CONSTRAINT "primary" PRIMARY KEY (id ASC), + FAMILY "primary" (id, created_at, updated_at) +); + +CREATE TABLE schema_migration ( + version VARCHAR(14) NOT NULL, + UNIQUE INDEX schema_migration_version_idx (version ASC), + FAMILY "primary" (version, rowid) +); diff --git a/internal/e2e/fixtures/cockroach/up/1.sql b/internal/e2e/fixtures/cockroach/up/1.sql new file mode 100644 index 00000000..feb711c1 --- /dev/null +++ b/internal/e2e/fixtures/cockroach/up/1.sql @@ -0,0 +1,30 @@ +CREATE TABLE e2e_users ( + id UUID NOT NULL, + created_at TIMESTAMP NOT NULL, + updated_at TIMESTAMP NOT NULL, + CONSTRAINT "primary" PRIMARY KEY (id ASC), + FAMILY "primary" (id, created_at, updated_at) +); + +CREATE TABLE e2e_user_notes ( + id UUID NOT NULL, + notes VARCHAR(255) NULL, + title VARCHAR(64) NOT NULL DEFAULT '':::STRING, + user_id UUID NOT NULL, + CONSTRAINT "primary" PRIMARY KEY (id ASC), + INDEX e2e_user_notes_auto_index_e2e_user_notes_e2e_users_id_fk (user_id ASC), + INDEX e2e_user_notes_user_id_idx (user_id ASC), + INDEX e2e_user_notes_title_idx (title ASC), + FAMILY "primary" (id, notes, title, user_id) +); + +CREATE TABLE schema_migration ( + version VARCHAR(14) NOT NULL, + UNIQUE INDEX schema_migration_version_idx (version ASC), + FAMILY "primary" (version, rowid) +); + +ALTER TABLE e2e_user_notes ADD CONSTRAINT e2e_user_notes_e2e_users_id_fk FOREIGN KEY (user_id) REFERENCES e2e_users (id) ON DELETE CASCADE; + +-- Validate foreign key constraints. These can fail if there was unvalidated data during the dump. +ALTER TABLE e2e_user_notes VALIDATE CONSTRAINT e2e_user_notes_e2e_users_id_fk; diff --git a/internal/e2e/fixtures/cockroach/up/2.sql b/internal/e2e/fixtures/cockroach/up/2.sql new file mode 100644 index 00000000..f1acc221 --- /dev/null +++ b/internal/e2e/fixtures/cockroach/up/2.sql @@ -0,0 +1,28 @@ +CREATE TABLE e2e_users ( + id UUID NOT NULL, + created_at TIMESTAMP NOT NULL, + updated_at TIMESTAMP NOT NULL, + CONSTRAINT "primary" PRIMARY KEY (id ASC), + FAMILY "primary" (id, created_at, updated_at) +); + +CREATE TABLE e2e_user_notes ( + id UUID NOT NULL, + notes VARCHAR(255) NULL, + user_id UUID NOT NULL, + CONSTRAINT "primary" PRIMARY KEY (id ASC), + INDEX e2e_user_notes_auto_index_e2e_user_notes_e2e_users_id_fk (user_id ASC), + INDEX e2e_user_notes_user_id_idx (user_id ASC), + FAMILY "primary" (id, notes, user_id) +); + +CREATE TABLE schema_migration ( + version VARCHAR(14) NOT NULL, + UNIQUE INDEX schema_migration_version_idx (version ASC), + FAMILY "primary" (version, rowid) +); + +ALTER TABLE e2e_user_notes ADD CONSTRAINT e2e_user_notes_e2e_users_id_fk FOREIGN KEY (user_id) REFERENCES e2e_users (id) ON DELETE CASCADE; + +-- Validate foreign key constraints. These can fail if there was unvalidated data during the dump. +ALTER TABLE e2e_user_notes VALIDATE CONSTRAINT e2e_user_notes_e2e_users_id_fk; diff --git a/internal/e2e/fixtures/cockroach/up/3.sql b/internal/e2e/fixtures/cockroach/up/3.sql new file mode 100644 index 00000000..314f3572 --- /dev/null +++ b/internal/e2e/fixtures/cockroach/up/3.sql @@ -0,0 +1,29 @@ +CREATE TABLE e2e_users ( + id UUID NOT NULL, + created_at TIMESTAMP NOT NULL, + updated_at TIMESTAMP NOT NULL, + CONSTRAINT "primary" PRIMARY KEY (id ASC), + FAMILY "primary" (id, created_at, updated_at) +); + +CREATE TABLE e2e_user_notes ( + id UUID NOT NULL, + notes VARCHAR(255) NULL, + user_id UUID NOT NULL, + slug VARCHAR(64) NULL, + CONSTRAINT "primary" PRIMARY KEY (id ASC), + INDEX e2e_user_notes_auto_index_e2e_user_notes_e2e_users_id_fk (user_id ASC), + INDEX e2e_user_notes_user_id_idx (user_id ASC), + FAMILY "primary" (id, notes, user_id, slug) +); + +CREATE TABLE schema_migration ( + version VARCHAR(14) NOT NULL, + UNIQUE INDEX schema_migration_version_idx (version ASC), + FAMILY "primary" (version, rowid) +); + +ALTER TABLE e2e_user_notes ADD CONSTRAINT e2e_user_notes_e2e_users_id_fk FOREIGN KEY (user_id) REFERENCES e2e_users (id) ON DELETE CASCADE; + +-- Validate foreign key constraints. These can fail if there was unvalidated data during the dump. +ALTER TABLE e2e_user_notes VALIDATE CONSTRAINT e2e_user_notes_e2e_users_id_fk; diff --git a/internal/e2e/fixtures/cockroach/up/4.sql b/internal/e2e/fixtures/cockroach/up/4.sql new file mode 100644 index 00000000..314f3572 --- /dev/null +++ b/internal/e2e/fixtures/cockroach/up/4.sql @@ -0,0 +1,29 @@ +CREATE TABLE e2e_users ( + id UUID NOT NULL, + created_at TIMESTAMP NOT NULL, + updated_at TIMESTAMP NOT NULL, + CONSTRAINT "primary" PRIMARY KEY (id ASC), + FAMILY "primary" (id, created_at, updated_at) +); + +CREATE TABLE e2e_user_notes ( + id UUID NOT NULL, + notes VARCHAR(255) NULL, + user_id UUID NOT NULL, + slug VARCHAR(64) NULL, + CONSTRAINT "primary" PRIMARY KEY (id ASC), + INDEX e2e_user_notes_auto_index_e2e_user_notes_e2e_users_id_fk (user_id ASC), + INDEX e2e_user_notes_user_id_idx (user_id ASC), + FAMILY "primary" (id, notes, user_id, slug) +); + +CREATE TABLE schema_migration ( + version VARCHAR(14) NOT NULL, + UNIQUE INDEX schema_migration_version_idx (version ASC), + FAMILY "primary" (version, rowid) +); + +ALTER TABLE e2e_user_notes ADD CONSTRAINT e2e_user_notes_e2e_users_id_fk FOREIGN KEY (user_id) REFERENCES e2e_users (id) ON DELETE CASCADE; + +-- Validate foreign key constraints. These can fail if there was unvalidated data during the dump. +ALTER TABLE e2e_user_notes VALIDATE CONSTRAINT e2e_user_notes_e2e_users_id_fk; diff --git a/internal/e2e/fixtures/cockroach/up/5.sql b/internal/e2e/fixtures/cockroach/up/5.sql new file mode 100644 index 00000000..cbee1d77 --- /dev/null +++ b/internal/e2e/fixtures/cockroach/up/5.sql @@ -0,0 +1,30 @@ +CREATE TABLE e2e_users ( + id UUID NOT NULL, + created_at TIMESTAMP NOT NULL, + updated_at TIMESTAMP NOT NULL, + CONSTRAINT "primary" PRIMARY KEY (id ASC), + FAMILY "primary" (id, created_at, updated_at) +); + +CREATE TABLE e2e_user_notes ( + id UUID NOT NULL, + notes VARCHAR(255) NULL, + user_id UUID NOT NULL, + slug VARCHAR(64) NOT NULL, + CONSTRAINT "primary" PRIMARY KEY (id ASC), + INDEX e2e_user_notes_auto_index_e2e_user_notes_e2e_users_id_fk (user_id ASC), + INDEX e2e_user_notes_user_id_idx (user_id ASC), + UNIQUE INDEX e2e_user_notes_slug_idx (slug ASC), + FAMILY "primary" (id, notes, user_id, slug) +); + +CREATE TABLE schema_migration ( + version VARCHAR(14) NOT NULL, + UNIQUE INDEX schema_migration_version_idx (version ASC), + FAMILY "primary" (version, rowid) +); + +ALTER TABLE e2e_user_notes ADD CONSTRAINT e2e_user_notes_e2e_users_id_fk FOREIGN KEY (user_id) REFERENCES e2e_users (id) ON DELETE CASCADE; + +-- Validate foreign key constraints. These can fail if there was unvalidated data during the dump. +ALTER TABLE e2e_user_notes VALIDATE CONSTRAINT e2e_user_notes_e2e_users_id_fk; diff --git a/internal/e2e/fixtures/cockroach/up/6.sql b/internal/e2e/fixtures/cockroach/up/6.sql new file mode 100644 index 00000000..2a8eb5a7 --- /dev/null +++ b/internal/e2e/fixtures/cockroach/up/6.sql @@ -0,0 +1,30 @@ +CREATE TABLE e2e_users ( + id UUID NOT NULL, + created_at TIMESTAMP NOT NULL, + updated_at TIMESTAMP NOT NULL, + CONSTRAINT "primary" PRIMARY KEY (id ASC), + FAMILY "primary" (id, created_at, updated_at) +); + +CREATE TABLE e2e_user_posts ( + id UUID NOT NULL, + notes VARCHAR(255) NULL, + user_id UUID NOT NULL, + slug VARCHAR(64) NOT NULL, + CONSTRAINT "primary" PRIMARY KEY (id ASC), + INDEX e2e_user_notes_auto_index_e2e_user_notes_e2e_users_id_fk (user_id ASC), + INDEX e2e_user_notes_user_id_idx (user_id ASC), + UNIQUE INDEX e2e_user_notes_slug_idx (slug ASC), + FAMILY "primary" (id, notes, user_id, slug) +); + +CREATE TABLE schema_migration ( + version VARCHAR(14) NOT NULL, + UNIQUE INDEX schema_migration_version_idx (version ASC), + FAMILY "primary" (version, rowid) +); + +ALTER TABLE e2e_user_posts ADD CONSTRAINT e2e_user_notes_e2e_users_id_fk FOREIGN KEY (user_id) REFERENCES e2e_users (id) ON DELETE CASCADE; + +-- Validate foreign key constraints. These can fail if there was unvalidated data during the dump. +ALTER TABLE e2e_user_posts VALIDATE CONSTRAINT e2e_user_notes_e2e_users_id_fk; diff --git a/internal/e2e/fixtures/mysql/down/0.sql b/internal/e2e/fixtures/mysql/down/0.sql new file mode 100644 index 00000000..e400c80a --- /dev/null +++ b/internal/e2e/fixtures/mysql/down/0.sql @@ -0,0 +1,40 @@ +-- MySQL dump 10.13 Distrib 5.7.29, for macos10.14 (x86_64) +-- +-- Host: 127.0.0.1 Database: pop_test +-- ------------------------------------------------------ +-- Server version 5.7.30 + +/*!40101 SET @OLD_CHARACTER_SET_CLIENT=@@CHARACTER_SET_CLIENT */; +/*!40101 SET @OLD_CHARACTER_SET_RESULTS=@@CHARACTER_SET_RESULTS */; +/*!40101 SET @OLD_COLLATION_CONNECTION=@@COLLATION_CONNECTION */; +/*!40101 SET NAMES utf8 */; +/*!40103 SET @OLD_TIME_ZONE=@@TIME_ZONE */; +/*!40103 SET TIME_ZONE='+00:00' */; +/*!40014 SET @OLD_UNIQUE_CHECKS=@@UNIQUE_CHECKS, UNIQUE_CHECKS=0 */; +/*!40014 SET @OLD_FOREIGN_KEY_CHECKS=@@FOREIGN_KEY_CHECKS, FOREIGN_KEY_CHECKS=0 */; +/*!40101 SET @OLD_SQL_MODE=@@SQL_MODE, SQL_MODE='NO_AUTO_VALUE_ON_ZERO' */; +/*!40111 SET @OLD_SQL_NOTES=@@SQL_NOTES, SQL_NOTES=0 */; + +-- +-- Table structure for table `schema_migration` +-- + +DROP TABLE IF EXISTS `schema_migration`; +/*!40101 SET @saved_cs_client = @@character_set_client */; +/*!40101 SET character_set_client = utf8 */; +CREATE TABLE `schema_migration` ( + `version` varchar(14) NOT NULL, + UNIQUE KEY `schema_migration_version_idx` (`version`) +) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4; +/*!40101 SET character_set_client = @saved_cs_client */; +/*!40103 SET TIME_ZONE=@OLD_TIME_ZONE */; + +/*!40101 SET SQL_MODE=@OLD_SQL_MODE */; +/*!40014 SET FOREIGN_KEY_CHECKS=@OLD_FOREIGN_KEY_CHECKS */; +/*!40014 SET UNIQUE_CHECKS=@OLD_UNIQUE_CHECKS */; +/*!40101 SET CHARACTER_SET_CLIENT=@OLD_CHARACTER_SET_CLIENT */; +/*!40101 SET CHARACTER_SET_RESULTS=@OLD_CHARACTER_SET_RESULTS */; +/*!40101 SET COLLATION_CONNECTION=@OLD_COLLATION_CONNECTION */; +/*!40111 SET SQL_NOTES=@OLD_SQL_NOTES */; + +-- Dump completed on 2020-06-20 14:38:23 diff --git a/internal/e2e/fixtures/mysql/down/1.sql b/internal/e2e/fixtures/mysql/down/1.sql new file mode 100644 index 00000000..1e33ff32 --- /dev/null +++ b/internal/e2e/fixtures/mysql/down/1.sql @@ -0,0 +1,55 @@ +-- MySQL dump 10.13 Distrib 5.7.29, for macos10.14 (x86_64) +-- +-- Host: 127.0.0.1 Database: pop_test +-- ------------------------------------------------------ +-- Server version 5.7.30 + +/*!40101 SET @OLD_CHARACTER_SET_CLIENT=@@CHARACTER_SET_CLIENT */; +/*!40101 SET @OLD_CHARACTER_SET_RESULTS=@@CHARACTER_SET_RESULTS */; +/*!40101 SET @OLD_COLLATION_CONNECTION=@@COLLATION_CONNECTION */; +/*!40101 SET NAMES utf8 */; +/*!40103 SET @OLD_TIME_ZONE=@@TIME_ZONE */; +/*!40103 SET TIME_ZONE='+00:00' */; +/*!40014 SET @OLD_UNIQUE_CHECKS=@@UNIQUE_CHECKS, UNIQUE_CHECKS=0 */; +/*!40014 SET @OLD_FOREIGN_KEY_CHECKS=@@FOREIGN_KEY_CHECKS, FOREIGN_KEY_CHECKS=0 */; +/*!40101 SET @OLD_SQL_MODE=@@SQL_MODE, SQL_MODE='NO_AUTO_VALUE_ON_ZERO' */; +/*!40111 SET @OLD_SQL_NOTES=@@SQL_NOTES, SQL_NOTES=0 */; + +-- +-- Table structure for table `e2e_users` +-- + +DROP TABLE IF EXISTS `e2e_users`; +/*!40101 SET @saved_cs_client = @@character_set_client */; +/*!40101 SET character_set_client = utf8 */; +CREATE TABLE `e2e_users` ( + `id` char(36) NOT NULL, + `created_at` datetime NOT NULL, + `updated_at` datetime NOT NULL, + PRIMARY KEY (`id`) +) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4; +/*!40101 SET character_set_client = @saved_cs_client */; + +-- +-- Table structure for table `schema_migration` +-- + +DROP TABLE IF EXISTS `schema_migration`; +/*!40101 SET @saved_cs_client = @@character_set_client */; +/*!40101 SET character_set_client = utf8 */; +CREATE TABLE `schema_migration` ( + `version` varchar(14) NOT NULL, + UNIQUE KEY `schema_migration_version_idx` (`version`) +) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4; +/*!40101 SET character_set_client = @saved_cs_client */; +/*!40103 SET TIME_ZONE=@OLD_TIME_ZONE */; + +/*!40101 SET SQL_MODE=@OLD_SQL_MODE */; +/*!40014 SET FOREIGN_KEY_CHECKS=@OLD_FOREIGN_KEY_CHECKS */; +/*!40014 SET UNIQUE_CHECKS=@OLD_UNIQUE_CHECKS */; +/*!40101 SET CHARACTER_SET_CLIENT=@OLD_CHARACTER_SET_CLIENT */; +/*!40101 SET CHARACTER_SET_RESULTS=@OLD_CHARACTER_SET_RESULTS */; +/*!40101 SET COLLATION_CONNECTION=@OLD_COLLATION_CONNECTION */; +/*!40111 SET SQL_NOTES=@OLD_SQL_NOTES */; + +-- Dump completed on 2020-06-20 14:38:23 diff --git a/internal/e2e/fixtures/mysql/down/2.sql b/internal/e2e/fixtures/mysql/down/2.sql new file mode 100644 index 00000000..fd646a27 --- /dev/null +++ b/internal/e2e/fixtures/mysql/down/2.sql @@ -0,0 +1,74 @@ +-- MySQL dump 10.13 Distrib 5.7.29, for macos10.14 (x86_64) +-- +-- Host: 127.0.0.1 Database: pop_test +-- ------------------------------------------------------ +-- Server version 5.7.30 + +/*!40101 SET @OLD_CHARACTER_SET_CLIENT=@@CHARACTER_SET_CLIENT */; +/*!40101 SET @OLD_CHARACTER_SET_RESULTS=@@CHARACTER_SET_RESULTS */; +/*!40101 SET @OLD_COLLATION_CONNECTION=@@COLLATION_CONNECTION */; +/*!40101 SET NAMES utf8 */; +/*!40103 SET @OLD_TIME_ZONE=@@TIME_ZONE */; +/*!40103 SET TIME_ZONE='+00:00' */; +/*!40014 SET @OLD_UNIQUE_CHECKS=@@UNIQUE_CHECKS, UNIQUE_CHECKS=0 */; +/*!40014 SET @OLD_FOREIGN_KEY_CHECKS=@@FOREIGN_KEY_CHECKS, FOREIGN_KEY_CHECKS=0 */; +/*!40101 SET @OLD_SQL_MODE=@@SQL_MODE, SQL_MODE='NO_AUTO_VALUE_ON_ZERO' */; +/*!40111 SET @OLD_SQL_NOTES=@@SQL_NOTES, SQL_NOTES=0 */; + +-- +-- Table structure for table `e2e_user_notes` +-- + +DROP TABLE IF EXISTS `e2e_user_notes`; +/*!40101 SET @saved_cs_client = @@character_set_client */; +/*!40101 SET character_set_client = utf8 */; +CREATE TABLE `e2e_user_notes` ( + `id` char(36) NOT NULL, + `notes` varchar(255) DEFAULT NULL, + `user_id` char(36) NOT NULL, + `title` varchar(64) NOT NULL DEFAULT '', + PRIMARY KEY (`id`), + KEY `e2e_user_notes_user_id_idx` (`user_id`), + KEY `e2e_user_notes_title_idx` (`title`), + CONSTRAINT `e2e_user_notes_ibfk_1` FOREIGN KEY (`user_id`) REFERENCES `e2e_users` (`id`) ON DELETE CASCADE +) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4; +/*!40101 SET character_set_client = @saved_cs_client */; + +-- +-- Table structure for table `e2e_users` +-- + +DROP TABLE IF EXISTS `e2e_users`; +/*!40101 SET @saved_cs_client = @@character_set_client */; +/*!40101 SET character_set_client = utf8 */; +CREATE TABLE `e2e_users` ( + `id` char(36) NOT NULL, + `created_at` datetime NOT NULL, + `updated_at` datetime NOT NULL, + PRIMARY KEY (`id`) +) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4; +/*!40101 SET character_set_client = @saved_cs_client */; + +-- +-- Table structure for table `schema_migration` +-- + +DROP TABLE IF EXISTS `schema_migration`; +/*!40101 SET @saved_cs_client = @@character_set_client */; +/*!40101 SET character_set_client = utf8 */; +CREATE TABLE `schema_migration` ( + `version` varchar(14) NOT NULL, + UNIQUE KEY `schema_migration_version_idx` (`version`) +) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4; +/*!40101 SET character_set_client = @saved_cs_client */; +/*!40103 SET TIME_ZONE=@OLD_TIME_ZONE */; + +/*!40101 SET SQL_MODE=@OLD_SQL_MODE */; +/*!40014 SET FOREIGN_KEY_CHECKS=@OLD_FOREIGN_KEY_CHECKS */; +/*!40014 SET UNIQUE_CHECKS=@OLD_UNIQUE_CHECKS */; +/*!40101 SET CHARACTER_SET_CLIENT=@OLD_CHARACTER_SET_CLIENT */; +/*!40101 SET CHARACTER_SET_RESULTS=@OLD_CHARACTER_SET_RESULTS */; +/*!40101 SET COLLATION_CONNECTION=@OLD_COLLATION_CONNECTION */; +/*!40111 SET SQL_NOTES=@OLD_SQL_NOTES */; + +-- Dump completed on 2020-06-20 18:55:54 diff --git a/internal/e2e/fixtures/mysql/down/3.sql b/internal/e2e/fixtures/mysql/down/3.sql new file mode 100644 index 00000000..5da1424e --- /dev/null +++ b/internal/e2e/fixtures/mysql/down/3.sql @@ -0,0 +1,72 @@ +-- MySQL dump 10.13 Distrib 5.7.29, for macos10.14 (x86_64) +-- +-- Host: 127.0.0.1 Database: pop_test +-- ------------------------------------------------------ +-- Server version 5.7.30 + +/*!40101 SET @OLD_CHARACTER_SET_CLIENT=@@CHARACTER_SET_CLIENT */; +/*!40101 SET @OLD_CHARACTER_SET_RESULTS=@@CHARACTER_SET_RESULTS */; +/*!40101 SET @OLD_COLLATION_CONNECTION=@@COLLATION_CONNECTION */; +/*!40101 SET NAMES utf8 */; +/*!40103 SET @OLD_TIME_ZONE=@@TIME_ZONE */; +/*!40103 SET TIME_ZONE='+00:00' */; +/*!40014 SET @OLD_UNIQUE_CHECKS=@@UNIQUE_CHECKS, UNIQUE_CHECKS=0 */; +/*!40014 SET @OLD_FOREIGN_KEY_CHECKS=@@FOREIGN_KEY_CHECKS, FOREIGN_KEY_CHECKS=0 */; +/*!40101 SET @OLD_SQL_MODE=@@SQL_MODE, SQL_MODE='NO_AUTO_VALUE_ON_ZERO' */; +/*!40111 SET @OLD_SQL_NOTES=@@SQL_NOTES, SQL_NOTES=0 */; + +-- +-- Table structure for table `e2e_user_notes` +-- + +DROP TABLE IF EXISTS `e2e_user_notes`; +/*!40101 SET @saved_cs_client = @@character_set_client */; +/*!40101 SET character_set_client = utf8 */; +CREATE TABLE `e2e_user_notes` ( + `id` char(36) NOT NULL, + `notes` varchar(255) DEFAULT NULL, + `user_id` char(36) NOT NULL, + PRIMARY KEY (`id`), + KEY `e2e_user_notes_user_id_idx` (`user_id`), + CONSTRAINT `e2e_user_notes_ibfk_1` FOREIGN KEY (`user_id`) REFERENCES `e2e_users` (`id`) ON DELETE CASCADE +) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4; +/*!40101 SET character_set_client = @saved_cs_client */; + +-- +-- Table structure for table `e2e_users` +-- + +DROP TABLE IF EXISTS `e2e_users`; +/*!40101 SET @saved_cs_client = @@character_set_client */; +/*!40101 SET character_set_client = utf8 */; +CREATE TABLE `e2e_users` ( + `id` char(36) NOT NULL, + `created_at` datetime NOT NULL, + `updated_at` datetime NOT NULL, + PRIMARY KEY (`id`) +) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4; +/*!40101 SET character_set_client = @saved_cs_client */; + +-- +-- Table structure for table `schema_migration` +-- + +DROP TABLE IF EXISTS `schema_migration`; +/*!40101 SET @saved_cs_client = @@character_set_client */; +/*!40101 SET character_set_client = utf8 */; +CREATE TABLE `schema_migration` ( + `version` varchar(14) NOT NULL, + UNIQUE KEY `schema_migration_version_idx` (`version`) +) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4; +/*!40101 SET character_set_client = @saved_cs_client */; +/*!40103 SET TIME_ZONE=@OLD_TIME_ZONE */; + +/*!40101 SET SQL_MODE=@OLD_SQL_MODE */; +/*!40014 SET FOREIGN_KEY_CHECKS=@OLD_FOREIGN_KEY_CHECKS */; +/*!40014 SET UNIQUE_CHECKS=@OLD_UNIQUE_CHECKS */; +/*!40101 SET CHARACTER_SET_CLIENT=@OLD_CHARACTER_SET_CLIENT */; +/*!40101 SET CHARACTER_SET_RESULTS=@OLD_CHARACTER_SET_RESULTS */; +/*!40101 SET COLLATION_CONNECTION=@OLD_COLLATION_CONNECTION */; +/*!40111 SET SQL_NOTES=@OLD_SQL_NOTES */; + +-- Dump completed on 2020-06-20 18:55:54 diff --git a/internal/e2e/fixtures/mysql/down/4.sql b/internal/e2e/fixtures/mysql/down/4.sql new file mode 100644 index 00000000..e300ae3e --- /dev/null +++ b/internal/e2e/fixtures/mysql/down/4.sql @@ -0,0 +1,74 @@ +-- MySQL dump 10.13 Distrib 5.7.29, for macos10.14 (x86_64) +-- +-- Host: 127.0.0.1 Database: pop_test +-- ------------------------------------------------------ +-- Server version 5.7.30 + +/*!40101 SET @OLD_CHARACTER_SET_CLIENT=@@CHARACTER_SET_CLIENT */; +/*!40101 SET @OLD_CHARACTER_SET_RESULTS=@@CHARACTER_SET_RESULTS */; +/*!40101 SET @OLD_COLLATION_CONNECTION=@@COLLATION_CONNECTION */; +/*!40101 SET NAMES utf8 */; +/*!40103 SET @OLD_TIME_ZONE=@@TIME_ZONE */; +/*!40103 SET TIME_ZONE='+00:00' */; +/*!40014 SET @OLD_UNIQUE_CHECKS=@@UNIQUE_CHECKS, UNIQUE_CHECKS=0 */; +/*!40014 SET @OLD_FOREIGN_KEY_CHECKS=@@FOREIGN_KEY_CHECKS, FOREIGN_KEY_CHECKS=0 */; +/*!40101 SET @OLD_SQL_MODE=@@SQL_MODE, SQL_MODE='NO_AUTO_VALUE_ON_ZERO' */; +/*!40111 SET @OLD_SQL_NOTES=@@SQL_NOTES, SQL_NOTES=0 */; + +-- +-- Table structure for table `e2e_user_notes` +-- + +DROP TABLE IF EXISTS `e2e_user_notes`; +/*!40101 SET @saved_cs_client = @@character_set_client */; +/*!40101 SET character_set_client = utf8 */; +CREATE TABLE `e2e_user_notes` ( + `id` char(36) NOT NULL, + `notes` varchar(255) DEFAULT NULL, + `user_id` char(36) NOT NULL, + `slug` varchar(64) NOT NULL, + PRIMARY KEY (`id`), + UNIQUE KEY `e2e_user_notes_slug_idx` (`slug`), + KEY `e2e_user_notes_user_id_idx` (`user_id`), + CONSTRAINT `e2e_user_notes_ibfk_1` FOREIGN KEY (`user_id`) REFERENCES `e2e_users` (`id`) ON DELETE CASCADE +) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4; +/*!40101 SET character_set_client = @saved_cs_client */; + +-- +-- Table structure for table `e2e_users` +-- + +DROP TABLE IF EXISTS `e2e_users`; +/*!40101 SET @saved_cs_client = @@character_set_client */; +/*!40101 SET character_set_client = utf8 */; +CREATE TABLE `e2e_users` ( + `id` char(36) NOT NULL, + `created_at` datetime NOT NULL, + `updated_at` datetime NOT NULL, + PRIMARY KEY (`id`) +) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4; +/*!40101 SET character_set_client = @saved_cs_client */; + +-- +-- Table structure for table `schema_migration` +-- + +DROP TABLE IF EXISTS `schema_migration`; +/*!40101 SET @saved_cs_client = @@character_set_client */; +/*!40101 SET character_set_client = utf8 */; +CREATE TABLE `schema_migration` ( + `version` varchar(14) NOT NULL, + UNIQUE KEY `schema_migration_version_idx` (`version`) +) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4; +/*!40101 SET character_set_client = @saved_cs_client */; +/*!40103 SET TIME_ZONE=@OLD_TIME_ZONE */; + +/*!40101 SET SQL_MODE=@OLD_SQL_MODE */; +/*!40014 SET FOREIGN_KEY_CHECKS=@OLD_FOREIGN_KEY_CHECKS */; +/*!40014 SET UNIQUE_CHECKS=@OLD_UNIQUE_CHECKS */; +/*!40101 SET CHARACTER_SET_CLIENT=@OLD_CHARACTER_SET_CLIENT */; +/*!40101 SET CHARACTER_SET_RESULTS=@OLD_CHARACTER_SET_RESULTS */; +/*!40101 SET COLLATION_CONNECTION=@OLD_COLLATION_CONNECTION */; +/*!40111 SET SQL_NOTES=@OLD_SQL_NOTES */; + +-- Dump completed on 2020-06-20 18:55:53 diff --git a/internal/e2e/fixtures/mysql/down/5.sql b/internal/e2e/fixtures/mysql/down/5.sql new file mode 100644 index 00000000..e300ae3e --- /dev/null +++ b/internal/e2e/fixtures/mysql/down/5.sql @@ -0,0 +1,74 @@ +-- MySQL dump 10.13 Distrib 5.7.29, for macos10.14 (x86_64) +-- +-- Host: 127.0.0.1 Database: pop_test +-- ------------------------------------------------------ +-- Server version 5.7.30 + +/*!40101 SET @OLD_CHARACTER_SET_CLIENT=@@CHARACTER_SET_CLIENT */; +/*!40101 SET @OLD_CHARACTER_SET_RESULTS=@@CHARACTER_SET_RESULTS */; +/*!40101 SET @OLD_COLLATION_CONNECTION=@@COLLATION_CONNECTION */; +/*!40101 SET NAMES utf8 */; +/*!40103 SET @OLD_TIME_ZONE=@@TIME_ZONE */; +/*!40103 SET TIME_ZONE='+00:00' */; +/*!40014 SET @OLD_UNIQUE_CHECKS=@@UNIQUE_CHECKS, UNIQUE_CHECKS=0 */; +/*!40014 SET @OLD_FOREIGN_KEY_CHECKS=@@FOREIGN_KEY_CHECKS, FOREIGN_KEY_CHECKS=0 */; +/*!40101 SET @OLD_SQL_MODE=@@SQL_MODE, SQL_MODE='NO_AUTO_VALUE_ON_ZERO' */; +/*!40111 SET @OLD_SQL_NOTES=@@SQL_NOTES, SQL_NOTES=0 */; + +-- +-- Table structure for table `e2e_user_notes` +-- + +DROP TABLE IF EXISTS `e2e_user_notes`; +/*!40101 SET @saved_cs_client = @@character_set_client */; +/*!40101 SET character_set_client = utf8 */; +CREATE TABLE `e2e_user_notes` ( + `id` char(36) NOT NULL, + `notes` varchar(255) DEFAULT NULL, + `user_id` char(36) NOT NULL, + `slug` varchar(64) NOT NULL, + PRIMARY KEY (`id`), + UNIQUE KEY `e2e_user_notes_slug_idx` (`slug`), + KEY `e2e_user_notes_user_id_idx` (`user_id`), + CONSTRAINT `e2e_user_notes_ibfk_1` FOREIGN KEY (`user_id`) REFERENCES `e2e_users` (`id`) ON DELETE CASCADE +) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4; +/*!40101 SET character_set_client = @saved_cs_client */; + +-- +-- Table structure for table `e2e_users` +-- + +DROP TABLE IF EXISTS `e2e_users`; +/*!40101 SET @saved_cs_client = @@character_set_client */; +/*!40101 SET character_set_client = utf8 */; +CREATE TABLE `e2e_users` ( + `id` char(36) NOT NULL, + `created_at` datetime NOT NULL, + `updated_at` datetime NOT NULL, + PRIMARY KEY (`id`) +) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4; +/*!40101 SET character_set_client = @saved_cs_client */; + +-- +-- Table structure for table `schema_migration` +-- + +DROP TABLE IF EXISTS `schema_migration`; +/*!40101 SET @saved_cs_client = @@character_set_client */; +/*!40101 SET character_set_client = utf8 */; +CREATE TABLE `schema_migration` ( + `version` varchar(14) NOT NULL, + UNIQUE KEY `schema_migration_version_idx` (`version`) +) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4; +/*!40101 SET character_set_client = @saved_cs_client */; +/*!40103 SET TIME_ZONE=@OLD_TIME_ZONE */; + +/*!40101 SET SQL_MODE=@OLD_SQL_MODE */; +/*!40014 SET FOREIGN_KEY_CHECKS=@OLD_FOREIGN_KEY_CHECKS */; +/*!40014 SET UNIQUE_CHECKS=@OLD_UNIQUE_CHECKS */; +/*!40101 SET CHARACTER_SET_CLIENT=@OLD_CHARACTER_SET_CLIENT */; +/*!40101 SET CHARACTER_SET_RESULTS=@OLD_CHARACTER_SET_RESULTS */; +/*!40101 SET COLLATION_CONNECTION=@OLD_COLLATION_CONNECTION */; +/*!40111 SET SQL_NOTES=@OLD_SQL_NOTES */; + +-- Dump completed on 2020-06-20 18:55:53 diff --git a/internal/e2e/fixtures/mysql/down/6.sql b/internal/e2e/fixtures/mysql/down/6.sql new file mode 100644 index 00000000..e300ae3e --- /dev/null +++ b/internal/e2e/fixtures/mysql/down/6.sql @@ -0,0 +1,74 @@ +-- MySQL dump 10.13 Distrib 5.7.29, for macos10.14 (x86_64) +-- +-- Host: 127.0.0.1 Database: pop_test +-- ------------------------------------------------------ +-- Server version 5.7.30 + +/*!40101 SET @OLD_CHARACTER_SET_CLIENT=@@CHARACTER_SET_CLIENT */; +/*!40101 SET @OLD_CHARACTER_SET_RESULTS=@@CHARACTER_SET_RESULTS */; +/*!40101 SET @OLD_COLLATION_CONNECTION=@@COLLATION_CONNECTION */; +/*!40101 SET NAMES utf8 */; +/*!40103 SET @OLD_TIME_ZONE=@@TIME_ZONE */; +/*!40103 SET TIME_ZONE='+00:00' */; +/*!40014 SET @OLD_UNIQUE_CHECKS=@@UNIQUE_CHECKS, UNIQUE_CHECKS=0 */; +/*!40014 SET @OLD_FOREIGN_KEY_CHECKS=@@FOREIGN_KEY_CHECKS, FOREIGN_KEY_CHECKS=0 */; +/*!40101 SET @OLD_SQL_MODE=@@SQL_MODE, SQL_MODE='NO_AUTO_VALUE_ON_ZERO' */; +/*!40111 SET @OLD_SQL_NOTES=@@SQL_NOTES, SQL_NOTES=0 */; + +-- +-- Table structure for table `e2e_user_notes` +-- + +DROP TABLE IF EXISTS `e2e_user_notes`; +/*!40101 SET @saved_cs_client = @@character_set_client */; +/*!40101 SET character_set_client = utf8 */; +CREATE TABLE `e2e_user_notes` ( + `id` char(36) NOT NULL, + `notes` varchar(255) DEFAULT NULL, + `user_id` char(36) NOT NULL, + `slug` varchar(64) NOT NULL, + PRIMARY KEY (`id`), + UNIQUE KEY `e2e_user_notes_slug_idx` (`slug`), + KEY `e2e_user_notes_user_id_idx` (`user_id`), + CONSTRAINT `e2e_user_notes_ibfk_1` FOREIGN KEY (`user_id`) REFERENCES `e2e_users` (`id`) ON DELETE CASCADE +) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4; +/*!40101 SET character_set_client = @saved_cs_client */; + +-- +-- Table structure for table `e2e_users` +-- + +DROP TABLE IF EXISTS `e2e_users`; +/*!40101 SET @saved_cs_client = @@character_set_client */; +/*!40101 SET character_set_client = utf8 */; +CREATE TABLE `e2e_users` ( + `id` char(36) NOT NULL, + `created_at` datetime NOT NULL, + `updated_at` datetime NOT NULL, + PRIMARY KEY (`id`) +) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4; +/*!40101 SET character_set_client = @saved_cs_client */; + +-- +-- Table structure for table `schema_migration` +-- + +DROP TABLE IF EXISTS `schema_migration`; +/*!40101 SET @saved_cs_client = @@character_set_client */; +/*!40101 SET character_set_client = utf8 */; +CREATE TABLE `schema_migration` ( + `version` varchar(14) NOT NULL, + UNIQUE KEY `schema_migration_version_idx` (`version`) +) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4; +/*!40101 SET character_set_client = @saved_cs_client */; +/*!40103 SET TIME_ZONE=@OLD_TIME_ZONE */; + +/*!40101 SET SQL_MODE=@OLD_SQL_MODE */; +/*!40014 SET FOREIGN_KEY_CHECKS=@OLD_FOREIGN_KEY_CHECKS */; +/*!40014 SET UNIQUE_CHECKS=@OLD_UNIQUE_CHECKS */; +/*!40101 SET CHARACTER_SET_CLIENT=@OLD_CHARACTER_SET_CLIENT */; +/*!40101 SET CHARACTER_SET_RESULTS=@OLD_CHARACTER_SET_RESULTS */; +/*!40101 SET COLLATION_CONNECTION=@OLD_COLLATION_CONNECTION */; +/*!40111 SET SQL_NOTES=@OLD_SQL_NOTES */; + +-- Dump completed on 2020-06-20 18:55:53 diff --git a/internal/e2e/fixtures/mysql/up/0.sql b/internal/e2e/fixtures/mysql/up/0.sql new file mode 100644 index 00000000..8f516f45 --- /dev/null +++ b/internal/e2e/fixtures/mysql/up/0.sql @@ -0,0 +1,55 @@ +-- MySQL dump 10.13 Distrib 5.7.29, for macos10.14 (x86_64) +-- +-- Host: 127.0.0.1 Database: pop_test +-- ------------------------------------------------------ +-- Server version 5.7.30 + +/*!40101 SET @OLD_CHARACTER_SET_CLIENT=@@CHARACTER_SET_CLIENT */; +/*!40101 SET @OLD_CHARACTER_SET_RESULTS=@@CHARACTER_SET_RESULTS */; +/*!40101 SET @OLD_COLLATION_CONNECTION=@@COLLATION_CONNECTION */; +/*!40101 SET NAMES utf8 */; +/*!40103 SET @OLD_TIME_ZONE=@@TIME_ZONE */; +/*!40103 SET TIME_ZONE='+00:00' */; +/*!40014 SET @OLD_UNIQUE_CHECKS=@@UNIQUE_CHECKS, UNIQUE_CHECKS=0 */; +/*!40014 SET @OLD_FOREIGN_KEY_CHECKS=@@FOREIGN_KEY_CHECKS, FOREIGN_KEY_CHECKS=0 */; +/*!40101 SET @OLD_SQL_MODE=@@SQL_MODE, SQL_MODE='NO_AUTO_VALUE_ON_ZERO' */; +/*!40111 SET @OLD_SQL_NOTES=@@SQL_NOTES, SQL_NOTES=0 */; + +-- +-- Table structure for table `e2e_users` +-- + +DROP TABLE IF EXISTS `e2e_users`; +/*!40101 SET @saved_cs_client = @@character_set_client */; +/*!40101 SET character_set_client = utf8 */; +CREATE TABLE `e2e_users` ( + `id` char(36) NOT NULL, + `created_at` datetime NOT NULL, + `updated_at` datetime NOT NULL, + PRIMARY KEY (`id`) +) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4; +/*!40101 SET character_set_client = @saved_cs_client */; + +-- +-- Table structure for table `schema_migration` +-- + +DROP TABLE IF EXISTS `schema_migration`; +/*!40101 SET @saved_cs_client = @@character_set_client */; +/*!40101 SET character_set_client = utf8 */; +CREATE TABLE `schema_migration` ( + `version` varchar(14) NOT NULL, + UNIQUE KEY `schema_migration_version_idx` (`version`) +) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4; +/*!40101 SET character_set_client = @saved_cs_client */; +/*!40103 SET TIME_ZONE=@OLD_TIME_ZONE */; + +/*!40101 SET SQL_MODE=@OLD_SQL_MODE */; +/*!40014 SET FOREIGN_KEY_CHECKS=@OLD_FOREIGN_KEY_CHECKS */; +/*!40014 SET UNIQUE_CHECKS=@OLD_UNIQUE_CHECKS */; +/*!40101 SET CHARACTER_SET_CLIENT=@OLD_CHARACTER_SET_CLIENT */; +/*!40101 SET CHARACTER_SET_RESULTS=@OLD_CHARACTER_SET_RESULTS */; +/*!40101 SET COLLATION_CONNECTION=@OLD_COLLATION_CONNECTION */; +/*!40111 SET SQL_NOTES=@OLD_SQL_NOTES */; + +-- Dump completed on 2020-06-20 14:38:22 diff --git a/internal/e2e/fixtures/mysql/up/1.sql b/internal/e2e/fixtures/mysql/up/1.sql new file mode 100644 index 00000000..457e3f8a --- /dev/null +++ b/internal/e2e/fixtures/mysql/up/1.sql @@ -0,0 +1,74 @@ +-- MySQL dump 10.13 Distrib 5.7.29, for macos10.14 (x86_64) +-- +-- Host: 127.0.0.1 Database: pop_test +-- ------------------------------------------------------ +-- Server version 5.7.30 + +/*!40101 SET @OLD_CHARACTER_SET_CLIENT=@@CHARACTER_SET_CLIENT */; +/*!40101 SET @OLD_CHARACTER_SET_RESULTS=@@CHARACTER_SET_RESULTS */; +/*!40101 SET @OLD_COLLATION_CONNECTION=@@COLLATION_CONNECTION */; +/*!40101 SET NAMES utf8 */; +/*!40103 SET @OLD_TIME_ZONE=@@TIME_ZONE */; +/*!40103 SET TIME_ZONE='+00:00' */; +/*!40014 SET @OLD_UNIQUE_CHECKS=@@UNIQUE_CHECKS, UNIQUE_CHECKS=0 */; +/*!40014 SET @OLD_FOREIGN_KEY_CHECKS=@@FOREIGN_KEY_CHECKS, FOREIGN_KEY_CHECKS=0 */; +/*!40101 SET @OLD_SQL_MODE=@@SQL_MODE, SQL_MODE='NO_AUTO_VALUE_ON_ZERO' */; +/*!40111 SET @OLD_SQL_NOTES=@@SQL_NOTES, SQL_NOTES=0 */; + +-- +-- Table structure for table `e2e_user_notes` +-- + +DROP TABLE IF EXISTS `e2e_user_notes`; +/*!40101 SET @saved_cs_client = @@character_set_client */; +/*!40101 SET character_set_client = utf8 */; +CREATE TABLE `e2e_user_notes` ( + `id` char(36) NOT NULL, + `notes` varchar(255) DEFAULT NULL, + `title` varchar(64) NOT NULL DEFAULT '', + `user_id` char(36) NOT NULL, + PRIMARY KEY (`id`), + KEY `e2e_user_notes_user_id_idx` (`user_id`), + KEY `e2e_user_notes_title_idx` (`title`), + CONSTRAINT `e2e_user_notes_ibfk_1` FOREIGN KEY (`user_id`) REFERENCES `e2e_users` (`id`) ON DELETE CASCADE +) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4; +/*!40101 SET character_set_client = @saved_cs_client */; + +-- +-- Table structure for table `e2e_users` +-- + +DROP TABLE IF EXISTS `e2e_users`; +/*!40101 SET @saved_cs_client = @@character_set_client */; +/*!40101 SET character_set_client = utf8 */; +CREATE TABLE `e2e_users` ( + `id` char(36) NOT NULL, + `created_at` datetime NOT NULL, + `updated_at` datetime NOT NULL, + PRIMARY KEY (`id`) +) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4; +/*!40101 SET character_set_client = @saved_cs_client */; + +-- +-- Table structure for table `schema_migration` +-- + +DROP TABLE IF EXISTS `schema_migration`; +/*!40101 SET @saved_cs_client = @@character_set_client */; +/*!40101 SET character_set_client = utf8 */; +CREATE TABLE `schema_migration` ( + `version` varchar(14) NOT NULL, + UNIQUE KEY `schema_migration_version_idx` (`version`) +) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4; +/*!40101 SET character_set_client = @saved_cs_client */; +/*!40103 SET TIME_ZONE=@OLD_TIME_ZONE */; + +/*!40101 SET SQL_MODE=@OLD_SQL_MODE */; +/*!40014 SET FOREIGN_KEY_CHECKS=@OLD_FOREIGN_KEY_CHECKS */; +/*!40014 SET UNIQUE_CHECKS=@OLD_UNIQUE_CHECKS */; +/*!40101 SET CHARACTER_SET_CLIENT=@OLD_CHARACTER_SET_CLIENT */; +/*!40101 SET CHARACTER_SET_RESULTS=@OLD_CHARACTER_SET_RESULTS */; +/*!40101 SET COLLATION_CONNECTION=@OLD_COLLATION_CONNECTION */; +/*!40111 SET SQL_NOTES=@OLD_SQL_NOTES */; + +-- Dump completed on 2020-06-20 18:55:52 diff --git a/internal/e2e/fixtures/mysql/up/2.sql b/internal/e2e/fixtures/mysql/up/2.sql new file mode 100644 index 00000000..78f1cc2c --- /dev/null +++ b/internal/e2e/fixtures/mysql/up/2.sql @@ -0,0 +1,72 @@ +-- MySQL dump 10.13 Distrib 5.7.29, for macos10.14 (x86_64) +-- +-- Host: 127.0.0.1 Database: pop_test +-- ------------------------------------------------------ +-- Server version 5.7.30 + +/*!40101 SET @OLD_CHARACTER_SET_CLIENT=@@CHARACTER_SET_CLIENT */; +/*!40101 SET @OLD_CHARACTER_SET_RESULTS=@@CHARACTER_SET_RESULTS */; +/*!40101 SET @OLD_COLLATION_CONNECTION=@@COLLATION_CONNECTION */; +/*!40101 SET NAMES utf8 */; +/*!40103 SET @OLD_TIME_ZONE=@@TIME_ZONE */; +/*!40103 SET TIME_ZONE='+00:00' */; +/*!40014 SET @OLD_UNIQUE_CHECKS=@@UNIQUE_CHECKS, UNIQUE_CHECKS=0 */; +/*!40014 SET @OLD_FOREIGN_KEY_CHECKS=@@FOREIGN_KEY_CHECKS, FOREIGN_KEY_CHECKS=0 */; +/*!40101 SET @OLD_SQL_MODE=@@SQL_MODE, SQL_MODE='NO_AUTO_VALUE_ON_ZERO' */; +/*!40111 SET @OLD_SQL_NOTES=@@SQL_NOTES, SQL_NOTES=0 */; + +-- +-- Table structure for table `e2e_user_notes` +-- + +DROP TABLE IF EXISTS `e2e_user_notes`; +/*!40101 SET @saved_cs_client = @@character_set_client */; +/*!40101 SET character_set_client = utf8 */; +CREATE TABLE `e2e_user_notes` ( + `id` char(36) NOT NULL, + `notes` varchar(255) DEFAULT NULL, + `user_id` char(36) NOT NULL, + PRIMARY KEY (`id`), + KEY `e2e_user_notes_user_id_idx` (`user_id`), + CONSTRAINT `e2e_user_notes_ibfk_1` FOREIGN KEY (`user_id`) REFERENCES `e2e_users` (`id`) ON DELETE CASCADE +) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4; +/*!40101 SET character_set_client = @saved_cs_client */; + +-- +-- Table structure for table `e2e_users` +-- + +DROP TABLE IF EXISTS `e2e_users`; +/*!40101 SET @saved_cs_client = @@character_set_client */; +/*!40101 SET character_set_client = utf8 */; +CREATE TABLE `e2e_users` ( + `id` char(36) NOT NULL, + `created_at` datetime NOT NULL, + `updated_at` datetime NOT NULL, + PRIMARY KEY (`id`) +) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4; +/*!40101 SET character_set_client = @saved_cs_client */; + +-- +-- Table structure for table `schema_migration` +-- + +DROP TABLE IF EXISTS `schema_migration`; +/*!40101 SET @saved_cs_client = @@character_set_client */; +/*!40101 SET character_set_client = utf8 */; +CREATE TABLE `schema_migration` ( + `version` varchar(14) NOT NULL, + UNIQUE KEY `schema_migration_version_idx` (`version`) +) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4; +/*!40101 SET character_set_client = @saved_cs_client */; +/*!40103 SET TIME_ZONE=@OLD_TIME_ZONE */; + +/*!40101 SET SQL_MODE=@OLD_SQL_MODE */; +/*!40014 SET FOREIGN_KEY_CHECKS=@OLD_FOREIGN_KEY_CHECKS */; +/*!40014 SET UNIQUE_CHECKS=@OLD_UNIQUE_CHECKS */; +/*!40101 SET CHARACTER_SET_CLIENT=@OLD_CHARACTER_SET_CLIENT */; +/*!40101 SET CHARACTER_SET_RESULTS=@OLD_CHARACTER_SET_RESULTS */; +/*!40101 SET COLLATION_CONNECTION=@OLD_COLLATION_CONNECTION */; +/*!40111 SET SQL_NOTES=@OLD_SQL_NOTES */; + +-- Dump completed on 2020-06-20 18:55:52 diff --git a/internal/e2e/fixtures/mysql/up/3.sql b/internal/e2e/fixtures/mysql/up/3.sql new file mode 100644 index 00000000..68a229d4 --- /dev/null +++ b/internal/e2e/fixtures/mysql/up/3.sql @@ -0,0 +1,73 @@ +-- MySQL dump 10.13 Distrib 5.7.29, for macos10.14 (x86_64) +-- +-- Host: 127.0.0.1 Database: pop_test +-- ------------------------------------------------------ +-- Server version 5.7.30 + +/*!40101 SET @OLD_CHARACTER_SET_CLIENT=@@CHARACTER_SET_CLIENT */; +/*!40101 SET @OLD_CHARACTER_SET_RESULTS=@@CHARACTER_SET_RESULTS */; +/*!40101 SET @OLD_COLLATION_CONNECTION=@@COLLATION_CONNECTION */; +/*!40101 SET NAMES utf8 */; +/*!40103 SET @OLD_TIME_ZONE=@@TIME_ZONE */; +/*!40103 SET TIME_ZONE='+00:00' */; +/*!40014 SET @OLD_UNIQUE_CHECKS=@@UNIQUE_CHECKS, UNIQUE_CHECKS=0 */; +/*!40014 SET @OLD_FOREIGN_KEY_CHECKS=@@FOREIGN_KEY_CHECKS, FOREIGN_KEY_CHECKS=0 */; +/*!40101 SET @OLD_SQL_MODE=@@SQL_MODE, SQL_MODE='NO_AUTO_VALUE_ON_ZERO' */; +/*!40111 SET @OLD_SQL_NOTES=@@SQL_NOTES, SQL_NOTES=0 */; + +-- +-- Table structure for table `e2e_user_notes` +-- + +DROP TABLE IF EXISTS `e2e_user_notes`; +/*!40101 SET @saved_cs_client = @@character_set_client */; +/*!40101 SET character_set_client = utf8 */; +CREATE TABLE `e2e_user_notes` ( + `id` char(36) NOT NULL, + `notes` varchar(255) DEFAULT NULL, + `user_id` char(36) NOT NULL, + `slug` varchar(64) DEFAULT NULL, + PRIMARY KEY (`id`), + KEY `e2e_user_notes_user_id_idx` (`user_id`), + CONSTRAINT `e2e_user_notes_ibfk_1` FOREIGN KEY (`user_id`) REFERENCES `e2e_users` (`id`) ON DELETE CASCADE +) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4; +/*!40101 SET character_set_client = @saved_cs_client */; + +-- +-- Table structure for table `e2e_users` +-- + +DROP TABLE IF EXISTS `e2e_users`; +/*!40101 SET @saved_cs_client = @@character_set_client */; +/*!40101 SET character_set_client = utf8 */; +CREATE TABLE `e2e_users` ( + `id` char(36) NOT NULL, + `created_at` datetime NOT NULL, + `updated_at` datetime NOT NULL, + PRIMARY KEY (`id`) +) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4; +/*!40101 SET character_set_client = @saved_cs_client */; + +-- +-- Table structure for table `schema_migration` +-- + +DROP TABLE IF EXISTS `schema_migration`; +/*!40101 SET @saved_cs_client = @@character_set_client */; +/*!40101 SET character_set_client = utf8 */; +CREATE TABLE `schema_migration` ( + `version` varchar(14) NOT NULL, + UNIQUE KEY `schema_migration_version_idx` (`version`) +) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4; +/*!40101 SET character_set_client = @saved_cs_client */; +/*!40103 SET TIME_ZONE=@OLD_TIME_ZONE */; + +/*!40101 SET SQL_MODE=@OLD_SQL_MODE */; +/*!40014 SET FOREIGN_KEY_CHECKS=@OLD_FOREIGN_KEY_CHECKS */; +/*!40014 SET UNIQUE_CHECKS=@OLD_UNIQUE_CHECKS */; +/*!40101 SET CHARACTER_SET_CLIENT=@OLD_CHARACTER_SET_CLIENT */; +/*!40101 SET CHARACTER_SET_RESULTS=@OLD_CHARACTER_SET_RESULTS */; +/*!40101 SET COLLATION_CONNECTION=@OLD_COLLATION_CONNECTION */; +/*!40111 SET SQL_NOTES=@OLD_SQL_NOTES */; + +-- Dump completed on 2020-06-20 18:55:52 diff --git a/internal/e2e/fixtures/mysql/up/4.sql b/internal/e2e/fixtures/mysql/up/4.sql new file mode 100644 index 00000000..68a229d4 --- /dev/null +++ b/internal/e2e/fixtures/mysql/up/4.sql @@ -0,0 +1,73 @@ +-- MySQL dump 10.13 Distrib 5.7.29, for macos10.14 (x86_64) +-- +-- Host: 127.0.0.1 Database: pop_test +-- ------------------------------------------------------ +-- Server version 5.7.30 + +/*!40101 SET @OLD_CHARACTER_SET_CLIENT=@@CHARACTER_SET_CLIENT */; +/*!40101 SET @OLD_CHARACTER_SET_RESULTS=@@CHARACTER_SET_RESULTS */; +/*!40101 SET @OLD_COLLATION_CONNECTION=@@COLLATION_CONNECTION */; +/*!40101 SET NAMES utf8 */; +/*!40103 SET @OLD_TIME_ZONE=@@TIME_ZONE */; +/*!40103 SET TIME_ZONE='+00:00' */; +/*!40014 SET @OLD_UNIQUE_CHECKS=@@UNIQUE_CHECKS, UNIQUE_CHECKS=0 */; +/*!40014 SET @OLD_FOREIGN_KEY_CHECKS=@@FOREIGN_KEY_CHECKS, FOREIGN_KEY_CHECKS=0 */; +/*!40101 SET @OLD_SQL_MODE=@@SQL_MODE, SQL_MODE='NO_AUTO_VALUE_ON_ZERO' */; +/*!40111 SET @OLD_SQL_NOTES=@@SQL_NOTES, SQL_NOTES=0 */; + +-- +-- Table structure for table `e2e_user_notes` +-- + +DROP TABLE IF EXISTS `e2e_user_notes`; +/*!40101 SET @saved_cs_client = @@character_set_client */; +/*!40101 SET character_set_client = utf8 */; +CREATE TABLE `e2e_user_notes` ( + `id` char(36) NOT NULL, + `notes` varchar(255) DEFAULT NULL, + `user_id` char(36) NOT NULL, + `slug` varchar(64) DEFAULT NULL, + PRIMARY KEY (`id`), + KEY `e2e_user_notes_user_id_idx` (`user_id`), + CONSTRAINT `e2e_user_notes_ibfk_1` FOREIGN KEY (`user_id`) REFERENCES `e2e_users` (`id`) ON DELETE CASCADE +) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4; +/*!40101 SET character_set_client = @saved_cs_client */; + +-- +-- Table structure for table `e2e_users` +-- + +DROP TABLE IF EXISTS `e2e_users`; +/*!40101 SET @saved_cs_client = @@character_set_client */; +/*!40101 SET character_set_client = utf8 */; +CREATE TABLE `e2e_users` ( + `id` char(36) NOT NULL, + `created_at` datetime NOT NULL, + `updated_at` datetime NOT NULL, + PRIMARY KEY (`id`) +) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4; +/*!40101 SET character_set_client = @saved_cs_client */; + +-- +-- Table structure for table `schema_migration` +-- + +DROP TABLE IF EXISTS `schema_migration`; +/*!40101 SET @saved_cs_client = @@character_set_client */; +/*!40101 SET character_set_client = utf8 */; +CREATE TABLE `schema_migration` ( + `version` varchar(14) NOT NULL, + UNIQUE KEY `schema_migration_version_idx` (`version`) +) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4; +/*!40101 SET character_set_client = @saved_cs_client */; +/*!40103 SET TIME_ZONE=@OLD_TIME_ZONE */; + +/*!40101 SET SQL_MODE=@OLD_SQL_MODE */; +/*!40014 SET FOREIGN_KEY_CHECKS=@OLD_FOREIGN_KEY_CHECKS */; +/*!40014 SET UNIQUE_CHECKS=@OLD_UNIQUE_CHECKS */; +/*!40101 SET CHARACTER_SET_CLIENT=@OLD_CHARACTER_SET_CLIENT */; +/*!40101 SET CHARACTER_SET_RESULTS=@OLD_CHARACTER_SET_RESULTS */; +/*!40101 SET COLLATION_CONNECTION=@OLD_COLLATION_CONNECTION */; +/*!40111 SET SQL_NOTES=@OLD_SQL_NOTES */; + +-- Dump completed on 2020-06-20 18:55:52 diff --git a/internal/e2e/fixtures/mysql/up/5.sql b/internal/e2e/fixtures/mysql/up/5.sql new file mode 100644 index 00000000..e300ae3e --- /dev/null +++ b/internal/e2e/fixtures/mysql/up/5.sql @@ -0,0 +1,74 @@ +-- MySQL dump 10.13 Distrib 5.7.29, for macos10.14 (x86_64) +-- +-- Host: 127.0.0.1 Database: pop_test +-- ------------------------------------------------------ +-- Server version 5.7.30 + +/*!40101 SET @OLD_CHARACTER_SET_CLIENT=@@CHARACTER_SET_CLIENT */; +/*!40101 SET @OLD_CHARACTER_SET_RESULTS=@@CHARACTER_SET_RESULTS */; +/*!40101 SET @OLD_COLLATION_CONNECTION=@@COLLATION_CONNECTION */; +/*!40101 SET NAMES utf8 */; +/*!40103 SET @OLD_TIME_ZONE=@@TIME_ZONE */; +/*!40103 SET TIME_ZONE='+00:00' */; +/*!40014 SET @OLD_UNIQUE_CHECKS=@@UNIQUE_CHECKS, UNIQUE_CHECKS=0 */; +/*!40014 SET @OLD_FOREIGN_KEY_CHECKS=@@FOREIGN_KEY_CHECKS, FOREIGN_KEY_CHECKS=0 */; +/*!40101 SET @OLD_SQL_MODE=@@SQL_MODE, SQL_MODE='NO_AUTO_VALUE_ON_ZERO' */; +/*!40111 SET @OLD_SQL_NOTES=@@SQL_NOTES, SQL_NOTES=0 */; + +-- +-- Table structure for table `e2e_user_notes` +-- + +DROP TABLE IF EXISTS `e2e_user_notes`; +/*!40101 SET @saved_cs_client = @@character_set_client */; +/*!40101 SET character_set_client = utf8 */; +CREATE TABLE `e2e_user_notes` ( + `id` char(36) NOT NULL, + `notes` varchar(255) DEFAULT NULL, + `user_id` char(36) NOT NULL, + `slug` varchar(64) NOT NULL, + PRIMARY KEY (`id`), + UNIQUE KEY `e2e_user_notes_slug_idx` (`slug`), + KEY `e2e_user_notes_user_id_idx` (`user_id`), + CONSTRAINT `e2e_user_notes_ibfk_1` FOREIGN KEY (`user_id`) REFERENCES `e2e_users` (`id`) ON DELETE CASCADE +) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4; +/*!40101 SET character_set_client = @saved_cs_client */; + +-- +-- Table structure for table `e2e_users` +-- + +DROP TABLE IF EXISTS `e2e_users`; +/*!40101 SET @saved_cs_client = @@character_set_client */; +/*!40101 SET character_set_client = utf8 */; +CREATE TABLE `e2e_users` ( + `id` char(36) NOT NULL, + `created_at` datetime NOT NULL, + `updated_at` datetime NOT NULL, + PRIMARY KEY (`id`) +) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4; +/*!40101 SET character_set_client = @saved_cs_client */; + +-- +-- Table structure for table `schema_migration` +-- + +DROP TABLE IF EXISTS `schema_migration`; +/*!40101 SET @saved_cs_client = @@character_set_client */; +/*!40101 SET character_set_client = utf8 */; +CREATE TABLE `schema_migration` ( + `version` varchar(14) NOT NULL, + UNIQUE KEY `schema_migration_version_idx` (`version`) +) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4; +/*!40101 SET character_set_client = @saved_cs_client */; +/*!40103 SET TIME_ZONE=@OLD_TIME_ZONE */; + +/*!40101 SET SQL_MODE=@OLD_SQL_MODE */; +/*!40014 SET FOREIGN_KEY_CHECKS=@OLD_FOREIGN_KEY_CHECKS */; +/*!40014 SET UNIQUE_CHECKS=@OLD_UNIQUE_CHECKS */; +/*!40101 SET CHARACTER_SET_CLIENT=@OLD_CHARACTER_SET_CLIENT */; +/*!40101 SET CHARACTER_SET_RESULTS=@OLD_CHARACTER_SET_RESULTS */; +/*!40101 SET COLLATION_CONNECTION=@OLD_COLLATION_CONNECTION */; +/*!40111 SET SQL_NOTES=@OLD_SQL_NOTES */; + +-- Dump completed on 2020-06-20 18:55:53 diff --git a/internal/e2e/fixtures/mysql/up/6.sql b/internal/e2e/fixtures/mysql/up/6.sql new file mode 100644 index 00000000..d8ade9d4 --- /dev/null +++ b/internal/e2e/fixtures/mysql/up/6.sql @@ -0,0 +1,74 @@ +-- MySQL dump 10.13 Distrib 5.7.29, for macos10.14 (x86_64) +-- +-- Host: 127.0.0.1 Database: pop_test +-- ------------------------------------------------------ +-- Server version 5.7.30 + +/*!40101 SET @OLD_CHARACTER_SET_CLIENT=@@CHARACTER_SET_CLIENT */; +/*!40101 SET @OLD_CHARACTER_SET_RESULTS=@@CHARACTER_SET_RESULTS */; +/*!40101 SET @OLD_COLLATION_CONNECTION=@@COLLATION_CONNECTION */; +/*!40101 SET NAMES utf8 */; +/*!40103 SET @OLD_TIME_ZONE=@@TIME_ZONE */; +/*!40103 SET TIME_ZONE='+00:00' */; +/*!40014 SET @OLD_UNIQUE_CHECKS=@@UNIQUE_CHECKS, UNIQUE_CHECKS=0 */; +/*!40014 SET @OLD_FOREIGN_KEY_CHECKS=@@FOREIGN_KEY_CHECKS, FOREIGN_KEY_CHECKS=0 */; +/*!40101 SET @OLD_SQL_MODE=@@SQL_MODE, SQL_MODE='NO_AUTO_VALUE_ON_ZERO' */; +/*!40111 SET @OLD_SQL_NOTES=@@SQL_NOTES, SQL_NOTES=0 */; + +-- +-- Table structure for table `e2e_user_posts` +-- + +DROP TABLE IF EXISTS `e2e_user_posts`; +/*!40101 SET @saved_cs_client = @@character_set_client */; +/*!40101 SET character_set_client = utf8 */; +CREATE TABLE `e2e_user_posts` ( + `id` char(36) NOT NULL, + `notes` varchar(255) DEFAULT NULL, + `user_id` char(36) NOT NULL, + `slug` varchar(64) NOT NULL, + PRIMARY KEY (`id`), + UNIQUE KEY `e2e_user_notes_slug_idx` (`slug`), + KEY `e2e_user_notes_user_id_idx` (`user_id`), + CONSTRAINT `e2e_user_posts_ibfk_1` FOREIGN KEY (`user_id`) REFERENCES `e2e_users` (`id`) ON DELETE CASCADE +) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4; +/*!40101 SET character_set_client = @saved_cs_client */; + +-- +-- Table structure for table `e2e_users` +-- + +DROP TABLE IF EXISTS `e2e_users`; +/*!40101 SET @saved_cs_client = @@character_set_client */; +/*!40101 SET character_set_client = utf8 */; +CREATE TABLE `e2e_users` ( + `id` char(36) NOT NULL, + `created_at` datetime NOT NULL, + `updated_at` datetime NOT NULL, + PRIMARY KEY (`id`) +) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4; +/*!40101 SET character_set_client = @saved_cs_client */; + +-- +-- Table structure for table `schema_migration` +-- + +DROP TABLE IF EXISTS `schema_migration`; +/*!40101 SET @saved_cs_client = @@character_set_client */; +/*!40101 SET character_set_client = utf8 */; +CREATE TABLE `schema_migration` ( + `version` varchar(14) NOT NULL, + UNIQUE KEY `schema_migration_version_idx` (`version`) +) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4; +/*!40101 SET character_set_client = @saved_cs_client */; +/*!40103 SET TIME_ZONE=@OLD_TIME_ZONE */; + +/*!40101 SET SQL_MODE=@OLD_SQL_MODE */; +/*!40014 SET FOREIGN_KEY_CHECKS=@OLD_FOREIGN_KEY_CHECKS */; +/*!40014 SET UNIQUE_CHECKS=@OLD_UNIQUE_CHECKS */; +/*!40101 SET CHARACTER_SET_CLIENT=@OLD_CHARACTER_SET_CLIENT */; +/*!40101 SET CHARACTER_SET_RESULTS=@OLD_CHARACTER_SET_RESULTS */; +/*!40101 SET COLLATION_CONNECTION=@OLD_COLLATION_CONNECTION */; +/*!40111 SET SQL_NOTES=@OLD_SQL_NOTES */; + +-- Dump completed on 2020-06-20 18:55:53 diff --git a/internal/e2e/fixtures/postgres/down/0.sql b/internal/e2e/fixtures/postgres/down/0.sql new file mode 100644 index 00000000..8cdf2be7 --- /dev/null +++ b/internal/e2e/fixtures/postgres/down/0.sql @@ -0,0 +1,42 @@ +-- +-- PostgreSQL database dump +-- + +-- Dumped from database version 9.6.18 +-- Dumped by pg_dump version 12.3 + +SET statement_timeout = 0; +SET lock_timeout = 0; +SET idle_in_transaction_session_timeout = 0; +SET client_encoding = 'UTF8'; +SET standard_conforming_strings = on; +SELECT pg_catalog.set_config('search_path', '', false); +SET check_function_bodies = false; +SET xmloption = content; +SET client_min_messages = warning; +SET row_security = off; + +SET default_tablespace = ''; + +-- +-- Name: schema_migration; Type: TABLE; Schema: public; Owner: postgres +-- + +CREATE TABLE public.schema_migration ( + version character varying(14) NOT NULL +); + + +ALTER TABLE public.schema_migration OWNER TO postgres; + +-- +-- Name: schema_migration_version_idx; Type: INDEX; Schema: public; Owner: postgres +-- + +CREATE UNIQUE INDEX schema_migration_version_idx ON public.schema_migration USING btree (version); + + +-- +-- PostgreSQL database dump complete +-- + diff --git a/internal/e2e/fixtures/postgres/down/1.sql b/internal/e2e/fixtures/postgres/down/1.sql new file mode 100644 index 00000000..48055796 --- /dev/null +++ b/internal/e2e/fixtures/postgres/down/1.sql @@ -0,0 +1,63 @@ +-- +-- PostgreSQL database dump +-- + +-- Dumped from database version 9.6.18 +-- Dumped by pg_dump version 12.3 + +SET statement_timeout = 0; +SET lock_timeout = 0; +SET idle_in_transaction_session_timeout = 0; +SET client_encoding = 'UTF8'; +SET standard_conforming_strings = on; +SELECT pg_catalog.set_config('search_path', '', false); +SET check_function_bodies = false; +SET xmloption = content; +SET client_min_messages = warning; +SET row_security = off; + +SET default_tablespace = ''; + +-- +-- Name: e2e_users; Type: TABLE; Schema: public; Owner: postgres +-- + +CREATE TABLE public.e2e_users ( + id uuid NOT NULL, + created_at timestamp without time zone NOT NULL, + updated_at timestamp without time zone NOT NULL +); + + +ALTER TABLE public.e2e_users OWNER TO postgres; + +-- +-- Name: schema_migration; Type: TABLE; Schema: public; Owner: postgres +-- + +CREATE TABLE public.schema_migration ( + version character varying(14) NOT NULL +); + + +ALTER TABLE public.schema_migration OWNER TO postgres; + +-- +-- Name: e2e_users e2e_users_pkey; Type: CONSTRAINT; Schema: public; Owner: postgres +-- + +ALTER TABLE ONLY public.e2e_users + ADD CONSTRAINT e2e_users_pkey PRIMARY KEY (id); + + +-- +-- Name: schema_migration_version_idx; Type: INDEX; Schema: public; Owner: postgres +-- + +CREATE UNIQUE INDEX schema_migration_version_idx ON public.schema_migration USING btree (version); + + +-- +-- PostgreSQL database dump complete +-- + diff --git a/internal/e2e/fixtures/postgres/down/2.sql b/internal/e2e/fixtures/postgres/down/2.sql new file mode 100644 index 00000000..6ed5ef7e --- /dev/null +++ b/internal/e2e/fixtures/postgres/down/2.sql @@ -0,0 +1,107 @@ +-- +-- PostgreSQL database dump +-- + +-- Dumped from database version 9.6.18 +-- Dumped by pg_dump version 12.3 + +SET statement_timeout = 0; +SET lock_timeout = 0; +SET idle_in_transaction_session_timeout = 0; +SET client_encoding = 'UTF8'; +SET standard_conforming_strings = on; +SELECT pg_catalog.set_config('search_path', '', false); +SET check_function_bodies = false; +SET xmloption = content; +SET client_min_messages = warning; +SET row_security = off; + +SET default_tablespace = ''; + +-- +-- Name: e2e_user_notes; Type: TABLE; Schema: public; Owner: postgres +-- + +CREATE TABLE public.e2e_user_notes ( + id uuid NOT NULL, + notes character varying(255), + user_id uuid NOT NULL, + title character varying(64) DEFAULT ''::character varying NOT NULL +); + + +ALTER TABLE public.e2e_user_notes OWNER TO postgres; + +-- +-- Name: e2e_users; Type: TABLE; Schema: public; Owner: postgres +-- + +CREATE TABLE public.e2e_users ( + id uuid NOT NULL, + created_at timestamp without time zone NOT NULL, + updated_at timestamp without time zone NOT NULL +); + + +ALTER TABLE public.e2e_users OWNER TO postgres; + +-- +-- Name: schema_migration; Type: TABLE; Schema: public; Owner: postgres +-- + +CREATE TABLE public.schema_migration ( + version character varying(14) NOT NULL +); + + +ALTER TABLE public.schema_migration OWNER TO postgres; + +-- +-- Name: e2e_user_notes e2e_user_notes_pkey; Type: CONSTRAINT; Schema: public; Owner: postgres +-- + +ALTER TABLE ONLY public.e2e_user_notes + ADD CONSTRAINT e2e_user_notes_pkey PRIMARY KEY (id); + + +-- +-- Name: e2e_users e2e_users_pkey; Type: CONSTRAINT; Schema: public; Owner: postgres +-- + +ALTER TABLE ONLY public.e2e_users + ADD CONSTRAINT e2e_users_pkey PRIMARY KEY (id); + + +-- +-- Name: e2e_user_notes_title_idx; Type: INDEX; Schema: public; Owner: postgres +-- + +CREATE INDEX e2e_user_notes_title_idx ON public.e2e_user_notes USING btree (title); + + +-- +-- Name: e2e_user_notes_user_id_idx; Type: INDEX; Schema: public; Owner: postgres +-- + +CREATE INDEX e2e_user_notes_user_id_idx ON public.e2e_user_notes USING btree (user_id); + + +-- +-- Name: schema_migration_version_idx; Type: INDEX; Schema: public; Owner: postgres +-- + +CREATE UNIQUE INDEX schema_migration_version_idx ON public.schema_migration USING btree (version); + + +-- +-- Name: e2e_user_notes e2e_user_notes_user_id_fkey; Type: FK CONSTRAINT; Schema: public; Owner: postgres +-- + +ALTER TABLE ONLY public.e2e_user_notes + ADD CONSTRAINT e2e_user_notes_user_id_fkey FOREIGN KEY (user_id) REFERENCES public.e2e_users(id) ON DELETE CASCADE; + + +-- +-- PostgreSQL database dump complete +-- + diff --git a/internal/e2e/fixtures/postgres/down/3.sql b/internal/e2e/fixtures/postgres/down/3.sql new file mode 100644 index 00000000..1df0c431 --- /dev/null +++ b/internal/e2e/fixtures/postgres/down/3.sql @@ -0,0 +1,99 @@ +-- +-- PostgreSQL database dump +-- + +-- Dumped from database version 9.6.18 +-- Dumped by pg_dump version 12.3 + +SET statement_timeout = 0; +SET lock_timeout = 0; +SET idle_in_transaction_session_timeout = 0; +SET client_encoding = 'UTF8'; +SET standard_conforming_strings = on; +SELECT pg_catalog.set_config('search_path', '', false); +SET check_function_bodies = false; +SET xmloption = content; +SET client_min_messages = warning; +SET row_security = off; + +SET default_tablespace = ''; + +-- +-- Name: e2e_user_notes; Type: TABLE; Schema: public; Owner: postgres +-- + +CREATE TABLE public.e2e_user_notes ( + id uuid NOT NULL, + notes character varying(255), + user_id uuid NOT NULL +); + + +ALTER TABLE public.e2e_user_notes OWNER TO postgres; + +-- +-- Name: e2e_users; Type: TABLE; Schema: public; Owner: postgres +-- + +CREATE TABLE public.e2e_users ( + id uuid NOT NULL, + created_at timestamp without time zone NOT NULL, + updated_at timestamp without time zone NOT NULL +); + + +ALTER TABLE public.e2e_users OWNER TO postgres; + +-- +-- Name: schema_migration; Type: TABLE; Schema: public; Owner: postgres +-- + +CREATE TABLE public.schema_migration ( + version character varying(14) NOT NULL +); + + +ALTER TABLE public.schema_migration OWNER TO postgres; + +-- +-- Name: e2e_user_notes e2e_user_notes_pkey; Type: CONSTRAINT; Schema: public; Owner: postgres +-- + +ALTER TABLE ONLY public.e2e_user_notes + ADD CONSTRAINT e2e_user_notes_pkey PRIMARY KEY (id); + + +-- +-- Name: e2e_users e2e_users_pkey; Type: CONSTRAINT; Schema: public; Owner: postgres +-- + +ALTER TABLE ONLY public.e2e_users + ADD CONSTRAINT e2e_users_pkey PRIMARY KEY (id); + + +-- +-- Name: e2e_user_notes_user_id_idx; Type: INDEX; Schema: public; Owner: postgres +-- + +CREATE INDEX e2e_user_notes_user_id_idx ON public.e2e_user_notes USING btree (user_id); + + +-- +-- Name: schema_migration_version_idx; Type: INDEX; Schema: public; Owner: postgres +-- + +CREATE UNIQUE INDEX schema_migration_version_idx ON public.schema_migration USING btree (version); + + +-- +-- Name: e2e_user_notes e2e_user_notes_user_id_fkey; Type: FK CONSTRAINT; Schema: public; Owner: postgres +-- + +ALTER TABLE ONLY public.e2e_user_notes + ADD CONSTRAINT e2e_user_notes_user_id_fkey FOREIGN KEY (user_id) REFERENCES public.e2e_users(id) ON DELETE CASCADE; + + +-- +-- PostgreSQL database dump complete +-- + diff --git a/internal/e2e/fixtures/postgres/down/4.sql b/internal/e2e/fixtures/postgres/down/4.sql new file mode 100644 index 00000000..c3f525cb --- /dev/null +++ b/internal/e2e/fixtures/postgres/down/4.sql @@ -0,0 +1,107 @@ +-- +-- PostgreSQL database dump +-- + +-- Dumped from database version 9.6.18 +-- Dumped by pg_dump version 12.3 + +SET statement_timeout = 0; +SET lock_timeout = 0; +SET idle_in_transaction_session_timeout = 0; +SET client_encoding = 'UTF8'; +SET standard_conforming_strings = on; +SELECT pg_catalog.set_config('search_path', '', false); +SET check_function_bodies = false; +SET xmloption = content; +SET client_min_messages = warning; +SET row_security = off; + +SET default_tablespace = ''; + +-- +-- Name: e2e_user_notes; Type: TABLE; Schema: public; Owner: postgres +-- + +CREATE TABLE public.e2e_user_notes ( + id uuid NOT NULL, + notes character varying(255), + user_id uuid NOT NULL, + slug character varying(64) NOT NULL +); + + +ALTER TABLE public.e2e_user_notes OWNER TO postgres; + +-- +-- Name: e2e_users; Type: TABLE; Schema: public; Owner: postgres +-- + +CREATE TABLE public.e2e_users ( + id uuid NOT NULL, + created_at timestamp without time zone NOT NULL, + updated_at timestamp without time zone NOT NULL +); + + +ALTER TABLE public.e2e_users OWNER TO postgres; + +-- +-- Name: schema_migration; Type: TABLE; Schema: public; Owner: postgres +-- + +CREATE TABLE public.schema_migration ( + version character varying(14) NOT NULL +); + + +ALTER TABLE public.schema_migration OWNER TO postgres; + +-- +-- Name: e2e_user_notes e2e_user_notes_pkey; Type: CONSTRAINT; Schema: public; Owner: postgres +-- + +ALTER TABLE ONLY public.e2e_user_notes + ADD CONSTRAINT e2e_user_notes_pkey PRIMARY KEY (id); + + +-- +-- Name: e2e_users e2e_users_pkey; Type: CONSTRAINT; Schema: public; Owner: postgres +-- + +ALTER TABLE ONLY public.e2e_users + ADD CONSTRAINT e2e_users_pkey PRIMARY KEY (id); + + +-- +-- Name: e2e_user_notes_slug_idx; Type: INDEX; Schema: public; Owner: postgres +-- + +CREATE UNIQUE INDEX e2e_user_notes_slug_idx ON public.e2e_user_notes USING btree (slug); + + +-- +-- Name: e2e_user_notes_user_id_idx; Type: INDEX; Schema: public; Owner: postgres +-- + +CREATE INDEX e2e_user_notes_user_id_idx ON public.e2e_user_notes USING btree (user_id); + + +-- +-- Name: schema_migration_version_idx; Type: INDEX; Schema: public; Owner: postgres +-- + +CREATE UNIQUE INDEX schema_migration_version_idx ON public.schema_migration USING btree (version); + + +-- +-- Name: e2e_user_notes e2e_user_notes_user_id_fkey; Type: FK CONSTRAINT; Schema: public; Owner: postgres +-- + +ALTER TABLE ONLY public.e2e_user_notes + ADD CONSTRAINT e2e_user_notes_user_id_fkey FOREIGN KEY (user_id) REFERENCES public.e2e_users(id) ON DELETE CASCADE; + + +-- +-- PostgreSQL database dump complete +-- + diff --git a/internal/e2e/fixtures/postgres/down/5.sql b/internal/e2e/fixtures/postgres/down/5.sql new file mode 100644 index 00000000..c3f525cb --- /dev/null +++ b/internal/e2e/fixtures/postgres/down/5.sql @@ -0,0 +1,107 @@ +-- +-- PostgreSQL database dump +-- + +-- Dumped from database version 9.6.18 +-- Dumped by pg_dump version 12.3 + +SET statement_timeout = 0; +SET lock_timeout = 0; +SET idle_in_transaction_session_timeout = 0; +SET client_encoding = 'UTF8'; +SET standard_conforming_strings = on; +SELECT pg_catalog.set_config('search_path', '', false); +SET check_function_bodies = false; +SET xmloption = content; +SET client_min_messages = warning; +SET row_security = off; + +SET default_tablespace = ''; + +-- +-- Name: e2e_user_notes; Type: TABLE; Schema: public; Owner: postgres +-- + +CREATE TABLE public.e2e_user_notes ( + id uuid NOT NULL, + notes character varying(255), + user_id uuid NOT NULL, + slug character varying(64) NOT NULL +); + + +ALTER TABLE public.e2e_user_notes OWNER TO postgres; + +-- +-- Name: e2e_users; Type: TABLE; Schema: public; Owner: postgres +-- + +CREATE TABLE public.e2e_users ( + id uuid NOT NULL, + created_at timestamp without time zone NOT NULL, + updated_at timestamp without time zone NOT NULL +); + + +ALTER TABLE public.e2e_users OWNER TO postgres; + +-- +-- Name: schema_migration; Type: TABLE; Schema: public; Owner: postgres +-- + +CREATE TABLE public.schema_migration ( + version character varying(14) NOT NULL +); + + +ALTER TABLE public.schema_migration OWNER TO postgres; + +-- +-- Name: e2e_user_notes e2e_user_notes_pkey; Type: CONSTRAINT; Schema: public; Owner: postgres +-- + +ALTER TABLE ONLY public.e2e_user_notes + ADD CONSTRAINT e2e_user_notes_pkey PRIMARY KEY (id); + + +-- +-- Name: e2e_users e2e_users_pkey; Type: CONSTRAINT; Schema: public; Owner: postgres +-- + +ALTER TABLE ONLY public.e2e_users + ADD CONSTRAINT e2e_users_pkey PRIMARY KEY (id); + + +-- +-- Name: e2e_user_notes_slug_idx; Type: INDEX; Schema: public; Owner: postgres +-- + +CREATE UNIQUE INDEX e2e_user_notes_slug_idx ON public.e2e_user_notes USING btree (slug); + + +-- +-- Name: e2e_user_notes_user_id_idx; Type: INDEX; Schema: public; Owner: postgres +-- + +CREATE INDEX e2e_user_notes_user_id_idx ON public.e2e_user_notes USING btree (user_id); + + +-- +-- Name: schema_migration_version_idx; Type: INDEX; Schema: public; Owner: postgres +-- + +CREATE UNIQUE INDEX schema_migration_version_idx ON public.schema_migration USING btree (version); + + +-- +-- Name: e2e_user_notes e2e_user_notes_user_id_fkey; Type: FK CONSTRAINT; Schema: public; Owner: postgres +-- + +ALTER TABLE ONLY public.e2e_user_notes + ADD CONSTRAINT e2e_user_notes_user_id_fkey FOREIGN KEY (user_id) REFERENCES public.e2e_users(id) ON DELETE CASCADE; + + +-- +-- PostgreSQL database dump complete +-- + diff --git a/internal/e2e/fixtures/postgres/down/6.sql b/internal/e2e/fixtures/postgres/down/6.sql new file mode 100644 index 00000000..c3f525cb --- /dev/null +++ b/internal/e2e/fixtures/postgres/down/6.sql @@ -0,0 +1,107 @@ +-- +-- PostgreSQL database dump +-- + +-- Dumped from database version 9.6.18 +-- Dumped by pg_dump version 12.3 + +SET statement_timeout = 0; +SET lock_timeout = 0; +SET idle_in_transaction_session_timeout = 0; +SET client_encoding = 'UTF8'; +SET standard_conforming_strings = on; +SELECT pg_catalog.set_config('search_path', '', false); +SET check_function_bodies = false; +SET xmloption = content; +SET client_min_messages = warning; +SET row_security = off; + +SET default_tablespace = ''; + +-- +-- Name: e2e_user_notes; Type: TABLE; Schema: public; Owner: postgres +-- + +CREATE TABLE public.e2e_user_notes ( + id uuid NOT NULL, + notes character varying(255), + user_id uuid NOT NULL, + slug character varying(64) NOT NULL +); + + +ALTER TABLE public.e2e_user_notes OWNER TO postgres; + +-- +-- Name: e2e_users; Type: TABLE; Schema: public; Owner: postgres +-- + +CREATE TABLE public.e2e_users ( + id uuid NOT NULL, + created_at timestamp without time zone NOT NULL, + updated_at timestamp without time zone NOT NULL +); + + +ALTER TABLE public.e2e_users OWNER TO postgres; + +-- +-- Name: schema_migration; Type: TABLE; Schema: public; Owner: postgres +-- + +CREATE TABLE public.schema_migration ( + version character varying(14) NOT NULL +); + + +ALTER TABLE public.schema_migration OWNER TO postgres; + +-- +-- Name: e2e_user_notes e2e_user_notes_pkey; Type: CONSTRAINT; Schema: public; Owner: postgres +-- + +ALTER TABLE ONLY public.e2e_user_notes + ADD CONSTRAINT e2e_user_notes_pkey PRIMARY KEY (id); + + +-- +-- Name: e2e_users e2e_users_pkey; Type: CONSTRAINT; Schema: public; Owner: postgres +-- + +ALTER TABLE ONLY public.e2e_users + ADD CONSTRAINT e2e_users_pkey PRIMARY KEY (id); + + +-- +-- Name: e2e_user_notes_slug_idx; Type: INDEX; Schema: public; Owner: postgres +-- + +CREATE UNIQUE INDEX e2e_user_notes_slug_idx ON public.e2e_user_notes USING btree (slug); + + +-- +-- Name: e2e_user_notes_user_id_idx; Type: INDEX; Schema: public; Owner: postgres +-- + +CREATE INDEX e2e_user_notes_user_id_idx ON public.e2e_user_notes USING btree (user_id); + + +-- +-- Name: schema_migration_version_idx; Type: INDEX; Schema: public; Owner: postgres +-- + +CREATE UNIQUE INDEX schema_migration_version_idx ON public.schema_migration USING btree (version); + + +-- +-- Name: e2e_user_notes e2e_user_notes_user_id_fkey; Type: FK CONSTRAINT; Schema: public; Owner: postgres +-- + +ALTER TABLE ONLY public.e2e_user_notes + ADD CONSTRAINT e2e_user_notes_user_id_fkey FOREIGN KEY (user_id) REFERENCES public.e2e_users(id) ON DELETE CASCADE; + + +-- +-- PostgreSQL database dump complete +-- + diff --git a/internal/e2e/fixtures/postgres/up/0.sql b/internal/e2e/fixtures/postgres/up/0.sql new file mode 100644 index 00000000..48055796 --- /dev/null +++ b/internal/e2e/fixtures/postgres/up/0.sql @@ -0,0 +1,63 @@ +-- +-- PostgreSQL database dump +-- + +-- Dumped from database version 9.6.18 +-- Dumped by pg_dump version 12.3 + +SET statement_timeout = 0; +SET lock_timeout = 0; +SET idle_in_transaction_session_timeout = 0; +SET client_encoding = 'UTF8'; +SET standard_conforming_strings = on; +SELECT pg_catalog.set_config('search_path', '', false); +SET check_function_bodies = false; +SET xmloption = content; +SET client_min_messages = warning; +SET row_security = off; + +SET default_tablespace = ''; + +-- +-- Name: e2e_users; Type: TABLE; Schema: public; Owner: postgres +-- + +CREATE TABLE public.e2e_users ( + id uuid NOT NULL, + created_at timestamp without time zone NOT NULL, + updated_at timestamp without time zone NOT NULL +); + + +ALTER TABLE public.e2e_users OWNER TO postgres; + +-- +-- Name: schema_migration; Type: TABLE; Schema: public; Owner: postgres +-- + +CREATE TABLE public.schema_migration ( + version character varying(14) NOT NULL +); + + +ALTER TABLE public.schema_migration OWNER TO postgres; + +-- +-- Name: e2e_users e2e_users_pkey; Type: CONSTRAINT; Schema: public; Owner: postgres +-- + +ALTER TABLE ONLY public.e2e_users + ADD CONSTRAINT e2e_users_pkey PRIMARY KEY (id); + + +-- +-- Name: schema_migration_version_idx; Type: INDEX; Schema: public; Owner: postgres +-- + +CREATE UNIQUE INDEX schema_migration_version_idx ON public.schema_migration USING btree (version); + + +-- +-- PostgreSQL database dump complete +-- + diff --git a/internal/e2e/fixtures/postgres/up/1.sql b/internal/e2e/fixtures/postgres/up/1.sql new file mode 100644 index 00000000..af4e7d11 --- /dev/null +++ b/internal/e2e/fixtures/postgres/up/1.sql @@ -0,0 +1,107 @@ +-- +-- PostgreSQL database dump +-- + +-- Dumped from database version 9.6.18 +-- Dumped by pg_dump version 12.3 + +SET statement_timeout = 0; +SET lock_timeout = 0; +SET idle_in_transaction_session_timeout = 0; +SET client_encoding = 'UTF8'; +SET standard_conforming_strings = on; +SELECT pg_catalog.set_config('search_path', '', false); +SET check_function_bodies = false; +SET xmloption = content; +SET client_min_messages = warning; +SET row_security = off; + +SET default_tablespace = ''; + +-- +-- Name: e2e_user_notes; Type: TABLE; Schema: public; Owner: postgres +-- + +CREATE TABLE public.e2e_user_notes ( + id uuid NOT NULL, + notes character varying(255), + title character varying(64) DEFAULT ''::character varying NOT NULL, + user_id uuid NOT NULL +); + + +ALTER TABLE public.e2e_user_notes OWNER TO postgres; + +-- +-- Name: e2e_users; Type: TABLE; Schema: public; Owner: postgres +-- + +CREATE TABLE public.e2e_users ( + id uuid NOT NULL, + created_at timestamp without time zone NOT NULL, + updated_at timestamp without time zone NOT NULL +); + + +ALTER TABLE public.e2e_users OWNER TO postgres; + +-- +-- Name: schema_migration; Type: TABLE; Schema: public; Owner: postgres +-- + +CREATE TABLE public.schema_migration ( + version character varying(14) NOT NULL +); + + +ALTER TABLE public.schema_migration OWNER TO postgres; + +-- +-- Name: e2e_user_notes e2e_user_notes_pkey; Type: CONSTRAINT; Schema: public; Owner: postgres +-- + +ALTER TABLE ONLY public.e2e_user_notes + ADD CONSTRAINT e2e_user_notes_pkey PRIMARY KEY (id); + + +-- +-- Name: e2e_users e2e_users_pkey; Type: CONSTRAINT; Schema: public; Owner: postgres +-- + +ALTER TABLE ONLY public.e2e_users + ADD CONSTRAINT e2e_users_pkey PRIMARY KEY (id); + + +-- +-- Name: e2e_user_notes_title_idx; Type: INDEX; Schema: public; Owner: postgres +-- + +CREATE INDEX e2e_user_notes_title_idx ON public.e2e_user_notes USING btree (title); + + +-- +-- Name: e2e_user_notes_user_id_idx; Type: INDEX; Schema: public; Owner: postgres +-- + +CREATE INDEX e2e_user_notes_user_id_idx ON public.e2e_user_notes USING btree (user_id); + + +-- +-- Name: schema_migration_version_idx; Type: INDEX; Schema: public; Owner: postgres +-- + +CREATE UNIQUE INDEX schema_migration_version_idx ON public.schema_migration USING btree (version); + + +-- +-- Name: e2e_user_notes e2e_user_notes_user_id_fkey; Type: FK CONSTRAINT; Schema: public; Owner: postgres +-- + +ALTER TABLE ONLY public.e2e_user_notes + ADD CONSTRAINT e2e_user_notes_user_id_fkey FOREIGN KEY (user_id) REFERENCES public.e2e_users(id) ON DELETE CASCADE; + + +-- +-- PostgreSQL database dump complete +-- + diff --git a/internal/e2e/fixtures/postgres/up/2.sql b/internal/e2e/fixtures/postgres/up/2.sql new file mode 100644 index 00000000..1df0c431 --- /dev/null +++ b/internal/e2e/fixtures/postgres/up/2.sql @@ -0,0 +1,99 @@ +-- +-- PostgreSQL database dump +-- + +-- Dumped from database version 9.6.18 +-- Dumped by pg_dump version 12.3 + +SET statement_timeout = 0; +SET lock_timeout = 0; +SET idle_in_transaction_session_timeout = 0; +SET client_encoding = 'UTF8'; +SET standard_conforming_strings = on; +SELECT pg_catalog.set_config('search_path', '', false); +SET check_function_bodies = false; +SET xmloption = content; +SET client_min_messages = warning; +SET row_security = off; + +SET default_tablespace = ''; + +-- +-- Name: e2e_user_notes; Type: TABLE; Schema: public; Owner: postgres +-- + +CREATE TABLE public.e2e_user_notes ( + id uuid NOT NULL, + notes character varying(255), + user_id uuid NOT NULL +); + + +ALTER TABLE public.e2e_user_notes OWNER TO postgres; + +-- +-- Name: e2e_users; Type: TABLE; Schema: public; Owner: postgres +-- + +CREATE TABLE public.e2e_users ( + id uuid NOT NULL, + created_at timestamp without time zone NOT NULL, + updated_at timestamp without time zone NOT NULL +); + + +ALTER TABLE public.e2e_users OWNER TO postgres; + +-- +-- Name: schema_migration; Type: TABLE; Schema: public; Owner: postgres +-- + +CREATE TABLE public.schema_migration ( + version character varying(14) NOT NULL +); + + +ALTER TABLE public.schema_migration OWNER TO postgres; + +-- +-- Name: e2e_user_notes e2e_user_notes_pkey; Type: CONSTRAINT; Schema: public; Owner: postgres +-- + +ALTER TABLE ONLY public.e2e_user_notes + ADD CONSTRAINT e2e_user_notes_pkey PRIMARY KEY (id); + + +-- +-- Name: e2e_users e2e_users_pkey; Type: CONSTRAINT; Schema: public; Owner: postgres +-- + +ALTER TABLE ONLY public.e2e_users + ADD CONSTRAINT e2e_users_pkey PRIMARY KEY (id); + + +-- +-- Name: e2e_user_notes_user_id_idx; Type: INDEX; Schema: public; Owner: postgres +-- + +CREATE INDEX e2e_user_notes_user_id_idx ON public.e2e_user_notes USING btree (user_id); + + +-- +-- Name: schema_migration_version_idx; Type: INDEX; Schema: public; Owner: postgres +-- + +CREATE UNIQUE INDEX schema_migration_version_idx ON public.schema_migration USING btree (version); + + +-- +-- Name: e2e_user_notes e2e_user_notes_user_id_fkey; Type: FK CONSTRAINT; Schema: public; Owner: postgres +-- + +ALTER TABLE ONLY public.e2e_user_notes + ADD CONSTRAINT e2e_user_notes_user_id_fkey FOREIGN KEY (user_id) REFERENCES public.e2e_users(id) ON DELETE CASCADE; + + +-- +-- PostgreSQL database dump complete +-- + diff --git a/internal/e2e/fixtures/postgres/up/3.sql b/internal/e2e/fixtures/postgres/up/3.sql new file mode 100644 index 00000000..dfcfd11b --- /dev/null +++ b/internal/e2e/fixtures/postgres/up/3.sql @@ -0,0 +1,100 @@ +-- +-- PostgreSQL database dump +-- + +-- Dumped from database version 9.6.18 +-- Dumped by pg_dump version 12.3 + +SET statement_timeout = 0; +SET lock_timeout = 0; +SET idle_in_transaction_session_timeout = 0; +SET client_encoding = 'UTF8'; +SET standard_conforming_strings = on; +SELECT pg_catalog.set_config('search_path', '', false); +SET check_function_bodies = false; +SET xmloption = content; +SET client_min_messages = warning; +SET row_security = off; + +SET default_tablespace = ''; + +-- +-- Name: e2e_user_notes; Type: TABLE; Schema: public; Owner: postgres +-- + +CREATE TABLE public.e2e_user_notes ( + id uuid NOT NULL, + notes character varying(255), + user_id uuid NOT NULL, + slug character varying(64) +); + + +ALTER TABLE public.e2e_user_notes OWNER TO postgres; + +-- +-- Name: e2e_users; Type: TABLE; Schema: public; Owner: postgres +-- + +CREATE TABLE public.e2e_users ( + id uuid NOT NULL, + created_at timestamp without time zone NOT NULL, + updated_at timestamp without time zone NOT NULL +); + + +ALTER TABLE public.e2e_users OWNER TO postgres; + +-- +-- Name: schema_migration; Type: TABLE; Schema: public; Owner: postgres +-- + +CREATE TABLE public.schema_migration ( + version character varying(14) NOT NULL +); + + +ALTER TABLE public.schema_migration OWNER TO postgres; + +-- +-- Name: e2e_user_notes e2e_user_notes_pkey; Type: CONSTRAINT; Schema: public; Owner: postgres +-- + +ALTER TABLE ONLY public.e2e_user_notes + ADD CONSTRAINT e2e_user_notes_pkey PRIMARY KEY (id); + + +-- +-- Name: e2e_users e2e_users_pkey; Type: CONSTRAINT; Schema: public; Owner: postgres +-- + +ALTER TABLE ONLY public.e2e_users + ADD CONSTRAINT e2e_users_pkey PRIMARY KEY (id); + + +-- +-- Name: e2e_user_notes_user_id_idx; Type: INDEX; Schema: public; Owner: postgres +-- + +CREATE INDEX e2e_user_notes_user_id_idx ON public.e2e_user_notes USING btree (user_id); + + +-- +-- Name: schema_migration_version_idx; Type: INDEX; Schema: public; Owner: postgres +-- + +CREATE UNIQUE INDEX schema_migration_version_idx ON public.schema_migration USING btree (version); + + +-- +-- Name: e2e_user_notes e2e_user_notes_user_id_fkey; Type: FK CONSTRAINT; Schema: public; Owner: postgres +-- + +ALTER TABLE ONLY public.e2e_user_notes + ADD CONSTRAINT e2e_user_notes_user_id_fkey FOREIGN KEY (user_id) REFERENCES public.e2e_users(id) ON DELETE CASCADE; + + +-- +-- PostgreSQL database dump complete +-- + diff --git a/internal/e2e/fixtures/postgres/up/4.sql b/internal/e2e/fixtures/postgres/up/4.sql new file mode 100644 index 00000000..dfcfd11b --- /dev/null +++ b/internal/e2e/fixtures/postgres/up/4.sql @@ -0,0 +1,100 @@ +-- +-- PostgreSQL database dump +-- + +-- Dumped from database version 9.6.18 +-- Dumped by pg_dump version 12.3 + +SET statement_timeout = 0; +SET lock_timeout = 0; +SET idle_in_transaction_session_timeout = 0; +SET client_encoding = 'UTF8'; +SET standard_conforming_strings = on; +SELECT pg_catalog.set_config('search_path', '', false); +SET check_function_bodies = false; +SET xmloption = content; +SET client_min_messages = warning; +SET row_security = off; + +SET default_tablespace = ''; + +-- +-- Name: e2e_user_notes; Type: TABLE; Schema: public; Owner: postgres +-- + +CREATE TABLE public.e2e_user_notes ( + id uuid NOT NULL, + notes character varying(255), + user_id uuid NOT NULL, + slug character varying(64) +); + + +ALTER TABLE public.e2e_user_notes OWNER TO postgres; + +-- +-- Name: e2e_users; Type: TABLE; Schema: public; Owner: postgres +-- + +CREATE TABLE public.e2e_users ( + id uuid NOT NULL, + created_at timestamp without time zone NOT NULL, + updated_at timestamp without time zone NOT NULL +); + + +ALTER TABLE public.e2e_users OWNER TO postgres; + +-- +-- Name: schema_migration; Type: TABLE; Schema: public; Owner: postgres +-- + +CREATE TABLE public.schema_migration ( + version character varying(14) NOT NULL +); + + +ALTER TABLE public.schema_migration OWNER TO postgres; + +-- +-- Name: e2e_user_notes e2e_user_notes_pkey; Type: CONSTRAINT; Schema: public; Owner: postgres +-- + +ALTER TABLE ONLY public.e2e_user_notes + ADD CONSTRAINT e2e_user_notes_pkey PRIMARY KEY (id); + + +-- +-- Name: e2e_users e2e_users_pkey; Type: CONSTRAINT; Schema: public; Owner: postgres +-- + +ALTER TABLE ONLY public.e2e_users + ADD CONSTRAINT e2e_users_pkey PRIMARY KEY (id); + + +-- +-- Name: e2e_user_notes_user_id_idx; Type: INDEX; Schema: public; Owner: postgres +-- + +CREATE INDEX e2e_user_notes_user_id_idx ON public.e2e_user_notes USING btree (user_id); + + +-- +-- Name: schema_migration_version_idx; Type: INDEX; Schema: public; Owner: postgres +-- + +CREATE UNIQUE INDEX schema_migration_version_idx ON public.schema_migration USING btree (version); + + +-- +-- Name: e2e_user_notes e2e_user_notes_user_id_fkey; Type: FK CONSTRAINT; Schema: public; Owner: postgres +-- + +ALTER TABLE ONLY public.e2e_user_notes + ADD CONSTRAINT e2e_user_notes_user_id_fkey FOREIGN KEY (user_id) REFERENCES public.e2e_users(id) ON DELETE CASCADE; + + +-- +-- PostgreSQL database dump complete +-- + diff --git a/internal/e2e/fixtures/postgres/up/5.sql b/internal/e2e/fixtures/postgres/up/5.sql new file mode 100644 index 00000000..c3f525cb --- /dev/null +++ b/internal/e2e/fixtures/postgres/up/5.sql @@ -0,0 +1,107 @@ +-- +-- PostgreSQL database dump +-- + +-- Dumped from database version 9.6.18 +-- Dumped by pg_dump version 12.3 + +SET statement_timeout = 0; +SET lock_timeout = 0; +SET idle_in_transaction_session_timeout = 0; +SET client_encoding = 'UTF8'; +SET standard_conforming_strings = on; +SELECT pg_catalog.set_config('search_path', '', false); +SET check_function_bodies = false; +SET xmloption = content; +SET client_min_messages = warning; +SET row_security = off; + +SET default_tablespace = ''; + +-- +-- Name: e2e_user_notes; Type: TABLE; Schema: public; Owner: postgres +-- + +CREATE TABLE public.e2e_user_notes ( + id uuid NOT NULL, + notes character varying(255), + user_id uuid NOT NULL, + slug character varying(64) NOT NULL +); + + +ALTER TABLE public.e2e_user_notes OWNER TO postgres; + +-- +-- Name: e2e_users; Type: TABLE; Schema: public; Owner: postgres +-- + +CREATE TABLE public.e2e_users ( + id uuid NOT NULL, + created_at timestamp without time zone NOT NULL, + updated_at timestamp without time zone NOT NULL +); + + +ALTER TABLE public.e2e_users OWNER TO postgres; + +-- +-- Name: schema_migration; Type: TABLE; Schema: public; Owner: postgres +-- + +CREATE TABLE public.schema_migration ( + version character varying(14) NOT NULL +); + + +ALTER TABLE public.schema_migration OWNER TO postgres; + +-- +-- Name: e2e_user_notes e2e_user_notes_pkey; Type: CONSTRAINT; Schema: public; Owner: postgres +-- + +ALTER TABLE ONLY public.e2e_user_notes + ADD CONSTRAINT e2e_user_notes_pkey PRIMARY KEY (id); + + +-- +-- Name: e2e_users e2e_users_pkey; Type: CONSTRAINT; Schema: public; Owner: postgres +-- + +ALTER TABLE ONLY public.e2e_users + ADD CONSTRAINT e2e_users_pkey PRIMARY KEY (id); + + +-- +-- Name: e2e_user_notes_slug_idx; Type: INDEX; Schema: public; Owner: postgres +-- + +CREATE UNIQUE INDEX e2e_user_notes_slug_idx ON public.e2e_user_notes USING btree (slug); + + +-- +-- Name: e2e_user_notes_user_id_idx; Type: INDEX; Schema: public; Owner: postgres +-- + +CREATE INDEX e2e_user_notes_user_id_idx ON public.e2e_user_notes USING btree (user_id); + + +-- +-- Name: schema_migration_version_idx; Type: INDEX; Schema: public; Owner: postgres +-- + +CREATE UNIQUE INDEX schema_migration_version_idx ON public.schema_migration USING btree (version); + + +-- +-- Name: e2e_user_notes e2e_user_notes_user_id_fkey; Type: FK CONSTRAINT; Schema: public; Owner: postgres +-- + +ALTER TABLE ONLY public.e2e_user_notes + ADD CONSTRAINT e2e_user_notes_user_id_fkey FOREIGN KEY (user_id) REFERENCES public.e2e_users(id) ON DELETE CASCADE; + + +-- +-- PostgreSQL database dump complete +-- + diff --git a/internal/e2e/fixtures/postgres/up/6.sql b/internal/e2e/fixtures/postgres/up/6.sql new file mode 100644 index 00000000..6820686d --- /dev/null +++ b/internal/e2e/fixtures/postgres/up/6.sql @@ -0,0 +1,107 @@ +-- +-- PostgreSQL database dump +-- + +-- Dumped from database version 9.6.18 +-- Dumped by pg_dump version 12.3 + +SET statement_timeout = 0; +SET lock_timeout = 0; +SET idle_in_transaction_session_timeout = 0; +SET client_encoding = 'UTF8'; +SET standard_conforming_strings = on; +SELECT pg_catalog.set_config('search_path', '', false); +SET check_function_bodies = false; +SET xmloption = content; +SET client_min_messages = warning; +SET row_security = off; + +SET default_tablespace = ''; + +-- +-- Name: e2e_user_posts; Type: TABLE; Schema: public; Owner: postgres +-- + +CREATE TABLE public.e2e_user_posts ( + id uuid NOT NULL, + notes character varying(255), + user_id uuid NOT NULL, + slug character varying(64) NOT NULL +); + + +ALTER TABLE public.e2e_user_posts OWNER TO postgres; + +-- +-- Name: e2e_users; Type: TABLE; Schema: public; Owner: postgres +-- + +CREATE TABLE public.e2e_users ( + id uuid NOT NULL, + created_at timestamp without time zone NOT NULL, + updated_at timestamp without time zone NOT NULL +); + + +ALTER TABLE public.e2e_users OWNER TO postgres; + +-- +-- Name: schema_migration; Type: TABLE; Schema: public; Owner: postgres +-- + +CREATE TABLE public.schema_migration ( + version character varying(14) NOT NULL +); + + +ALTER TABLE public.schema_migration OWNER TO postgres; + +-- +-- Name: e2e_user_posts e2e_user_notes_pkey; Type: CONSTRAINT; Schema: public; Owner: postgres +-- + +ALTER TABLE ONLY public.e2e_user_posts + ADD CONSTRAINT e2e_user_notes_pkey PRIMARY KEY (id); + + +-- +-- Name: e2e_users e2e_users_pkey; Type: CONSTRAINT; Schema: public; Owner: postgres +-- + +ALTER TABLE ONLY public.e2e_users + ADD CONSTRAINT e2e_users_pkey PRIMARY KEY (id); + + +-- +-- Name: e2e_user_notes_slug_idx; Type: INDEX; Schema: public; Owner: postgres +-- + +CREATE UNIQUE INDEX e2e_user_notes_slug_idx ON public.e2e_user_posts USING btree (slug); + + +-- +-- Name: e2e_user_notes_user_id_idx; Type: INDEX; Schema: public; Owner: postgres +-- + +CREATE INDEX e2e_user_notes_user_id_idx ON public.e2e_user_posts USING btree (user_id); + + +-- +-- Name: schema_migration_version_idx; Type: INDEX; Schema: public; Owner: postgres +-- + +CREATE UNIQUE INDEX schema_migration_version_idx ON public.schema_migration USING btree (version); + + +-- +-- Name: e2e_user_posts e2e_user_notes_user_id_fkey; Type: FK CONSTRAINT; Schema: public; Owner: postgres +-- + +ALTER TABLE ONLY public.e2e_user_posts + ADD CONSTRAINT e2e_user_notes_user_id_fkey FOREIGN KEY (user_id) REFERENCES public.e2e_users(id) ON DELETE CASCADE; + + +-- +-- PostgreSQL database dump complete +-- + diff --git a/internal/e2e/fixtures/sqlite3/down/0.sql b/internal/e2e/fixtures/sqlite3/down/0.sql new file mode 100644 index 00000000..c05edc39 --- /dev/null +++ b/internal/e2e/fixtures/sqlite3/down/0.sql @@ -0,0 +1,4 @@ +CREATE TABLE IF NOT EXISTS "schema_migration" ( +"version" TEXT NOT NULL +); +CREATE UNIQUE INDEX "schema_migration_version_idx" ON "schema_migration" (version); diff --git a/internal/e2e/fixtures/sqlite3/down/1.sql b/internal/e2e/fixtures/sqlite3/down/1.sql new file mode 100644 index 00000000..a195dc59 --- /dev/null +++ b/internal/e2e/fixtures/sqlite3/down/1.sql @@ -0,0 +1,9 @@ +CREATE TABLE IF NOT EXISTS "schema_migration" ( +"version" TEXT NOT NULL +); +CREATE UNIQUE INDEX "schema_migration_version_idx" ON "schema_migration" (version); +CREATE TABLE IF NOT EXISTS "e2e_users" ( +"id" TEXT PRIMARY KEY, +"created_at" DATETIME NOT NULL, +"updated_at" DATETIME NOT NULL +); diff --git a/internal/e2e/fixtures/sqlite3/down/2.sql b/internal/e2e/fixtures/sqlite3/down/2.sql new file mode 100644 index 00000000..ea34fc7a --- /dev/null +++ b/internal/e2e/fixtures/sqlite3/down/2.sql @@ -0,0 +1,16 @@ +CREATE TABLE IF NOT EXISTS "schema_migration" ( +"version" TEXT NOT NULL +); +CREATE UNIQUE INDEX "schema_migration_version_idx" ON "schema_migration" (version); +CREATE TABLE IF NOT EXISTS "e2e_users" ( +"id" TEXT PRIMARY KEY, +"created_at" DATETIME NOT NULL, +"updated_at" DATETIME NOT NULL +); +CREATE TABLE IF NOT EXISTS "e2e_user_notes" ( +"id" TEXT PRIMARY KEY, +"notes" TEXT, +"user_id" char(36) NOT NULL, "title" TEXT NOT NULL DEFAULT '', +FOREIGN KEY (user_id) REFERENCES e2e_users (id) ON UPDATE NO ACTION ON DELETE CASCADE +); +CREATE INDEX "e2e_user_notes_title_idx" ON "e2e_user_notes" (title); diff --git a/internal/e2e/fixtures/sqlite3/down/3.sql b/internal/e2e/fixtures/sqlite3/down/3.sql new file mode 100644 index 00000000..bbfbce92 --- /dev/null +++ b/internal/e2e/fixtures/sqlite3/down/3.sql @@ -0,0 +1,15 @@ +CREATE TABLE IF NOT EXISTS "schema_migration" ( +"version" TEXT NOT NULL +); +CREATE UNIQUE INDEX "schema_migration_version_idx" ON "schema_migration" (version); +CREATE TABLE IF NOT EXISTS "e2e_users" ( +"id" TEXT PRIMARY KEY, +"created_at" DATETIME NOT NULL, +"updated_at" DATETIME NOT NULL +); +CREATE TABLE IF NOT EXISTS "e2e_user_notes" ( +"id" TEXT PRIMARY KEY, +"notes" TEXT, +"user_id" char(36) NOT NULL, +FOREIGN KEY (user_id) REFERENCES e2e_users (id) ON UPDATE NO ACTION ON DELETE CASCADE +); diff --git a/internal/e2e/fixtures/sqlite3/down/4.sql b/internal/e2e/fixtures/sqlite3/down/4.sql new file mode 100644 index 00000000..eca44db6 --- /dev/null +++ b/internal/e2e/fixtures/sqlite3/down/4.sql @@ -0,0 +1,17 @@ +CREATE TABLE IF NOT EXISTS "schema_migration" ( +"version" TEXT NOT NULL +); +CREATE UNIQUE INDEX "schema_migration_version_idx" ON "schema_migration" (version); +CREATE TABLE IF NOT EXISTS "e2e_users" ( +"id" TEXT PRIMARY KEY, +"created_at" DATETIME NOT NULL, +"updated_at" DATETIME NOT NULL +); +CREATE TABLE IF NOT EXISTS "e2e_user_notes" ( +"id" TEXT PRIMARY KEY, +"notes" TEXT, +"user_id" char(36) NOT NULL, +"slug" TEXT NOT NULL, +FOREIGN KEY (user_id) REFERENCES e2e_users (id) ON UPDATE NO ACTION ON DELETE CASCADE +); +CREATE UNIQUE INDEX "e2e_user_notes_slug_idx" ON "e2e_user_notes" (slug); diff --git a/internal/e2e/fixtures/sqlite3/down/5.sql b/internal/e2e/fixtures/sqlite3/down/5.sql new file mode 100644 index 00000000..eca44db6 --- /dev/null +++ b/internal/e2e/fixtures/sqlite3/down/5.sql @@ -0,0 +1,17 @@ +CREATE TABLE IF NOT EXISTS "schema_migration" ( +"version" TEXT NOT NULL +); +CREATE UNIQUE INDEX "schema_migration_version_idx" ON "schema_migration" (version); +CREATE TABLE IF NOT EXISTS "e2e_users" ( +"id" TEXT PRIMARY KEY, +"created_at" DATETIME NOT NULL, +"updated_at" DATETIME NOT NULL +); +CREATE TABLE IF NOT EXISTS "e2e_user_notes" ( +"id" TEXT PRIMARY KEY, +"notes" TEXT, +"user_id" char(36) NOT NULL, +"slug" TEXT NOT NULL, +FOREIGN KEY (user_id) REFERENCES e2e_users (id) ON UPDATE NO ACTION ON DELETE CASCADE +); +CREATE UNIQUE INDEX "e2e_user_notes_slug_idx" ON "e2e_user_notes" (slug); diff --git a/internal/e2e/fixtures/sqlite3/down/6.sql b/internal/e2e/fixtures/sqlite3/down/6.sql new file mode 100644 index 00000000..eca44db6 --- /dev/null +++ b/internal/e2e/fixtures/sqlite3/down/6.sql @@ -0,0 +1,17 @@ +CREATE TABLE IF NOT EXISTS "schema_migration" ( +"version" TEXT NOT NULL +); +CREATE UNIQUE INDEX "schema_migration_version_idx" ON "schema_migration" (version); +CREATE TABLE IF NOT EXISTS "e2e_users" ( +"id" TEXT PRIMARY KEY, +"created_at" DATETIME NOT NULL, +"updated_at" DATETIME NOT NULL +); +CREATE TABLE IF NOT EXISTS "e2e_user_notes" ( +"id" TEXT PRIMARY KEY, +"notes" TEXT, +"user_id" char(36) NOT NULL, +"slug" TEXT NOT NULL, +FOREIGN KEY (user_id) REFERENCES e2e_users (id) ON UPDATE NO ACTION ON DELETE CASCADE +); +CREATE UNIQUE INDEX "e2e_user_notes_slug_idx" ON "e2e_user_notes" (slug); diff --git a/internal/e2e/fixtures/sqlite3/up/0.sql b/internal/e2e/fixtures/sqlite3/up/0.sql new file mode 100644 index 00000000..a195dc59 --- /dev/null +++ b/internal/e2e/fixtures/sqlite3/up/0.sql @@ -0,0 +1,9 @@ +CREATE TABLE IF NOT EXISTS "schema_migration" ( +"version" TEXT NOT NULL +); +CREATE UNIQUE INDEX "schema_migration_version_idx" ON "schema_migration" (version); +CREATE TABLE IF NOT EXISTS "e2e_users" ( +"id" TEXT PRIMARY KEY, +"created_at" DATETIME NOT NULL, +"updated_at" DATETIME NOT NULL +); diff --git a/internal/e2e/fixtures/sqlite3/up/1.sql b/internal/e2e/fixtures/sqlite3/up/1.sql new file mode 100644 index 00000000..ad3d96cf --- /dev/null +++ b/internal/e2e/fixtures/sqlite3/up/1.sql @@ -0,0 +1,18 @@ +CREATE TABLE IF NOT EXISTS "schema_migration" ( +"version" TEXT NOT NULL +); +CREATE UNIQUE INDEX "schema_migration_version_idx" ON "schema_migration" (version); +CREATE TABLE IF NOT EXISTS "e2e_users" ( +"id" TEXT PRIMARY KEY, +"created_at" DATETIME NOT NULL, +"updated_at" DATETIME NOT NULL +); +CREATE TABLE IF NOT EXISTS "e2e_user_notes" ( +"id" TEXT PRIMARY KEY, +"notes" TEXT, +"title" TEXT NOT NULL DEFAULT '', +"user_id" char(36) NOT NULL, +FOREIGN KEY (user_id) REFERENCES e2e_users (id) ON DELETE cascade +); +CREATE INDEX "e2e_user_notes_user_id_idx" ON "e2e_user_notes" (user_id); +CREATE INDEX "e2e_user_notes_title_idx" ON "e2e_user_notes" (title); diff --git a/internal/e2e/fixtures/sqlite3/up/2.sql b/internal/e2e/fixtures/sqlite3/up/2.sql new file mode 100644 index 00000000..0cfb6f4c --- /dev/null +++ b/internal/e2e/fixtures/sqlite3/up/2.sql @@ -0,0 +1,16 @@ +CREATE TABLE IF NOT EXISTS "schema_migration" ( +"version" TEXT NOT NULL +); +CREATE UNIQUE INDEX "schema_migration_version_idx" ON "schema_migration" (version); +CREATE TABLE IF NOT EXISTS "e2e_users" ( +"id" TEXT PRIMARY KEY, +"created_at" DATETIME NOT NULL, +"updated_at" DATETIME NOT NULL +); +CREATE TABLE IF NOT EXISTS "e2e_user_notes" ( +"id" TEXT PRIMARY KEY, +"notes" TEXT, +"user_id" char(36) NOT NULL, +FOREIGN KEY (user_id) REFERENCES e2e_users (id) ON UPDATE NO ACTION ON DELETE CASCADE +); +CREATE INDEX "e2e_user_notes_user_id_idx" ON "e2e_user_notes" (user_id); diff --git a/internal/e2e/fixtures/sqlite3/up/3.sql b/internal/e2e/fixtures/sqlite3/up/3.sql new file mode 100644 index 00000000..89d85409 --- /dev/null +++ b/internal/e2e/fixtures/sqlite3/up/3.sql @@ -0,0 +1,16 @@ +CREATE TABLE IF NOT EXISTS "schema_migration" ( +"version" TEXT NOT NULL +); +CREATE UNIQUE INDEX "schema_migration_version_idx" ON "schema_migration" (version); +CREATE TABLE IF NOT EXISTS "e2e_users" ( +"id" TEXT PRIMARY KEY, +"created_at" DATETIME NOT NULL, +"updated_at" DATETIME NOT NULL +); +CREATE TABLE IF NOT EXISTS "e2e_user_notes" ( +"id" TEXT PRIMARY KEY, +"notes" TEXT, +"user_id" char(36) NOT NULL, "slug" TEXT, +FOREIGN KEY (user_id) REFERENCES e2e_users (id) ON UPDATE NO ACTION ON DELETE CASCADE +); +CREATE INDEX "e2e_user_notes_user_id_idx" ON "e2e_user_notes" (user_id); diff --git a/internal/e2e/fixtures/sqlite3/up/4.sql b/internal/e2e/fixtures/sqlite3/up/4.sql new file mode 100644 index 00000000..89d85409 --- /dev/null +++ b/internal/e2e/fixtures/sqlite3/up/4.sql @@ -0,0 +1,16 @@ +CREATE TABLE IF NOT EXISTS "schema_migration" ( +"version" TEXT NOT NULL +); +CREATE UNIQUE INDEX "schema_migration_version_idx" ON "schema_migration" (version); +CREATE TABLE IF NOT EXISTS "e2e_users" ( +"id" TEXT PRIMARY KEY, +"created_at" DATETIME NOT NULL, +"updated_at" DATETIME NOT NULL +); +CREATE TABLE IF NOT EXISTS "e2e_user_notes" ( +"id" TEXT PRIMARY KEY, +"notes" TEXT, +"user_id" char(36) NOT NULL, "slug" TEXT, +FOREIGN KEY (user_id) REFERENCES e2e_users (id) ON UPDATE NO ACTION ON DELETE CASCADE +); +CREATE INDEX "e2e_user_notes_user_id_idx" ON "e2e_user_notes" (user_id); diff --git a/internal/e2e/fixtures/sqlite3/up/5.sql b/internal/e2e/fixtures/sqlite3/up/5.sql new file mode 100644 index 00000000..eca44db6 --- /dev/null +++ b/internal/e2e/fixtures/sqlite3/up/5.sql @@ -0,0 +1,17 @@ +CREATE TABLE IF NOT EXISTS "schema_migration" ( +"version" TEXT NOT NULL +); +CREATE UNIQUE INDEX "schema_migration_version_idx" ON "schema_migration" (version); +CREATE TABLE IF NOT EXISTS "e2e_users" ( +"id" TEXT PRIMARY KEY, +"created_at" DATETIME NOT NULL, +"updated_at" DATETIME NOT NULL +); +CREATE TABLE IF NOT EXISTS "e2e_user_notes" ( +"id" TEXT PRIMARY KEY, +"notes" TEXT, +"user_id" char(36) NOT NULL, +"slug" TEXT NOT NULL, +FOREIGN KEY (user_id) REFERENCES e2e_users (id) ON UPDATE NO ACTION ON DELETE CASCADE +); +CREATE UNIQUE INDEX "e2e_user_notes_slug_idx" ON "e2e_user_notes" (slug); diff --git a/internal/e2e/fixtures/sqlite3/up/6.sql b/internal/e2e/fixtures/sqlite3/up/6.sql new file mode 100644 index 00000000..2f441f7b --- /dev/null +++ b/internal/e2e/fixtures/sqlite3/up/6.sql @@ -0,0 +1,17 @@ +CREATE TABLE IF NOT EXISTS "schema_migration" ( +"version" TEXT NOT NULL +); +CREATE UNIQUE INDEX "schema_migration_version_idx" ON "schema_migration" (version); +CREATE TABLE IF NOT EXISTS "e2e_users" ( +"id" TEXT PRIMARY KEY, +"created_at" DATETIME NOT NULL, +"updated_at" DATETIME NOT NULL +); +CREATE TABLE IF NOT EXISTS "e2e_user_posts" ( +"id" TEXT PRIMARY KEY, +"notes" TEXT, +"user_id" char(36) NOT NULL, +"slug" TEXT NOT NULL, +FOREIGN KEY (user_id) REFERENCES e2e_users (id) ON UPDATE NO ACTION ON DELETE CASCADE +); +CREATE UNIQUE INDEX "e2e_user_notes_slug_idx" ON "e2e_user_posts" (slug); diff --git a/internal/e2e/integration_test.go b/internal/e2e/integration_test.go new file mode 100644 index 00000000..62298aee --- /dev/null +++ b/internal/e2e/integration_test.go @@ -0,0 +1,31 @@ +// +build e2e + +package e2e_test + +import ( + "os" + "testing" + + _ "github.com/jackc/pgx/v4/stdlib" + + "github.com/gobuffalo/pop/v5" + "github.com/stretchr/testify/require" + "github.com/stretchr/testify/suite" +) + +func TestSpecificSuites(t *testing.T) { + require.NoError(t, pop.LoadConfigFile()) + + switch d := os.Getenv("SODA_DIALECT"); d { + case "postgres": + suite.Run(t, &PostgreSQLSuite{}) + case "cockroach": + suite.Run(t, &CockroachSuite{}) + case "mysql": + suite.Run(t, &MySQLSuite{}) + case "sqlite": + suite.Run(t, &SQLiteSuite{}) + default: + t.Fatalf("Got unsupported dialect: %s", d) + } +} diff --git a/internal/e2e/migrations/20191100000001_users.down.fizz b/internal/e2e/migrations/20191100000001_users.down.fizz new file mode 100644 index 00000000..eb76bd79 --- /dev/null +++ b/internal/e2e/migrations/20191100000001_users.down.fizz @@ -0,0 +1 @@ +drop_table("e2e_users") diff --git a/internal/e2e/migrations/20191100000001_users.up.fizz b/internal/e2e/migrations/20191100000001_users.up.fizz new file mode 100644 index 00000000..8164eb4d --- /dev/null +++ b/internal/e2e/migrations/20191100000001_users.up.fizz @@ -0,0 +1,3 @@ +create_table("e2e_users") { + t.Column("id", "uuid", {"primary": true}) +} diff --git a/internal/e2e/migrations/20191100000002_user_notes.down.fizz b/internal/e2e/migrations/20191100000002_user_notes.down.fizz new file mode 100644 index 00000000..c04bbc5e --- /dev/null +++ b/internal/e2e/migrations/20191100000002_user_notes.down.fizz @@ -0,0 +1 @@ +drop_table("e2e_user_notes") diff --git a/internal/e2e/migrations/20191100000002_user_notes.up.fizz b/internal/e2e/migrations/20191100000002_user_notes.up.fizz new file mode 100644 index 00000000..8fd024e6 --- /dev/null +++ b/internal/e2e/migrations/20191100000002_user_notes.up.fizz @@ -0,0 +1,13 @@ +create_table("e2e_user_notes") { + t.Column("id", "uuid", {"primary": true}) + t.Column("notes", "string", {"null": true}) + t.Column("title", "string", {"size": 64, "default": ""}) + + t.Column("user_id", "uuid") + t.ForeignKey("user_id", {"e2e_users": ["id"]}, {"on_delete": "cascade"}) + + t.DisableTimestamps() +} + +add_index("e2e_user_notes", "user_id", {"name": "e2e_user_notes_user_id_idx"}) +add_index("e2e_user_notes", "title", {"name": "e2e_user_notes_title_idx"}) diff --git a/internal/e2e/migrations/20191100000003_user_notes_drop_title.down.fizz b/internal/e2e/migrations/20191100000003_user_notes_drop_title.down.fizz new file mode 100644 index 00000000..91a63232 --- /dev/null +++ b/internal/e2e/migrations/20191100000003_user_notes_drop_title.down.fizz @@ -0,0 +1,2 @@ +add_column("e2e_user_notes", "title", "string", { "default": "", "size": 64 }) +add_index("e2e_user_notes", "title", {"name": "e2e_user_notes_title_idx"}) diff --git a/internal/e2e/migrations/20191100000003_user_notes_drop_title.up.fizz b/internal/e2e/migrations/20191100000003_user_notes_drop_title.up.fizz new file mode 100644 index 00000000..aaf68d45 --- /dev/null +++ b/internal/e2e/migrations/20191100000003_user_notes_drop_title.up.fizz @@ -0,0 +1 @@ +drop_column("e2e_user_notes", "title") diff --git a/internal/e2e/migrations/20191100000004_user_notes_add_slug.down.fizz b/internal/e2e/migrations/20191100000004_user_notes_add_slug.down.fizz new file mode 100644 index 00000000..a33a869b --- /dev/null +++ b/internal/e2e/migrations/20191100000004_user_notes_add_slug.down.fizz @@ -0,0 +1 @@ +drop_column("e2e_user_notes", "slug") diff --git a/internal/e2e/migrations/20191100000004_user_notes_add_slug.up.fizz b/internal/e2e/migrations/20191100000004_user_notes_add_slug.up.fizz new file mode 100644 index 00000000..79310017 --- /dev/null +++ b/internal/e2e/migrations/20191100000004_user_notes_add_slug.up.fizz @@ -0,0 +1 @@ +add_column("e2e_user_notes", "slug", "string", { "null": true, "size": 64 }) diff --git a/internal/e2e/migrations/20191100000005_user_notes_add_slug.down.fizz b/internal/e2e/migrations/20191100000005_user_notes_add_slug.down.fizz new file mode 100644 index 00000000..e69de29b diff --git a/internal/e2e/migrations/20191100000005_user_notes_add_slug.up.fizz b/internal/e2e/migrations/20191100000005_user_notes_add_slug.up.fizz new file mode 100644 index 00000000..7f031a01 --- /dev/null +++ b/internal/e2e/migrations/20191100000005_user_notes_add_slug.up.fizz @@ -0,0 +1 @@ +sql("UPDATE e2e_user_notes SET slug='';") diff --git a/internal/e2e/migrations/20191100000006_user_notes_add_slug.down.fizz b/internal/e2e/migrations/20191100000006_user_notes_add_slug.down.fizz new file mode 100644 index 00000000..e69de29b diff --git a/internal/e2e/migrations/20191100000006_user_notes_add_slug.up.fizz b/internal/e2e/migrations/20191100000006_user_notes_add_slug.up.fizz new file mode 100644 index 00000000..60dda0b7 --- /dev/null +++ b/internal/e2e/migrations/20191100000006_user_notes_add_slug.up.fizz @@ -0,0 +1,2 @@ +change_column("e2e_user_notes", "slug", "string", { "size": 64 }) +add_index("e2e_user_notes", "slug", { "unique":true, "name": "e2e_user_notes_slug_idx"}) diff --git a/internal/e2e/migrations/20191100000007_user_notes_rename.down.fizz b/internal/e2e/migrations/20191100000007_user_notes_rename.down.fizz new file mode 100644 index 00000000..97991826 --- /dev/null +++ b/internal/e2e/migrations/20191100000007_user_notes_rename.down.fizz @@ -0,0 +1 @@ +rename_table("e2e_user_posts","e2e_user_notes") diff --git a/internal/e2e/migrations/20191100000007_user_notes_rename.up.fizz b/internal/e2e/migrations/20191100000007_user_notes_rename.up.fizz new file mode 100644 index 00000000..2c7056e3 --- /dev/null +++ b/internal/e2e/migrations/20191100000007_user_notes_rename.up.fizz @@ -0,0 +1 @@ +rename_table("e2e_user_notes", "e2e_user_posts") diff --git a/internal/e2e/migrator_test.go b/internal/e2e/migrator_test.go new file mode 100644 index 00000000..af7e6149 --- /dev/null +++ b/internal/e2e/migrator_test.go @@ -0,0 +1,167 @@ +package e2e_test + +import ( + "fmt" + "io/ioutil" + "os" + "path/filepath" + "regexp" + "strconv" + "strings" + "time" + + "github.com/gobuffalo/pop/v5" + "github.com/stretchr/testify/require" + "github.com/stretchr/testify/suite" +) + +func run(s *suite.Suite, c *pop.Connection, checkSchema func()) { + r := s.Require() + + dest, err := ioutil.TempDir(os.TempDir(), "fizz-up-integration") + r.NoError(err) + + m, err := pop.NewFileMigrator("./migrations", c) + r.NoError(err) + m.SchemaPath = dest + + const migrationCount = 7 + refreshFixtures, _ := strconv.ParseBool(os.Getenv("REFRESH_FIXTURES")) + + actualFilePath := filepath.Join(dest, "schema.sql") + + // k is be the number of migrations that should run + s.Run("direction=up", func() { + for k := 0; k < migrationCount; k++ { + r := s.Require() + + _, err := m.UpTo(1) + r.NoError(err) + r.NoError(m.DumpMigrationSchema()) + expectedFilePath := filepath.Join("fixtures", c.Dialect.Name(), "up", fmt.Sprintf("%d.sql", k)) + + if !expectEqualFiles(s, expectedFilePath, actualFilePath) && refreshFixtures { + content, err := ioutil.ReadFile(actualFilePath) + r.NoError(err) + r.NoError(ioutil.WriteFile(expectedFilePath, content, 0666)) + } + } + }) + + s.Run("check=schema", checkSchema) + + s.Run("direction=down", func() { + for k := migrationCount - 1; k >= 0; k-- { + r := s.Require() + + r.NoError(m.Down(1)) + r.NoError(m.DumpMigrationSchema()) + expectedFilePath := filepath.Join("fixtures", c.Dialect.Name(), "down", fmt.Sprintf("%d.sql", k)) + + if !expectEqualFiles(s, expectedFilePath, actualFilePath) && refreshFixtures { + content, err := ioutil.ReadFile(actualFilePath) + r.NoError(err) + r.NoError(ioutil.WriteFile(expectedFilePath, content, 0666)) + } + } + }) +} + +func expectEqualFiles(s *suite.Suite, expected, actual string) bool { + A := s.Assert() + ac, err := ioutil.ReadFile(actual) + A.NoError(err) + + ec, err := ioutil.ReadFile(expected) + A.NoError(err) + + A.EqualValues( + normalizeDump(string(ec)), + normalizeDump(string(ac)), + ` +expected file: %s +actual file: %s +actual SQL dump: + +%s +`, expected, actual, ac) + + return normalizeDump(string(ec)) == + normalizeDump(string(ac)) +} + +var spaces = regexp.MustCompile("\\s+") +var comments = regexp.MustCompile("(?m)^-(.*)$") + +func normalizeDump(in string) string { + in = comments.ReplaceAllString(in, "") + spaces.ReplaceAllString(in, " ") + + return in +} + +func retryOpen(c *pop.Connection) (err error) { + for i := 0; i <= 60; i++ { + time.Sleep(time.Second) + + err = c.Open() + if err != nil { + continue + } + + err = c.RawQuery("SELECT 1").Exec() + if err == nil { + return nil + } + } + return err +} + +func runTestData(s *suite.Suite, c *pop.Connection, supportsUUID bool) func() { + return func() { + r := s.Require() + + if supportsUUID { + r.Error(c.RawQuery("INSERT INTO e2e_users (id, created_at, updated_at) VALUES (?, ?, ?)", "78dba9f7-dd20a39f64cb", time.Now(), time.Now()).Exec(), "should fail because uuid format is not correct") + } + + runInsertUUID(c, r) + runForeignKeyChecks(c, r) + runUniqueKeyChecks(c, r) + runNotNullChecks(c, r) + } +} + +func runInsertUUID(c *pop.Connection, r *require.Assertions) { + r.NoError(c.RawQuery("INSERT INTO e2e_users (id, created_at, updated_at) VALUES (?, ?, ?)", "78dba9f7-81af-415e-aa2b-dd20a39f64cb", time.Now(), time.Now()).Exec()) + r.Error(c.RawQuery("INSERT INTO e2e_users (id, created_at, updated_at) VALUES (?, ?, ?)", "78dba9f7-81af-415e-aa2b-dd20a39f64cb", time.Now(), time.Now()).Exec(), "should fail because it is a duplicate primary key") +} + +func runForeignKeyChecks(c *pop.Connection, r *require.Assertions) { + err := c.RawQuery("INSERT INTO e2e_user_posts (id, user_id, slug) VALUES (?,?,?)", "acd6abe3-38fa-4c3c-a676-933e1b06fa42", "cc1debdc-5d5a-41f3-a36b-48b1f3a03089", "slug-1").Exec() + r.Error(err, "should fail because foreign key constraint fails") + r.Contains(strings.ToLower(err.Error()), "foreign") + + r.NoError(c.RawQuery("INSERT INTO e2e_user_posts (id, user_id, slug) VALUES (?,?,?)", "03c6c800-54c6-40cd-89f1-7dff731f9b54", "78dba9f7-81af-415e-aa2b-dd20a39f64cb", "slug-1").Exec()) +} + +func runUniqueKeyChecks(c *pop.Connection, r *require.Assertions) { + r.NoError(c.RawQuery("INSERT INTO e2e_user_posts (id, user_id, slug) VALUES (?,?,?)", "ccbf7278-092d-4c6f-a627-84cf45233c6a", "78dba9f7-81af-415e-aa2b-dd20a39f64cb", "dupe-slug").Exec()) + + err := c.RawQuery("INSERT INTO e2e_user_posts (id, user_id, slug) VALUES (?,?,?)", "ff7eb268-1640-48d3-b295-57d9a20faf3f", "78dba9f7-81af-415e-aa2b-dd20a39f64cb", "dupe-slug").Exec() + r.Error(err, "should fail because UNIQUE constraint fails") + + message := strings.ToLower(err.Error()) + r.True( + strings.Contains(message, "duplicate") || + strings.Contains(message, "unique")) +} + +func runNotNullChecks(c *pop.Connection, r *require.Assertions) { + err := c.RawQuery("INSERT INTO e2e_user_posts (id, user_id) VALUES (?,?)", "a23e6e72-08f9-412f-afb8-01f6af234eb9", "78dba9f7-81af-415e-aa2b-dd20a39f64cb").Exec() + r.Error(err, "should fail because NOT NULL fails") + message := strings.ToLower(err.Error()) + r.True( + strings.Contains(message, "null") || + strings.Contains(message, "default")) +} diff --git a/internal/e2e/mysql_test.go b/internal/e2e/mysql_test.go new file mode 100644 index 00000000..b8d539f2 --- /dev/null +++ b/internal/e2e/mysql_test.go @@ -0,0 +1,20 @@ +package e2e_test + +import ( + "github.com/gobuffalo/pop/v5" + "github.com/stretchr/testify/suite" +) + +type MySQLSuite struct { + suite.Suite +} + +func (s *MySQLSuite) Test_MySQL_MigrationSteps() { + r := s.Require() + + c, err := pop.Connect("mysql") + r.NoError(err) + r.NoError(retryOpen(c)) + + run(&s.Suite, c, runTestData(&s.Suite, c, false)) +} diff --git a/internal/e2e/postgres_test.go b/internal/e2e/postgres_test.go new file mode 100644 index 00000000..9a2cdab8 --- /dev/null +++ b/internal/e2e/postgres_test.go @@ -0,0 +1,20 @@ +package e2e_test + +import ( + "github.com/gobuffalo/pop/v5" + "github.com/stretchr/testify/suite" +) + +type PostgreSQLSuite struct { + suite.Suite +} + +func (s *PostgreSQLSuite) Test_PostgreSQL_MigrationSteps() { + r := s.Require() + + c, err := pop.Connect("postgres") + r.NoError(err) + r.NoError(retryOpen(c)) + + run(&s.Suite, c, runTestData(&s.Suite, c, true)) +} diff --git a/internal/e2e/sqlite3_test.go b/internal/e2e/sqlite3_test.go new file mode 100644 index 00000000..2ce51041 --- /dev/null +++ b/internal/e2e/sqlite3_test.go @@ -0,0 +1,26 @@ +package e2e_test + +import ( + "io/ioutil" + + "github.com/gobuffalo/pop/v5" + "github.com/stretchr/testify/suite" +) + +type SQLiteSuite struct { + suite.Suite +} + +func (s *SQLiteSuite) Test_SQLite_MigrationSteps() { + r := s.Require() + + td, err := ioutil.TempDir("", "pop-e2e-sqlite") + r.NoError(err) + + c, err := pop.NewConnection(&pop.ConnectionDetails{URL: "sqlite3://" + td + "db.sql?mode=rwc&_fk=true"}) + r.NoError(err) + r.NoError(c.Open(), "%s", c.URL()) + r.NoError(c.RawQuery("SELECT 1").Exec(), "%s", c.URL()) + + run(&s.Suite, c, runTestData(&s.Suite, c, false)) +} diff --git a/tables.go b/tables.go index fe011a2a..22bf7c42 100644 --- a/tables.go +++ b/tables.go @@ -262,7 +262,15 @@ func (t *Table) ColumnNames() []string { func (t *Table) HasColumns(args ...string) bool { for _, a := range args { if _, ok := t.columnsCache[a]; !ok { - return false + // Just because the cache couldn't find the column doesn't mean it's not there. + // Let's see if it really doesn't exist! + var found bool + for _, name := range t.ColumnNames() { + if found = name == a; found { + break + } + } + return found } } return true diff --git a/tables_private_test.go b/tables_private_test.go new file mode 100644 index 00000000..6978167c --- /dev/null +++ b/tables_private_test.go @@ -0,0 +1,17 @@ +package fizz + +import ( + "testing" + + "github.com/stretchr/testify/require" +) + +func Test_Table_HasColumnNoCache(t *testing.T) { + r := require.New(t) + table := NewTable("users", nil) + table.Column("firstname", "string", nil) + table.Column("lastname", "string", nil) + table.columnsCache = map[string]struct{}{} + r.True(table.HasColumns("firstname", "lastname")) + r.False(table.HasColumns("age")) +} diff --git a/test.sh b/test.sh index dfb44236..9b9e1d0e 100755 --- a/test.sh +++ b/test.sh @@ -34,10 +34,17 @@ function test { soda create -e $SODA_DIALECT soda migrate -e $SODA_DIALECT -p ./testdata/migrations go test -tags sqlite -count=1 $verbose $(go list ./... | grep -v /vendor/) + echo "!!! Resetting $1" + soda drop -e $SODA_DIALECT + soda create -e $SODA_DIALECT + echo "!!! Running e2e tests $1" + go test -tags sqlite,e2e -count=1 $verbose ./internal/e2e } +test "sqlite" test "postgres" test "cockroach" test "mysql" -test "sqlserver" -test "sqlite" + +# Does not appear to be implemented in pop: +# test "sqlserver" diff --git a/testdata/migrations/.gitignore b/testdata/migrations/.gitignore new file mode 100644 index 00000000..b446312f --- /dev/null +++ b/testdata/migrations/.gitignore @@ -0,0 +1 @@ +schema.sql \ No newline at end of file diff --git a/translators/sqlite.go b/translators/sqlite.go index be353929..0827de85 100644 --- a/translators/sqlite.go +++ b/translators/sqlite.go @@ -116,13 +116,25 @@ func (p *SQLite) ChangeColumn(t fizz.Table) (string, error) { sql := []string{} s, err := p.withTempTable(t.Name, func(tempTable fizz.Table) (string, error) { + var indices []string + for _, i := range tableInfo.Indexes { + s, err := p.DropIndex(fizz.Table{ + Name: tableInfo.Name, + Indexes: []fizz.Index{i}, + }) + if err != nil { + return "", err + } + indices = append(indices, s) + } + createTableSQL, err := p.CreateTable(*tableInfo) if err != nil { return "", err } ins := fmt.Sprintf("INSERT INTO \"%s\" (%s) SELECT %s FROM \"%s\";", t.Name, strings.Join(tableInfo.ColumnNames(), ", "), strings.Join(tableInfo.ColumnNames(), ", "), tempTable.Name) - return strings.Join([]string{createTableSQL, ins}, "\n"), nil + return strings.Join(append(indices, createTableSQL, ins), "\n"), nil }) if err != nil { @@ -188,6 +200,14 @@ func (p *SQLite) DropColumn(t fizz.Table) (string, error) { } tableInfo.Indexes = newIndexes + newForeignKeys := []fizz.ForeignKey{} + for _, i := range tableInfo.ForeignKeys { + if tableInfo.HasColumns(i.Column) { + newForeignKeys = append(newForeignKeys, i) + } + } + tableInfo.ForeignKeys = newForeignKeys + s, err := p.withTempTable(t.Name, func(tempTable fizz.Table) (string, error) { createTableSQL, err := p.CreateTable(*tableInfo) if err != nil { diff --git a/translators/sqlite_meta.go b/translators/sqlite_meta.go index 48136b24..a8625b44 100644 --- a/translators/sqlite_meta.go +++ b/translators/sqlite_meta.go @@ -16,6 +16,17 @@ type sqliteIndexListInfo struct { Partial string `db:"partial"` } +type sqliteForeignKeyListInfo struct { + ID int `db:"id"` + Seq int `db:"seq"` + From string `db:"from"` + To string `db:"to"` + Table string `db:"table"` + OnUpdate string `db:"on_update"` + OnDelete string `db:"on_delete"` + Match string `db:"match"` +} + type sqliteIndexInfo struct { Seq int `db:"seqno"` CID int `db:"cid"` @@ -106,6 +117,10 @@ func (p *sqliteSchema) buildTableData(table *fizz.Table, db *sql.DB) error { if err != nil { return err } + err = p.buildTableForeignKeyIndexes(table, db) + if err != nil { + return err + } p.schema[table.Name] = table return nil } @@ -154,3 +169,46 @@ func (p *sqliteSchema) buildTableIndexes(t *fizz.Table, db *sql.DB) error { } return nil } + +func (p *sqliteSchema) buildTableForeignKeyIndexes(t *fizz.Table, db *sql.DB) error { + // This ignores all internal SQLite keys which are prefixed with `sqlite_` as explained here: + // https://www.sqlite.org/fileformat2.html#intschema + prag := fmt.Sprintf(`SELECT "seq", "table", "from", "to", "on_update", "on_delete", "match" FROM pragma_foreign_key_list('%s')`, t.Name) + res, err := db.Query(prag) + if err != nil { + return err + } + defer res.Close() + + foreignKeys := []fizz.ForeignKey{} + for res.Next() { + li := sqliteForeignKeyListInfo{} + err = res.Scan(&li.Seq, &li.Table, &li.From, &li.To, &li.OnUpdate, &li.OnDelete, &li.Match) + if err != nil { + return err + } + + options := map[string]interface{}{} + if li.OnDelete != "" { + options["on_delete"] = li.OnDelete + } + + if li.OnUpdate != "" { + options["on_update"] = li.OnUpdate + } + + i := fizz.ForeignKey{ + Column: li.From, + References: fizz.ForeignKeyRef{ + Table: li.Table, + Columns: []string{li.To}, + }, + Options: options, + } + i.Name = fmt.Sprintf("%s_%s_%s_fk", t.Name, i.References.Table, strings.Join(i.References.Columns, "_")) + + foreignKeys = append(foreignKeys, i) + } + t.ForeignKeys = foreignKeys + return nil +} diff --git a/translators/sqlite_test.go b/translators/sqlite_test.go index ecdce13b..986941d5 100644 --- a/translators/sqlite_test.go +++ b/translators/sqlite_test.go @@ -340,3 +340,50 @@ CREATE UNIQUE INDEX "new_ix" ON "users" (id, created_at);` res, _ := fizz.AString(`rename_index("users", "old_ix", "new_ix")`, sqt) r.Equal(ddl, res) } + +func (p *SQLiteSuite) Test_SQLite_DropColumnWithForeignKey() { + r := p.Require() + + res, _ := fizz.AString(` + create_table("users") { + t.Column("uuid", "uuid", {"primary": true}) + } + + create_table("user_notes") { + t.Column("uuid", "uuid", {"primary": true}) + t.Column("user_id", "uuid") + t.Column("notes", "string") + t.ForeignKey("user_id", {"users": ["uuid"]}, {"on_delete": "cascade"}) + }`, sqt) + r.Equal(`CREATE TABLE "users" ( +"uuid" TEXT PRIMARY KEY, +"created_at" DATETIME NOT NULL, +"updated_at" DATETIME NOT NULL +); +CREATE TABLE "user_notes" ( +"uuid" TEXT PRIMARY KEY, +"user_id" char(36) NOT NULL, +"notes" TEXT NOT NULL, +"created_at" DATETIME NOT NULL, +"updated_at" DATETIME NOT NULL, +FOREIGN KEY (user_id) REFERENCES users (uuid) ON DELETE cascade +);`, res) + + res, _ = fizz.AString(`drop_column("user_notes","notes")`, sqt) + r.Equal(`ALTER TABLE "user_notes" RENAME TO "_user_notes_tmp"; +CREATE TABLE "user_notes" ( +"uuid" TEXT PRIMARY KEY, +"user_id" char(36) NOT NULL, +"created_at" DATETIME NOT NULL, +"updated_at" DATETIME NOT NULL, +FOREIGN KEY (user_id) REFERENCES users (uuid) ON DELETE cascade +); +INSERT INTO "user_notes" (uuid, user_id, created_at, updated_at) SELECT uuid, user_id, created_at, updated_at FROM "_user_notes_tmp"; +DROP TABLE "_user_notes_tmp";`, res) + + res, _ = fizz.AString(`rename_table("users","user_accounts")`, sqt) + r.Equal(`ALTER TABLE "users" RENAME TO "user_accounts";`, res) + + res, _ = fizz.AString(`add_column("user_notes","notes","string")`, sqt) + r.Equal(`ALTER TABLE "user_notes" ADD COLUMN "notes" TEXT NOT NULL;`, res) +}