From 68a6d4c97b2b6c4c8ce95801324057ff9e48bbe7 Mon Sep 17 00:00:00 2001 From: Yonghwan SO Date: Thu, 8 Sep 2022 00:12:04 +0900 Subject: [PATCH 1/3] updated module dependencies, github action for testing, and etc. --- .github/CODEOWNERS | 2 +- .github/dependabot.yml | 7 +++++- .github/workflows/tests.yml | 8 +++---- go.mod | 2 +- go.sum | 43 ++++++++++++++++++++----------------- version.go | 2 +- 6 files changed, 36 insertions(+), 28 deletions(-) diff --git a/.github/CODEOWNERS b/.github/CODEOWNERS index 1e697d79..4ee7e5f8 100644 --- a/.github/CODEOWNERS +++ b/.github/CODEOWNERS @@ -1,3 +1,3 @@ translators/cockroach* @mclark4386 # Default owner -* @gobuffalo/pop-managers \ No newline at end of file +* @gobuffalo/core-managers @gobuffalo/database \ No newline at end of file diff --git a/.github/dependabot.yml b/.github/dependabot.yml index aad738c7..95e5c1fb 100644 --- a/.github/dependabot.yml +++ b/.github/dependabot.yml @@ -3,9 +3,14 @@ updates: - package-ecosystem: "gomod" directory: "/" schedule: - interval: "daily" + interval: "weekly" + day: "friday" + labels: + - "dependency" - package-ecosystem: "github-actions" directory: "/" schedule: interval: "daily" + labels: + - "process" diff --git a/.github/workflows/tests.yml b/.github/workflows/tests.yml index 4ce67923..97fb9ea8 100644 --- a/.github/workflows/tests.yml +++ b/.github/workflows/tests.yml @@ -71,7 +71,7 @@ jobs: services: postgres: - image: postgres:14 + image: postgres:10 env: POSTGRES_USER: postgres POSTGRES_PASSWORD: postgres @@ -134,9 +134,9 @@ jobs: run: | mkdir -p crdb pushd crdb - wget -qO- https://binaries.cockroachdb.com/cockroach-v2.1.0.linux-amd64.tgz | tar -xz - sudo cp -i cockroach-v2.1.0.linux-amd64/cockroach /usr/local/bin/ - cockroach start --insecure --background + wget -qO- https://binaries.cockroachdb.com/cockroach-v21.1.19.linux-amd64.tgz | tar -xz + mv cockroach-v21.1.19.linux-amd64/* . + ./cockroach start-single-node --insecure --background popd - name: Install and run soda diff --git a/go.mod b/go.mod index 9505b928..07e35059 100644 --- a/go.mod +++ b/go.mod @@ -5,7 +5,7 @@ go 1.16 require ( github.com/Masterminds/semver/v3 v3.1.1 github.com/go-sql-driver/mysql v1.6.0 - github.com/gobuffalo/plush/v4 v4.1.14 + github.com/gobuffalo/plush/v4 v4.1.15 github.com/kballard/go-shellquote v0.0.0-20180428030007-95032a82bc51 github.com/stretchr/testify v1.8.0 ) diff --git a/go.sum b/go.sum index afa2d6d9..3cc36122 100644 --- a/go.sum +++ b/go.sum @@ -9,18 +9,18 @@ github.com/fatih/structs v1.1.0 h1:Q7juDM0QtcnhCpeyLGQKyg4TOIghuNXrkL32pHAUMxo= github.com/fatih/structs v1.1.0/go.mod h1:9NiDSp5zOcgEDl+j00MP/WkGVPOlPRLejGD8Ga6PJ7M= github.com/go-sql-driver/mysql v1.6.0 h1:BCTh4TKNUYmOmMUcQ3IipzF5prigylS7XXjEkfCHuOE= github.com/go-sql-driver/mysql v1.6.0/go.mod h1:DCzpHaOWr8IXmIStZouvnhqoel9Qv2LBy8hT2VhHyBg= -github.com/gobuffalo/flect v0.2.5 h1:H6vvsv2an0lalEaCDRThvtBfmg44W/QHXBCYUXf/6S4= -github.com/gobuffalo/flect v0.2.5/go.mod h1:1ZyCLIbg0YD7sDkzvFdPoOydPtD8y9JQnrOROolUcM8= -github.com/gobuffalo/github_flavored_markdown v1.1.1 h1:kUf8ginyBOTRXcKSTPsPAqlA25vQ80+xAspLIYaxmTU= -github.com/gobuffalo/github_flavored_markdown v1.1.1/go.mod h1:yU32Pen+eorS58oxh/bNZx76zUOCJwmvyV5FBrvzOKQ= -github.com/gobuffalo/helpers v0.6.5 h1:Quf1KAUae97sdDmm/QP5V9P/0XYpK+HrhnYXU+nf65M= -github.com/gobuffalo/helpers v0.6.5/go.mod h1:LA4zcc89tkZsfKpJIWsXLibiqTgZQ4EvDszfxdqr9ZA= -github.com/gobuffalo/plush/v4 v4.1.14 h1:F3IRVRHVBVJZA4g//zbq0lyF+QBjNtZIGC6e/2k86L8= -github.com/gobuffalo/plush/v4 v4.1.14/go.mod h1:s3hUyj/JlwEiJ039OBJevojq9xT40D1pgekw0o88CVU= -github.com/gobuffalo/tags/v3 v3.1.3 h1:yhq9gudiEngYtPzH1KtMUknxffQBqwNfkHKP6i4l4NE= -github.com/gobuffalo/tags/v3 v3.1.3/go.mod h1:WAAjKdskZUmdi6EkNjP2SXBwBwRovHsjJsPJbBiPlKc= -github.com/gobuffalo/validate/v3 v3.3.2 h1:GZdJlDy6zDRXF5BnEiY+pGvGDFx95atMIWd3N3MMseE= -github.com/gobuffalo/validate/v3 v3.3.2/go.mod h1:jiEEw+N7KbAP2aInFxGnfitI0g7HjXqcp5hDD6TaQDU= +github.com/gobuffalo/flect v0.3.0 h1:erfPWM+K1rFNIQeRPdeEXxo8yFr/PO17lhRnS8FUrtk= +github.com/gobuffalo/flect v0.3.0/go.mod h1:5pf3aGnsvqvCj50AVni7mJJF8ICxGZ8HomberC3pXLE= +github.com/gobuffalo/github_flavored_markdown v1.1.2 h1:G7n4cS9F1NsGJzWZPeMABMtDWO+j+KSqI7Fc6Xj66Jw= +github.com/gobuffalo/github_flavored_markdown v1.1.2/go.mod h1:72ahoBtSQiibDfmkkrU1GSUJONt2ofOCyRIILzE83Kk= +github.com/gobuffalo/helpers v0.6.6 h1:h7cnk9WNdvDtK4VVz/p4itkYPVTP2tr3NwRrxb8QwQA= +github.com/gobuffalo/helpers v0.6.6/go.mod h1:O+QsL1S4hoR3Pgn6OYSjztYdQbUebRW13xxzYYI8kos= +github.com/gobuffalo/plush/v4 v4.1.15 h1:L+dI8NV/60dIU7X8ZG0NZunYZI95wlD6guSyE4rghms= +github.com/gobuffalo/plush/v4 v4.1.15/go.mod h1:Qxu8HB1qRS7dEwwqnjv5iMiOcvcqr+tyghqlV449vyM= +github.com/gobuffalo/tags/v3 v3.1.4 h1:X/ydLLPhgXV4h04Hp2xlbI2oc5MDaa7eub6zw8oHjsM= +github.com/gobuffalo/tags/v3 v3.1.4/go.mod h1:ArRNo3ErlHO8BtdA0REaZxijuWnWzF6PUXngmMXd2I0= +github.com/gobuffalo/validate/v3 v3.3.3 h1:o7wkIGSvZBYBd6ChQoLxkz2y1pfmhbI4jNJYh6PuNJ4= +github.com/gobuffalo/validate/v3 v3.3.3/go.mod h1:YC7FsbJ/9hW/VjQdmXPvFqvRis4vrRYFxr69WiNZw6g= github.com/gofrs/uuid v4.2.0+incompatible h1:yyYWMnhkhrKwwr8gAOcOCYxOOscHgDS9yZgBrnJfGa0= github.com/gofrs/uuid v4.2.0+incompatible/go.mod h1:b2aQJv3Z4Fp6yNu3cdSllBxTCLRxnplIgP/c0N/04lM= github.com/gorilla/css v1.0.0 h1:BQqNyPTi50JCFMTw/b67hByjMVXZRwGha6wxVGkeihY= @@ -32,8 +32,8 @@ github.com/kr/pretty v0.1.0/go.mod h1:dAy3ld7l9f0ibDNOQOHHMYYIIbhfbHSm3C4ZsoJORN github.com/kr/pty v1.1.1/go.mod h1:pFQYn66WHrOpPYNljwOMqo10TkYh1fy3cYio2l3bCsQ= 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/microcosm-cc/bluemonday v1.0.16 h1:kHmAq2t7WPWLjiGvzKa5o3HzSfahUKiOq7fAPUiMNIc= -github.com/microcosm-cc/bluemonday v1.0.16/go.mod h1:Z0r70sCuXHig8YpBzCc5eGHAap2K7e/u082ZUpDRRqM= +github.com/microcosm-cc/bluemonday v1.0.19 h1:OI7hoF5FY4pFz2VA//RN8TfM0YJ2dJcl4P4APrCWy6c= +github.com/microcosm-cc/bluemonday v1.0.19/go.mod h1:QNzV2UbLK2/53oIIwTOyLUSABMkjZ4tqiyC1g/DyqxE= 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/sergi/go-diff v1.2.0 h1:XU+rvMAioB0UC3q1MFrIQy4Vo5/4VsRDQQXHsEya6xQ= @@ -45,26 +45,29 @@ github.com/sourcegraph/syntaxhighlight v0.0.0-20170531221838-bd320f5d308e/go.mod github.com/stretchr/objx v0.1.0/go.mod h1:HFkY916IF+rwdDfMAkV7OtwuqBVzrE8GR6GFx+wExME= github.com/stretchr/objx v0.4.0/go.mod h1:YvHI0jy2hoMjB+UWwv71VJQ9isScKT/TqJzVSSt89Yw= github.com/stretchr/testify v1.4.0/go.mod h1:j7eGeouHqKxXV5pUuKE4zz7dFj8WfuZ+81PSLYec5m4= -github.com/stretchr/testify v1.5.1/go.mod h1:5W2xD1RspED5o8YsWQXVCued0rvSQ+mT+I5cxcmMvtA= -github.com/stretchr/testify v1.7.0/go.mod h1:6Fq8oRcR53rry900zMqJjRRixrwX3KX962/h/Wwjteg= github.com/stretchr/testify v1.7.1/go.mod h1:6Fq8oRcR53rry900zMqJjRRixrwX3KX962/h/Wwjteg= github.com/stretchr/testify v1.8.0 h1:pSgiaMZlXftHpm5L7V1+rVB+AZJydKsMxsQBIJw4PKk= github.com/stretchr/testify v1.8.0/go.mod h1:yNjHg4UonilssWZ8iaSj1OCr/vHnekPRkoO+kdMU+MU= golang.org/x/net v0.0.0-20210614182718-04defd469f4e/go.mod h1:9nx3DQGgdP8bBQD5qxJ1jj9UTztislL4KSBs9R2vV5Y= -golang.org/x/net v0.0.0-20211015210444-4f30a5c0130f h1:OfiFi4JbukWwe3lzw+xunroH1mnC1e2Gy5cxNJApiSY= -golang.org/x/net v0.0.0-20211015210444-4f30a5c0130f/go.mod h1:9nx3DQGgdP8bBQD5qxJ1jj9UTztislL4KSBs9R2vV5Y= -golang.org/x/sync v0.0.0-20220601150217-0de741cfad7f h1:Ax0t5p6N38Ga0dThY21weqDEyz2oklo4IvDkpigvkD8= -golang.org/x/sync v0.0.0-20220601150217-0de741cfad7f/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= +golang.org/x/net v0.0.0-20220826154423-83b083e8dc8b h1:ZmngSVLe/wycRns9MKikG9OWIEjGcGAkacif7oYQaUY= +golang.org/x/net v0.0.0-20220826154423-83b083e8dc8b/go.mod h1:YDH+HFinaLZZlnHAfSS6ZXJJ9M9t4Dl22yv3iI2vPwk= +golang.org/x/sync v0.0.0-20220819030929-7fc1605a5dde h1:ejfdSekXMDxDLbRrJMwUk6KnSLZ2McaUCVcIKM+N6jc= +golang.org/x/sync v0.0.0-20220819030929-7fc1605a5dde/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= golang.org/x/sys v0.0.0-20201119102817-f84b799fce68/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/sys v0.0.0-20210423082822-04245dca01da/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= +golang.org/x/sys v0.0.0-20210615035016-665e8c7367d1/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= +golang.org/x/sys v0.0.0-20220728004956-3c1f35247d10/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= golang.org/x/term v0.0.0-20201126162022-7de9c90e9dd1/go.mod h1:bj7SfCRtBDWHUb9snDiAeCFNEtKQo2Wmx5Cou7ajbmo= +golang.org/x/term v0.0.0-20210927222741-03fcf44c2211/go.mod h1:jbD1KX2456YbFQfuXm/mYQcufACuNUgVhRMnK/tPxf8= golang.org/x/text v0.3.6/go.mod h1:5Zoc/QRtKVWzQhOtBMvqHzDpF6irO9z98xDceosuGiQ= +golang.org/x/text v0.3.7/go.mod h1:u+2+/6zg+i71rQMx5EYifcz6MCKuco9NR6JIITiCfzQ= golang.org/x/tools v0.0.0-20180917221912-90fa682c2a6e/go.mod h1:n7NCudcB/nEzxVGmLbDWY5pfWTLqBcC2KZ6jyYvM4mQ= gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405/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/yaml.v2 v2.2.2/go.mod h1:hI93XBmqTisBFMUTm0b8Fm+jr3Dg1NNxqwp+5A1VGuI= gopkg.in/yaml.v2 v2.2.4/go.mod h1:hI93XBmqTisBFMUTm0b8Fm+jr3Dg1NNxqwp+5A1VGuI= +gopkg.in/yaml.v2 v2.4.0/go.mod h1:RDklbk79AGWmwhnvt/jBztapEOGDOx6ZbXqjP6csGnQ= gopkg.in/yaml.v3 v3.0.0-20200313102051-9f266ea9e77c/go.mod h1:K4uyk7z7BCEPqu6E+C64Yfv1cQ7kz7rIZviUmN+EgEM= gopkg.in/yaml.v3 v3.0.1 h1:fxVm/GzAzEWqLHuvctI91KS9hhNmmWOoWu0XTYJS7CA= gopkg.in/yaml.v3 v3.0.1/go.mod h1:K4uyk7z7BCEPqu6E+C64Yfv1cQ7kz7rIZviUmN+EgEM= diff --git a/version.go b/version.go index 8de20d64..704050cb 100644 --- a/version.go +++ b/version.go @@ -1,4 +1,4 @@ package fizz // Version gives the current fizz version. -const Version = "v1.14.2" +const Version = "v1.14.3" From cbe65ffa5b5c8aa8e31b07cbd3d962e21866ba6b Mon Sep 17 00:00:00 2001 From: Yonghwan SO Date: Sat, 10 Sep 2022 00:37:38 +0900 Subject: [PATCH 2/3] fixed e2e test configuration: why does it run for only sqlite... --- .github/workflows/tests.yml | 27 ++++++++++++++++----------- database.yml | 10 +++++----- 2 files changed, 21 insertions(+), 16 deletions(-) diff --git a/.github/workflows/tests.yml b/.github/workflows/tests.yml index 97fb9ea8..64609742 100644 --- a/.github/workflows/tests.yml +++ b/.github/workflows/tests.yml @@ -25,7 +25,7 @@ jobs: ports: - 3307:3306 # needed because the mysql container does not provide a healthcheck - options: --health-cmd "mysqladmin ping -h localhost" --health-interval 10s --health-timeout 5s --health-retries 5 + options: --health-cmd "mysqladmin ping -h localhost" --health-interval 5s --health-timeout 5s --health-retries 10 steps: - uses: actions/checkout@v3 @@ -51,9 +51,9 @@ jobs: run: | go test -v -tags sqlite -race ./... - - name: Reset soda and run e2e + - name: Reset database and run e2e env: - SODA_DIALECT: "sqlite" + SODA_DIALECT: "mysql" run: | soda drop -e $SODA_DIALECT -p ./testdata/migrations soda create -e $SODA_DIALECT -p ./testdata/migrations @@ -77,9 +77,9 @@ jobs: POSTGRES_PASSWORD: postgres POSTGRES_DB: postgres ports: - - 5432:5432 + - 5433:5432 # needed because the postgres container does not provide a healthcheck - options: --health-cmd pg_isready --health-interval 10s --health-timeout 5s --health-retries 5 + options: --health-cmd pg_isready --health-interval 5s --health-timeout 5s --health-retries 10 steps: - uses: actions/checkout@v3 @@ -105,9 +105,9 @@ jobs: run: | go test -v -tags sqlite -race ./... - - name: Reset soda and run e2e + - name: Reset database and run e2e env: - SODA_DIALECT: "sqlite" + SODA_DIALECT: "postgres" run: | soda drop -e $SODA_DIALECT -p ./testdata/migrations soda create -e $SODA_DIALECT -p ./testdata/migrations @@ -136,12 +136,15 @@ jobs: pushd crdb wget -qO- https://binaries.cockroachdb.com/cockroach-v21.1.19.linux-amd64.tgz | tar -xz mv cockroach-v21.1.19.linux-amd64/* . + ln -s `pwd`/cockroach /usr/local/bin/ + cockroach version ./cockroach start-single-node --insecure --background popd - name: Install and run soda env: SODA_DIALECT: "cockroach" + COCKROACH_PORT: 26257 run: | go install -tags sqlite github.com/gobuffalo/pop/v6/soda@latest soda drop -e $SODA_DIALECT -p ./testdata/migrations @@ -151,12 +154,14 @@ jobs: - name: Test env: SODA_DIALECT: "cockroach" + COCKROACH_PORT: 26257 run: | go test -v -tags sqlite -race ./... - - name: Reset soda and run e2e + - name: Reset database and run e2e env: - SODA_DIALECT: "sqlite" + SODA_DIALECT: "cockroach" + COCKROACH_PORT: 26257 run: | soda drop -e $SODA_DIALECT -p ./testdata/migrations soda create -e $SODA_DIALECT -p ./testdata/migrations @@ -213,7 +218,7 @@ jobs: go test -v -tags sqlite ./... shell: bash - - name: Reset soda and run e2e + - name: Reset database and run e2e if: ${{ matrix.os != 'windows-latest' }} env: SODA_DIALECT: "sqlite" @@ -224,7 +229,7 @@ jobs: go test -v -tags sqlite,e2e -race ./... shell: bash - - name: Reset soda and run e2e without race detection + - name: Reset database and run e2e without race detection if: ${{ matrix.os == 'windows-latest' }} env: SODA_DIALECT: "sqlite" diff --git a/database.yml b/database.yml index 4ee63b38..a21537ec 100644 --- a/database.yml +++ b/database.yml @@ -2,20 +2,20 @@ mysql: dialect: "mysql" database: "pop_test" host: {{ envOr "MYSQL_HOST" "127.0.0.1" }} - port: {{ envOr "MYSQL_PORT" "3306" }} + port: {{ envOr "MYSQL_PORT" "3307" }} user: {{ envOr "MYSQL_USER" "root" }} password: {{ envOr "MYSQL_PASSWORD" "root" }} postgres: - url: "postgres://postgres:postgres@localhost:5432/pop_test?sslmode=disable" + url: "postgres://postgres:postgres@localhost:5433/pop_test?sslmode=disable" pool: 25 cockroach: - # url: "cockroach://root@127.0.0.1:26257/pop_test?application_name=cockroach&sslmode=disable" + # url: "cockroach://root@127.0.0.1:26258/pop_test?application_name=cockroach&sslmode=disable" dialect: "cockroach" database: "pop_test" host: {{ envOr "COCKROACH_HOST" "127.0.0.1" }} - port: {{ envOr "COCKROACH_PORT" "26257" }} + port: {{ envOr "COCKROACH_PORT" "26258" }} user: {{ envOr "COCKROACH_USER" "root" }} password: {{ envOr "COCKROACH_PASSWORD" "" }} options: @@ -31,7 +31,7 @@ sqlserver: sqlite: dialect: "sqlite3" - database: "./sql_scripts/sqlite/test.sqlite" + database: "./tmp/test.sqlite" options: mode: rwc From 8360d1e71f7b0a3e036218fe17781d2ca2c0044a Mon Sep 17 00:00:00 2001 From: Yonghwan SO Date: Sat, 10 Sep 2022 02:02:20 +0900 Subject: [PATCH 3/3] updated local test script and fixtures for cockroach based on v21.1 --- Makefile | 45 +-------- README.md | 57 +++++++---- docker-compose.yml | 63 ++++++++---- test.sh | 45 +++++---- testdata/e2e/fixtures/cockroach/down/0.sql | 8 +- testdata/e2e/fixtures/cockroach/down/1.sql | 21 ++-- testdata/e2e/fixtures/cockroach/down/10.sql | 41 +++++--- testdata/e2e/fixtures/cockroach/down/11.sql | 41 +++++--- testdata/e2e/fixtures/cockroach/down/12.sql | 41 +++++--- testdata/e2e/fixtures/cockroach/down/13.sql | 41 +++++--- testdata/e2e/fixtures/cockroach/down/14.sql | 41 +++++--- testdata/e2e/fixtures/cockroach/down/15.sql | 104 ++++++++++++-------- testdata/e2e/fixtures/cockroach/down/2.sql | 41 +++++--- testdata/e2e/fixtures/cockroach/down/3.sql | 41 +++++--- testdata/e2e/fixtures/cockroach/down/4.sql | 41 +++++--- testdata/e2e/fixtures/cockroach/down/5.sql | 41 +++++--- testdata/e2e/fixtures/cockroach/down/6.sql | 41 +++++--- testdata/e2e/fixtures/cockroach/down/7.sql | 41 +++++--- testdata/e2e/fixtures/cockroach/down/8.sql | 41 +++++--- testdata/e2e/fixtures/cockroach/down/9.sql | 41 +++++--- testdata/e2e/fixtures/cockroach/up/0.sql | 21 ++-- testdata/e2e/fixtures/cockroach/up/1.sql | 41 +++++--- testdata/e2e/fixtures/cockroach/up/10.sql | 41 +++++--- testdata/e2e/fixtures/cockroach/up/11.sql | 41 +++++--- testdata/e2e/fixtures/cockroach/up/12.sql | 41 +++++--- testdata/e2e/fixtures/cockroach/up/13.sql | 41 +++++--- testdata/e2e/fixtures/cockroach/up/14.sql | 100 +++++++++++-------- testdata/e2e/fixtures/cockroach/up/15.sql | 104 ++++++++++++-------- testdata/e2e/fixtures/cockroach/up/2.sql | 41 +++++--- testdata/e2e/fixtures/cockroach/up/3.sql | 41 +++++--- testdata/e2e/fixtures/cockroach/up/4.sql | 41 +++++--- testdata/e2e/fixtures/cockroach/up/5.sql | 41 +++++--- testdata/e2e/fixtures/cockroach/up/6.sql | 41 +++++--- testdata/e2e/fixtures/cockroach/up/7.sql | 41 +++++--- testdata/e2e/fixtures/cockroach/up/8.sql | 41 +++++--- testdata/e2e/fixtures/cockroach/up/9.sql | 41 +++++--- 36 files changed, 1005 insertions(+), 629 deletions(-) diff --git a/Makefile b/Makefile index 0250c8db..54f00e2c 100644 --- a/Makefile +++ b/Makefile @@ -1,58 +1,23 @@ -TAGS ?= "sqlite" -GO_BIN ?= "go" +TAGS ?= sqlite +GO_BIN ?= go install: $(GO_BIN) install -tags ${TAGS} -v . - make tidy tidy: -ifeq ($(GO111MODULE),on) $(GO_BIN) mod tidy -else - echo skipping go mod tidy -endif - -deps: - $(GO_BIN) get -tags ${TAGS} -t ./... - make tidy build: $(GO_BIN) build -v . - make tidy test: - ./test.sh - make tidy - -ci-deps: - $(GO_BIN) get -tags ${TAGS} -t ./... - -ci-test: - $(GO_BIN) test -tags ${TAGS} -race ./... + ./test.sh -cover -v lint: go get github.com/golangci/golangci-lint/cmd/golangci-lint golangci-lint run --enable-all - make tidy update: -ifeq ($(GO111MODULE),on) rm go.* - $(GO_BIN) mod init - $(GO_BIN) mod tidy -else - $(GO_BIN) get -u -tags ${TAGS} -endif - make test - make install - make tidy - -release-test: - $(GO_BIN) test -tags ${TAGS} -race ./... - make tidy - -release: - $(GO_BIN) get github.com/gobuffalo/release - make tidy - release -y -f version.go --skip-packr - make tidy \ No newline at end of file + $(GO_BIN) mod init github.com/gobuffalo/fizz + $(GO_BIN) mod tidy --go=1.16 diff --git a/README.md b/README.md index 8898f66a..68a232e7 100644 --- a/README.md +++ b/README.md @@ -1,11 +1,28 @@ # Fizz [![Actions Status](https://github.com/gobuffalo/fizz/workflows/Tests/badge.svg)](https://github.com/gobuffalo/fizz/actions) -[![GoDoc](https://godoc.org/github.com/gobuffalo/fizz?status.svg)](https://godoc.org/github.com/gobuffalo/fizz) +[![Go Reference](https://pkg.go.dev/badge/github.com/gobuffalo/fizz.svg)](https://pkg.go.dev/github.com/gobuffalo/fizz) A Common DSL for Migrating Databases -## Create a Table + +## Supported Database Engines + +Fizz supports minimum supported version of all supported database engines. +Currently, the following database engines are officially supported. (Since +Fizz is used with the migration feature of Pop, supported databases and the +versions are correlated with Pop.) + +* PostgreSQL 10 +* MySQL 5.7 / MariaDB 10.3 +* SQLite3 3.22 +* CockroachDB v21.1 +* MSSQL 2017 (not fully supported) + + +## Usage + +### Create a Table ``` javascript create_table("users") { @@ -28,7 +45,7 @@ create_table("todos") { } ``` -The `id` column don't have to be an integer. For instance, your can use an [`UUID`](https://github.com/gobuffalo/uuid) type instead: +The `id` column don't have to be an integer. For instance, your can use an UUID type instead: ```javascript create_table("users") { @@ -75,19 +92,19 @@ create_table("user_privileges") { Please note that the `t.PrimaryKey` statement MUST be after the columns definitions. -## Drop a Table +### Drop a Table ``` javascript drop_table("table_name") ``` -## Rename a Table +### Rename a Table ``` javascript rename_table("old_table_name", "new_table_name") ``` -## Add a Column +### Add a Column ``` javascript add_column("table_name", "column_name", "string", {}) @@ -95,69 +112,69 @@ add_column("table_name", "column_name", "string", {}) See [above](#column-info) for more details on column types and options. -## Alter a column +### Alter a column ``` javascript change_column("table_name", "column_name", "string", {}) ``` -## Rename a Column +### Rename a Column ``` javascript rename_column("table_name", "old_column_name", "new_column_name") ``` -## Drop a Column +### Drop a Column ``` javascript drop_column("table_name", "column_name") ``` -## Add an Index +### Add an Index #### Supported Options: * `name` - This defaults to `table_name_column_name_idx` * `unique` -### Simple Index: +#### Simple Index: ``` javascript add_index("table_name", "column_name", {}) ``` -### Multi-Column Index: +#### Multi-Column Index: ``` javascript add_index("table_name", ["column_1", "column_2"], {}) ``` -### Unique Index: +#### Unique Index: ``` javascript add_index("table_name", "column_name", {"unique": true}) ``` -### Index Names: +#### Index Names: ``` javascript add_index("table_name", "column_name", {}) # name => table_name_column_name_idx add_index("table_name", "column_name", {"name": "custom_index_name"}) ``` -## Rename an Index +### Rename an Index ``` javascript rename_index("table_name", "old_index_name", "new_index_name") ``` -## Drop an Index +### Drop an Index ``` javascript drop_index("table_name", "index_name") ``` -## Add a Foreign Key +### Add a Foreign Key ```javascript add_foreign_key("table_name", "field", {"ref_table_name": ["ref_column"]}, { @@ -176,7 +193,7 @@ add_foreign_key("table_name", "field", {"ref_table_name": ["ref_column"]}, { **Note:** `on_update` and `on_delete` are not supported on CockroachDB yet. -## Drop a Foreign Key +### Drop a Foreign Key ```javascript drop_foreign_key("table_name", "fk_name", {"if_exists": true}) @@ -187,13 +204,13 @@ drop_foreign_key("table_name", "fk_name", {"if_exists": true}) * `if_exists` - Adds `IF EXISTS` condition -## Raw SQL +### Raw SQL ``` javascript sql("select * from users;") ``` -## Execute an External Command +### Execute an External Command Sometimes during a migration you need to shell out to an external command. diff --git a/docker-compose.yml b/docker-compose.yml index 6e491d48..8a4ff6d1 100644 --- a/docker-compose.yml +++ b/docker-compose.yml @@ -8,32 +8,53 @@ services: - MYSQL_DATABASE=pop_test - MYSQL_USER=pop - MYSQL_PASSWORD=pop - volumes: - - ./sql:/docker-entrypoint-initdb.d + #volumes: + #- ./_vol/mysql:/docker-entrypoint-initdb.d ports: - - "3306:3306" + - "3307:3306" + healthcheck: + test: ["CMD", "mysqladmin" ,"ping", "-h", "localhost"] + interval: 5s + timeout: 5s + retries: 10 + start_period: 3s + postgres: - image: postgres:9.6 + image: postgres:10 environment: - POSTGRES_DB=pop_test - POSTGRES_PASSWORD=postgres ports: - - "5432:5432" - volumes: - - ./sqldumps:/docker-entrypoint-initdb.d + - "5433:5432" + #volumes: + #- ./_vol/postgres:/docker-entrypoint-initdb.d + healthcheck: + test: ["CMD", "pg_isready"] + interval: 5s + timeout: 5s + retries: 10 + start_period: 3s + cockroach: - image: cockroachdb/cockroach:v19.2.10 + image: cockroachdb/cockroach:latest-v21.1 ports: - - "26257:26257" - - "8080:8080" - volumes: - - "./cockroach-data/roach1:/cockroach/cockroach-data" - command: start --insecure - mssqlserver: - image: "microsoft/mssql-server-linux" - environment: - - SA_PASSWORD=Tt@12345678 - - MSSQLSERVER_PASSWORD=Tt@12345678 - - ACCEPT_EULA=Y - ports: - - "1433:1433" + - "26258:26257" + - "8081:8080" + #volumes: + #- ./_vol/cockroach:/cockroach/cockroach-data + command: start-single-node --insecure + healthcheck: + test: ["CMD", "curl", "http://localhost:8080/health"] + interval: 5s + timeout: 5s + retries: 10 + start_period: 3s + +# mssqlserver: +# image: "microsoft/mssql-server-linux" +# environment: +# - SA_PASSWORD=Tt@12345678 +# - MSSQLSERVER_PASSWORD=Tt@12345678 +# - ACCEPT_EULA=Y +# ports: +# - "1433:1433" diff --git a/test.sh b/test.sh index 34cccda1..8e72c3df 100755 --- a/test.sh +++ b/test.sh @@ -1,43 +1,50 @@ #!/bin/bash + set -e -clear -verbose="" +# NOTE: See also docker-compose.yml and database.yml to configure database +# properties. +export MYSQL_PORT=3307 +export COCKROACH_PORT=26258 -echo $@ +COMPOSE=docker-compose +which docker-compose || COMPOSE="docker compose" -if [[ "$@" == "-v" ]] -then - verbose="-v" -fi +args=$@ function cleanup { echo "Cleanup resources..." - docker-compose down - find ./sql_scripts/sqlite -name *.sqlite* -delete || true + $COMPOSE down + docker volume prune -f + find ./tmp -name *.sqlite* -delete || true } # defer cleanup, so it will be executed even after premature exit trap cleanup EXIT -docker-compose up -d -sleep 10 # Ensure mysql is online - -go install -tags sqlite github.com/gobuffalo/pop/v6/soda@latest - function test { - echo "!!! Testing $1" export SODA_DIALECT=$1 + + echo "" + echo "######################################################################" + echo "### Running unit tests for $SODA_DIALECT" soda drop -e $SODA_DIALECT 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" + go test -tags sqlite -count=1 $args ./... + + echo "" + echo "######################################################################" + echo "### Running e2e tests for $1" soda drop -e $SODA_DIALECT soda create -e $SODA_DIALECT - echo "!!! Running e2e tests $1" - cd testdata/e2e; go test -tags sqlite,e2e -count=1 $verbose ./...; cd .. + pushd testdata/e2e; go test -tags sqlite,e2e -count=1 $args ./...; popd } + +$COMPOSE up --wait + +go install -tags sqlite github.com/gobuffalo/pop/v6/soda@latest + test "sqlite" test "postgres" test "cockroach" diff --git a/testdata/e2e/fixtures/cockroach/down/0.sql b/testdata/e2e/fixtures/cockroach/down/0.sql index 4e370dec..cc9c77a9 100644 --- a/testdata/e2e/fixtures/cockroach/down/0.sql +++ b/testdata/e2e/fixtures/cockroach/down/0.sql @@ -1,5 +1,11 @@ -CREATE TABLE schema_migration ( +-- # 1 column +-- # row 1 +-- ## 269 +CREATE TABLE public.schema_migration ( version VARCHAR(14) NOT NULL, + rowid INT8 NOT VISIBLE NOT NULL DEFAULT unique_rowid(), + CONSTRAINT "primary" PRIMARY KEY (rowid ASC), UNIQUE INDEX schema_migration_version_idx (version ASC), FAMILY "primary" (version, rowid) ); +-- # 1 row diff --git a/testdata/e2e/fixtures/cockroach/down/1.sql b/testdata/e2e/fixtures/cockroach/down/1.sql index 6d7a4713..1066f535 100644 --- a/testdata/e2e/fixtures/cockroach/down/1.sql +++ b/testdata/e2e/fixtures/cockroach/down/1.sql @@ -1,4 +1,16 @@ -CREATE TABLE e2e_users ( +-- # 1 column +-- # row 1 +-- ## 269 +CREATE TABLE public.schema_migration ( + version VARCHAR(14) NOT NULL, + rowid INT8 NOT VISIBLE NOT NULL DEFAULT unique_rowid(), + CONSTRAINT "primary" PRIMARY KEY (rowid ASC), + UNIQUE INDEX schema_migration_version_idx (version ASC), + FAMILY "primary" (version, rowid) +); +-- # row 2 +-- ## 247 +CREATE TABLE public.e2e_users ( id UUID NOT NULL, created_at TIMESTAMP NOT NULL, updated_at TIMESTAMP NOT NULL, @@ -6,9 +18,4 @@ CREATE TABLE e2e_users ( CONSTRAINT "primary" PRIMARY KEY (id ASC), FAMILY "primary" (id, created_at, updated_at, username) ); - -CREATE TABLE schema_migration ( - version VARCHAR(14) NOT NULL, - UNIQUE INDEX schema_migration_version_idx (version ASC), - FAMILY "primary" (version, rowid) -); +-- # 2 rows diff --git a/testdata/e2e/fixtures/cockroach/down/10.sql b/testdata/e2e/fixtures/cockroach/down/10.sql index ab6d1891..e7c4546e 100644 --- a/testdata/e2e/fixtures/cockroach/down/10.sql +++ b/testdata/e2e/fixtures/cockroach/down/10.sql @@ -1,30 +1,41 @@ -CREATE TABLE e2e_users ( +-- # 1 column +-- # row 1 +-- ## 269 +CREATE TABLE public.schema_migration ( + version VARCHAR(14) NOT NULL, + rowid INT8 NOT VISIBLE NOT NULL DEFAULT unique_rowid(), + CONSTRAINT "primary" PRIMARY KEY (rowid ASC), + UNIQUE INDEX schema_migration_version_idx (version ASC), + FAMILY "primary" (version, rowid) +); +-- # row 2 +-- ## 208 +CREATE TABLE public.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 ( +-- # row 3 +-- ## 352 +CREATE TABLE public.e2e_user_posts ( id UUID NOT NULL, content VARCHAR(255) NOT NULL DEFAULT '':::STRING, 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, content, 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; +-- # row 4 +-- ## 152 +ALTER TABLE public.e2e_user_posts ADD CONSTRAINT e2e_user_notes_e2e_users_id_fk FOREIGN KEY (user_id) REFERENCES public.e2e_users(id) ON DELETE CASCADE; +-- # row 5 +-- ## 115 +-- Validate foreign key constraints. These can fail if there was unvalidated data during the SHOW CREATE ALL TABLES +-- # row 6 +-- ## 85 +ALTER TABLE public.e2e_user_posts VALIDATE CONSTRAINT e2e_user_notes_e2e_users_id_fk; +-- # 6 rows diff --git a/testdata/e2e/fixtures/cockroach/down/11.sql b/testdata/e2e/fixtures/cockroach/down/11.sql index 7028d77c..434281ad 100644 --- a/testdata/e2e/fixtures/cockroach/down/11.sql +++ b/testdata/e2e/fixtures/cockroach/down/11.sql @@ -1,30 +1,41 @@ -CREATE TABLE e2e_users ( +-- # 1 column +-- # row 1 +-- ## 269 +CREATE TABLE public.schema_migration ( + version VARCHAR(14) NOT NULL, + rowid INT8 NOT VISIBLE NOT NULL DEFAULT unique_rowid(), + CONSTRAINT "primary" PRIMARY KEY (rowid ASC), + UNIQUE INDEX schema_migration_version_idx (version ASC), + FAMILY "primary" (version, rowid) +); +-- # row 2 +-- ## 208 +CREATE TABLE public.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 ( +-- # row 3 +-- ## 352 +CREATE TABLE public.e2e_user_posts ( id UUID NOT NULL, content VARCHAR(255) NOT NULL DEFAULT '':::STRING, slug VARCHAR(32) NOT NULL, user_id UUID NOT NULL, CONSTRAINT "primary" PRIMARY KEY (id ASC), UNIQUE INDEX e2e_user_notes_slug_idx (slug 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, content, slug, 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_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; +-- # row 4 +-- ## 152 +ALTER TABLE public.e2e_user_posts ADD CONSTRAINT e2e_user_notes_e2e_users_id_fk FOREIGN KEY (user_id) REFERENCES public.e2e_users(id) ON DELETE CASCADE; +-- # row 5 +-- ## 115 +-- Validate foreign key constraints. These can fail if there was unvalidated data during the SHOW CREATE ALL TABLES +-- # row 6 +-- ## 85 +ALTER TABLE public.e2e_user_posts VALIDATE CONSTRAINT e2e_user_notes_e2e_users_id_fk; +-- # 6 rows diff --git a/testdata/e2e/fixtures/cockroach/down/12.sql b/testdata/e2e/fixtures/cockroach/down/12.sql index f0663c77..16d66ece 100644 --- a/testdata/e2e/fixtures/cockroach/down/12.sql +++ b/testdata/e2e/fixtures/cockroach/down/12.sql @@ -1,30 +1,41 @@ -CREATE TABLE e2e_authors ( +-- # 1 column +-- # row 1 +-- ## 269 +CREATE TABLE public.schema_migration ( + version VARCHAR(14) NOT NULL, + rowid INT8 NOT VISIBLE NOT NULL DEFAULT unique_rowid(), + CONSTRAINT "primary" PRIMARY KEY (rowid ASC), + UNIQUE INDEX schema_migration_version_idx (version ASC), + FAMILY "primary" (version, rowid) +); +-- # row 2 +-- ## 210 +CREATE TABLE public.e2e_authors ( 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 ( +-- # row 3 +-- ## 352 +CREATE TABLE public.e2e_user_posts ( id UUID NOT NULL, content VARCHAR(255) NOT NULL DEFAULT '':::STRING, slug VARCHAR(32) NOT NULL, user_id UUID NOT NULL, CONSTRAINT "primary" PRIMARY KEY (id ASC), UNIQUE INDEX e2e_user_notes_slug_idx (slug 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, content, slug, 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_posts ADD CONSTRAINT e2e_user_notes_e2e_users_id_fk FOREIGN KEY (user_id) REFERENCES e2e_authors(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; +-- # row 4 +-- ## 154 +ALTER TABLE public.e2e_user_posts ADD CONSTRAINT e2e_user_notes_e2e_users_id_fk FOREIGN KEY (user_id) REFERENCES public.e2e_authors(id) ON DELETE CASCADE; +-- # row 5 +-- ## 115 +-- Validate foreign key constraints. These can fail if there was unvalidated data during the SHOW CREATE ALL TABLES +-- # row 6 +-- ## 85 +ALTER TABLE public.e2e_user_posts VALIDATE CONSTRAINT e2e_user_notes_e2e_users_id_fk; +-- # 6 rows diff --git a/testdata/e2e/fixtures/cockroach/down/13.sql b/testdata/e2e/fixtures/cockroach/down/13.sql index fb9dbdd9..2c5bdc0b 100644 --- a/testdata/e2e/fixtures/cockroach/down/13.sql +++ b/testdata/e2e/fixtures/cockroach/down/13.sql @@ -1,30 +1,41 @@ -CREATE TABLE e2e_authors ( +-- # 1 column +-- # row 1 +-- ## 269 +CREATE TABLE public.schema_migration ( + version VARCHAR(14) NOT NULL, + rowid INT8 NOT VISIBLE NOT NULL DEFAULT unique_rowid(), + CONSTRAINT "primary" PRIMARY KEY (rowid ASC), + UNIQUE INDEX schema_migration_version_idx (version ASC), + FAMILY "primary" (version, rowid) +); +-- # row 2 +-- ## 210 +CREATE TABLE public.e2e_authors ( 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 ( +-- # row 3 +-- ## 358 +CREATE TABLE public.e2e_user_posts ( id UUID NOT NULL, content VARCHAR(255) NOT NULL DEFAULT '':::STRING, slug VARCHAR(32) NOT NULL, author_id UUID NOT NULL, CONSTRAINT "primary" PRIMARY KEY (id ASC), UNIQUE INDEX e2e_user_notes_slug_idx (slug ASC), - INDEX e2e_user_notes_auto_index_e2e_user_notes_e2e_users_id_fk (author_id ASC), INDEX e2e_user_notes_user_id_idx (author_id ASC), FAMILY "primary" (id, content, slug, author_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_posts ADD CONSTRAINT e2e_user_notes_e2e_users_id_fk FOREIGN KEY (author_id) REFERENCES e2e_authors(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; +-- # row 4 +-- ## 156 +ALTER TABLE public.e2e_user_posts ADD CONSTRAINT e2e_user_notes_e2e_users_id_fk FOREIGN KEY (author_id) REFERENCES public.e2e_authors(id) ON DELETE CASCADE; +-- # row 5 +-- ## 115 +-- Validate foreign key constraints. These can fail if there was unvalidated data during the SHOW CREATE ALL TABLES +-- # row 6 +-- ## 85 +ALTER TABLE public.e2e_user_posts VALIDATE CONSTRAINT e2e_user_notes_e2e_users_id_fk; +-- # 6 rows diff --git a/testdata/e2e/fixtures/cockroach/down/14.sql b/testdata/e2e/fixtures/cockroach/down/14.sql index 3b25bca5..e55f8a38 100644 --- a/testdata/e2e/fixtures/cockroach/down/14.sql +++ b/testdata/e2e/fixtures/cockroach/down/14.sql @@ -1,12 +1,25 @@ -CREATE TABLE e2e_authors ( +-- # 1 column +-- # row 1 +-- ## 269 +CREATE TABLE public.schema_migration ( + version VARCHAR(14) NOT NULL, + rowid INT8 NOT VISIBLE NOT NULL DEFAULT unique_rowid(), + CONSTRAINT "primary" PRIMARY KEY (rowid ASC), + UNIQUE INDEX schema_migration_version_idx (version ASC), + FAMILY "primary" (version, rowid) +); +-- # row 2 +-- ## 210 +CREATE TABLE public.e2e_authors ( 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 ( +-- # row 3 +-- ## 405 +CREATE TABLE public.e2e_user_posts ( id UUID NOT NULL, content VARCHAR(255) NOT NULL DEFAULT '':::STRING, slug VARCHAR(32) NOT NULL, @@ -14,18 +27,16 @@ CREATE TABLE e2e_user_posts ( author_id UUID NULL, CONSTRAINT "primary" PRIMARY KEY (id ASC), UNIQUE INDEX e2e_user_notes_slug_idx (slug ASC), - INDEX e2e_user_notes_auto_index_e2e_user_notes_e2e_users_id_fk (author_id ASC), INDEX e2e_user_notes_user_id_idx (author_id ASC), FAMILY "primary" (id, content, slug, published, author_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_posts ADD CONSTRAINT e2e_user_notes_e2e_users_id_fk FOREIGN KEY (author_id) REFERENCES e2e_authors(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; +-- # row 4 +-- ## 156 +ALTER TABLE public.e2e_user_posts ADD CONSTRAINT e2e_user_notes_e2e_users_id_fk FOREIGN KEY (author_id) REFERENCES public.e2e_authors(id) ON DELETE CASCADE; +-- # row 5 +-- ## 115 +-- Validate foreign key constraints. These can fail if there was unvalidated data during the SHOW CREATE ALL TABLES +-- # row 6 +-- ## 85 +ALTER TABLE public.e2e_user_posts VALIDATE CONSTRAINT e2e_user_notes_e2e_users_id_fk; +-- # 6 rows diff --git a/testdata/e2e/fixtures/cockroach/down/15.sql b/testdata/e2e/fixtures/cockroach/down/15.sql index b8c6d372..7c5c54ae 100644 --- a/testdata/e2e/fixtures/cockroach/down/15.sql +++ b/testdata/e2e/fixtures/cockroach/down/15.sql @@ -1,62 +1,82 @@ -CREATE TABLE e2e_address ( - id UUID NOT NULL, - CONSTRAINT "primary" PRIMARY KEY (id ASC), - FAMILY "primary" (id) +-- # 1 column +-- # row 1 +-- ## 269 +CREATE TABLE public.schema_migration ( + version VARCHAR(14) NOT NULL, + rowid INT8 NOT VISIBLE NOT NULL DEFAULT unique_rowid(), + CONSTRAINT "primary" PRIMARY KEY (rowid ASC), + UNIQUE INDEX schema_migration_version_idx (version ASC), + FAMILY "primary" (version, rowid) ); - -CREATE TABLE e2e_authors ( +-- # row 2 +-- ## 210 +CREATE TABLE public.e2e_authors ( 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_flow ( +-- # row 3 +-- ## 405 +CREATE TABLE public.e2e_user_posts ( + id UUID NOT NULL, + content VARCHAR(255) NOT NULL DEFAULT '':::STRING, + slug VARCHAR(32) NOT NULL, + published BOOL NOT NULL DEFAULT false, + author_id UUID NULL, + CONSTRAINT "primary" PRIMARY KEY (id ASC), + UNIQUE INDEX e2e_user_notes_slug_idx (slug ASC), + INDEX e2e_user_notes_user_id_idx (author_id ASC), + FAMILY "primary" (id, content, slug, published, author_id) +); +-- # row 4 +-- ## 119 +CREATE TABLE public.e2e_flow ( + id UUID NOT NULL, + CONSTRAINT "primary" PRIMARY KEY (id ASC), + FAMILY "primary" (id) +); +-- # row 5 +-- ## 122 +CREATE TABLE public.e2e_address ( id UUID NOT NULL, CONSTRAINT "primary" PRIMARY KEY (id ASC), FAMILY "primary" (id) ); - -CREATE TABLE e2e_token ( +-- # row 6 +-- ## 492 +CREATE TABLE public.e2e_token ( id UUID NOT NULL, token VARCHAR(64) NOT NULL, e2e_address_id UUID NOT NULL, - expires_at TIMESTAMP NOT NULL DEFAULT '2000-01-01 00:00:00+00:00':::TIMESTAMP, - issued_at TIMESTAMP NOT NULL DEFAULT '2000-01-01 00:00:00+00:00':::TIMESTAMP, + expires_at TIMESTAMP NOT NULL DEFAULT '2000-01-01 00:00:00':::TIMESTAMP, + issued_at TIMESTAMP NOT NULL DEFAULT '2000-01-01 00:00:00':::TIMESTAMP, e2e_flow_id UUID NOT NULL, CONSTRAINT "primary" PRIMARY KEY (id ASC), - INDEX e2e_token_auto_index_e2e_token_e2e_address_id_fk (e2e_address_id ASC), UNIQUE INDEX e2e_token_uq_idx (token ASC), INDEX e2e_token_idx (token ASC), - INDEX e2e_token_auto_index_e2e_token_e2e_flow_id_fk (e2e_flow_id ASC), FAMILY "primary" (id, token, e2e_address_id, expires_at, issued_at, e2e_flow_id) ); - -CREATE TABLE e2e_user_posts ( - id UUID NOT NULL, - content VARCHAR(255) NOT NULL DEFAULT '':::STRING, - slug VARCHAR(32) NOT NULL, - published BOOL NOT NULL DEFAULT false, - author_id UUID NULL, - CONSTRAINT "primary" PRIMARY KEY (id ASC), - UNIQUE INDEX e2e_user_notes_slug_idx (slug ASC), - INDEX e2e_user_notes_auto_index_e2e_user_notes_e2e_users_id_fk (author_id ASC), - INDEX e2e_user_notes_user_id_idx (author_id ASC), - FAMILY "primary" (id, content, slug, published, author_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_token ADD CONSTRAINT e2e_token_e2e_address_id_fk FOREIGN KEY (e2e_address_id) REFERENCES e2e_address(id) ON DELETE CASCADE; -ALTER TABLE e2e_token ADD CONSTRAINT e2e_token_e2e_flow_id_fk FOREIGN KEY (e2e_flow_id) REFERENCES e2e_flow(id) ON DELETE CASCADE; -ALTER TABLE e2e_user_posts ADD CONSTRAINT e2e_user_notes_e2e_users_id_fk FOREIGN KEY (author_id) REFERENCES e2e_authors(id) ON DELETE CASCADE; - --- Validate foreign key constraints. These can fail if there was unvalidated data during the dump. -ALTER TABLE e2e_token VALIDATE CONSTRAINT e2e_token_e2e_address_id_fk; -ALTER TABLE e2e_token VALIDATE CONSTRAINT e2e_token_e2e_flow_id_fk; -ALTER TABLE e2e_user_posts VALIDATE CONSTRAINT e2e_user_notes_e2e_users_id_fk; +-- # row 7 +-- ## 156 +ALTER TABLE public.e2e_user_posts ADD CONSTRAINT e2e_user_notes_e2e_users_id_fk FOREIGN KEY (author_id) REFERENCES public.e2e_authors(id) ON DELETE CASCADE; +-- # row 8 +-- ## 153 +ALTER TABLE public.e2e_token ADD CONSTRAINT e2e_token_e2e_address_id_fk FOREIGN KEY (e2e_address_id) REFERENCES public.e2e_address(id) ON DELETE CASCADE; +-- # row 9 +-- ## 144 +ALTER TABLE public.e2e_token ADD CONSTRAINT e2e_token_e2e_flow_id_fk FOREIGN KEY (e2e_flow_id) REFERENCES public.e2e_flow(id) ON DELETE CASCADE; +-- # row 10 +-- ## 115 +-- Validate foreign key constraints. These can fail if there was unvalidated data during the SHOW CREATE ALL TABLES +-- # row 11 +-- ## 85 +ALTER TABLE public.e2e_user_posts VALIDATE CONSTRAINT e2e_user_notes_e2e_users_id_fk; +-- # row 12 +-- ## 77 +ALTER TABLE public.e2e_token VALIDATE CONSTRAINT e2e_token_e2e_address_id_fk; +-- # row 13 +-- ## 74 +ALTER TABLE public.e2e_token VALIDATE CONSTRAINT e2e_token_e2e_flow_id_fk; +-- # 13 rows diff --git a/testdata/e2e/fixtures/cockroach/down/2.sql b/testdata/e2e/fixtures/cockroach/down/2.sql index 25f52369..91a85101 100644 --- a/testdata/e2e/fixtures/cockroach/down/2.sql +++ b/testdata/e2e/fixtures/cockroach/down/2.sql @@ -1,4 +1,16 @@ -CREATE TABLE e2e_users ( +-- # 1 column +-- # row 1 +-- ## 269 +CREATE TABLE public.schema_migration ( + version VARCHAR(14) NOT NULL, + rowid INT8 NOT VISIBLE NOT NULL DEFAULT unique_rowid(), + CONSTRAINT "primary" PRIMARY KEY (rowid ASC), + UNIQUE INDEX schema_migration_version_idx (version ASC), + FAMILY "primary" (version, rowid) +); +-- # row 2 +-- ## 247 +CREATE TABLE public.e2e_users ( id UUID NOT NULL, created_at TIMESTAMP NOT NULL, updated_at TIMESTAMP NOT NULL, @@ -6,26 +18,25 @@ CREATE TABLE e2e_users ( CONSTRAINT "primary" PRIMARY KEY (id ASC), FAMILY "primary" (id, created_at, updated_at, username) ); - -CREATE TABLE e2e_user_notes ( +-- # row 3 +-- ## 341 +CREATE TABLE public.e2e_user_notes ( id UUID NOT NULL, user_id UUID NOT NULL, notes VARCHAR(255) 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, user_id, notes, 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; +-- # row 4 +-- ## 152 +ALTER TABLE public.e2e_user_notes ADD CONSTRAINT e2e_user_notes_e2e_users_id_fk FOREIGN KEY (user_id) REFERENCES public.e2e_users(id) ON DELETE CASCADE; +-- # row 5 +-- ## 115 +-- Validate foreign key constraints. These can fail if there was unvalidated data during the SHOW CREATE ALL TABLES +-- # row 6 +-- ## 85 +ALTER TABLE public.e2e_user_notes VALIDATE CONSTRAINT e2e_user_notes_e2e_users_id_fk; +-- # 6 rows diff --git a/testdata/e2e/fixtures/cockroach/down/3.sql b/testdata/e2e/fixtures/cockroach/down/3.sql index 07a69de4..9e064ffe 100644 --- a/testdata/e2e/fixtures/cockroach/down/3.sql +++ b/testdata/e2e/fixtures/cockroach/down/3.sql @@ -1,4 +1,16 @@ -CREATE TABLE e2e_users ( +-- # 1 column +-- # row 1 +-- ## 269 +CREATE TABLE public.schema_migration ( + version VARCHAR(14) NOT NULL, + rowid INT8 NOT VISIBLE NOT NULL DEFAULT unique_rowid(), + CONSTRAINT "primary" PRIMARY KEY (rowid ASC), + UNIQUE INDEX schema_migration_version_idx (version ASC), + FAMILY "primary" (version, rowid) +); +-- # row 2 +-- ## 247 +CREATE TABLE public.e2e_users ( id UUID NOT NULL, created_at TIMESTAMP NOT NULL, updated_at TIMESTAMP NOT NULL, @@ -6,24 +18,23 @@ CREATE TABLE e2e_users ( CONSTRAINT "primary" PRIMARY KEY (id ASC), FAMILY "primary" (id, created_at, updated_at, username) ); - -CREATE TABLE e2e_user_notes ( +-- # row 3 +-- ## 240 +CREATE TABLE public.e2e_user_notes ( id UUID NOT NULL, user_id UUID NOT NULL, notes VARCHAR(255) 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, user_id, notes) ); - -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; +-- # row 4 +-- ## 152 +ALTER TABLE public.e2e_user_notes ADD CONSTRAINT e2e_user_notes_e2e_users_id_fk FOREIGN KEY (user_id) REFERENCES public.e2e_users(id) ON DELETE CASCADE; +-- # row 5 +-- ## 115 +-- Validate foreign key constraints. These can fail if there was unvalidated data during the SHOW CREATE ALL TABLES +-- # row 6 +-- ## 85 +ALTER TABLE public.e2e_user_notes VALIDATE CONSTRAINT e2e_user_notes_e2e_users_id_fk; +-- # 6 rows diff --git a/testdata/e2e/fixtures/cockroach/down/4.sql b/testdata/e2e/fixtures/cockroach/down/4.sql index 3cd32657..1995631c 100644 --- a/testdata/e2e/fixtures/cockroach/down/4.sql +++ b/testdata/e2e/fixtures/cockroach/down/4.sql @@ -1,4 +1,16 @@ -CREATE TABLE e2e_users ( +-- # 1 column +-- # row 1 +-- ## 269 +CREATE TABLE public.schema_migration ( + version VARCHAR(14) NOT NULL, + rowid INT8 NOT VISIBLE NOT NULL DEFAULT unique_rowid(), + CONSTRAINT "primary" PRIMARY KEY (rowid ASC), + UNIQUE INDEX schema_migration_version_idx (version ASC), + FAMILY "primary" (version, rowid) +); +-- # row 2 +-- ## 247 +CREATE TABLE public.e2e_users ( id UUID NOT NULL, created_at TIMESTAMP NOT NULL, updated_at TIMESTAMP NOT NULL, @@ -6,26 +18,25 @@ CREATE TABLE e2e_users ( CONSTRAINT "primary" PRIMARY KEY (id ASC), FAMILY "primary" (id, created_at, updated_at, username) ); - -CREATE TABLE e2e_user_notes ( +-- # row 3 +-- ## 324 +CREATE TABLE public.e2e_user_notes ( id UUID NOT NULL, user_id UUID NOT NULL, slug VARCHAR(64) NOT NULL, notes VARCHAR(255) 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, user_id, slug, notes) ); - -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; +-- # row 4 +-- ## 152 +ALTER TABLE public.e2e_user_notes ADD CONSTRAINT e2e_user_notes_e2e_users_id_fk FOREIGN KEY (user_id) REFERENCES public.e2e_users(id) ON DELETE CASCADE; +-- # row 5 +-- ## 115 +-- Validate foreign key constraints. These can fail if there was unvalidated data during the SHOW CREATE ALL TABLES +-- # row 6 +-- ## 85 +ALTER TABLE public.e2e_user_notes VALIDATE CONSTRAINT e2e_user_notes_e2e_users_id_fk; +-- # 6 rows diff --git a/testdata/e2e/fixtures/cockroach/down/5.sql b/testdata/e2e/fixtures/cockroach/down/5.sql index 3cd32657..1995631c 100644 --- a/testdata/e2e/fixtures/cockroach/down/5.sql +++ b/testdata/e2e/fixtures/cockroach/down/5.sql @@ -1,4 +1,16 @@ -CREATE TABLE e2e_users ( +-- # 1 column +-- # row 1 +-- ## 269 +CREATE TABLE public.schema_migration ( + version VARCHAR(14) NOT NULL, + rowid INT8 NOT VISIBLE NOT NULL DEFAULT unique_rowid(), + CONSTRAINT "primary" PRIMARY KEY (rowid ASC), + UNIQUE INDEX schema_migration_version_idx (version ASC), + FAMILY "primary" (version, rowid) +); +-- # row 2 +-- ## 247 +CREATE TABLE public.e2e_users ( id UUID NOT NULL, created_at TIMESTAMP NOT NULL, updated_at TIMESTAMP NOT NULL, @@ -6,26 +18,25 @@ CREATE TABLE e2e_users ( CONSTRAINT "primary" PRIMARY KEY (id ASC), FAMILY "primary" (id, created_at, updated_at, username) ); - -CREATE TABLE e2e_user_notes ( +-- # row 3 +-- ## 324 +CREATE TABLE public.e2e_user_notes ( id UUID NOT NULL, user_id UUID NOT NULL, slug VARCHAR(64) NOT NULL, notes VARCHAR(255) 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, user_id, slug, notes) ); - -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; +-- # row 4 +-- ## 152 +ALTER TABLE public.e2e_user_notes ADD CONSTRAINT e2e_user_notes_e2e_users_id_fk FOREIGN KEY (user_id) REFERENCES public.e2e_users(id) ON DELETE CASCADE; +-- # row 5 +-- ## 115 +-- Validate foreign key constraints. These can fail if there was unvalidated data during the SHOW CREATE ALL TABLES +-- # row 6 +-- ## 85 +ALTER TABLE public.e2e_user_notes VALIDATE CONSTRAINT e2e_user_notes_e2e_users_id_fk; +-- # 6 rows diff --git a/testdata/e2e/fixtures/cockroach/down/6.sql b/testdata/e2e/fixtures/cockroach/down/6.sql index 3cd32657..1995631c 100644 --- a/testdata/e2e/fixtures/cockroach/down/6.sql +++ b/testdata/e2e/fixtures/cockroach/down/6.sql @@ -1,4 +1,16 @@ -CREATE TABLE e2e_users ( +-- # 1 column +-- # row 1 +-- ## 269 +CREATE TABLE public.schema_migration ( + version VARCHAR(14) NOT NULL, + rowid INT8 NOT VISIBLE NOT NULL DEFAULT unique_rowid(), + CONSTRAINT "primary" PRIMARY KEY (rowid ASC), + UNIQUE INDEX schema_migration_version_idx (version ASC), + FAMILY "primary" (version, rowid) +); +-- # row 2 +-- ## 247 +CREATE TABLE public.e2e_users ( id UUID NOT NULL, created_at TIMESTAMP NOT NULL, updated_at TIMESTAMP NOT NULL, @@ -6,26 +18,25 @@ CREATE TABLE e2e_users ( CONSTRAINT "primary" PRIMARY KEY (id ASC), FAMILY "primary" (id, created_at, updated_at, username) ); - -CREATE TABLE e2e_user_notes ( +-- # row 3 +-- ## 324 +CREATE TABLE public.e2e_user_notes ( id UUID NOT NULL, user_id UUID NOT NULL, slug VARCHAR(64) NOT NULL, notes VARCHAR(255) 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, user_id, slug, notes) ); - -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; +-- # row 4 +-- ## 152 +ALTER TABLE public.e2e_user_notes ADD CONSTRAINT e2e_user_notes_e2e_users_id_fk FOREIGN KEY (user_id) REFERENCES public.e2e_users(id) ON DELETE CASCADE; +-- # row 5 +-- ## 115 +-- Validate foreign key constraints. These can fail if there was unvalidated data during the SHOW CREATE ALL TABLES +-- # row 6 +-- ## 85 +ALTER TABLE public.e2e_user_notes VALIDATE CONSTRAINT e2e_user_notes_e2e_users_id_fk; +-- # 6 rows diff --git a/testdata/e2e/fixtures/cockroach/down/7.sql b/testdata/e2e/fixtures/cockroach/down/7.sql index a3f547f1..e08c5952 100644 --- a/testdata/e2e/fixtures/cockroach/down/7.sql +++ b/testdata/e2e/fixtures/cockroach/down/7.sql @@ -1,4 +1,16 @@ -CREATE TABLE e2e_users ( +-- # 1 column +-- # row 1 +-- ## 269 +CREATE TABLE public.schema_migration ( + version VARCHAR(14) NOT NULL, + rowid INT8 NOT VISIBLE NOT NULL DEFAULT unique_rowid(), + CONSTRAINT "primary" PRIMARY KEY (rowid ASC), + UNIQUE INDEX schema_migration_version_idx (version ASC), + FAMILY "primary" (version, rowid) +); +-- # row 2 +-- ## 247 +CREATE TABLE public.e2e_users ( id UUID NOT NULL, created_at TIMESTAMP NOT NULL, updated_at TIMESTAMP NOT NULL, @@ -6,26 +18,25 @@ CREATE TABLE e2e_users ( CONSTRAINT "primary" PRIMARY KEY (id ASC), FAMILY "primary" (id, created_at, updated_at, username) ); - -CREATE TABLE e2e_user_posts ( +-- # row 3 +-- ## 324 +CREATE TABLE public.e2e_user_posts ( id UUID NOT NULL, user_id UUID NOT NULL, slug VARCHAR(64) NOT NULL, notes VARCHAR(255) 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, user_id, slug, notes) ); - -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; +-- # row 4 +-- ## 152 +ALTER TABLE public.e2e_user_posts ADD CONSTRAINT e2e_user_notes_e2e_users_id_fk FOREIGN KEY (user_id) REFERENCES public.e2e_users(id) ON DELETE CASCADE; +-- # row 5 +-- ## 115 +-- Validate foreign key constraints. These can fail if there was unvalidated data during the SHOW CREATE ALL TABLES +-- # row 6 +-- ## 85 +ALTER TABLE public.e2e_user_posts VALIDATE CONSTRAINT e2e_user_notes_e2e_users_id_fk; +-- # 6 rows diff --git a/testdata/e2e/fixtures/cockroach/down/8.sql b/testdata/e2e/fixtures/cockroach/down/8.sql index cd092333..97c5cb02 100644 --- a/testdata/e2e/fixtures/cockroach/down/8.sql +++ b/testdata/e2e/fixtures/cockroach/down/8.sql @@ -1,4 +1,16 @@ -CREATE TABLE e2e_users ( +-- # 1 column +-- # row 1 +-- ## 269 +CREATE TABLE public.schema_migration ( + version VARCHAR(14) NOT NULL, + rowid INT8 NOT VISIBLE NOT NULL DEFAULT unique_rowid(), + CONSTRAINT "primary" PRIMARY KEY (rowid ASC), + UNIQUE INDEX schema_migration_version_idx (version ASC), + FAMILY "primary" (version, rowid) +); +-- # row 2 +-- ## 247 +CREATE TABLE public.e2e_users ( id UUID NOT NULL, created_at TIMESTAMP NOT NULL, updated_at TIMESTAMP NOT NULL, @@ -6,26 +18,25 @@ CREATE TABLE e2e_users ( CONSTRAINT "primary" PRIMARY KEY (id ASC), FAMILY "primary" (id, created_at, updated_at, username) ); - -CREATE TABLE e2e_user_posts ( +-- # row 3 +-- ## 352 +CREATE TABLE public.e2e_user_posts ( id UUID NOT NULL, content VARCHAR(255) NOT NULL DEFAULT '':::STRING, 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, content, 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; +-- # row 4 +-- ## 152 +ALTER TABLE public.e2e_user_posts ADD CONSTRAINT e2e_user_notes_e2e_users_id_fk FOREIGN KEY (user_id) REFERENCES public.e2e_users(id) ON DELETE CASCADE; +-- # row 5 +-- ## 115 +-- Validate foreign key constraints. These can fail if there was unvalidated data during the SHOW CREATE ALL TABLES +-- # row 6 +-- ## 85 +ALTER TABLE public.e2e_user_posts VALIDATE CONSTRAINT e2e_user_notes_e2e_users_id_fk; +-- # 6 rows diff --git a/testdata/e2e/fixtures/cockroach/down/9.sql b/testdata/e2e/fixtures/cockroach/down/9.sql index f0d7431c..0b52e76d 100644 --- a/testdata/e2e/fixtures/cockroach/down/9.sql +++ b/testdata/e2e/fixtures/cockroach/down/9.sql @@ -1,4 +1,16 @@ -CREATE TABLE e2e_users ( +-- # 1 column +-- # row 1 +-- ## 269 +CREATE TABLE public.schema_migration ( + version VARCHAR(14) NOT NULL, + rowid INT8 NOT VISIBLE NOT NULL DEFAULT unique_rowid(), + CONSTRAINT "primary" PRIMARY KEY (rowid ASC), + UNIQUE INDEX schema_migration_version_idx (version ASC), + FAMILY "primary" (version, rowid) +); +-- # row 2 +-- ## 239 +CREATE TABLE public.e2e_users ( id UUID NOT NULL, created_at TIMESTAMP NOT NULL, updated_at TIMESTAMP NOT NULL, @@ -6,26 +18,25 @@ CREATE TABLE e2e_users ( CONSTRAINT "primary" PRIMARY KEY (id ASC), FAMILY "primary" (id, created_at, updated_at, name) ); - -CREATE TABLE e2e_user_posts ( +-- # row 3 +-- ## 352 +CREATE TABLE public.e2e_user_posts ( id UUID NOT NULL, content VARCHAR(255) NOT NULL DEFAULT '':::STRING, 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, content, 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; +-- # row 4 +-- ## 152 +ALTER TABLE public.e2e_user_posts ADD CONSTRAINT e2e_user_notes_e2e_users_id_fk FOREIGN KEY (user_id) REFERENCES public.e2e_users(id) ON DELETE CASCADE; +-- # row 5 +-- ## 115 +-- Validate foreign key constraints. These can fail if there was unvalidated data during the SHOW CREATE ALL TABLES +-- # row 6 +-- ## 85 +ALTER TABLE public.e2e_user_posts VALIDATE CONSTRAINT e2e_user_notes_e2e_users_id_fk; +-- # 6 rows diff --git a/testdata/e2e/fixtures/cockroach/up/0.sql b/testdata/e2e/fixtures/cockroach/up/0.sql index 094f36b7..2c9763ba 100644 --- a/testdata/e2e/fixtures/cockroach/up/0.sql +++ b/testdata/e2e/fixtures/cockroach/up/0.sql @@ -1,4 +1,16 @@ -CREATE TABLE e2e_users ( +-- # 1 column +-- # row 1 +-- ## 269 +CREATE TABLE public.schema_migration ( + version VARCHAR(14) NOT NULL, + rowid INT8 NOT VISIBLE NOT NULL DEFAULT unique_rowid(), + CONSTRAINT "primary" PRIMARY KEY (rowid ASC), + UNIQUE INDEX schema_migration_version_idx (version ASC), + FAMILY "primary" (version, rowid) +); +-- # row 2 +-- ## 247 +CREATE TABLE public.e2e_users ( id UUID NOT NULL, username VARCHAR(255) NULL, created_at TIMESTAMP NOT NULL, @@ -6,9 +18,4 @@ CREATE TABLE e2e_users ( CONSTRAINT "primary" PRIMARY KEY (id ASC), FAMILY "primary" (id, username, 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) -); +-- # 2 rows diff --git a/testdata/e2e/fixtures/cockroach/up/1.sql b/testdata/e2e/fixtures/cockroach/up/1.sql index 99e6f184..4d1d0c4f 100644 --- a/testdata/e2e/fixtures/cockroach/up/1.sql +++ b/testdata/e2e/fixtures/cockroach/up/1.sql @@ -1,4 +1,16 @@ -CREATE TABLE e2e_users ( +-- # 1 column +-- # row 1 +-- ## 269 +CREATE TABLE public.schema_migration ( + version VARCHAR(14) NOT NULL, + rowid INT8 NOT VISIBLE NOT NULL DEFAULT unique_rowid(), + CONSTRAINT "primary" PRIMARY KEY (rowid ASC), + UNIQUE INDEX schema_migration_version_idx (version ASC), + FAMILY "primary" (version, rowid) +); +-- # row 2 +-- ## 247 +CREATE TABLE public.e2e_users ( id UUID NOT NULL, username VARCHAR(255) NULL, created_at TIMESTAMP NOT NULL, @@ -6,26 +18,25 @@ CREATE TABLE e2e_users ( CONSTRAINT "primary" PRIMARY KEY (id ASC), FAMILY "primary" (id, username, created_at, updated_at) ); - -CREATE TABLE e2e_user_notes ( +-- # row 3 +-- ## 341 +CREATE TABLE public.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; +-- # row 4 +-- ## 152 +ALTER TABLE public.e2e_user_notes ADD CONSTRAINT e2e_user_notes_e2e_users_id_fk FOREIGN KEY (user_id) REFERENCES public.e2e_users(id) ON DELETE CASCADE; +-- # row 5 +-- ## 115 +-- Validate foreign key constraints. These can fail if there was unvalidated data during the SHOW CREATE ALL TABLES +-- # row 6 +-- ## 85 +ALTER TABLE public.e2e_user_notes VALIDATE CONSTRAINT e2e_user_notes_e2e_users_id_fk; +-- # 6 rows diff --git a/testdata/e2e/fixtures/cockroach/up/10.sql b/testdata/e2e/fixtures/cockroach/up/10.sql index 5346f6ce..1ce93299 100644 --- a/testdata/e2e/fixtures/cockroach/up/10.sql +++ b/testdata/e2e/fixtures/cockroach/up/10.sql @@ -1,30 +1,41 @@ -CREATE TABLE e2e_users ( +-- # 1 column +-- # row 1 +-- ## 269 +CREATE TABLE public.schema_migration ( + version VARCHAR(14) NOT NULL, + rowid INT8 NOT VISIBLE NOT NULL DEFAULT unique_rowid(), + CONSTRAINT "primary" PRIMARY KEY (rowid ASC), + UNIQUE INDEX schema_migration_version_idx (version ASC), + FAMILY "primary" (version, rowid) +); +-- # row 2 +-- ## 208 +CREATE TABLE public.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 ( +-- # row 3 +-- ## 352 +CREATE TABLE public.e2e_user_posts ( id UUID NOT NULL, user_id UUID NOT NULL, content VARCHAR(255) NOT NULL DEFAULT '':::STRING, slug VARCHAR(32) 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, user_id, content, 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; +-- # row 4 +-- ## 152 +ALTER TABLE public.e2e_user_posts ADD CONSTRAINT e2e_user_notes_e2e_users_id_fk FOREIGN KEY (user_id) REFERENCES public.e2e_users(id) ON DELETE CASCADE; +-- # row 5 +-- ## 115 +-- Validate foreign key constraints. These can fail if there was unvalidated data during the SHOW CREATE ALL TABLES +-- # row 6 +-- ## 85 +ALTER TABLE public.e2e_user_posts VALIDATE CONSTRAINT e2e_user_notes_e2e_users_id_fk; +-- # 6 rows diff --git a/testdata/e2e/fixtures/cockroach/up/11.sql b/testdata/e2e/fixtures/cockroach/up/11.sql index b61522b0..046eb328 100644 --- a/testdata/e2e/fixtures/cockroach/up/11.sql +++ b/testdata/e2e/fixtures/cockroach/up/11.sql @@ -1,30 +1,41 @@ -CREATE TABLE e2e_authors ( +-- # 1 column +-- # row 1 +-- ## 269 +CREATE TABLE public.schema_migration ( + version VARCHAR(14) NOT NULL, + rowid INT8 NOT VISIBLE NOT NULL DEFAULT unique_rowid(), + CONSTRAINT "primary" PRIMARY KEY (rowid ASC), + UNIQUE INDEX schema_migration_version_idx (version ASC), + FAMILY "primary" (version, rowid) +); +-- # row 2 +-- ## 210 +CREATE TABLE public.e2e_authors ( 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 ( +-- # row 3 +-- ## 352 +CREATE TABLE public.e2e_user_posts ( id UUID NOT NULL, user_id UUID NOT NULL, content VARCHAR(255) NOT NULL DEFAULT '':::STRING, slug VARCHAR(32) 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, user_id, content, 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_authors(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; +-- # row 4 +-- ## 154 +ALTER TABLE public.e2e_user_posts ADD CONSTRAINT e2e_user_notes_e2e_users_id_fk FOREIGN KEY (user_id) REFERENCES public.e2e_authors(id) ON DELETE CASCADE; +-- # row 5 +-- ## 115 +-- Validate foreign key constraints. These can fail if there was unvalidated data during the SHOW CREATE ALL TABLES +-- # row 6 +-- ## 85 +ALTER TABLE public.e2e_user_posts VALIDATE CONSTRAINT e2e_user_notes_e2e_users_id_fk; +-- # 6 rows diff --git a/testdata/e2e/fixtures/cockroach/up/12.sql b/testdata/e2e/fixtures/cockroach/up/12.sql index bf9084fc..76061fa7 100644 --- a/testdata/e2e/fixtures/cockroach/up/12.sql +++ b/testdata/e2e/fixtures/cockroach/up/12.sql @@ -1,30 +1,41 @@ -CREATE TABLE e2e_authors ( +-- # 1 column +-- # row 1 +-- ## 269 +CREATE TABLE public.schema_migration ( + version VARCHAR(14) NOT NULL, + rowid INT8 NOT VISIBLE NOT NULL DEFAULT unique_rowid(), + CONSTRAINT "primary" PRIMARY KEY (rowid ASC), + UNIQUE INDEX schema_migration_version_idx (version ASC), + FAMILY "primary" (version, rowid) +); +-- # row 2 +-- ## 210 +CREATE TABLE public.e2e_authors ( 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 ( +-- # row 3 +-- ## 358 +CREATE TABLE public.e2e_user_posts ( id UUID NOT NULL, author_id UUID NOT NULL, content VARCHAR(255) NOT NULL DEFAULT '':::STRING, slug VARCHAR(32) NOT NULL, CONSTRAINT "primary" PRIMARY KEY (id ASC), - INDEX e2e_user_notes_auto_index_e2e_user_notes_e2e_users_id_fk (author_id ASC), INDEX e2e_user_notes_user_id_idx (author_id ASC), UNIQUE INDEX e2e_user_notes_slug_idx (slug ASC), FAMILY "primary" (id, author_id, content, 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 (author_id) REFERENCES e2e_authors(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; +-- # row 4 +-- ## 156 +ALTER TABLE public.e2e_user_posts ADD CONSTRAINT e2e_user_notes_e2e_users_id_fk FOREIGN KEY (author_id) REFERENCES public.e2e_authors(id) ON DELETE CASCADE; +-- # row 5 +-- ## 115 +-- Validate foreign key constraints. These can fail if there was unvalidated data during the SHOW CREATE ALL TABLES +-- # row 6 +-- ## 85 +ALTER TABLE public.e2e_user_posts VALIDATE CONSTRAINT e2e_user_notes_e2e_users_id_fk; +-- # 6 rows diff --git a/testdata/e2e/fixtures/cockroach/up/13.sql b/testdata/e2e/fixtures/cockroach/up/13.sql index 3b25bca5..e55f8a38 100644 --- a/testdata/e2e/fixtures/cockroach/up/13.sql +++ b/testdata/e2e/fixtures/cockroach/up/13.sql @@ -1,12 +1,25 @@ -CREATE TABLE e2e_authors ( +-- # 1 column +-- # row 1 +-- ## 269 +CREATE TABLE public.schema_migration ( + version VARCHAR(14) NOT NULL, + rowid INT8 NOT VISIBLE NOT NULL DEFAULT unique_rowid(), + CONSTRAINT "primary" PRIMARY KEY (rowid ASC), + UNIQUE INDEX schema_migration_version_idx (version ASC), + FAMILY "primary" (version, rowid) +); +-- # row 2 +-- ## 210 +CREATE TABLE public.e2e_authors ( 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 ( +-- # row 3 +-- ## 405 +CREATE TABLE public.e2e_user_posts ( id UUID NOT NULL, content VARCHAR(255) NOT NULL DEFAULT '':::STRING, slug VARCHAR(32) NOT NULL, @@ -14,18 +27,16 @@ CREATE TABLE e2e_user_posts ( author_id UUID NULL, CONSTRAINT "primary" PRIMARY KEY (id ASC), UNIQUE INDEX e2e_user_notes_slug_idx (slug ASC), - INDEX e2e_user_notes_auto_index_e2e_user_notes_e2e_users_id_fk (author_id ASC), INDEX e2e_user_notes_user_id_idx (author_id ASC), FAMILY "primary" (id, content, slug, published, author_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_posts ADD CONSTRAINT e2e_user_notes_e2e_users_id_fk FOREIGN KEY (author_id) REFERENCES e2e_authors(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; +-- # row 4 +-- ## 156 +ALTER TABLE public.e2e_user_posts ADD CONSTRAINT e2e_user_notes_e2e_users_id_fk FOREIGN KEY (author_id) REFERENCES public.e2e_authors(id) ON DELETE CASCADE; +-- # row 5 +-- ## 115 +-- Validate foreign key constraints. These can fail if there was unvalidated data during the SHOW CREATE ALL TABLES +-- # row 6 +-- ## 85 +ALTER TABLE public.e2e_user_posts VALIDATE CONSTRAINT e2e_user_notes_e2e_users_id_fk; +-- # 6 rows diff --git a/testdata/e2e/fixtures/cockroach/up/14.sql b/testdata/e2e/fixtures/cockroach/up/14.sql index 611a3bf1..cc61db16 100644 --- a/testdata/e2e/fixtures/cockroach/up/14.sql +++ b/testdata/e2e/fixtures/cockroach/up/14.sql @@ -1,60 +1,80 @@ -CREATE TABLE e2e_address ( - id UUID NOT NULL, - CONSTRAINT "primary" PRIMARY KEY (id ASC), - FAMILY "primary" (id) +-- # 1 column +-- # row 1 +-- ## 269 +CREATE TABLE public.schema_migration ( + version VARCHAR(14) NOT NULL, + rowid INT8 NOT VISIBLE NOT NULL DEFAULT unique_rowid(), + CONSTRAINT "primary" PRIMARY KEY (rowid ASC), + UNIQUE INDEX schema_migration_version_idx (version ASC), + FAMILY "primary" (version, rowid) ); - -CREATE TABLE e2e_authors ( +-- # row 2 +-- ## 210 +CREATE TABLE public.e2e_authors ( 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_flow ( +-- # row 3 +-- ## 405 +CREATE TABLE public.e2e_user_posts ( + id UUID NOT NULL, + content VARCHAR(255) NOT NULL DEFAULT '':::STRING, + slug VARCHAR(32) NOT NULL, + published BOOL NOT NULL DEFAULT false, + author_id UUID NULL, + CONSTRAINT "primary" PRIMARY KEY (id ASC), + UNIQUE INDEX e2e_user_notes_slug_idx (slug ASC), + INDEX e2e_user_notes_user_id_idx (author_id ASC), + FAMILY "primary" (id, content, slug, published, author_id) +); +-- # row 4 +-- ## 119 +CREATE TABLE public.e2e_flow ( + id UUID NOT NULL, + CONSTRAINT "primary" PRIMARY KEY (id ASC), + FAMILY "primary" (id) +); +-- # row 5 +-- ## 122 +CREATE TABLE public.e2e_address ( id UUID NOT NULL, CONSTRAINT "primary" PRIMARY KEY (id ASC), FAMILY "primary" (id) ); - -CREATE TABLE e2e_token ( +-- # row 6 +-- ## 322 +CREATE TABLE public.e2e_token ( id UUID NOT NULL, token VARCHAR(64) NOT NULL, e2e_flow_id UUID NOT NULL, e2e_address_id UUID NOT NULL, CONSTRAINT "primary" PRIMARY KEY (id ASC), - INDEX e2e_token_auto_index_e2e_token_e2e_flow_id_fk (e2e_flow_id ASC), - INDEX e2e_token_auto_index_e2e_token_e2e_address_id_fk (e2e_address_id ASC), UNIQUE INDEX e2e_token_uq_idx (token ASC), INDEX e2e_token_idx (token ASC), FAMILY "primary" (id, token, e2e_flow_id, e2e_address_id) ); - -CREATE TABLE e2e_user_posts ( - id UUID NOT NULL, - content VARCHAR(255) NOT NULL DEFAULT '':::STRING, - slug VARCHAR(32) NOT NULL, - published BOOL NOT NULL DEFAULT false, - author_id UUID NULL, - CONSTRAINT "primary" PRIMARY KEY (id ASC), - UNIQUE INDEX e2e_user_notes_slug_idx (slug ASC), - INDEX e2e_user_notes_auto_index_e2e_user_notes_e2e_users_id_fk (author_id ASC), - INDEX e2e_user_notes_user_id_idx (author_id ASC), - FAMILY "primary" (id, content, slug, published, author_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_token ADD CONSTRAINT e2e_token_e2e_flow_id_fk FOREIGN KEY (e2e_flow_id) REFERENCES e2e_flow(id) ON DELETE CASCADE; -ALTER TABLE e2e_token ADD CONSTRAINT e2e_token_e2e_address_id_fk FOREIGN KEY (e2e_address_id) REFERENCES e2e_address(id) ON DELETE CASCADE; -ALTER TABLE e2e_user_posts ADD CONSTRAINT e2e_user_notes_e2e_users_id_fk FOREIGN KEY (author_id) REFERENCES e2e_authors(id) ON DELETE CASCADE; - --- Validate foreign key constraints. These can fail if there was unvalidated data during the dump. -ALTER TABLE e2e_token VALIDATE CONSTRAINT e2e_token_e2e_flow_id_fk; -ALTER TABLE e2e_token VALIDATE CONSTRAINT e2e_token_e2e_address_id_fk; -ALTER TABLE e2e_user_posts VALIDATE CONSTRAINT e2e_user_notes_e2e_users_id_fk; +-- # row 7 +-- ## 156 +ALTER TABLE public.e2e_user_posts ADD CONSTRAINT e2e_user_notes_e2e_users_id_fk FOREIGN KEY (author_id) REFERENCES public.e2e_authors(id) ON DELETE CASCADE; +-- # row 8 +-- ## 144 +ALTER TABLE public.e2e_token ADD CONSTRAINT e2e_token_e2e_flow_id_fk FOREIGN KEY (e2e_flow_id) REFERENCES public.e2e_flow(id) ON DELETE CASCADE; +-- # row 9 +-- ## 153 +ALTER TABLE public.e2e_token ADD CONSTRAINT e2e_token_e2e_address_id_fk FOREIGN KEY (e2e_address_id) REFERENCES public.e2e_address(id) ON DELETE CASCADE; +-- # row 10 +-- ## 115 +-- Validate foreign key constraints. These can fail if there was unvalidated data during the SHOW CREATE ALL TABLES +-- # row 11 +-- ## 85 +ALTER TABLE public.e2e_user_posts VALIDATE CONSTRAINT e2e_user_notes_e2e_users_id_fk; +-- # row 12 +-- ## 74 +ALTER TABLE public.e2e_token VALIDATE CONSTRAINT e2e_token_e2e_flow_id_fk; +-- # row 13 +-- ## 77 +ALTER TABLE public.e2e_token VALIDATE CONSTRAINT e2e_token_e2e_address_id_fk; +-- # 13 rows diff --git a/testdata/e2e/fixtures/cockroach/up/15.sql b/testdata/e2e/fixtures/cockroach/up/15.sql index 833b8b4f..d24fec17 100644 --- a/testdata/e2e/fixtures/cockroach/up/15.sql +++ b/testdata/e2e/fixtures/cockroach/up/15.sql @@ -1,62 +1,82 @@ -CREATE TABLE e2e_address ( - id UUID NOT NULL, - CONSTRAINT "primary" PRIMARY KEY (id ASC), - FAMILY "primary" (id) +-- # 1 column +-- # row 1 +-- ## 269 +CREATE TABLE public.schema_migration ( + version VARCHAR(14) NOT NULL, + rowid INT8 NOT VISIBLE NOT NULL DEFAULT unique_rowid(), + CONSTRAINT "primary" PRIMARY KEY (rowid ASC), + UNIQUE INDEX schema_migration_version_idx (version ASC), + FAMILY "primary" (version, rowid) ); - -CREATE TABLE e2e_authors ( +-- # row 2 +-- ## 210 +CREATE TABLE public.e2e_authors ( 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_flow ( +-- # row 3 +-- ## 405 +CREATE TABLE public.e2e_user_posts ( + id UUID NOT NULL, + content VARCHAR(255) NOT NULL DEFAULT '':::STRING, + slug VARCHAR(32) NOT NULL, + published BOOL NOT NULL DEFAULT false, + author_id UUID NULL, + CONSTRAINT "primary" PRIMARY KEY (id ASC), + UNIQUE INDEX e2e_user_notes_slug_idx (slug ASC), + INDEX e2e_user_notes_user_id_idx (author_id ASC), + FAMILY "primary" (id, content, slug, published, author_id) +); +-- # row 4 +-- ## 119 +CREATE TABLE public.e2e_flow ( + id UUID NOT NULL, + CONSTRAINT "primary" PRIMARY KEY (id ASC), + FAMILY "primary" (id) +); +-- # row 5 +-- ## 122 +CREATE TABLE public.e2e_address ( id UUID NOT NULL, CONSTRAINT "primary" PRIMARY KEY (id ASC), FAMILY "primary" (id) ); - -CREATE TABLE e2e_token ( +-- # row 6 +-- ## 488 +CREATE TABLE public.e2e_token ( id UUID NOT NULL, token VARCHAR(64) NOT NULL, e2e_address_id UUID NOT NULL, - expires_at TIMESTAMP NOT NULL DEFAULT '2000-01-01 00:00:00+00:00':::TIMESTAMP, - issued_at TIMESTAMP NOT NULL DEFAULT '2000-01-01 00:00:00+00:00':::TIMESTAMP, + expires_at TIMESTAMP NOT NULL DEFAULT '2000-01-01 00:00:00':::TIMESTAMP, + issued_at TIMESTAMP NOT NULL DEFAULT '2000-01-01 00:00:00':::TIMESTAMP, e2e_flow_id UUID NULL, CONSTRAINT "primary" PRIMARY KEY (id ASC), - INDEX e2e_token_auto_index_e2e_token_e2e_address_id_fk (e2e_address_id ASC), UNIQUE INDEX e2e_token_uq_idx (token ASC), INDEX e2e_token_idx (token ASC), - INDEX e2e_token_auto_index_e2e_token_e2e_flow_id_fk (e2e_flow_id ASC), FAMILY "primary" (id, token, e2e_address_id, expires_at, issued_at, e2e_flow_id) ); - -CREATE TABLE e2e_user_posts ( - id UUID NOT NULL, - content VARCHAR(255) NOT NULL DEFAULT '':::STRING, - slug VARCHAR(32) NOT NULL, - published BOOL NOT NULL DEFAULT false, - author_id UUID NULL, - CONSTRAINT "primary" PRIMARY KEY (id ASC), - UNIQUE INDEX e2e_user_notes_slug_idx (slug ASC), - INDEX e2e_user_notes_auto_index_e2e_user_notes_e2e_users_id_fk (author_id ASC), - INDEX e2e_user_notes_user_id_idx (author_id ASC), - FAMILY "primary" (id, content, slug, published, author_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_token ADD CONSTRAINT e2e_token_e2e_address_id_fk FOREIGN KEY (e2e_address_id) REFERENCES e2e_address(id) ON DELETE CASCADE; -ALTER TABLE e2e_token ADD CONSTRAINT e2e_token_e2e_flow_id_fk FOREIGN KEY (e2e_flow_id) REFERENCES e2e_flow(id) ON DELETE CASCADE; -ALTER TABLE e2e_user_posts ADD CONSTRAINT e2e_user_notes_e2e_users_id_fk FOREIGN KEY (author_id) REFERENCES e2e_authors(id) ON DELETE CASCADE; - --- Validate foreign key constraints. These can fail if there was unvalidated data during the dump. -ALTER TABLE e2e_token VALIDATE CONSTRAINT e2e_token_e2e_address_id_fk; -ALTER TABLE e2e_token VALIDATE CONSTRAINT e2e_token_e2e_flow_id_fk; -ALTER TABLE e2e_user_posts VALIDATE CONSTRAINT e2e_user_notes_e2e_users_id_fk; +-- # row 7 +-- ## 156 +ALTER TABLE public.e2e_user_posts ADD CONSTRAINT e2e_user_notes_e2e_users_id_fk FOREIGN KEY (author_id) REFERENCES public.e2e_authors(id) ON DELETE CASCADE; +-- # row 8 +-- ## 153 +ALTER TABLE public.e2e_token ADD CONSTRAINT e2e_token_e2e_address_id_fk FOREIGN KEY (e2e_address_id) REFERENCES public.e2e_address(id) ON DELETE CASCADE; +-- # row 9 +-- ## 144 +ALTER TABLE public.e2e_token ADD CONSTRAINT e2e_token_e2e_flow_id_fk FOREIGN KEY (e2e_flow_id) REFERENCES public.e2e_flow(id) ON DELETE CASCADE; +-- # row 10 +-- ## 115 +-- Validate foreign key constraints. These can fail if there was unvalidated data during the SHOW CREATE ALL TABLES +-- # row 11 +-- ## 85 +ALTER TABLE public.e2e_user_posts VALIDATE CONSTRAINT e2e_user_notes_e2e_users_id_fk; +-- # row 12 +-- ## 77 +ALTER TABLE public.e2e_token VALIDATE CONSTRAINT e2e_token_e2e_address_id_fk; +-- # row 13 +-- ## 74 +ALTER TABLE public.e2e_token VALIDATE CONSTRAINT e2e_token_e2e_flow_id_fk; +-- # 13 rows diff --git a/testdata/e2e/fixtures/cockroach/up/2.sql b/testdata/e2e/fixtures/cockroach/up/2.sql index 7ac1b314..83728d31 100644 --- a/testdata/e2e/fixtures/cockroach/up/2.sql +++ b/testdata/e2e/fixtures/cockroach/up/2.sql @@ -1,4 +1,16 @@ -CREATE TABLE e2e_users ( +-- # 1 column +-- # row 1 +-- ## 269 +CREATE TABLE public.schema_migration ( + version VARCHAR(14) NOT NULL, + rowid INT8 NOT VISIBLE NOT NULL DEFAULT unique_rowid(), + CONSTRAINT "primary" PRIMARY KEY (rowid ASC), + UNIQUE INDEX schema_migration_version_idx (version ASC), + FAMILY "primary" (version, rowid) +); +-- # row 2 +-- ## 247 +CREATE TABLE public.e2e_users ( id UUID NOT NULL, username VARCHAR(255) NULL, created_at TIMESTAMP NOT NULL, @@ -6,24 +18,23 @@ CREATE TABLE e2e_users ( CONSTRAINT "primary" PRIMARY KEY (id ASC), FAMILY "primary" (id, username, created_at, updated_at) ); - -CREATE TABLE e2e_user_notes ( +-- # row 3 +-- ## 240 +CREATE TABLE public.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; +-- # row 4 +-- ## 152 +ALTER TABLE public.e2e_user_notes ADD CONSTRAINT e2e_user_notes_e2e_users_id_fk FOREIGN KEY (user_id) REFERENCES public.e2e_users(id) ON DELETE CASCADE; +-- # row 5 +-- ## 115 +-- Validate foreign key constraints. These can fail if there was unvalidated data during the SHOW CREATE ALL TABLES +-- # row 6 +-- ## 85 +ALTER TABLE public.e2e_user_notes VALIDATE CONSTRAINT e2e_user_notes_e2e_users_id_fk; +-- # 6 rows diff --git a/testdata/e2e/fixtures/cockroach/up/3.sql b/testdata/e2e/fixtures/cockroach/up/3.sql index e558dd85..cc99ebdb 100644 --- a/testdata/e2e/fixtures/cockroach/up/3.sql +++ b/testdata/e2e/fixtures/cockroach/up/3.sql @@ -1,4 +1,16 @@ -CREATE TABLE e2e_users ( +-- # 1 column +-- # row 1 +-- ## 269 +CREATE TABLE public.schema_migration ( + version VARCHAR(14) NOT NULL, + rowid INT8 NOT VISIBLE NOT NULL DEFAULT unique_rowid(), + CONSTRAINT "primary" PRIMARY KEY (rowid ASC), + UNIQUE INDEX schema_migration_version_idx (version ASC), + FAMILY "primary" (version, rowid) +); +-- # row 2 +-- ## 247 +CREATE TABLE public.e2e_users ( id UUID NOT NULL, username VARCHAR(255) NULL, created_at TIMESTAMP NOT NULL, @@ -6,25 +18,24 @@ CREATE TABLE e2e_users ( CONSTRAINT "primary" PRIMARY KEY (id ASC), FAMILY "primary" (id, username, created_at, updated_at) ); - -CREATE TABLE e2e_user_notes ( +-- # row 3 +-- ## 270 +CREATE TABLE public.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; +-- # row 4 +-- ## 152 +ALTER TABLE public.e2e_user_notes ADD CONSTRAINT e2e_user_notes_e2e_users_id_fk FOREIGN KEY (user_id) REFERENCES public.e2e_users(id) ON DELETE CASCADE; +-- # row 5 +-- ## 115 +-- Validate foreign key constraints. These can fail if there was unvalidated data during the SHOW CREATE ALL TABLES +-- # row 6 +-- ## 85 +ALTER TABLE public.e2e_user_notes VALIDATE CONSTRAINT e2e_user_notes_e2e_users_id_fk; +-- # 6 rows diff --git a/testdata/e2e/fixtures/cockroach/up/4.sql b/testdata/e2e/fixtures/cockroach/up/4.sql index e558dd85..cc99ebdb 100644 --- a/testdata/e2e/fixtures/cockroach/up/4.sql +++ b/testdata/e2e/fixtures/cockroach/up/4.sql @@ -1,4 +1,16 @@ -CREATE TABLE e2e_users ( +-- # 1 column +-- # row 1 +-- ## 269 +CREATE TABLE public.schema_migration ( + version VARCHAR(14) NOT NULL, + rowid INT8 NOT VISIBLE NOT NULL DEFAULT unique_rowid(), + CONSTRAINT "primary" PRIMARY KEY (rowid ASC), + UNIQUE INDEX schema_migration_version_idx (version ASC), + FAMILY "primary" (version, rowid) +); +-- # row 2 +-- ## 247 +CREATE TABLE public.e2e_users ( id UUID NOT NULL, username VARCHAR(255) NULL, created_at TIMESTAMP NOT NULL, @@ -6,25 +18,24 @@ CREATE TABLE e2e_users ( CONSTRAINT "primary" PRIMARY KEY (id ASC), FAMILY "primary" (id, username, created_at, updated_at) ); - -CREATE TABLE e2e_user_notes ( +-- # row 3 +-- ## 270 +CREATE TABLE public.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; +-- # row 4 +-- ## 152 +ALTER TABLE public.e2e_user_notes ADD CONSTRAINT e2e_user_notes_e2e_users_id_fk FOREIGN KEY (user_id) REFERENCES public.e2e_users(id) ON DELETE CASCADE; +-- # row 5 +-- ## 115 +-- Validate foreign key constraints. These can fail if there was unvalidated data during the SHOW CREATE ALL TABLES +-- # row 6 +-- ## 85 +ALTER TABLE public.e2e_user_notes VALIDATE CONSTRAINT e2e_user_notes_e2e_users_id_fk; +-- # 6 rows diff --git a/testdata/e2e/fixtures/cockroach/up/5.sql b/testdata/e2e/fixtures/cockroach/up/5.sql index b66869e4..0a021eae 100644 --- a/testdata/e2e/fixtures/cockroach/up/5.sql +++ b/testdata/e2e/fixtures/cockroach/up/5.sql @@ -1,4 +1,16 @@ -CREATE TABLE e2e_users ( +-- # 1 column +-- # row 1 +-- ## 269 +CREATE TABLE public.schema_migration ( + version VARCHAR(14) NOT NULL, + rowid INT8 NOT VISIBLE NOT NULL DEFAULT unique_rowid(), + CONSTRAINT "primary" PRIMARY KEY (rowid ASC), + UNIQUE INDEX schema_migration_version_idx (version ASC), + FAMILY "primary" (version, rowid) +); +-- # row 2 +-- ## 247 +CREATE TABLE public.e2e_users ( id UUID NOT NULL, username VARCHAR(255) NULL, created_at TIMESTAMP NOT NULL, @@ -6,26 +18,25 @@ CREATE TABLE e2e_users ( CONSTRAINT "primary" PRIMARY KEY (id ASC), FAMILY "primary" (id, username, created_at, updated_at) ); - -CREATE TABLE e2e_user_notes ( +-- # row 3 +-- ## 324 +CREATE TABLE public.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; +-- # row 4 +-- ## 152 +ALTER TABLE public.e2e_user_notes ADD CONSTRAINT e2e_user_notes_e2e_users_id_fk FOREIGN KEY (user_id) REFERENCES public.e2e_users(id) ON DELETE CASCADE; +-- # row 5 +-- ## 115 +-- Validate foreign key constraints. These can fail if there was unvalidated data during the SHOW CREATE ALL TABLES +-- # row 6 +-- ## 85 +ALTER TABLE public.e2e_user_notes VALIDATE CONSTRAINT e2e_user_notes_e2e_users_id_fk; +-- # 6 rows diff --git a/testdata/e2e/fixtures/cockroach/up/6.sql b/testdata/e2e/fixtures/cockroach/up/6.sql index 6b7f10b2..cb08e9f8 100644 --- a/testdata/e2e/fixtures/cockroach/up/6.sql +++ b/testdata/e2e/fixtures/cockroach/up/6.sql @@ -1,4 +1,16 @@ -CREATE TABLE e2e_users ( +-- # 1 column +-- # row 1 +-- ## 269 +CREATE TABLE public.schema_migration ( + version VARCHAR(14) NOT NULL, + rowid INT8 NOT VISIBLE NOT NULL DEFAULT unique_rowid(), + CONSTRAINT "primary" PRIMARY KEY (rowid ASC), + UNIQUE INDEX schema_migration_version_idx (version ASC), + FAMILY "primary" (version, rowid) +); +-- # row 2 +-- ## 247 +CREATE TABLE public.e2e_users ( id UUID NOT NULL, username VARCHAR(255) NULL, created_at TIMESTAMP NOT NULL, @@ -6,26 +18,25 @@ CREATE TABLE e2e_users ( CONSTRAINT "primary" PRIMARY KEY (id ASC), FAMILY "primary" (id, username, created_at, updated_at) ); - -CREATE TABLE e2e_user_posts ( +-- # row 3 +-- ## 324 +CREATE TABLE public.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; +-- # row 4 +-- ## 152 +ALTER TABLE public.e2e_user_posts ADD CONSTRAINT e2e_user_notes_e2e_users_id_fk FOREIGN KEY (user_id) REFERENCES public.e2e_users(id) ON DELETE CASCADE; +-- # row 5 +-- ## 115 +-- Validate foreign key constraints. These can fail if there was unvalidated data during the SHOW CREATE ALL TABLES +-- # row 6 +-- ## 85 +ALTER TABLE public.e2e_user_posts VALIDATE CONSTRAINT e2e_user_notes_e2e_users_id_fk; +-- # 6 rows diff --git a/testdata/e2e/fixtures/cockroach/up/7.sql b/testdata/e2e/fixtures/cockroach/up/7.sql index c0843a8b..9cea5c38 100644 --- a/testdata/e2e/fixtures/cockroach/up/7.sql +++ b/testdata/e2e/fixtures/cockroach/up/7.sql @@ -1,4 +1,16 @@ -CREATE TABLE e2e_users ( +-- # 1 column +-- # row 1 +-- ## 269 +CREATE TABLE public.schema_migration ( + version VARCHAR(14) NOT NULL, + rowid INT8 NOT VISIBLE NOT NULL DEFAULT unique_rowid(), + CONSTRAINT "primary" PRIMARY KEY (rowid ASC), + UNIQUE INDEX schema_migration_version_idx (version ASC), + FAMILY "primary" (version, rowid) +); +-- # row 2 +-- ## 247 +CREATE TABLE public.e2e_users ( id UUID NOT NULL, username VARCHAR(255) NULL, created_at TIMESTAMP NOT NULL, @@ -6,26 +18,25 @@ CREATE TABLE e2e_users ( CONSTRAINT "primary" PRIMARY KEY (id ASC), FAMILY "primary" (id, username, created_at, updated_at) ); - -CREATE TABLE e2e_user_posts ( +-- # row 3 +-- ## 352 +CREATE TABLE public.e2e_user_posts ( id UUID NOT NULL, user_id UUID NOT NULL, slug VARCHAR(64) NOT NULL, content VARCHAR(255) 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), UNIQUE INDEX e2e_user_notes_slug_idx (slug ASC), FAMILY "primary" (id, user_id, slug, content) ); - -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; +-- # row 4 +-- ## 152 +ALTER TABLE public.e2e_user_posts ADD CONSTRAINT e2e_user_notes_e2e_users_id_fk FOREIGN KEY (user_id) REFERENCES public.e2e_users(id) ON DELETE CASCADE; +-- # row 5 +-- ## 115 +-- Validate foreign key constraints. These can fail if there was unvalidated data during the SHOW CREATE ALL TABLES +-- # row 6 +-- ## 85 +ALTER TABLE public.e2e_user_posts VALIDATE CONSTRAINT e2e_user_notes_e2e_users_id_fk; +-- # 6 rows diff --git a/testdata/e2e/fixtures/cockroach/up/8.sql b/testdata/e2e/fixtures/cockroach/up/8.sql index fe96793b..8746816e 100644 --- a/testdata/e2e/fixtures/cockroach/up/8.sql +++ b/testdata/e2e/fixtures/cockroach/up/8.sql @@ -1,4 +1,16 @@ -CREATE TABLE e2e_users ( +-- # 1 column +-- # row 1 +-- ## 269 +CREATE TABLE public.schema_migration ( + version VARCHAR(14) NOT NULL, + rowid INT8 NOT VISIBLE NOT NULL DEFAULT unique_rowid(), + CONSTRAINT "primary" PRIMARY KEY (rowid ASC), + UNIQUE INDEX schema_migration_version_idx (version ASC), + FAMILY "primary" (version, rowid) +); +-- # row 2 +-- ## 239 +CREATE TABLE public.e2e_users ( id UUID NOT NULL, name VARCHAR(255) NULL, created_at TIMESTAMP NOT NULL, @@ -6,26 +18,25 @@ CREATE TABLE e2e_users ( CONSTRAINT "primary" PRIMARY KEY (id ASC), FAMILY "primary" (id, name, created_at, updated_at) ); - -CREATE TABLE e2e_user_posts ( +-- # row 3 +-- ## 352 +CREATE TABLE public.e2e_user_posts ( id UUID NOT NULL, user_id UUID NOT NULL, slug VARCHAR(64) NOT NULL, content VARCHAR(255) 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), UNIQUE INDEX e2e_user_notes_slug_idx (slug ASC), FAMILY "primary" (id, user_id, slug, content) ); - -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; +-- # row 4 +-- ## 152 +ALTER TABLE public.e2e_user_posts ADD CONSTRAINT e2e_user_notes_e2e_users_id_fk FOREIGN KEY (user_id) REFERENCES public.e2e_users(id) ON DELETE CASCADE; +-- # row 5 +-- ## 115 +-- Validate foreign key constraints. These can fail if there was unvalidated data during the SHOW CREATE ALL TABLES +-- # row 6 +-- ## 85 +ALTER TABLE public.e2e_user_posts VALIDATE CONSTRAINT e2e_user_notes_e2e_users_id_fk; +-- # 6 rows diff --git a/testdata/e2e/fixtures/cockroach/up/9.sql b/testdata/e2e/fixtures/cockroach/up/9.sql index 99fb8e71..9ca0d17c 100644 --- a/testdata/e2e/fixtures/cockroach/up/9.sql +++ b/testdata/e2e/fixtures/cockroach/up/9.sql @@ -1,30 +1,41 @@ -CREATE TABLE e2e_users ( +-- # 1 column +-- # row 1 +-- ## 269 +CREATE TABLE public.schema_migration ( + version VARCHAR(14) NOT NULL, + rowid INT8 NOT VISIBLE NOT NULL DEFAULT unique_rowid(), + CONSTRAINT "primary" PRIMARY KEY (rowid ASC), + UNIQUE INDEX schema_migration_version_idx (version ASC), + FAMILY "primary" (version, rowid) +); +-- # row 2 +-- ## 208 +CREATE TABLE public.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 ( +-- # row 3 +-- ## 352 +CREATE TABLE public.e2e_user_posts ( id UUID NOT NULL, user_id UUID NOT NULL, slug VARCHAR(64) NOT NULL, content VARCHAR(255) 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), UNIQUE INDEX e2e_user_notes_slug_idx (slug ASC), FAMILY "primary" (id, user_id, slug, content) ); - -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; +-- # row 4 +-- ## 152 +ALTER TABLE public.e2e_user_posts ADD CONSTRAINT e2e_user_notes_e2e_users_id_fk FOREIGN KEY (user_id) REFERENCES public.e2e_users(id) ON DELETE CASCADE; +-- # row 5 +-- ## 115 +-- Validate foreign key constraints. These can fail if there was unvalidated data during the SHOW CREATE ALL TABLES +-- # row 6 +-- ## 85 +ALTER TABLE public.e2e_user_posts VALIDATE CONSTRAINT e2e_user_notes_e2e_users_id_fk; +-- # 6 rows