├── .github ├── CODEOWNERS ├── FUNDING.yml └── workflows │ ├── standard-stale.yml │ └── tests.yml ├── .gitignore ├── LICENSE ├── Makefile ├── README.md ├── SHOULDERS.md ├── bubbler.go ├── bubbler_test.go ├── columns.go ├── columns_test.go ├── database.yml ├── docker-compose.yml ├── fizz.go ├── foreign_keys.go ├── go.mod ├── go.sum ├── index.go ├── raw_sql.go ├── tables.go ├── tables_private_test.go ├── tables_test.go ├── test.sh ├── testdata ├── e2e │ ├── cockroach_test.go │ ├── fixtures │ │ ├── cockroach │ │ │ ├── down │ │ │ │ ├── 0.sql │ │ │ │ ├── 1.sql │ │ │ │ ├── 10.sql │ │ │ │ ├── 11.sql │ │ │ │ ├── 12.sql │ │ │ │ ├── 13.sql │ │ │ │ ├── 14.sql │ │ │ │ ├── 15.sql │ │ │ │ ├── 2.sql │ │ │ │ ├── 3.sql │ │ │ │ ├── 4.sql │ │ │ │ ├── 5.sql │ │ │ │ ├── 6.sql │ │ │ │ ├── 7.sql │ │ │ │ ├── 8.sql │ │ │ │ └── 9.sql │ │ │ └── up │ │ │ │ ├── 0.sql │ │ │ │ ├── 1.sql │ │ │ │ ├── 10.sql │ │ │ │ ├── 11.sql │ │ │ │ ├── 12.sql │ │ │ │ ├── 13.sql │ │ │ │ ├── 14.sql │ │ │ │ ├── 15.sql │ │ │ │ ├── 2.sql │ │ │ │ ├── 3.sql │ │ │ │ ├── 4.sql │ │ │ │ ├── 5.sql │ │ │ │ ├── 6.sql │ │ │ │ ├── 7.sql │ │ │ │ ├── 8.sql │ │ │ │ └── 9.sql │ │ ├── mysql │ │ │ ├── down │ │ │ │ ├── 0.sql │ │ │ │ ├── 1.sql │ │ │ │ ├── 10.sql │ │ │ │ ├── 11.sql │ │ │ │ ├── 12.sql │ │ │ │ ├── 13.sql │ │ │ │ ├── 14.sql │ │ │ │ ├── 15.sql │ │ │ │ ├── 2.sql │ │ │ │ ├── 3.sql │ │ │ │ ├── 4.sql │ │ │ │ ├── 5.sql │ │ │ │ ├── 6.sql │ │ │ │ ├── 7.sql │ │ │ │ ├── 8.sql │ │ │ │ └── 9.sql │ │ │ └── up │ │ │ │ ├── 0.sql │ │ │ │ ├── 1.sql │ │ │ │ ├── 10.sql │ │ │ │ ├── 11.sql │ │ │ │ ├── 12.sql │ │ │ │ ├── 13.sql │ │ │ │ ├── 14.sql │ │ │ │ ├── 15.sql │ │ │ │ ├── 2.sql │ │ │ │ ├── 3.sql │ │ │ │ ├── 4.sql │ │ │ │ ├── 5.sql │ │ │ │ ├── 6.sql │ │ │ │ ├── 7.sql │ │ │ │ ├── 8.sql │ │ │ │ └── 9.sql │ │ ├── postgres │ │ │ ├── down │ │ │ │ ├── 0.sql │ │ │ │ ├── 1.sql │ │ │ │ ├── 10.sql │ │ │ │ ├── 11.sql │ │ │ │ ├── 12.sql │ │ │ │ ├── 13.sql │ │ │ │ ├── 14.sql │ │ │ │ ├── 15.sql │ │ │ │ ├── 2.sql │ │ │ │ ├── 3.sql │ │ │ │ ├── 4.sql │ │ │ │ ├── 5.sql │ │ │ │ ├── 6.sql │ │ │ │ ├── 7.sql │ │ │ │ ├── 8.sql │ │ │ │ └── 9.sql │ │ │ └── up │ │ │ │ ├── 0.sql │ │ │ │ ├── 1.sql │ │ │ │ ├── 10.sql │ │ │ │ ├── 11.sql │ │ │ │ ├── 12.sql │ │ │ │ ├── 13.sql │ │ │ │ ├── 14.sql │ │ │ │ ├── 15.sql │ │ │ │ ├── 2.sql │ │ │ │ ├── 3.sql │ │ │ │ ├── 4.sql │ │ │ │ ├── 5.sql │ │ │ │ ├── 6.sql │ │ │ │ ├── 7.sql │ │ │ │ ├── 8.sql │ │ │ │ └── 9.sql │ │ └── sqlite3 │ │ │ ├── down │ │ │ ├── 0.sql │ │ │ ├── 1.sql │ │ │ ├── 10.sql │ │ │ ├── 11.sql │ │ │ ├── 12.sql │ │ │ ├── 13.sql │ │ │ ├── 14.sql │ │ │ ├── 15.sql │ │ │ ├── 2.sql │ │ │ ├── 3.sql │ │ │ ├── 4.sql │ │ │ ├── 5.sql │ │ │ ├── 6.sql │ │ │ ├── 7.sql │ │ │ ├── 8.sql │ │ │ └── 9.sql │ │ │ └── up │ │ │ ├── 0.sql │ │ │ ├── 1.sql │ │ │ ├── 10.sql │ │ │ ├── 11.sql │ │ │ ├── 12.sql │ │ │ ├── 13.sql │ │ │ ├── 14.sql │ │ │ ├── 15.sql │ │ │ ├── 2.sql │ │ │ ├── 3.sql │ │ │ ├── 4.sql │ │ │ ├── 5.sql │ │ │ ├── 6.sql │ │ │ ├── 7.sql │ │ │ ├── 8.sql │ │ │ └── 9.sql │ ├── go.mod │ ├── go.sum │ ├── integration_test.go │ ├── migrations │ │ ├── 20191100000001_users.down.fizz │ │ ├── 20191100000001_users.up.fizz │ │ ├── 20191100000002_user_notes.down.fizz │ │ ├── 20191100000002_user_notes.up.fizz │ │ ├── 20191100000003_user_notes_drop_title.down.fizz │ │ ├── 20191100000003_user_notes_drop_title.up.fizz │ │ ├── 20191100000004_user_notes_add_slug.down.fizz │ │ ├── 20191100000004_user_notes_add_slug.up.fizz │ │ ├── 20191100000005_user_notes_add_slug.down.fizz │ │ ├── 20191100000005_user_notes_add_slug.up.fizz │ │ ├── 20191100000006_user_notes_add_slug.down.fizz │ │ ├── 20191100000006_user_notes_add_slug.up.fizz │ │ ├── 20191100000007_user_notes_rename.down.fizz │ │ ├── 20191100000007_user_notes_rename.up.fizz │ │ ├── 20191100000008_user_notes_rename_notes.down.fizz │ │ ├── 20191100000008_user_notes_rename_notes.up.fizz │ │ ├── 20191100000009_users_username.down.fizz │ │ ├── 20191100000009_users_username.up.fizz │ │ ├── 20191100000010_users_drop_name.down.fizz │ │ ├── 20191100000010_users_drop_name.up.fizz │ │ ├── 20191100000011_user_posts_change_column.down.fizz │ │ ├── 20191100000011_user_posts_change_column.up.fizz │ │ ├── 20191100000012_rename_user.down.fizz │ │ ├── 20191100000012_rename_user.up.fizz │ │ ├── 20191100000013_rename_user_notes_user.down.fizz │ │ ├── 20191100000013_rename_user_notes_user.up.fizz │ │ ├── 20191100000014_rename_user_add_published.down.fizz │ │ ├── 20191100000014_rename_user_add_published.up.fizz │ │ ├── 20191100000015_auto_fk.down.fizz │ │ ├── 20191100000015_auto_fk.up.fizz │ │ ├── 20191100000016_rename_auto_fk.down.fizz │ │ └── 20191100000016_rename_auto_fk.up.fizz │ ├── migrator_test.go │ ├── mysql_test.go │ ├── postgres_test.go │ └── sqlite3_test.go └── migrations │ ├── .gitignore │ ├── 20160808213308_setup_tests.down.fizz │ ├── 20160808213308_setup_tests.up.fizz │ ├── 20160808213310_setup_tests2.down.fizz │ ├── 20160808213310_setup_tests2.up.fizz │ └── multiple │ ├── 20180413210602_create_users.mysql.up.sql │ ├── 20180413210602_create_users.postgres.up.sql │ ├── 20180413210602_create_users.sqlite3.up.sql │ └── 20180413210602_create_users.up.sql ├── translator.go ├── translators ├── cockroach.go ├── cockroach_meta.go ├── cockroach_test.go ├── mariadb.go ├── mariadb_test.go ├── mssqlserver.go ├── mssqlserver_test.go ├── mysql.go ├── mysql_meta.go ├── mysql_test.go ├── postgres.go ├── postgres_test.go ├── schema.go ├── schema_test.go ├── sqlite.go ├── sqlite_meta.go ├── sqlite_meta_test.go ├── sqlite_test.go └── translators_test.go └── version.go /.github/CODEOWNERS: -------------------------------------------------------------------------------- 1 | translators/cockroach* @mclark4386 2 | # Default owner 3 | * @gobuffalo/core-managers @gobuffalo/database -------------------------------------------------------------------------------- /.github/FUNDING.yml: -------------------------------------------------------------------------------- 1 | # These are supported funding model platforms 2 | 3 | github: [markbates, stanislas-m] 4 | patreon: buffalo -------------------------------------------------------------------------------- /.github/workflows/standard-stale.yml: -------------------------------------------------------------------------------- 1 | name: Standard Autocloser 2 | 3 | on: 4 | schedule: 5 | - cron: "30 1 * * *" 6 | 7 | jobs: 8 | call-standard-autocloser: 9 | name: Autocloser 10 | uses: gobuffalo/.github/.github/workflows/stale.yml@v1 11 | secrets: inherit 12 | -------------------------------------------------------------------------------- /.gitignore: -------------------------------------------------------------------------------- 1 | *.log 2 | .DS_Store 3 | doc 4 | tmp 5 | pkg 6 | *.gem 7 | *.pid 8 | coverage 9 | coverage.data 10 | build/* 11 | *.pbxuser 12 | *.mode1v3 13 | .svn 14 | profile 15 | .console_history 16 | .sass-cache/* 17 | .rake_tasks~ 18 | *.log.lck 19 | solr/ 20 | .jhw-cache/ 21 | jhw.* 22 | *.sublime* 23 | node_modules/ 24 | dist/ 25 | generated/ 26 | .vendor/ 27 | bin/* 28 | gin-bin 29 | .idea/ 30 | .vscode/ 31 | cockroach-data/ 32 | migrations/schema.sql 33 | vendor/ 34 | sqldumps/ 35 | sql/ 36 | -------------------------------------------------------------------------------- /LICENSE: -------------------------------------------------------------------------------- 1 | The MIT License (MIT) 2 | 3 | Copyright (c) 2019 Mark Bates 4 | 5 | Permission is hereby granted, free of charge, to any person obtaining a copy 6 | of this software and associated documentation files (the "Software"), to deal 7 | in the Software without restriction, including without limitation the rights 8 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 9 | copies of the Software, and to permit persons to whom the Software is 10 | furnished to do so, subject to the following conditions: 11 | 12 | The above copyright notice and this permission notice shall be included in all 13 | copies or substantial portions of the Software. 14 | 15 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 16 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 17 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 18 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 19 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 20 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 21 | SOFTWARE. 22 | -------------------------------------------------------------------------------- /Makefile: -------------------------------------------------------------------------------- 1 | TAGS ?= sqlite 2 | GO_BIN ?= go 3 | 4 | install: 5 | $(GO_BIN) install -tags ${TAGS} -v . 6 | 7 | tidy: 8 | $(GO_BIN) mod tidy 9 | 10 | build: 11 | $(GO_BIN) build -v . 12 | 13 | test: 14 | ./test.sh -cover -v 15 | 16 | lint: 17 | go get github.com/golangci/golangci-lint/cmd/golangci-lint 18 | golangci-lint run --enable-all 19 | 20 | update: 21 | rm go.* 22 | $(GO_BIN) mod init github.com/gobuffalo/fizz 23 | $(GO_BIN) mod tidy --go=1.16 24 | -------------------------------------------------------------------------------- /SHOULDERS.md: -------------------------------------------------------------------------------- 1 | # Fizz Stands on the Shoulders of Giants 2 | 3 | Fizz does not try to reinvent the wheel! Instead, it uses the already great wheels developed by the Go community and puts them all together in the best way possible. Without these giants, this project would not be possible. Please make sure to check them out and thank them for all of their hard work. 4 | 5 | Thank you to the following **GIANTS**: 6 | 7 | * [github.com/Masterminds/semver/v3](https://godoc.org/github.com/Masterminds/semver/v3) 8 | * [github.com/aymerick/douceur](https://godoc.org/github.com/aymerick/douceur) 9 | * [github.com/davecgh/go-spew](https://godoc.org/github.com/davecgh/go-spew) 10 | * [github.com/fatih/structs](https://godoc.org/github.com/fatih/structs) 11 | * [github.com/go-sql-driver/mysql](https://godoc.org/github.com/go-sql-driver/mysql) 12 | * [github.com/gobuffalo/flect](https://godoc.org/github.com/gobuffalo/flect) 13 | * [github.com/gobuffalo/github_flavored_markdown](https://godoc.org/github.com/gobuffalo/github_flavored_markdown) 14 | * [github.com/gobuffalo/helpers](https://godoc.org/github.com/gobuffalo/helpers) 15 | * [github.com/gobuffalo/plush/v4](https://godoc.org/github.com/gobuffalo/plush/v4) 16 | * [github.com/gobuffalo/tags/v3](https://godoc.org/github.com/gobuffalo/tags/v3) 17 | * [github.com/gobuffalo/validate/v3](https://godoc.org/github.com/gobuffalo/validate/v3) 18 | * [github.com/gofrs/uuid](https://godoc.org/github.com/gofrs/uuid) 19 | * [github.com/gorilla/css](https://godoc.org/github.com/gorilla/css) 20 | * [github.com/kballard/go-shellquote](https://godoc.org/github.com/kballard/go-shellquote) 21 | * [github.com/kr/pretty](https://godoc.org/github.com/kr/pretty) 22 | * [github.com/kr/pty](https://godoc.org/github.com/kr/pty) 23 | * [github.com/kr/text](https://godoc.org/github.com/kr/text) 24 | * [github.com/microcosm-cc/bluemonday](https://godoc.org/github.com/microcosm-cc/bluemonday) 25 | * [github.com/pmezard/go-difflib](https://godoc.org/github.com/pmezard/go-difflib) 26 | * [github.com/sergi/go-diff](https://godoc.org/github.com/sergi/go-diff) 27 | * [github.com/sourcegraph/annotate](https://godoc.org/github.com/sourcegraph/annotate) 28 | * [github.com/sourcegraph/syntaxhighlight](https://godoc.org/github.com/sourcegraph/syntaxhighlight) 29 | * [github.com/stretchr/objx](https://godoc.org/github.com/stretchr/objx) 30 | * [github.com/stretchr/testify](https://godoc.org/github.com/stretchr/testify) 31 | * [golang.org/x/net](https://godoc.org/golang.org/x/net) 32 | * [golang.org/x/sync](https://godoc.org/golang.org/x/sync) 33 | * [golang.org/x/sys](https://godoc.org/golang.org/x/sys) 34 | * [golang.org/x/term](https://godoc.org/golang.org/x/term) 35 | * [golang.org/x/text](https://godoc.org/golang.org/x/text) 36 | * [golang.org/x/tools](https://godoc.org/golang.org/x/tools) 37 | * [gopkg.in/check.v1](https://godoc.org/gopkg.in/check.v1) 38 | * [gopkg.in/yaml.v2](https://godoc.org/gopkg.in/yaml.v2) 39 | * [gopkg.in/yaml.v3](https://godoc.org/gopkg.in/yaml.v3) 40 | -------------------------------------------------------------------------------- /bubbler.go: -------------------------------------------------------------------------------- 1 | package fizz 2 | 3 | import ( 4 | "os" 5 | "strings" 6 | 7 | "github.com/gobuffalo/plush/v4" 8 | ) 9 | 10 | type BubbleType int 11 | 12 | type Bubbler struct { 13 | Translator 14 | data []string 15 | } 16 | 17 | func NewBubbler(t Translator) *Bubbler { 18 | return &Bubbler{ 19 | Translator: t, 20 | data: []string{}, 21 | } 22 | } 23 | 24 | func (b *Bubbler) String() string { 25 | return strings.Join(b.data, "\n") 26 | } 27 | 28 | func (b *Bubbler) Bubble(s string) (string, error) { 29 | f := fizzer{b} 30 | ctx := plush.NewContextWith(map[string]interface{}{ 31 | "exec": f.Exec(os.Stdout), 32 | "create_table": f.CreateTable, 33 | "change_column": f.ChangeColumn, 34 | "add_column": f.AddColumn, 35 | "drop_column": f.DropColumn, 36 | "rename_column": f.RenameColumn, 37 | "raw": f.RawSQL, 38 | "sql": f.RawSQL, 39 | "add_index": f.AddIndex, 40 | "drop_index": f.DropIndex, 41 | "rename_index": f.RenameIndex, 42 | "add_foreign_key": f.AddForeignKey, 43 | "drop_foreign_key": f.DropForeignKey, 44 | "drop_table": f.DropTable, 45 | "rename_table": f.RenameTable, 46 | }) 47 | 48 | err := plush.RunScript(s, ctx) 49 | 50 | return b.String(), err 51 | } 52 | -------------------------------------------------------------------------------- /bubbler_test.go: -------------------------------------------------------------------------------- 1 | package fizz 2 | 3 | import ( 4 | "bytes" 5 | "strings" 6 | "testing" 7 | 8 | "github.com/stretchr/testify/require" 9 | ) 10 | 11 | func Test_Exec(t *testing.T) { 12 | r := require.New(t) 13 | 14 | b := NewBubbler(nil) 15 | f := fizzer{b} 16 | bb := &bytes.Buffer{} 17 | c := f.Exec(bb) 18 | r.NoError(c("echo hello")) 19 | r.Equal("hello", strings.TrimSpace(bb.String())) 20 | } 21 | 22 | func Test_ExecQuoted(t *testing.T) { 23 | r := require.New(t) 24 | 25 | b := NewBubbler(nil) 26 | f := fizzer{b} 27 | bb := &bytes.Buffer{} 28 | c := f.Exec(bb) 29 | // without proper splitting we would get "'a b c'" 30 | r.NoError(c("echo 'a b c'")) 31 | r.Equal("a b c", strings.TrimSpace(bb.String())) 32 | } 33 | -------------------------------------------------------------------------------- /columns.go: -------------------------------------------------------------------------------- 1 | package fizz 2 | 3 | import ( 4 | "encoding/json" 5 | "fmt" 6 | "sort" 7 | "strings" 8 | ) 9 | 10 | // Deprecated: Fizz won't force you to have an ID field now. 11 | var INT_ID_COL = Column{ 12 | Name: "id", 13 | Primary: true, 14 | ColType: "integer", 15 | Options: Options{}, 16 | } 17 | 18 | // Deprecated: Fizz won't force you to have an ID field now. 19 | var UUID_ID_COL = Column{ 20 | Name: "id", 21 | Primary: true, 22 | ColType: "uuid", 23 | Options: Options{}, 24 | } 25 | 26 | var CREATED_COL = Column{Name: "created_at", ColType: "timestamp", Options: nil} 27 | var UPDATED_COL = Column{Name: "updated_at", ColType: "timestamp", Options: nil} 28 | 29 | type Column struct { 30 | Name string 31 | ColType string 32 | Primary bool 33 | Options map[string]interface{} 34 | } 35 | 36 | func (c Column) String() string { 37 | if c.Primary || c.Options != nil { 38 | var opts map[string]interface{} 39 | if c.Options == nil { 40 | opts = make(map[string]interface{}) 41 | } else { 42 | opts = c.Options 43 | } 44 | if c.Primary { 45 | opts["primary"] = true 46 | } 47 | 48 | o := make([]string, 0, len(opts)) 49 | for k, v := range opts { 50 | vv, _ := json.Marshal(v) 51 | o = append(o, fmt.Sprintf("%s: %s", k, string(vv))) 52 | } 53 | sort.SliceStable(o, func(i, j int) bool { return o[i] < o[j] }) 54 | return fmt.Sprintf(`t.Column("%s", "%s", {%s})`, c.Name, c.ColType, strings.Join(o, ", ")) 55 | } 56 | return fmt.Sprintf(`t.Column("%s", "%s")`, c.Name, c.ColType) 57 | } 58 | 59 | func (f fizzer) ChangeColumn(table, name, ctype string, options Options) error { 60 | t := Table{ 61 | Name: table, 62 | Columns: []Column{ 63 | {Name: name, ColType: ctype, Options: options}, 64 | }, 65 | } 66 | return f.add(f.Bubbler.ChangeColumn(t)) 67 | } 68 | 69 | func (f fizzer) AddColumn(table, name, ctype string, options Options) error { 70 | t := Table{ 71 | Name: table, 72 | Columns: []Column{ 73 | {Name: name, ColType: ctype, Options: options}, 74 | }, 75 | } 76 | return f.add(f.Bubbler.AddColumn(t)) 77 | } 78 | 79 | func (f fizzer) DropColumn(table, name string) error { 80 | t := Table{ 81 | Name: table, 82 | Columns: []Column{ 83 | {Name: name}, 84 | }, 85 | } 86 | return f.add(f.Bubbler.DropColumn(t)) 87 | } 88 | 89 | func (f fizzer) RenameColumn(table, old, new string) error { 90 | t := Table{ 91 | Name: table, 92 | Columns: []Column{ 93 | {Name: old}, 94 | {Name: new}, 95 | }, 96 | } 97 | return f.add(f.Bubbler.RenameColumn(t)) 98 | } 99 | -------------------------------------------------------------------------------- /columns_test.go: -------------------------------------------------------------------------------- 1 | package fizz_test 2 | 3 | import ( 4 | "testing" 5 | 6 | "github.com/gobuffalo/fizz" 7 | "github.com/stretchr/testify/require" 8 | ) 9 | 10 | func Test_Column_Stringer(t *testing.T) { 11 | t.Run("primary column", func(tt *testing.T) { 12 | r := require.New(tt) 13 | c := fizz.Column{ 14 | Name: "pk", 15 | ColType: "int", 16 | Primary: true, 17 | } 18 | 19 | r.Equal(`t.Column("pk", "int", {primary: true})`, c.String()) 20 | }) 21 | 22 | t.Run("primary column with raw default", func(tt *testing.T) { 23 | r := require.New(tt) 24 | c := fizz.Column{ 25 | Name: "pk", 26 | ColType: "int", 27 | Primary: true, 28 | Options: map[string]interface{}{ 29 | "default_raw": "uuid_generate_v4()", 30 | }, 31 | } 32 | 33 | r.Equal(`t.Column("pk", "int", {default_raw: "uuid_generate_v4()", primary: true})`, c.String()) 34 | }) 35 | 36 | t.Run("simple column", func(tt *testing.T) { 37 | r := require.New(tt) 38 | c := fizz.Column{ 39 | Name: "name", 40 | ColType: "string", 41 | } 42 | 43 | r.Equal(`t.Column("name", "string")`, c.String()) 44 | }) 45 | 46 | t.Run("with option", func(tt *testing.T) { 47 | r := require.New(tt) 48 | c := fizz.Column{ 49 | Name: "alive", 50 | ColType: "boolean", 51 | Options: map[string]interface{}{ 52 | "null": true, 53 | }, 54 | } 55 | 56 | r.Equal(`t.Column("alive", "boolean", {null: true})`, c.String()) 57 | }) 58 | 59 | t.Run("with string option", func(tt *testing.T) { 60 | r := require.New(tt) 61 | c := fizz.Column{ 62 | Name: "price", 63 | ColType: "numeric", 64 | Options: map[string]interface{}{ 65 | "default": "1.00", 66 | }, 67 | } 68 | 69 | r.Equal(`t.Column("price", "numeric", {default: "1.00"})`, c.String()) 70 | }) 71 | } 72 | -------------------------------------------------------------------------------- /database.yml: -------------------------------------------------------------------------------- 1 | mysql: 2 | dialect: "mysql" 3 | database: "pop_test" 4 | host: {{ envOr "MYSQL_HOST" "127.0.0.1" }} 5 | port: {{ envOr "MYSQL_PORT" "3307" }} 6 | user: {{ envOr "MYSQL_USER" "root" }} 7 | password: {{ envOr "MYSQL_PASSWORD" "root" }} 8 | 9 | postgres: 10 | url: "postgres://postgres:postgres@localhost:5433/pop_test?sslmode=disable" 11 | pool: 25 12 | 13 | cockroach: 14 | # url: "cockroach://root@127.0.0.1:26258/pop_test?application_name=cockroach&sslmode=disable" 15 | dialect: "cockroach" 16 | database: "pop_test" 17 | host: {{ envOr "COCKROACH_HOST" "127.0.0.1" }} 18 | port: {{ envOr "COCKROACH_PORT" "26258" }} 19 | user: {{ envOr "COCKROACH_USER" "root" }} 20 | password: {{ envOr "COCKROACH_PASSWORD" "" }} 21 | options: 22 | sslmode: disable 23 | 24 | sqlserver: 25 | dialect: "sqlserver" 26 | database: "pop_test" 27 | host: {{ envOr "MSSQLSERVER_HOST" "127.0.0.1" }} 28 | port: {{ envOr "MSSQLSERVER_PORT" "1433" }} 29 | user: {{ envOr "MSSQLSERVER_USER" "sa" }} 30 | password: {{ envOr "MSSQLSERVER_PASSWORD" "Tt@12345678" }} 31 | 32 | sqlite: 33 | dialect: "sqlite3" 34 | database: "./tmp/test.sqlite" 35 | options: 36 | mode: rwc 37 | 38 | -------------------------------------------------------------------------------- /docker-compose.yml: -------------------------------------------------------------------------------- 1 | version: '2' 2 | 3 | services: 4 | mysql: 5 | image: mysql:5.7 6 | environment: 7 | - MYSQL_ROOT_PASSWORD=root 8 | - MYSQL_DATABASE=pop_test 9 | - MYSQL_USER=pop 10 | - MYSQL_PASSWORD=pop 11 | #volumes: 12 | #- ./_vol/mysql:/docker-entrypoint-initdb.d 13 | ports: 14 | - "3307:3306" 15 | healthcheck: 16 | test: ["CMD", "mysqladmin" ,"ping", "-h", "localhost"] 17 | interval: 5s 18 | timeout: 5s 19 | retries: 10 20 | start_period: 3s 21 | 22 | postgres: 23 | image: postgres:10 24 | environment: 25 | - POSTGRES_DB=pop_test 26 | - POSTGRES_PASSWORD=postgres 27 | ports: 28 | - "5433:5432" 29 | #volumes: 30 | #- ./_vol/postgres:/docker-entrypoint-initdb.d 31 | healthcheck: 32 | test: ["CMD", "pg_isready"] 33 | interval: 5s 34 | timeout: 5s 35 | retries: 10 36 | start_period: 3s 37 | 38 | cockroach: 39 | image: cockroachdb/cockroach:latest-v21.1 40 | ports: 41 | - "26258:26257" 42 | - "8081:8080" 43 | #volumes: 44 | #- ./_vol/cockroach:/cockroach/cockroach-data 45 | command: start-single-node --insecure 46 | healthcheck: 47 | test: ["CMD", "curl", "http://localhost:8080/health"] 48 | interval: 5s 49 | timeout: 5s 50 | retries: 10 51 | start_period: 3s 52 | 53 | # mssqlserver: 54 | # image: "microsoft/mssql-server-linux" 55 | # environment: 56 | # - SA_PASSWORD=Tt@12345678 57 | # - MSSQLSERVER_PASSWORD=Tt@12345678 58 | # - ACCEPT_EULA=Y 59 | # ports: 60 | # - "1433:1433" 61 | -------------------------------------------------------------------------------- /fizz.go: -------------------------------------------------------------------------------- 1 | /* 2 | Package fizz is a common DSL for writing SQL migrations 3 | */ 4 | package fizz 5 | 6 | import ( 7 | "io" 8 | "io/ioutil" 9 | "os" 10 | "os/exec" 11 | 12 | shellquote "github.com/kballard/go-shellquote" 13 | ) 14 | 15 | // Options is a generic map of options. 16 | type Options map[string]interface{} 17 | 18 | type fizzer struct { 19 | Bubbler *Bubbler 20 | } 21 | 22 | func (f fizzer) add(s string, err error) error { 23 | if err != nil { 24 | return err 25 | } 26 | f.Bubbler.data = append(f.Bubbler.data, s) 27 | return nil 28 | } 29 | 30 | func (f fizzer) Exec(out io.Writer) func(string) error { 31 | return func(s string) error { 32 | args, err := shellquote.Split(s) 33 | if err != nil { 34 | return err 35 | } 36 | cmd := exec.Command(args[0], args[1:]...) 37 | cmd.Stdin = os.Stdin 38 | cmd.Stdout = out 39 | cmd.Stderr = os.Stderr 40 | err = cmd.Run() 41 | if err != nil { 42 | return err 43 | } 44 | return nil 45 | } 46 | } 47 | 48 | // AFile reads in a fizz migration from an io.Reader and translates its contents to SQL. 49 | func AFile(f io.Reader, t Translator) (string, error) { 50 | b, err := ioutil.ReadAll(f) 51 | if err != nil { 52 | return "", err 53 | } 54 | return AString(string(b), t) 55 | } 56 | 57 | // AString reads a fizz string, and translates its contents to SQL. 58 | func AString(s string, t Translator) (string, error) { 59 | b := NewBubbler(t) 60 | return b.Bubble(s) 61 | } 62 | -------------------------------------------------------------------------------- /foreign_keys.go: -------------------------------------------------------------------------------- 1 | package fizz 2 | 3 | import ( 4 | "encoding/json" 5 | "fmt" 6 | "sort" 7 | "strings" 8 | ) 9 | 10 | type ForeignKeyRef struct { 11 | Table string 12 | Columns []string 13 | } 14 | 15 | type ForeignKey struct { 16 | Name string 17 | Column string 18 | References ForeignKeyRef 19 | Options Options 20 | } 21 | 22 | func (f ForeignKey) String() string { 23 | refs := fmt.Sprintf(`{"%s": ["%s"]}`, f.References.Table, strings.Join(f.References.Columns, `", "`)) 24 | var opts map[string]interface{} 25 | if f.Options == nil { 26 | opts = make(map[string]interface{}) 27 | } else { 28 | opts = f.Options 29 | } 30 | 31 | o := make([]string, 0, len(opts)) 32 | for k, v := range opts { 33 | vv, _ := json.Marshal(v) 34 | o = append(o, fmt.Sprintf("%s: %s", k, string(vv))) 35 | } 36 | sort.SliceStable(o, func(i, j int) bool { return o[i] < o[j] }) 37 | return fmt.Sprintf(`t.ForeignKey("%s", %s, {%s})`, f.Column, refs, strings.Join(o, ", ")) 38 | } 39 | 40 | func (f fizzer) AddForeignKey(table string, column string, refs interface{}, options Options) error { 41 | fkr, err := parseForeignKeyRef(refs) 42 | if err != nil { 43 | return err 44 | } 45 | fk := ForeignKey{ 46 | Column: column, 47 | References: fkr, 48 | Options: options, 49 | } 50 | 51 | if options["name"] != nil { 52 | var ok bool 53 | fk.Name, ok = options["name"].(string) 54 | if !ok { 55 | return fmt.Errorf(`expected options field "name" to be of type "string" but got "%T"`, options["name"]) 56 | } 57 | } else { 58 | fk.Name = fmt.Sprintf("%s_%s_%s_fk", table, fk.References.Table, strings.Join(fk.References.Columns, "_")) 59 | } 60 | 61 | return f.add(f.Bubbler.AddForeignKey(Table{ 62 | Name: table, 63 | ForeignKeys: []ForeignKey{fk}, 64 | })) 65 | } 66 | 67 | func (f fizzer) DropForeignKey(table string, fk string, options Options) error { 68 | return f.add(f.Bubbler.DropForeignKey(Table{ 69 | Name: table, 70 | ForeignKeys: []ForeignKey{ 71 | { 72 | Name: fk, 73 | Options: options, 74 | }, 75 | }, 76 | })) 77 | } 78 | 79 | func parseForeignKeyRef(refs interface{}) (ForeignKeyRef, error) { 80 | fkr := ForeignKeyRef{} 81 | refMap, ok := refs.(map[string]interface{}) 82 | if !ok { 83 | return fkr, fmt.Errorf(`invalid references format %s\nmust be "{"table": ["colum1", "column2"]}"`, refs) 84 | } 85 | if len(refMap) != 1 { 86 | return fkr, fmt.Errorf("only one table is supported as Foreign key reference") 87 | } 88 | for table, columns := range refMap { 89 | fkr.Table = table 90 | for _, c := range columns.([]interface{}) { 91 | fkr.Columns = append(fkr.Columns, fmt.Sprintf("%s", c)) 92 | } 93 | } 94 | 95 | return fkr, nil 96 | } 97 | -------------------------------------------------------------------------------- /go.mod: -------------------------------------------------------------------------------- 1 | module github.com/gobuffalo/fizz 2 | 3 | go 1.16 4 | 5 | require ( 6 | github.com/Masterminds/semver/v3 v3.1.1 7 | github.com/go-sql-driver/mysql v1.6.0 8 | github.com/gobuffalo/plush/v4 v4.1.16 9 | github.com/kballard/go-shellquote v0.0.0-20180428030007-95032a82bc51 10 | github.com/stretchr/testify v1.8.0 11 | ) 12 | -------------------------------------------------------------------------------- /index.go: -------------------------------------------------------------------------------- 1 | package fizz 2 | 3 | import ( 4 | "encoding/json" 5 | "fmt" 6 | "sort" 7 | "strings" 8 | ) 9 | 10 | // Index is the index definition for fizz. 11 | type Index struct { 12 | Name string 13 | Columns []string 14 | Unique bool 15 | Options Options 16 | } 17 | 18 | func (i Index) String() string { 19 | var opts map[string]interface{} 20 | if i.Options == nil { 21 | opts = make(map[string]interface{}) 22 | } else { 23 | opts = i.Options 24 | } 25 | if i.Name != "" { 26 | opts["name"] = i.Name 27 | } 28 | if i.Unique { 29 | opts["unique"] = true 30 | } 31 | o := make([]string, 0, len(opts)) 32 | for k, v := range opts { 33 | vv, _ := json.Marshal(v) 34 | o = append(o, fmt.Sprintf("%s: %s", k, string(vv))) 35 | } 36 | sort.SliceStable(o, func(i, j int) bool { return o[i] < o[j] }) 37 | if len(i.Columns) > 1 { 38 | cols := make([]string, len(i.Columns)) 39 | for k, v := range i.Columns { 40 | cols[k] = `"` + v + `"` 41 | } 42 | return fmt.Sprintf(`t.Index([%s], {%s})`, strings.Join(cols, ", "), strings.Join(o, ", ")) 43 | } 44 | return fmt.Sprintf(`t.Index("%s", {%s})`, i.Columns[0], strings.Join(o, ", ")) 45 | } 46 | 47 | func (f fizzer) AddIndex(table string, columns interface{}, options Options) error { 48 | t := NewTable(table, nil) 49 | if err := t.Index(columns, options); err != nil { 50 | return err 51 | } 52 | return f.add(f.Bubbler.AddIndex(t)) 53 | } 54 | 55 | func (f fizzer) DropIndex(table, name string) error { 56 | return f.add(f.Bubbler.DropIndex(Table{ 57 | Name: table, 58 | Indexes: []Index{ 59 | {Name: name}, 60 | }, 61 | })) 62 | } 63 | 64 | func (f fizzer) RenameIndex(table, old, new string) error { 65 | return f.add(f.Bubbler.RenameIndex(Table{ 66 | Name: table, 67 | Indexes: []Index{ 68 | {Name: old}, 69 | {Name: new}, 70 | }, 71 | })) 72 | } 73 | -------------------------------------------------------------------------------- /raw_sql.go: -------------------------------------------------------------------------------- 1 | package fizz 2 | 3 | import ( 4 | "strings" 5 | ) 6 | 7 | func (f fizzer) RawSQL(sql string) error { 8 | if !strings.HasSuffix(sql, ";") { 9 | sql += ";" 10 | } 11 | return f.add(sql, nil) 12 | } 13 | 14 | // Deprecated: use RawSQL instead. 15 | func (f fizzer) RawSql(sql string) error { 16 | return f.RawSQL(sql) 17 | } 18 | -------------------------------------------------------------------------------- /tables_private_test.go: -------------------------------------------------------------------------------- 1 | package fizz 2 | 3 | import ( 4 | "testing" 5 | 6 | "github.com/stretchr/testify/require" 7 | ) 8 | 9 | func Test_Table_HasColumnNoCache(t *testing.T) { 10 | r := require.New(t) 11 | table := NewTable("users", nil) 12 | r.NoError(table.Column("firstname", "string", nil)) 13 | r.NoError(table.Column("lastname", "string", nil)) 14 | table.columnsCache = map[string]struct{}{} 15 | r.True(table.HasColumns("firstname", "lastname")) 16 | r.False(table.HasColumns("age")) 17 | } 18 | -------------------------------------------------------------------------------- /test.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | 3 | set -e 4 | 5 | # NOTE: See also docker-compose.yml and database.yml to configure database 6 | # properties. 7 | export MYSQL_PORT=3307 8 | export COCKROACH_PORT=26258 9 | 10 | COMPOSE=docker-compose 11 | which docker-compose || COMPOSE="docker compose" 12 | 13 | args=$@ 14 | 15 | function cleanup { 16 | echo "Cleanup resources..." 17 | $COMPOSE down 18 | docker volume prune -f 19 | find ./tmp -name *.sqlite* -delete || true 20 | } 21 | # defer cleanup, so it will be executed even after premature exit 22 | trap cleanup EXIT 23 | 24 | function test { 25 | export SODA_DIALECT=$1 26 | 27 | echo "" 28 | echo "######################################################################" 29 | echo "### Running unit tests for $SODA_DIALECT" 30 | soda drop -e $SODA_DIALECT 31 | soda create -e $SODA_DIALECT 32 | soda migrate -e $SODA_DIALECT -p ./testdata/migrations 33 | go test -tags sqlite -count=1 $args ./... 34 | 35 | echo "" 36 | echo "######################################################################" 37 | echo "### Running e2e tests for $1" 38 | soda drop -e $SODA_DIALECT 39 | soda create -e $SODA_DIALECT 40 | pushd testdata/e2e; go test -tags sqlite,e2e -count=1 $args ./...; popd 41 | } 42 | 43 | 44 | $COMPOSE up --wait 45 | 46 | go install -tags sqlite github.com/gobuffalo/pop/v6/soda@latest 47 | 48 | test "sqlite" 49 | test "postgres" 50 | test "cockroach" 51 | test "mysql" 52 | 53 | # Does not appear to be implemented in pop: 54 | # test "sqlserver" 55 | -------------------------------------------------------------------------------- /testdata/e2e/cockroach_test.go: -------------------------------------------------------------------------------- 1 | package e2e_test 2 | 3 | import ( 4 | "github.com/gobuffalo/pop/v6" 5 | "github.com/stretchr/testify/suite" 6 | ) 7 | 8 | type CockroachSuite struct { 9 | suite.Suite 10 | } 11 | 12 | func (s *CockroachSuite) Test_Cockroach_MigrationSteps() { 13 | r := s.Require() 14 | 15 | c, err := pop.Connect("cockroach") 16 | r.NoError(err) 17 | r.NoError(retryOpen(c)) 18 | 19 | run(&s.Suite, c, runTestData(&s.Suite, c, true)) 20 | } 21 | -------------------------------------------------------------------------------- /testdata/e2e/fixtures/cockroach/down/0.sql: -------------------------------------------------------------------------------- 1 | -- # 1 column 2 | -- # row 1 3 | -- ## 269 4 | CREATE TABLE public.schema_migration ( 5 | version VARCHAR(14) NOT NULL, 6 | rowid INT8 NOT VISIBLE NOT NULL DEFAULT unique_rowid(), 7 | CONSTRAINT "primary" PRIMARY KEY (rowid ASC), 8 | UNIQUE INDEX schema_migration_version_idx (version ASC), 9 | FAMILY "primary" (version, rowid) 10 | ); 11 | -- # 1 row 12 | -------------------------------------------------------------------------------- /testdata/e2e/fixtures/cockroach/down/1.sql: -------------------------------------------------------------------------------- 1 | -- # 1 column 2 | -- # row 1 3 | -- ## 269 4 | CREATE TABLE public.schema_migration ( 5 | version VARCHAR(14) NOT NULL, 6 | rowid INT8 NOT VISIBLE NOT NULL DEFAULT unique_rowid(), 7 | CONSTRAINT "primary" PRIMARY KEY (rowid ASC), 8 | UNIQUE INDEX schema_migration_version_idx (version ASC), 9 | FAMILY "primary" (version, rowid) 10 | ); 11 | -- # row 2 12 | -- ## 247 13 | CREATE TABLE public.e2e_users ( 14 | id UUID NOT NULL, 15 | created_at TIMESTAMP NOT NULL, 16 | updated_at TIMESTAMP NOT NULL, 17 | username VARCHAR(255) NULL, 18 | CONSTRAINT "primary" PRIMARY KEY (id ASC), 19 | FAMILY "primary" (id, created_at, updated_at, username) 20 | ); 21 | -- # 2 rows 22 | -------------------------------------------------------------------------------- /testdata/e2e/fixtures/cockroach/down/10.sql: -------------------------------------------------------------------------------- 1 | -- # 1 column 2 | -- # row 1 3 | -- ## 269 4 | CREATE TABLE public.schema_migration ( 5 | version VARCHAR(14) NOT NULL, 6 | rowid INT8 NOT VISIBLE NOT NULL DEFAULT unique_rowid(), 7 | CONSTRAINT "primary" PRIMARY KEY (rowid ASC), 8 | UNIQUE INDEX schema_migration_version_idx (version ASC), 9 | FAMILY "primary" (version, rowid) 10 | ); 11 | -- # row 2 12 | -- ## 208 13 | CREATE TABLE public.e2e_users ( 14 | id UUID NOT NULL, 15 | created_at TIMESTAMP NOT NULL, 16 | updated_at TIMESTAMP NOT NULL, 17 | CONSTRAINT "primary" PRIMARY KEY (id ASC), 18 | FAMILY "primary" (id, created_at, updated_at) 19 | ); 20 | -- # row 3 21 | -- ## 352 22 | CREATE TABLE public.e2e_user_posts ( 23 | id UUID NOT NULL, 24 | content VARCHAR(255) NOT NULL DEFAULT '':::STRING, 25 | user_id UUID NOT NULL, 26 | slug VARCHAR(64) NOT NULL, 27 | CONSTRAINT "primary" PRIMARY KEY (id ASC), 28 | INDEX e2e_user_notes_user_id_idx (user_id ASC), 29 | UNIQUE INDEX e2e_user_notes_slug_idx (slug ASC), 30 | FAMILY "primary" (id, content, user_id, slug) 31 | ); 32 | -- # row 4 33 | -- ## 152 34 | 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; 35 | -- # row 5 36 | -- ## 115 37 | -- Validate foreign key constraints. These can fail if there was unvalidated data during the SHOW CREATE ALL TABLES 38 | -- # row 6 39 | -- ## 85 40 | ALTER TABLE public.e2e_user_posts VALIDATE CONSTRAINT e2e_user_notes_e2e_users_id_fk; 41 | -- # 6 rows 42 | -------------------------------------------------------------------------------- /testdata/e2e/fixtures/cockroach/down/11.sql: -------------------------------------------------------------------------------- 1 | -- # 1 column 2 | -- # row 1 3 | -- ## 269 4 | CREATE TABLE public.schema_migration ( 5 | version VARCHAR(14) NOT NULL, 6 | rowid INT8 NOT VISIBLE NOT NULL DEFAULT unique_rowid(), 7 | CONSTRAINT "primary" PRIMARY KEY (rowid ASC), 8 | UNIQUE INDEX schema_migration_version_idx (version ASC), 9 | FAMILY "primary" (version, rowid) 10 | ); 11 | -- # row 2 12 | -- ## 208 13 | CREATE TABLE public.e2e_users ( 14 | id UUID NOT NULL, 15 | created_at TIMESTAMP NOT NULL, 16 | updated_at TIMESTAMP NOT NULL, 17 | CONSTRAINT "primary" PRIMARY KEY (id ASC), 18 | FAMILY "primary" (id, created_at, updated_at) 19 | ); 20 | -- # row 3 21 | -- ## 352 22 | CREATE TABLE public.e2e_user_posts ( 23 | id UUID NOT NULL, 24 | content VARCHAR(255) NOT NULL DEFAULT '':::STRING, 25 | slug VARCHAR(32) NOT NULL, 26 | user_id UUID NOT NULL, 27 | CONSTRAINT "primary" PRIMARY KEY (id ASC), 28 | UNIQUE INDEX e2e_user_notes_slug_idx (slug ASC), 29 | INDEX e2e_user_notes_user_id_idx (user_id ASC), 30 | FAMILY "primary" (id, content, slug, user_id) 31 | ); 32 | -- # row 4 33 | -- ## 152 34 | 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; 35 | -- # row 5 36 | -- ## 115 37 | -- Validate foreign key constraints. These can fail if there was unvalidated data during the SHOW CREATE ALL TABLES 38 | -- # row 6 39 | -- ## 85 40 | ALTER TABLE public.e2e_user_posts VALIDATE CONSTRAINT e2e_user_notes_e2e_users_id_fk; 41 | -- # 6 rows 42 | -------------------------------------------------------------------------------- /testdata/e2e/fixtures/cockroach/down/12.sql: -------------------------------------------------------------------------------- 1 | -- # 1 column 2 | -- # row 1 3 | -- ## 269 4 | CREATE TABLE public.schema_migration ( 5 | version VARCHAR(14) NOT NULL, 6 | rowid INT8 NOT VISIBLE NOT NULL DEFAULT unique_rowid(), 7 | CONSTRAINT "primary" PRIMARY KEY (rowid ASC), 8 | UNIQUE INDEX schema_migration_version_idx (version ASC), 9 | FAMILY "primary" (version, rowid) 10 | ); 11 | -- # row 2 12 | -- ## 210 13 | CREATE TABLE public.e2e_authors ( 14 | id UUID NOT NULL, 15 | created_at TIMESTAMP NOT NULL, 16 | updated_at TIMESTAMP NOT NULL, 17 | CONSTRAINT "primary" PRIMARY KEY (id ASC), 18 | FAMILY "primary" (id, created_at, updated_at) 19 | ); 20 | -- # row 3 21 | -- ## 352 22 | CREATE TABLE public.e2e_user_posts ( 23 | id UUID NOT NULL, 24 | content VARCHAR(255) NOT NULL DEFAULT '':::STRING, 25 | slug VARCHAR(32) NOT NULL, 26 | user_id UUID NOT NULL, 27 | CONSTRAINT "primary" PRIMARY KEY (id ASC), 28 | UNIQUE INDEX e2e_user_notes_slug_idx (slug ASC), 29 | INDEX e2e_user_notes_user_id_idx (user_id ASC), 30 | FAMILY "primary" (id, content, slug, user_id) 31 | ); 32 | -- # row 4 33 | -- ## 154 34 | 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; 35 | -- # row 5 36 | -- ## 115 37 | -- Validate foreign key constraints. These can fail if there was unvalidated data during the SHOW CREATE ALL TABLES 38 | -- # row 6 39 | -- ## 85 40 | ALTER TABLE public.e2e_user_posts VALIDATE CONSTRAINT e2e_user_notes_e2e_users_id_fk; 41 | -- # 6 rows 42 | -------------------------------------------------------------------------------- /testdata/e2e/fixtures/cockroach/down/13.sql: -------------------------------------------------------------------------------- 1 | -- # 1 column 2 | -- # row 1 3 | -- ## 269 4 | CREATE TABLE public.schema_migration ( 5 | version VARCHAR(14) NOT NULL, 6 | rowid INT8 NOT VISIBLE NOT NULL DEFAULT unique_rowid(), 7 | CONSTRAINT "primary" PRIMARY KEY (rowid ASC), 8 | UNIQUE INDEX schema_migration_version_idx (version ASC), 9 | FAMILY "primary" (version, rowid) 10 | ); 11 | -- # row 2 12 | -- ## 210 13 | CREATE TABLE public.e2e_authors ( 14 | id UUID NOT NULL, 15 | created_at TIMESTAMP NOT NULL, 16 | updated_at TIMESTAMP NOT NULL, 17 | CONSTRAINT "primary" PRIMARY KEY (id ASC), 18 | FAMILY "primary" (id, created_at, updated_at) 19 | ); 20 | -- # row 3 21 | -- ## 358 22 | CREATE TABLE public.e2e_user_posts ( 23 | id UUID NOT NULL, 24 | content VARCHAR(255) NOT NULL DEFAULT '':::STRING, 25 | slug VARCHAR(32) NOT NULL, 26 | author_id UUID NOT NULL, 27 | CONSTRAINT "primary" PRIMARY KEY (id ASC), 28 | UNIQUE INDEX e2e_user_notes_slug_idx (slug ASC), 29 | INDEX e2e_user_notes_user_id_idx (author_id ASC), 30 | FAMILY "primary" (id, content, slug, author_id) 31 | ); 32 | -- # row 4 33 | -- ## 156 34 | 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; 35 | -- # row 5 36 | -- ## 115 37 | -- Validate foreign key constraints. These can fail if there was unvalidated data during the SHOW CREATE ALL TABLES 38 | -- # row 6 39 | -- ## 85 40 | ALTER TABLE public.e2e_user_posts VALIDATE CONSTRAINT e2e_user_notes_e2e_users_id_fk; 41 | -- # 6 rows 42 | -------------------------------------------------------------------------------- /testdata/e2e/fixtures/cockroach/down/14.sql: -------------------------------------------------------------------------------- 1 | -- # 1 column 2 | -- # row 1 3 | -- ## 269 4 | CREATE TABLE public.schema_migration ( 5 | version VARCHAR(14) NOT NULL, 6 | rowid INT8 NOT VISIBLE NOT NULL DEFAULT unique_rowid(), 7 | CONSTRAINT "primary" PRIMARY KEY (rowid ASC), 8 | UNIQUE INDEX schema_migration_version_idx (version ASC), 9 | FAMILY "primary" (version, rowid) 10 | ); 11 | -- # row 2 12 | -- ## 210 13 | CREATE TABLE public.e2e_authors ( 14 | id UUID NOT NULL, 15 | created_at TIMESTAMP NOT NULL, 16 | updated_at TIMESTAMP NOT NULL, 17 | CONSTRAINT "primary" PRIMARY KEY (id ASC), 18 | FAMILY "primary" (id, created_at, updated_at) 19 | ); 20 | -- # row 3 21 | -- ## 405 22 | CREATE TABLE public.e2e_user_posts ( 23 | id UUID NOT NULL, 24 | content VARCHAR(255) NOT NULL DEFAULT '':::STRING, 25 | slug VARCHAR(32) NOT NULL, 26 | published BOOL NOT NULL DEFAULT false, 27 | author_id UUID NULL, 28 | CONSTRAINT "primary" PRIMARY KEY (id ASC), 29 | UNIQUE INDEX e2e_user_notes_slug_idx (slug ASC), 30 | INDEX e2e_user_notes_user_id_idx (author_id ASC), 31 | FAMILY "primary" (id, content, slug, published, author_id) 32 | ); 33 | -- # row 4 34 | -- ## 156 35 | 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; 36 | -- # row 5 37 | -- ## 115 38 | -- Validate foreign key constraints. These can fail if there was unvalidated data during the SHOW CREATE ALL TABLES 39 | -- # row 6 40 | -- ## 85 41 | ALTER TABLE public.e2e_user_posts VALIDATE CONSTRAINT e2e_user_notes_e2e_users_id_fk; 42 | -- # 6 rows 43 | -------------------------------------------------------------------------------- /testdata/e2e/fixtures/cockroach/down/15.sql: -------------------------------------------------------------------------------- 1 | -- # 1 column 2 | -- # row 1 3 | -- ## 269 4 | CREATE TABLE public.schema_migration ( 5 | version VARCHAR(14) NOT NULL, 6 | rowid INT8 NOT VISIBLE NOT NULL DEFAULT unique_rowid(), 7 | CONSTRAINT "primary" PRIMARY KEY (rowid ASC), 8 | UNIQUE INDEX schema_migration_version_idx (version ASC), 9 | FAMILY "primary" (version, rowid) 10 | ); 11 | -- # row 2 12 | -- ## 210 13 | CREATE TABLE public.e2e_authors ( 14 | id UUID NOT NULL, 15 | created_at TIMESTAMP NOT NULL, 16 | updated_at TIMESTAMP NOT NULL, 17 | CONSTRAINT "primary" PRIMARY KEY (id ASC), 18 | FAMILY "primary" (id, created_at, updated_at) 19 | ); 20 | -- # row 3 21 | -- ## 405 22 | CREATE TABLE public.e2e_user_posts ( 23 | id UUID NOT NULL, 24 | content VARCHAR(255) NOT NULL DEFAULT '':::STRING, 25 | slug VARCHAR(32) NOT NULL, 26 | published BOOL NOT NULL DEFAULT false, 27 | author_id UUID NULL, 28 | CONSTRAINT "primary" PRIMARY KEY (id ASC), 29 | UNIQUE INDEX e2e_user_notes_slug_idx (slug ASC), 30 | INDEX e2e_user_notes_user_id_idx (author_id ASC), 31 | FAMILY "primary" (id, content, slug, published, author_id) 32 | ); 33 | -- # row 4 34 | -- ## 119 35 | CREATE TABLE public.e2e_flow ( 36 | id UUID NOT NULL, 37 | CONSTRAINT "primary" PRIMARY KEY (id ASC), 38 | FAMILY "primary" (id) 39 | ); 40 | -- # row 5 41 | -- ## 122 42 | CREATE TABLE public.e2e_address ( 43 | id UUID NOT NULL, 44 | CONSTRAINT "primary" PRIMARY KEY (id ASC), 45 | FAMILY "primary" (id) 46 | ); 47 | -- # row 6 48 | -- ## 492 49 | CREATE TABLE public.e2e_token ( 50 | id UUID NOT NULL, 51 | token VARCHAR(64) NOT NULL, 52 | e2e_address_id UUID NOT NULL, 53 | expires_at TIMESTAMP NOT NULL DEFAULT '2000-01-01 00:00:00':::TIMESTAMP, 54 | issued_at TIMESTAMP NOT NULL DEFAULT '2000-01-01 00:00:00':::TIMESTAMP, 55 | e2e_flow_id UUID NOT NULL, 56 | CONSTRAINT "primary" PRIMARY KEY (id ASC), 57 | UNIQUE INDEX e2e_token_uq_idx (token ASC), 58 | INDEX e2e_token_idx (token ASC), 59 | FAMILY "primary" (id, token, e2e_address_id, expires_at, issued_at, e2e_flow_id) 60 | ); 61 | -- # row 7 62 | -- ## 156 63 | 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; 64 | -- # row 8 65 | -- ## 153 66 | 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; 67 | -- # row 9 68 | -- ## 144 69 | 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; 70 | -- # row 10 71 | -- ## 115 72 | -- Validate foreign key constraints. These can fail if there was unvalidated data during the SHOW CREATE ALL TABLES 73 | -- # row 11 74 | -- ## 85 75 | ALTER TABLE public.e2e_user_posts VALIDATE CONSTRAINT e2e_user_notes_e2e_users_id_fk; 76 | -- # row 12 77 | -- ## 77 78 | ALTER TABLE public.e2e_token VALIDATE CONSTRAINT e2e_token_e2e_address_id_fk; 79 | -- # row 13 80 | -- ## 74 81 | ALTER TABLE public.e2e_token VALIDATE CONSTRAINT e2e_token_e2e_flow_id_fk; 82 | -- # 13 rows 83 | -------------------------------------------------------------------------------- /testdata/e2e/fixtures/cockroach/down/2.sql: -------------------------------------------------------------------------------- 1 | -- # 1 column 2 | -- # row 1 3 | -- ## 269 4 | CREATE TABLE public.schema_migration ( 5 | version VARCHAR(14) NOT NULL, 6 | rowid INT8 NOT VISIBLE NOT NULL DEFAULT unique_rowid(), 7 | CONSTRAINT "primary" PRIMARY KEY (rowid ASC), 8 | UNIQUE INDEX schema_migration_version_idx (version ASC), 9 | FAMILY "primary" (version, rowid) 10 | ); 11 | -- # row 2 12 | -- ## 247 13 | CREATE TABLE public.e2e_users ( 14 | id UUID NOT NULL, 15 | created_at TIMESTAMP NOT NULL, 16 | updated_at TIMESTAMP NOT NULL, 17 | username VARCHAR(255) NULL, 18 | CONSTRAINT "primary" PRIMARY KEY (id ASC), 19 | FAMILY "primary" (id, created_at, updated_at, username) 20 | ); 21 | -- # row 3 22 | -- ## 341 23 | CREATE TABLE public.e2e_user_notes ( 24 | id UUID NOT NULL, 25 | user_id UUID NOT NULL, 26 | notes VARCHAR(255) NULL, 27 | title VARCHAR(64) NOT NULL DEFAULT '':::STRING, 28 | CONSTRAINT "primary" PRIMARY KEY (id ASC), 29 | INDEX e2e_user_notes_user_id_idx (user_id ASC), 30 | INDEX e2e_user_notes_title_idx (title ASC), 31 | FAMILY "primary" (id, user_id, notes, title) 32 | ); 33 | -- # row 4 34 | -- ## 152 35 | 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; 36 | -- # row 5 37 | -- ## 115 38 | -- Validate foreign key constraints. These can fail if there was unvalidated data during the SHOW CREATE ALL TABLES 39 | -- # row 6 40 | -- ## 85 41 | ALTER TABLE public.e2e_user_notes VALIDATE CONSTRAINT e2e_user_notes_e2e_users_id_fk; 42 | -- # 6 rows 43 | -------------------------------------------------------------------------------- /testdata/e2e/fixtures/cockroach/down/3.sql: -------------------------------------------------------------------------------- 1 | -- # 1 column 2 | -- # row 1 3 | -- ## 269 4 | CREATE TABLE public.schema_migration ( 5 | version VARCHAR(14) NOT NULL, 6 | rowid INT8 NOT VISIBLE NOT NULL DEFAULT unique_rowid(), 7 | CONSTRAINT "primary" PRIMARY KEY (rowid ASC), 8 | UNIQUE INDEX schema_migration_version_idx (version ASC), 9 | FAMILY "primary" (version, rowid) 10 | ); 11 | -- # row 2 12 | -- ## 247 13 | CREATE TABLE public.e2e_users ( 14 | id UUID NOT NULL, 15 | created_at TIMESTAMP NOT NULL, 16 | updated_at TIMESTAMP NOT NULL, 17 | username VARCHAR(255) NULL, 18 | CONSTRAINT "primary" PRIMARY KEY (id ASC), 19 | FAMILY "primary" (id, created_at, updated_at, username) 20 | ); 21 | -- # row 3 22 | -- ## 240 23 | CREATE TABLE public.e2e_user_notes ( 24 | id UUID NOT NULL, 25 | user_id UUID NOT NULL, 26 | notes VARCHAR(255) NULL, 27 | CONSTRAINT "primary" PRIMARY KEY (id ASC), 28 | INDEX e2e_user_notes_user_id_idx (user_id ASC), 29 | FAMILY "primary" (id, user_id, notes) 30 | ); 31 | -- # row 4 32 | -- ## 152 33 | 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; 34 | -- # row 5 35 | -- ## 115 36 | -- Validate foreign key constraints. These can fail if there was unvalidated data during the SHOW CREATE ALL TABLES 37 | -- # row 6 38 | -- ## 85 39 | ALTER TABLE public.e2e_user_notes VALIDATE CONSTRAINT e2e_user_notes_e2e_users_id_fk; 40 | -- # 6 rows 41 | -------------------------------------------------------------------------------- /testdata/e2e/fixtures/cockroach/down/4.sql: -------------------------------------------------------------------------------- 1 | -- # 1 column 2 | -- # row 1 3 | -- ## 269 4 | CREATE TABLE public.schema_migration ( 5 | version VARCHAR(14) NOT NULL, 6 | rowid INT8 NOT VISIBLE NOT NULL DEFAULT unique_rowid(), 7 | CONSTRAINT "primary" PRIMARY KEY (rowid ASC), 8 | UNIQUE INDEX schema_migration_version_idx (version ASC), 9 | FAMILY "primary" (version, rowid) 10 | ); 11 | -- # row 2 12 | -- ## 247 13 | CREATE TABLE public.e2e_users ( 14 | id UUID NOT NULL, 15 | created_at TIMESTAMP NOT NULL, 16 | updated_at TIMESTAMP NOT NULL, 17 | username VARCHAR(255) NULL, 18 | CONSTRAINT "primary" PRIMARY KEY (id ASC), 19 | FAMILY "primary" (id, created_at, updated_at, username) 20 | ); 21 | -- # row 3 22 | -- ## 324 23 | CREATE TABLE public.e2e_user_notes ( 24 | id UUID NOT NULL, 25 | user_id UUID NOT NULL, 26 | slug VARCHAR(64) NOT NULL, 27 | notes VARCHAR(255) NULL, 28 | CONSTRAINT "primary" PRIMARY KEY (id ASC), 29 | INDEX e2e_user_notes_user_id_idx (user_id ASC), 30 | UNIQUE INDEX e2e_user_notes_slug_idx (slug ASC), 31 | FAMILY "primary" (id, user_id, slug, notes) 32 | ); 33 | -- # row 4 34 | -- ## 152 35 | 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; 36 | -- # row 5 37 | -- ## 115 38 | -- Validate foreign key constraints. These can fail if there was unvalidated data during the SHOW CREATE ALL TABLES 39 | -- # row 6 40 | -- ## 85 41 | ALTER TABLE public.e2e_user_notes VALIDATE CONSTRAINT e2e_user_notes_e2e_users_id_fk; 42 | -- # 6 rows 43 | -------------------------------------------------------------------------------- /testdata/e2e/fixtures/cockroach/down/5.sql: -------------------------------------------------------------------------------- 1 | -- # 1 column 2 | -- # row 1 3 | -- ## 269 4 | CREATE TABLE public.schema_migration ( 5 | version VARCHAR(14) NOT NULL, 6 | rowid INT8 NOT VISIBLE NOT NULL DEFAULT unique_rowid(), 7 | CONSTRAINT "primary" PRIMARY KEY (rowid ASC), 8 | UNIQUE INDEX schema_migration_version_idx (version ASC), 9 | FAMILY "primary" (version, rowid) 10 | ); 11 | -- # row 2 12 | -- ## 247 13 | CREATE TABLE public.e2e_users ( 14 | id UUID NOT NULL, 15 | created_at TIMESTAMP NOT NULL, 16 | updated_at TIMESTAMP NOT NULL, 17 | username VARCHAR(255) NULL, 18 | CONSTRAINT "primary" PRIMARY KEY (id ASC), 19 | FAMILY "primary" (id, created_at, updated_at, username) 20 | ); 21 | -- # row 3 22 | -- ## 324 23 | CREATE TABLE public.e2e_user_notes ( 24 | id UUID NOT NULL, 25 | user_id UUID NOT NULL, 26 | slug VARCHAR(64) NOT NULL, 27 | notes VARCHAR(255) NULL, 28 | CONSTRAINT "primary" PRIMARY KEY (id ASC), 29 | INDEX e2e_user_notes_user_id_idx (user_id ASC), 30 | UNIQUE INDEX e2e_user_notes_slug_idx (slug ASC), 31 | FAMILY "primary" (id, user_id, slug, notes) 32 | ); 33 | -- # row 4 34 | -- ## 152 35 | 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; 36 | -- # row 5 37 | -- ## 115 38 | -- Validate foreign key constraints. These can fail if there was unvalidated data during the SHOW CREATE ALL TABLES 39 | -- # row 6 40 | -- ## 85 41 | ALTER TABLE public.e2e_user_notes VALIDATE CONSTRAINT e2e_user_notes_e2e_users_id_fk; 42 | -- # 6 rows 43 | -------------------------------------------------------------------------------- /testdata/e2e/fixtures/cockroach/down/6.sql: -------------------------------------------------------------------------------- 1 | -- # 1 column 2 | -- # row 1 3 | -- ## 269 4 | CREATE TABLE public.schema_migration ( 5 | version VARCHAR(14) NOT NULL, 6 | rowid INT8 NOT VISIBLE NOT NULL DEFAULT unique_rowid(), 7 | CONSTRAINT "primary" PRIMARY KEY (rowid ASC), 8 | UNIQUE INDEX schema_migration_version_idx (version ASC), 9 | FAMILY "primary" (version, rowid) 10 | ); 11 | -- # row 2 12 | -- ## 247 13 | CREATE TABLE public.e2e_users ( 14 | id UUID NOT NULL, 15 | created_at TIMESTAMP NOT NULL, 16 | updated_at TIMESTAMP NOT NULL, 17 | username VARCHAR(255) NULL, 18 | CONSTRAINT "primary" PRIMARY KEY (id ASC), 19 | FAMILY "primary" (id, created_at, updated_at, username) 20 | ); 21 | -- # row 3 22 | -- ## 324 23 | CREATE TABLE public.e2e_user_notes ( 24 | id UUID NOT NULL, 25 | user_id UUID NOT NULL, 26 | slug VARCHAR(64) NOT NULL, 27 | notes VARCHAR(255) NULL, 28 | CONSTRAINT "primary" PRIMARY KEY (id ASC), 29 | INDEX e2e_user_notes_user_id_idx (user_id ASC), 30 | UNIQUE INDEX e2e_user_notes_slug_idx (slug ASC), 31 | FAMILY "primary" (id, user_id, slug, notes) 32 | ); 33 | -- # row 4 34 | -- ## 152 35 | 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; 36 | -- # row 5 37 | -- ## 115 38 | -- Validate foreign key constraints. These can fail if there was unvalidated data during the SHOW CREATE ALL TABLES 39 | -- # row 6 40 | -- ## 85 41 | ALTER TABLE public.e2e_user_notes VALIDATE CONSTRAINT e2e_user_notes_e2e_users_id_fk; 42 | -- # 6 rows 43 | -------------------------------------------------------------------------------- /testdata/e2e/fixtures/cockroach/down/7.sql: -------------------------------------------------------------------------------- 1 | -- # 1 column 2 | -- # row 1 3 | -- ## 269 4 | CREATE TABLE public.schema_migration ( 5 | version VARCHAR(14) NOT NULL, 6 | rowid INT8 NOT VISIBLE NOT NULL DEFAULT unique_rowid(), 7 | CONSTRAINT "primary" PRIMARY KEY (rowid ASC), 8 | UNIQUE INDEX schema_migration_version_idx (version ASC), 9 | FAMILY "primary" (version, rowid) 10 | ); 11 | -- # row 2 12 | -- ## 247 13 | CREATE TABLE public.e2e_users ( 14 | id UUID NOT NULL, 15 | created_at TIMESTAMP NOT NULL, 16 | updated_at TIMESTAMP NOT NULL, 17 | username VARCHAR(255) NULL, 18 | CONSTRAINT "primary" PRIMARY KEY (id ASC), 19 | FAMILY "primary" (id, created_at, updated_at, username) 20 | ); 21 | -- # row 3 22 | -- ## 324 23 | CREATE TABLE public.e2e_user_posts ( 24 | id UUID NOT NULL, 25 | user_id UUID NOT NULL, 26 | slug VARCHAR(64) NOT NULL, 27 | notes VARCHAR(255) NULL, 28 | CONSTRAINT "primary" PRIMARY KEY (id ASC), 29 | INDEX e2e_user_notes_user_id_idx (user_id ASC), 30 | UNIQUE INDEX e2e_user_notes_slug_idx (slug ASC), 31 | FAMILY "primary" (id, user_id, slug, notes) 32 | ); 33 | -- # row 4 34 | -- ## 152 35 | 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; 36 | -- # row 5 37 | -- ## 115 38 | -- Validate foreign key constraints. These can fail if there was unvalidated data during the SHOW CREATE ALL TABLES 39 | -- # row 6 40 | -- ## 85 41 | ALTER TABLE public.e2e_user_posts VALIDATE CONSTRAINT e2e_user_notes_e2e_users_id_fk; 42 | -- # 6 rows 43 | -------------------------------------------------------------------------------- /testdata/e2e/fixtures/cockroach/down/8.sql: -------------------------------------------------------------------------------- 1 | -- # 1 column 2 | -- # row 1 3 | -- ## 269 4 | CREATE TABLE public.schema_migration ( 5 | version VARCHAR(14) NOT NULL, 6 | rowid INT8 NOT VISIBLE NOT NULL DEFAULT unique_rowid(), 7 | CONSTRAINT "primary" PRIMARY KEY (rowid ASC), 8 | UNIQUE INDEX schema_migration_version_idx (version ASC), 9 | FAMILY "primary" (version, rowid) 10 | ); 11 | -- # row 2 12 | -- ## 247 13 | CREATE TABLE public.e2e_users ( 14 | id UUID NOT NULL, 15 | created_at TIMESTAMP NOT NULL, 16 | updated_at TIMESTAMP NOT NULL, 17 | username VARCHAR(255) NULL, 18 | CONSTRAINT "primary" PRIMARY KEY (id ASC), 19 | FAMILY "primary" (id, created_at, updated_at, username) 20 | ); 21 | -- # row 3 22 | -- ## 352 23 | CREATE TABLE public.e2e_user_posts ( 24 | id UUID NOT NULL, 25 | content VARCHAR(255) NOT NULL DEFAULT '':::STRING, 26 | user_id UUID NOT NULL, 27 | slug VARCHAR(64) NOT NULL, 28 | CONSTRAINT "primary" PRIMARY KEY (id ASC), 29 | INDEX e2e_user_notes_user_id_idx (user_id ASC), 30 | UNIQUE INDEX e2e_user_notes_slug_idx (slug ASC), 31 | FAMILY "primary" (id, content, user_id, slug) 32 | ); 33 | -- # row 4 34 | -- ## 152 35 | 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; 36 | -- # row 5 37 | -- ## 115 38 | -- Validate foreign key constraints. These can fail if there was unvalidated data during the SHOW CREATE ALL TABLES 39 | -- # row 6 40 | -- ## 85 41 | ALTER TABLE public.e2e_user_posts VALIDATE CONSTRAINT e2e_user_notes_e2e_users_id_fk; 42 | -- # 6 rows 43 | -------------------------------------------------------------------------------- /testdata/e2e/fixtures/cockroach/down/9.sql: -------------------------------------------------------------------------------- 1 | -- # 1 column 2 | -- # row 1 3 | -- ## 269 4 | CREATE TABLE public.schema_migration ( 5 | version VARCHAR(14) NOT NULL, 6 | rowid INT8 NOT VISIBLE NOT NULL DEFAULT unique_rowid(), 7 | CONSTRAINT "primary" PRIMARY KEY (rowid ASC), 8 | UNIQUE INDEX schema_migration_version_idx (version ASC), 9 | FAMILY "primary" (version, rowid) 10 | ); 11 | -- # row 2 12 | -- ## 239 13 | CREATE TABLE public.e2e_users ( 14 | id UUID NOT NULL, 15 | created_at TIMESTAMP NOT NULL, 16 | updated_at TIMESTAMP NOT NULL, 17 | name VARCHAR(255) NULL, 18 | CONSTRAINT "primary" PRIMARY KEY (id ASC), 19 | FAMILY "primary" (id, created_at, updated_at, name) 20 | ); 21 | -- # row 3 22 | -- ## 352 23 | CREATE TABLE public.e2e_user_posts ( 24 | id UUID NOT NULL, 25 | content VARCHAR(255) NOT NULL DEFAULT '':::STRING, 26 | user_id UUID NOT NULL, 27 | slug VARCHAR(64) NOT NULL, 28 | CONSTRAINT "primary" PRIMARY KEY (id ASC), 29 | INDEX e2e_user_notes_user_id_idx (user_id ASC), 30 | UNIQUE INDEX e2e_user_notes_slug_idx (slug ASC), 31 | FAMILY "primary" (id, content, user_id, slug) 32 | ); 33 | -- # row 4 34 | -- ## 152 35 | 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; 36 | -- # row 5 37 | -- ## 115 38 | -- Validate foreign key constraints. These can fail if there was unvalidated data during the SHOW CREATE ALL TABLES 39 | -- # row 6 40 | -- ## 85 41 | ALTER TABLE public.e2e_user_posts VALIDATE CONSTRAINT e2e_user_notes_e2e_users_id_fk; 42 | -- # 6 rows 43 | -------------------------------------------------------------------------------- /testdata/e2e/fixtures/cockroach/up/0.sql: -------------------------------------------------------------------------------- 1 | -- # 1 column 2 | -- # row 1 3 | -- ## 269 4 | CREATE TABLE public.schema_migration ( 5 | version VARCHAR(14) NOT NULL, 6 | rowid INT8 NOT VISIBLE NOT NULL DEFAULT unique_rowid(), 7 | CONSTRAINT "primary" PRIMARY KEY (rowid ASC), 8 | UNIQUE INDEX schema_migration_version_idx (version ASC), 9 | FAMILY "primary" (version, rowid) 10 | ); 11 | -- # row 2 12 | -- ## 247 13 | CREATE TABLE public.e2e_users ( 14 | id UUID NOT NULL, 15 | username VARCHAR(255) NULL, 16 | created_at TIMESTAMP NOT NULL, 17 | updated_at TIMESTAMP NOT NULL, 18 | CONSTRAINT "primary" PRIMARY KEY (id ASC), 19 | FAMILY "primary" (id, username, created_at, updated_at) 20 | ); 21 | -- # 2 rows 22 | -------------------------------------------------------------------------------- /testdata/e2e/fixtures/cockroach/up/1.sql: -------------------------------------------------------------------------------- 1 | -- # 1 column 2 | -- # row 1 3 | -- ## 269 4 | CREATE TABLE public.schema_migration ( 5 | version VARCHAR(14) NOT NULL, 6 | rowid INT8 NOT VISIBLE NOT NULL DEFAULT unique_rowid(), 7 | CONSTRAINT "primary" PRIMARY KEY (rowid ASC), 8 | UNIQUE INDEX schema_migration_version_idx (version ASC), 9 | FAMILY "primary" (version, rowid) 10 | ); 11 | -- # row 2 12 | -- ## 247 13 | CREATE TABLE public.e2e_users ( 14 | id UUID NOT NULL, 15 | username VARCHAR(255) NULL, 16 | created_at TIMESTAMP NOT NULL, 17 | updated_at TIMESTAMP NOT NULL, 18 | CONSTRAINT "primary" PRIMARY KEY (id ASC), 19 | FAMILY "primary" (id, username, created_at, updated_at) 20 | ); 21 | -- # row 3 22 | -- ## 341 23 | CREATE TABLE public.e2e_user_notes ( 24 | id UUID NOT NULL, 25 | notes VARCHAR(255) NULL, 26 | title VARCHAR(64) NOT NULL DEFAULT '':::STRING, 27 | user_id UUID NOT NULL, 28 | CONSTRAINT "primary" PRIMARY KEY (id ASC), 29 | INDEX e2e_user_notes_user_id_idx (user_id ASC), 30 | INDEX e2e_user_notes_title_idx (title ASC), 31 | FAMILY "primary" (id, notes, title, user_id) 32 | ); 33 | -- # row 4 34 | -- ## 152 35 | 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; 36 | -- # row 5 37 | -- ## 115 38 | -- Validate foreign key constraints. These can fail if there was unvalidated data during the SHOW CREATE ALL TABLES 39 | -- # row 6 40 | -- ## 85 41 | ALTER TABLE public.e2e_user_notes VALIDATE CONSTRAINT e2e_user_notes_e2e_users_id_fk; 42 | -- # 6 rows 43 | -------------------------------------------------------------------------------- /testdata/e2e/fixtures/cockroach/up/10.sql: -------------------------------------------------------------------------------- 1 | -- # 1 column 2 | -- # row 1 3 | -- ## 269 4 | CREATE TABLE public.schema_migration ( 5 | version VARCHAR(14) NOT NULL, 6 | rowid INT8 NOT VISIBLE NOT NULL DEFAULT unique_rowid(), 7 | CONSTRAINT "primary" PRIMARY KEY (rowid ASC), 8 | UNIQUE INDEX schema_migration_version_idx (version ASC), 9 | FAMILY "primary" (version, rowid) 10 | ); 11 | -- # row 2 12 | -- ## 208 13 | CREATE TABLE public.e2e_users ( 14 | id UUID NOT NULL, 15 | created_at TIMESTAMP NOT NULL, 16 | updated_at TIMESTAMP NOT NULL, 17 | CONSTRAINT "primary" PRIMARY KEY (id ASC), 18 | FAMILY "primary" (id, created_at, updated_at) 19 | ); 20 | -- # row 3 21 | -- ## 352 22 | CREATE TABLE public.e2e_user_posts ( 23 | id UUID NOT NULL, 24 | user_id UUID NOT NULL, 25 | content VARCHAR(255) NOT NULL DEFAULT '':::STRING, 26 | slug VARCHAR(32) NOT NULL, 27 | CONSTRAINT "primary" PRIMARY KEY (id ASC), 28 | INDEX e2e_user_notes_user_id_idx (user_id ASC), 29 | UNIQUE INDEX e2e_user_notes_slug_idx (slug ASC), 30 | FAMILY "primary" (id, user_id, content, slug) 31 | ); 32 | -- # row 4 33 | -- ## 152 34 | 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; 35 | -- # row 5 36 | -- ## 115 37 | -- Validate foreign key constraints. These can fail if there was unvalidated data during the SHOW CREATE ALL TABLES 38 | -- # row 6 39 | -- ## 85 40 | ALTER TABLE public.e2e_user_posts VALIDATE CONSTRAINT e2e_user_notes_e2e_users_id_fk; 41 | -- # 6 rows 42 | -------------------------------------------------------------------------------- /testdata/e2e/fixtures/cockroach/up/11.sql: -------------------------------------------------------------------------------- 1 | -- # 1 column 2 | -- # row 1 3 | -- ## 269 4 | CREATE TABLE public.schema_migration ( 5 | version VARCHAR(14) NOT NULL, 6 | rowid INT8 NOT VISIBLE NOT NULL DEFAULT unique_rowid(), 7 | CONSTRAINT "primary" PRIMARY KEY (rowid ASC), 8 | UNIQUE INDEX schema_migration_version_idx (version ASC), 9 | FAMILY "primary" (version, rowid) 10 | ); 11 | -- # row 2 12 | -- ## 210 13 | CREATE TABLE public.e2e_authors ( 14 | id UUID NOT NULL, 15 | created_at TIMESTAMP NOT NULL, 16 | updated_at TIMESTAMP NOT NULL, 17 | CONSTRAINT "primary" PRIMARY KEY (id ASC), 18 | FAMILY "primary" (id, created_at, updated_at) 19 | ); 20 | -- # row 3 21 | -- ## 352 22 | CREATE TABLE public.e2e_user_posts ( 23 | id UUID NOT NULL, 24 | user_id UUID NOT NULL, 25 | content VARCHAR(255) NOT NULL DEFAULT '':::STRING, 26 | slug VARCHAR(32) NOT NULL, 27 | CONSTRAINT "primary" PRIMARY KEY (id ASC), 28 | INDEX e2e_user_notes_user_id_idx (user_id ASC), 29 | UNIQUE INDEX e2e_user_notes_slug_idx (slug ASC), 30 | FAMILY "primary" (id, user_id, content, slug) 31 | ); 32 | -- # row 4 33 | -- ## 154 34 | 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; 35 | -- # row 5 36 | -- ## 115 37 | -- Validate foreign key constraints. These can fail if there was unvalidated data during the SHOW CREATE ALL TABLES 38 | -- # row 6 39 | -- ## 85 40 | ALTER TABLE public.e2e_user_posts VALIDATE CONSTRAINT e2e_user_notes_e2e_users_id_fk; 41 | -- # 6 rows 42 | -------------------------------------------------------------------------------- /testdata/e2e/fixtures/cockroach/up/12.sql: -------------------------------------------------------------------------------- 1 | -- # 1 column 2 | -- # row 1 3 | -- ## 269 4 | CREATE TABLE public.schema_migration ( 5 | version VARCHAR(14) NOT NULL, 6 | rowid INT8 NOT VISIBLE NOT NULL DEFAULT unique_rowid(), 7 | CONSTRAINT "primary" PRIMARY KEY (rowid ASC), 8 | UNIQUE INDEX schema_migration_version_idx (version ASC), 9 | FAMILY "primary" (version, rowid) 10 | ); 11 | -- # row 2 12 | -- ## 210 13 | CREATE TABLE public.e2e_authors ( 14 | id UUID NOT NULL, 15 | created_at TIMESTAMP NOT NULL, 16 | updated_at TIMESTAMP NOT NULL, 17 | CONSTRAINT "primary" PRIMARY KEY (id ASC), 18 | FAMILY "primary" (id, created_at, updated_at) 19 | ); 20 | -- # row 3 21 | -- ## 358 22 | CREATE TABLE public.e2e_user_posts ( 23 | id UUID NOT NULL, 24 | author_id UUID NOT NULL, 25 | content VARCHAR(255) NOT NULL DEFAULT '':::STRING, 26 | slug VARCHAR(32) NOT NULL, 27 | CONSTRAINT "primary" PRIMARY KEY (id ASC), 28 | INDEX e2e_user_notes_user_id_idx (author_id ASC), 29 | UNIQUE INDEX e2e_user_notes_slug_idx (slug ASC), 30 | FAMILY "primary" (id, author_id, content, slug) 31 | ); 32 | -- # row 4 33 | -- ## 156 34 | 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; 35 | -- # row 5 36 | -- ## 115 37 | -- Validate foreign key constraints. These can fail if there was unvalidated data during the SHOW CREATE ALL TABLES 38 | -- # row 6 39 | -- ## 85 40 | ALTER TABLE public.e2e_user_posts VALIDATE CONSTRAINT e2e_user_notes_e2e_users_id_fk; 41 | -- # 6 rows 42 | -------------------------------------------------------------------------------- /testdata/e2e/fixtures/cockroach/up/13.sql: -------------------------------------------------------------------------------- 1 | -- # 1 column 2 | -- # row 1 3 | -- ## 269 4 | CREATE TABLE public.schema_migration ( 5 | version VARCHAR(14) NOT NULL, 6 | rowid INT8 NOT VISIBLE NOT NULL DEFAULT unique_rowid(), 7 | CONSTRAINT "primary" PRIMARY KEY (rowid ASC), 8 | UNIQUE INDEX schema_migration_version_idx (version ASC), 9 | FAMILY "primary" (version, rowid) 10 | ); 11 | -- # row 2 12 | -- ## 210 13 | CREATE TABLE public.e2e_authors ( 14 | id UUID NOT NULL, 15 | created_at TIMESTAMP NOT NULL, 16 | updated_at TIMESTAMP NOT NULL, 17 | CONSTRAINT "primary" PRIMARY KEY (id ASC), 18 | FAMILY "primary" (id, created_at, updated_at) 19 | ); 20 | -- # row 3 21 | -- ## 405 22 | CREATE TABLE public.e2e_user_posts ( 23 | id UUID NOT NULL, 24 | content VARCHAR(255) NOT NULL DEFAULT '':::STRING, 25 | slug VARCHAR(32) NOT NULL, 26 | published BOOL NOT NULL DEFAULT false, 27 | author_id UUID NULL, 28 | CONSTRAINT "primary" PRIMARY KEY (id ASC), 29 | UNIQUE INDEX e2e_user_notes_slug_idx (slug ASC), 30 | INDEX e2e_user_notes_user_id_idx (author_id ASC), 31 | FAMILY "primary" (id, content, slug, published, author_id) 32 | ); 33 | -- # row 4 34 | -- ## 156 35 | 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; 36 | -- # row 5 37 | -- ## 115 38 | -- Validate foreign key constraints. These can fail if there was unvalidated data during the SHOW CREATE ALL TABLES 39 | -- # row 6 40 | -- ## 85 41 | ALTER TABLE public.e2e_user_posts VALIDATE CONSTRAINT e2e_user_notes_e2e_users_id_fk; 42 | -- # 6 rows 43 | -------------------------------------------------------------------------------- /testdata/e2e/fixtures/cockroach/up/14.sql: -------------------------------------------------------------------------------- 1 | -- # 1 column 2 | -- # row 1 3 | -- ## 269 4 | CREATE TABLE public.schema_migration ( 5 | version VARCHAR(14) NOT NULL, 6 | rowid INT8 NOT VISIBLE NOT NULL DEFAULT unique_rowid(), 7 | CONSTRAINT "primary" PRIMARY KEY (rowid ASC), 8 | UNIQUE INDEX schema_migration_version_idx (version ASC), 9 | FAMILY "primary" (version, rowid) 10 | ); 11 | -- # row 2 12 | -- ## 210 13 | CREATE TABLE public.e2e_authors ( 14 | id UUID NOT NULL, 15 | created_at TIMESTAMP NOT NULL, 16 | updated_at TIMESTAMP NOT NULL, 17 | CONSTRAINT "primary" PRIMARY KEY (id ASC), 18 | FAMILY "primary" (id, created_at, updated_at) 19 | ); 20 | -- # row 3 21 | -- ## 405 22 | CREATE TABLE public.e2e_user_posts ( 23 | id UUID NOT NULL, 24 | content VARCHAR(255) NOT NULL DEFAULT '':::STRING, 25 | slug VARCHAR(32) NOT NULL, 26 | published BOOL NOT NULL DEFAULT false, 27 | author_id UUID NULL, 28 | CONSTRAINT "primary" PRIMARY KEY (id ASC), 29 | UNIQUE INDEX e2e_user_notes_slug_idx (slug ASC), 30 | INDEX e2e_user_notes_user_id_idx (author_id ASC), 31 | FAMILY "primary" (id, content, slug, published, author_id) 32 | ); 33 | -- # row 4 34 | -- ## 119 35 | CREATE TABLE public.e2e_flow ( 36 | id UUID NOT NULL, 37 | CONSTRAINT "primary" PRIMARY KEY (id ASC), 38 | FAMILY "primary" (id) 39 | ); 40 | -- # row 5 41 | -- ## 122 42 | CREATE TABLE public.e2e_address ( 43 | id UUID NOT NULL, 44 | CONSTRAINT "primary" PRIMARY KEY (id ASC), 45 | FAMILY "primary" (id) 46 | ); 47 | -- # row 6 48 | -- ## 322 49 | CREATE TABLE public.e2e_token ( 50 | id UUID NOT NULL, 51 | token VARCHAR(64) NOT NULL, 52 | e2e_flow_id UUID NOT NULL, 53 | e2e_address_id UUID NOT NULL, 54 | CONSTRAINT "primary" PRIMARY KEY (id ASC), 55 | UNIQUE INDEX e2e_token_uq_idx (token ASC), 56 | INDEX e2e_token_idx (token ASC), 57 | FAMILY "primary" (id, token, e2e_flow_id, e2e_address_id) 58 | ); 59 | -- # row 7 60 | -- ## 156 61 | 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; 62 | -- # row 8 63 | -- ## 144 64 | 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; 65 | -- # row 9 66 | -- ## 153 67 | 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; 68 | -- # row 10 69 | -- ## 115 70 | -- Validate foreign key constraints. These can fail if there was unvalidated data during the SHOW CREATE ALL TABLES 71 | -- # row 11 72 | -- ## 85 73 | ALTER TABLE public.e2e_user_posts VALIDATE CONSTRAINT e2e_user_notes_e2e_users_id_fk; 74 | -- # row 12 75 | -- ## 74 76 | ALTER TABLE public.e2e_token VALIDATE CONSTRAINT e2e_token_e2e_flow_id_fk; 77 | -- # row 13 78 | -- ## 77 79 | ALTER TABLE public.e2e_token VALIDATE CONSTRAINT e2e_token_e2e_address_id_fk; 80 | -- # 13 rows 81 | -------------------------------------------------------------------------------- /testdata/e2e/fixtures/cockroach/up/15.sql: -------------------------------------------------------------------------------- 1 | -- # 1 column 2 | -- # row 1 3 | -- ## 269 4 | CREATE TABLE public.schema_migration ( 5 | version VARCHAR(14) NOT NULL, 6 | rowid INT8 NOT VISIBLE NOT NULL DEFAULT unique_rowid(), 7 | CONSTRAINT "primary" PRIMARY KEY (rowid ASC), 8 | UNIQUE INDEX schema_migration_version_idx (version ASC), 9 | FAMILY "primary" (version, rowid) 10 | ); 11 | -- # row 2 12 | -- ## 210 13 | CREATE TABLE public.e2e_authors ( 14 | id UUID NOT NULL, 15 | created_at TIMESTAMP NOT NULL, 16 | updated_at TIMESTAMP NOT NULL, 17 | CONSTRAINT "primary" PRIMARY KEY (id ASC), 18 | FAMILY "primary" (id, created_at, updated_at) 19 | ); 20 | -- # row 3 21 | -- ## 405 22 | CREATE TABLE public.e2e_user_posts ( 23 | id UUID NOT NULL, 24 | content VARCHAR(255) NOT NULL DEFAULT '':::STRING, 25 | slug VARCHAR(32) NOT NULL, 26 | published BOOL NOT NULL DEFAULT false, 27 | author_id UUID NULL, 28 | CONSTRAINT "primary" PRIMARY KEY (id ASC), 29 | UNIQUE INDEX e2e_user_notes_slug_idx (slug ASC), 30 | INDEX e2e_user_notes_user_id_idx (author_id ASC), 31 | FAMILY "primary" (id, content, slug, published, author_id) 32 | ); 33 | -- # row 4 34 | -- ## 119 35 | CREATE TABLE public.e2e_flow ( 36 | id UUID NOT NULL, 37 | CONSTRAINT "primary" PRIMARY KEY (id ASC), 38 | FAMILY "primary" (id) 39 | ); 40 | -- # row 5 41 | -- ## 122 42 | CREATE TABLE public.e2e_address ( 43 | id UUID NOT NULL, 44 | CONSTRAINT "primary" PRIMARY KEY (id ASC), 45 | FAMILY "primary" (id) 46 | ); 47 | -- # row 6 48 | -- ## 488 49 | CREATE TABLE public.e2e_token ( 50 | id UUID NOT NULL, 51 | token VARCHAR(64) NOT NULL, 52 | e2e_address_id UUID NOT NULL, 53 | expires_at TIMESTAMP NOT NULL DEFAULT '2000-01-01 00:00:00':::TIMESTAMP, 54 | issued_at TIMESTAMP NOT NULL DEFAULT '2000-01-01 00:00:00':::TIMESTAMP, 55 | e2e_flow_id UUID NULL, 56 | CONSTRAINT "primary" PRIMARY KEY (id ASC), 57 | UNIQUE INDEX e2e_token_uq_idx (token ASC), 58 | INDEX e2e_token_idx (token ASC), 59 | FAMILY "primary" (id, token, e2e_address_id, expires_at, issued_at, e2e_flow_id) 60 | ); 61 | -- # row 7 62 | -- ## 156 63 | 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; 64 | -- # row 8 65 | -- ## 153 66 | 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; 67 | -- # row 9 68 | -- ## 144 69 | 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; 70 | -- # row 10 71 | -- ## 115 72 | -- Validate foreign key constraints. These can fail if there was unvalidated data during the SHOW CREATE ALL TABLES 73 | -- # row 11 74 | -- ## 85 75 | ALTER TABLE public.e2e_user_posts VALIDATE CONSTRAINT e2e_user_notes_e2e_users_id_fk; 76 | -- # row 12 77 | -- ## 77 78 | ALTER TABLE public.e2e_token VALIDATE CONSTRAINT e2e_token_e2e_address_id_fk; 79 | -- # row 13 80 | -- ## 74 81 | ALTER TABLE public.e2e_token VALIDATE CONSTRAINT e2e_token_e2e_flow_id_fk; 82 | -- # 13 rows 83 | -------------------------------------------------------------------------------- /testdata/e2e/fixtures/cockroach/up/2.sql: -------------------------------------------------------------------------------- 1 | -- # 1 column 2 | -- # row 1 3 | -- ## 269 4 | CREATE TABLE public.schema_migration ( 5 | version VARCHAR(14) NOT NULL, 6 | rowid INT8 NOT VISIBLE NOT NULL DEFAULT unique_rowid(), 7 | CONSTRAINT "primary" PRIMARY KEY (rowid ASC), 8 | UNIQUE INDEX schema_migration_version_idx (version ASC), 9 | FAMILY "primary" (version, rowid) 10 | ); 11 | -- # row 2 12 | -- ## 247 13 | CREATE TABLE public.e2e_users ( 14 | id UUID NOT NULL, 15 | username VARCHAR(255) NULL, 16 | created_at TIMESTAMP NOT NULL, 17 | updated_at TIMESTAMP NOT NULL, 18 | CONSTRAINT "primary" PRIMARY KEY (id ASC), 19 | FAMILY "primary" (id, username, created_at, updated_at) 20 | ); 21 | -- # row 3 22 | -- ## 240 23 | CREATE TABLE public.e2e_user_notes ( 24 | id UUID NOT NULL, 25 | notes VARCHAR(255) NULL, 26 | user_id UUID NOT NULL, 27 | CONSTRAINT "primary" PRIMARY KEY (id ASC), 28 | INDEX e2e_user_notes_user_id_idx (user_id ASC), 29 | FAMILY "primary" (id, notes, user_id) 30 | ); 31 | -- # row 4 32 | -- ## 152 33 | 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; 34 | -- # row 5 35 | -- ## 115 36 | -- Validate foreign key constraints. These can fail if there was unvalidated data during the SHOW CREATE ALL TABLES 37 | -- # row 6 38 | -- ## 85 39 | ALTER TABLE public.e2e_user_notes VALIDATE CONSTRAINT e2e_user_notes_e2e_users_id_fk; 40 | -- # 6 rows 41 | -------------------------------------------------------------------------------- /testdata/e2e/fixtures/cockroach/up/3.sql: -------------------------------------------------------------------------------- 1 | -- # 1 column 2 | -- # row 1 3 | -- ## 269 4 | CREATE TABLE public.schema_migration ( 5 | version VARCHAR(14) NOT NULL, 6 | rowid INT8 NOT VISIBLE NOT NULL DEFAULT unique_rowid(), 7 | CONSTRAINT "primary" PRIMARY KEY (rowid ASC), 8 | UNIQUE INDEX schema_migration_version_idx (version ASC), 9 | FAMILY "primary" (version, rowid) 10 | ); 11 | -- # row 2 12 | -- ## 247 13 | CREATE TABLE public.e2e_users ( 14 | id UUID NOT NULL, 15 | username VARCHAR(255) NULL, 16 | created_at TIMESTAMP NOT NULL, 17 | updated_at TIMESTAMP NOT NULL, 18 | CONSTRAINT "primary" PRIMARY KEY (id ASC), 19 | FAMILY "primary" (id, username, created_at, updated_at) 20 | ); 21 | -- # row 3 22 | -- ## 270 23 | CREATE TABLE public.e2e_user_notes ( 24 | id UUID NOT NULL, 25 | notes VARCHAR(255) NULL, 26 | user_id UUID NOT NULL, 27 | slug VARCHAR(64) NULL, 28 | CONSTRAINT "primary" PRIMARY KEY (id ASC), 29 | INDEX e2e_user_notes_user_id_idx (user_id ASC), 30 | FAMILY "primary" (id, notes, user_id, slug) 31 | ); 32 | -- # row 4 33 | -- ## 152 34 | 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; 35 | -- # row 5 36 | -- ## 115 37 | -- Validate foreign key constraints. These can fail if there was unvalidated data during the SHOW CREATE ALL TABLES 38 | -- # row 6 39 | -- ## 85 40 | ALTER TABLE public.e2e_user_notes VALIDATE CONSTRAINT e2e_user_notes_e2e_users_id_fk; 41 | -- # 6 rows 42 | -------------------------------------------------------------------------------- /testdata/e2e/fixtures/cockroach/up/4.sql: -------------------------------------------------------------------------------- 1 | -- # 1 column 2 | -- # row 1 3 | -- ## 269 4 | CREATE TABLE public.schema_migration ( 5 | version VARCHAR(14) NOT NULL, 6 | rowid INT8 NOT VISIBLE NOT NULL DEFAULT unique_rowid(), 7 | CONSTRAINT "primary" PRIMARY KEY (rowid ASC), 8 | UNIQUE INDEX schema_migration_version_idx (version ASC), 9 | FAMILY "primary" (version, rowid) 10 | ); 11 | -- # row 2 12 | -- ## 247 13 | CREATE TABLE public.e2e_users ( 14 | id UUID NOT NULL, 15 | username VARCHAR(255) NULL, 16 | created_at TIMESTAMP NOT NULL, 17 | updated_at TIMESTAMP NOT NULL, 18 | CONSTRAINT "primary" PRIMARY KEY (id ASC), 19 | FAMILY "primary" (id, username, created_at, updated_at) 20 | ); 21 | -- # row 3 22 | -- ## 270 23 | CREATE TABLE public.e2e_user_notes ( 24 | id UUID NOT NULL, 25 | notes VARCHAR(255) NULL, 26 | user_id UUID NOT NULL, 27 | slug VARCHAR(64) NULL, 28 | CONSTRAINT "primary" PRIMARY KEY (id ASC), 29 | INDEX e2e_user_notes_user_id_idx (user_id ASC), 30 | FAMILY "primary" (id, notes, user_id, slug) 31 | ); 32 | -- # row 4 33 | -- ## 152 34 | 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; 35 | -- # row 5 36 | -- ## 115 37 | -- Validate foreign key constraints. These can fail if there was unvalidated data during the SHOW CREATE ALL TABLES 38 | -- # row 6 39 | -- ## 85 40 | ALTER TABLE public.e2e_user_notes VALIDATE CONSTRAINT e2e_user_notes_e2e_users_id_fk; 41 | -- # 6 rows 42 | -------------------------------------------------------------------------------- /testdata/e2e/fixtures/cockroach/up/5.sql: -------------------------------------------------------------------------------- 1 | -- # 1 column 2 | -- # row 1 3 | -- ## 269 4 | CREATE TABLE public.schema_migration ( 5 | version VARCHAR(14) NOT NULL, 6 | rowid INT8 NOT VISIBLE NOT NULL DEFAULT unique_rowid(), 7 | CONSTRAINT "primary" PRIMARY KEY (rowid ASC), 8 | UNIQUE INDEX schema_migration_version_idx (version ASC), 9 | FAMILY "primary" (version, rowid) 10 | ); 11 | -- # row 2 12 | -- ## 247 13 | CREATE TABLE public.e2e_users ( 14 | id UUID NOT NULL, 15 | username VARCHAR(255) NULL, 16 | created_at TIMESTAMP NOT NULL, 17 | updated_at TIMESTAMP NOT NULL, 18 | CONSTRAINT "primary" PRIMARY KEY (id ASC), 19 | FAMILY "primary" (id, username, created_at, updated_at) 20 | ); 21 | -- # row 3 22 | -- ## 324 23 | CREATE TABLE public.e2e_user_notes ( 24 | id UUID NOT NULL, 25 | notes VARCHAR(255) NULL, 26 | user_id UUID NOT NULL, 27 | slug VARCHAR(64) NOT NULL, 28 | CONSTRAINT "primary" PRIMARY KEY (id ASC), 29 | INDEX e2e_user_notes_user_id_idx (user_id ASC), 30 | UNIQUE INDEX e2e_user_notes_slug_idx (slug ASC), 31 | FAMILY "primary" (id, notes, user_id, slug) 32 | ); 33 | -- # row 4 34 | -- ## 152 35 | 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; 36 | -- # row 5 37 | -- ## 115 38 | -- Validate foreign key constraints. These can fail if there was unvalidated data during the SHOW CREATE ALL TABLES 39 | -- # row 6 40 | -- ## 85 41 | ALTER TABLE public.e2e_user_notes VALIDATE CONSTRAINT e2e_user_notes_e2e_users_id_fk; 42 | -- # 6 rows 43 | -------------------------------------------------------------------------------- /testdata/e2e/fixtures/cockroach/up/6.sql: -------------------------------------------------------------------------------- 1 | -- # 1 column 2 | -- # row 1 3 | -- ## 269 4 | CREATE TABLE public.schema_migration ( 5 | version VARCHAR(14) NOT NULL, 6 | rowid INT8 NOT VISIBLE NOT NULL DEFAULT unique_rowid(), 7 | CONSTRAINT "primary" PRIMARY KEY (rowid ASC), 8 | UNIQUE INDEX schema_migration_version_idx (version ASC), 9 | FAMILY "primary" (version, rowid) 10 | ); 11 | -- # row 2 12 | -- ## 247 13 | CREATE TABLE public.e2e_users ( 14 | id UUID NOT NULL, 15 | username VARCHAR(255) NULL, 16 | created_at TIMESTAMP NOT NULL, 17 | updated_at TIMESTAMP NOT NULL, 18 | CONSTRAINT "primary" PRIMARY KEY (id ASC), 19 | FAMILY "primary" (id, username, created_at, updated_at) 20 | ); 21 | -- # row 3 22 | -- ## 324 23 | CREATE TABLE public.e2e_user_posts ( 24 | id UUID NOT NULL, 25 | notes VARCHAR(255) NULL, 26 | user_id UUID NOT NULL, 27 | slug VARCHAR(64) NOT NULL, 28 | CONSTRAINT "primary" PRIMARY KEY (id ASC), 29 | INDEX e2e_user_notes_user_id_idx (user_id ASC), 30 | UNIQUE INDEX e2e_user_notes_slug_idx (slug ASC), 31 | FAMILY "primary" (id, notes, user_id, slug) 32 | ); 33 | -- # row 4 34 | -- ## 152 35 | 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; 36 | -- # row 5 37 | -- ## 115 38 | -- Validate foreign key constraints. These can fail if there was unvalidated data during the SHOW CREATE ALL TABLES 39 | -- # row 6 40 | -- ## 85 41 | ALTER TABLE public.e2e_user_posts VALIDATE CONSTRAINT e2e_user_notes_e2e_users_id_fk; 42 | -- # 6 rows 43 | -------------------------------------------------------------------------------- /testdata/e2e/fixtures/cockroach/up/7.sql: -------------------------------------------------------------------------------- 1 | -- # 1 column 2 | -- # row 1 3 | -- ## 269 4 | CREATE TABLE public.schema_migration ( 5 | version VARCHAR(14) NOT NULL, 6 | rowid INT8 NOT VISIBLE NOT NULL DEFAULT unique_rowid(), 7 | CONSTRAINT "primary" PRIMARY KEY (rowid ASC), 8 | UNIQUE INDEX schema_migration_version_idx (version ASC), 9 | FAMILY "primary" (version, rowid) 10 | ); 11 | -- # row 2 12 | -- ## 247 13 | CREATE TABLE public.e2e_users ( 14 | id UUID NOT NULL, 15 | username VARCHAR(255) NULL, 16 | created_at TIMESTAMP NOT NULL, 17 | updated_at TIMESTAMP NOT NULL, 18 | CONSTRAINT "primary" PRIMARY KEY (id ASC), 19 | FAMILY "primary" (id, username, created_at, updated_at) 20 | ); 21 | -- # row 3 22 | -- ## 352 23 | CREATE TABLE public.e2e_user_posts ( 24 | id UUID NOT NULL, 25 | user_id UUID NOT NULL, 26 | slug VARCHAR(64) NOT NULL, 27 | content VARCHAR(255) NOT NULL DEFAULT '':::STRING, 28 | CONSTRAINT "primary" PRIMARY KEY (id ASC), 29 | INDEX e2e_user_notes_user_id_idx (user_id ASC), 30 | UNIQUE INDEX e2e_user_notes_slug_idx (slug ASC), 31 | FAMILY "primary" (id, user_id, slug, content) 32 | ); 33 | -- # row 4 34 | -- ## 152 35 | 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; 36 | -- # row 5 37 | -- ## 115 38 | -- Validate foreign key constraints. These can fail if there was unvalidated data during the SHOW CREATE ALL TABLES 39 | -- # row 6 40 | -- ## 85 41 | ALTER TABLE public.e2e_user_posts VALIDATE CONSTRAINT e2e_user_notes_e2e_users_id_fk; 42 | -- # 6 rows 43 | -------------------------------------------------------------------------------- /testdata/e2e/fixtures/cockroach/up/8.sql: -------------------------------------------------------------------------------- 1 | -- # 1 column 2 | -- # row 1 3 | -- ## 269 4 | CREATE TABLE public.schema_migration ( 5 | version VARCHAR(14) NOT NULL, 6 | rowid INT8 NOT VISIBLE NOT NULL DEFAULT unique_rowid(), 7 | CONSTRAINT "primary" PRIMARY KEY (rowid ASC), 8 | UNIQUE INDEX schema_migration_version_idx (version ASC), 9 | FAMILY "primary" (version, rowid) 10 | ); 11 | -- # row 2 12 | -- ## 239 13 | CREATE TABLE public.e2e_users ( 14 | id UUID NOT NULL, 15 | name VARCHAR(255) NULL, 16 | created_at TIMESTAMP NOT NULL, 17 | updated_at TIMESTAMP NOT NULL, 18 | CONSTRAINT "primary" PRIMARY KEY (id ASC), 19 | FAMILY "primary" (id, name, created_at, updated_at) 20 | ); 21 | -- # row 3 22 | -- ## 352 23 | CREATE TABLE public.e2e_user_posts ( 24 | id UUID NOT NULL, 25 | user_id UUID NOT NULL, 26 | slug VARCHAR(64) NOT NULL, 27 | content VARCHAR(255) NOT NULL DEFAULT '':::STRING, 28 | CONSTRAINT "primary" PRIMARY KEY (id ASC), 29 | INDEX e2e_user_notes_user_id_idx (user_id ASC), 30 | UNIQUE INDEX e2e_user_notes_slug_idx (slug ASC), 31 | FAMILY "primary" (id, user_id, slug, content) 32 | ); 33 | -- # row 4 34 | -- ## 152 35 | 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; 36 | -- # row 5 37 | -- ## 115 38 | -- Validate foreign key constraints. These can fail if there was unvalidated data during the SHOW CREATE ALL TABLES 39 | -- # row 6 40 | -- ## 85 41 | ALTER TABLE public.e2e_user_posts VALIDATE CONSTRAINT e2e_user_notes_e2e_users_id_fk; 42 | -- # 6 rows 43 | -------------------------------------------------------------------------------- /testdata/e2e/fixtures/cockroach/up/9.sql: -------------------------------------------------------------------------------- 1 | -- # 1 column 2 | -- # row 1 3 | -- ## 269 4 | CREATE TABLE public.schema_migration ( 5 | version VARCHAR(14) NOT NULL, 6 | rowid INT8 NOT VISIBLE NOT NULL DEFAULT unique_rowid(), 7 | CONSTRAINT "primary" PRIMARY KEY (rowid ASC), 8 | UNIQUE INDEX schema_migration_version_idx (version ASC), 9 | FAMILY "primary" (version, rowid) 10 | ); 11 | -- # row 2 12 | -- ## 208 13 | CREATE TABLE public.e2e_users ( 14 | id UUID NOT NULL, 15 | created_at TIMESTAMP NOT NULL, 16 | updated_at TIMESTAMP NOT NULL, 17 | CONSTRAINT "primary" PRIMARY KEY (id ASC), 18 | FAMILY "primary" (id, created_at, updated_at) 19 | ); 20 | -- # row 3 21 | -- ## 352 22 | CREATE TABLE public.e2e_user_posts ( 23 | id UUID NOT NULL, 24 | user_id UUID NOT NULL, 25 | slug VARCHAR(64) NOT NULL, 26 | content VARCHAR(255) NOT NULL DEFAULT '':::STRING, 27 | CONSTRAINT "primary" PRIMARY KEY (id ASC), 28 | INDEX e2e_user_notes_user_id_idx (user_id ASC), 29 | UNIQUE INDEX e2e_user_notes_slug_idx (slug ASC), 30 | FAMILY "primary" (id, user_id, slug, content) 31 | ); 32 | -- # row 4 33 | -- ## 152 34 | 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; 35 | -- # row 5 36 | -- ## 115 37 | -- Validate foreign key constraints. These can fail if there was unvalidated data during the SHOW CREATE ALL TABLES 38 | -- # row 6 39 | -- ## 85 40 | ALTER TABLE public.e2e_user_posts VALIDATE CONSTRAINT e2e_user_notes_e2e_users_id_fk; 41 | -- # 6 rows 42 | -------------------------------------------------------------------------------- /testdata/e2e/fixtures/mysql/down/0.sql: -------------------------------------------------------------------------------- 1 | -- MySQL dump 10.13 Distrib 8.0.21, for osx10.15 (x86_64) 2 | -- 3 | -- Host: 127.0.0.1 Database: pop_test 4 | -- ------------------------------------------------------ 5 | -- Server version 5.7.31 6 | 7 | /*!40101 SET @OLD_CHARACTER_SET_CLIENT=@@CHARACTER_SET_CLIENT */; 8 | /*!40101 SET @OLD_CHARACTER_SET_RESULTS=@@CHARACTER_SET_RESULTS */; 9 | /*!40101 SET @OLD_COLLATION_CONNECTION=@@COLLATION_CONNECTION */; 10 | /*!50503 SET NAMES utf8mb4 */; 11 | /*!40103 SET @OLD_TIME_ZONE=@@TIME_ZONE */; 12 | /*!40103 SET TIME_ZONE='+00:00' */; 13 | /*!40014 SET @OLD_UNIQUE_CHECKS=@@UNIQUE_CHECKS, UNIQUE_CHECKS=0 */; 14 | /*!40014 SET @OLD_FOREIGN_KEY_CHECKS=@@FOREIGN_KEY_CHECKS, FOREIGN_KEY_CHECKS=0 */; 15 | /*!40101 SET @OLD_SQL_MODE=@@SQL_MODE, SQL_MODE='NO_AUTO_VALUE_ON_ZERO' */; 16 | /*!40111 SET @OLD_SQL_NOTES=@@SQL_NOTES, SQL_NOTES=0 */; 17 | 18 | -- 19 | -- Table structure for table `schema_migration` 20 | -- 21 | 22 | DROP TABLE IF EXISTS `schema_migration`; 23 | /*!40101 SET @saved_cs_client = @@character_set_client */; 24 | /*!50503 SET character_set_client = utf8mb4 */; 25 | CREATE TABLE `schema_migration` ( 26 | `version` varchar(14) NOT NULL, 27 | UNIQUE KEY `schema_migration_version_idx` (`version`) 28 | ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4; 29 | /*!40101 SET character_set_client = @saved_cs_client */; 30 | /*!40103 SET TIME_ZONE=@OLD_TIME_ZONE */; 31 | 32 | /*!40101 SET SQL_MODE=@OLD_SQL_MODE */; 33 | /*!40014 SET FOREIGN_KEY_CHECKS=@OLD_FOREIGN_KEY_CHECKS */; 34 | /*!40014 SET UNIQUE_CHECKS=@OLD_UNIQUE_CHECKS */; 35 | /*!40101 SET CHARACTER_SET_CLIENT=@OLD_CHARACTER_SET_CLIENT */; 36 | /*!40101 SET CHARACTER_SET_RESULTS=@OLD_CHARACTER_SET_RESULTS */; 37 | /*!40101 SET COLLATION_CONNECTION=@OLD_COLLATION_CONNECTION */; 38 | /*!40111 SET SQL_NOTES=@OLD_SQL_NOTES */; 39 | 40 | -- Dump completed on 2020-09-03 11:40:22 41 | -------------------------------------------------------------------------------- /testdata/e2e/fixtures/mysql/down/1.sql: -------------------------------------------------------------------------------- 1 | -- MySQL dump 10.13 Distrib 8.0.21, for osx10.15 (x86_64) 2 | -- 3 | -- Host: 127.0.0.1 Database: pop_test 4 | -- ------------------------------------------------------ 5 | -- Server version 5.7.31 6 | 7 | /*!40101 SET @OLD_CHARACTER_SET_CLIENT=@@CHARACTER_SET_CLIENT */; 8 | /*!40101 SET @OLD_CHARACTER_SET_RESULTS=@@CHARACTER_SET_RESULTS */; 9 | /*!40101 SET @OLD_COLLATION_CONNECTION=@@COLLATION_CONNECTION */; 10 | /*!50503 SET NAMES utf8mb4 */; 11 | /*!40103 SET @OLD_TIME_ZONE=@@TIME_ZONE */; 12 | /*!40103 SET TIME_ZONE='+00:00' */; 13 | /*!40014 SET @OLD_UNIQUE_CHECKS=@@UNIQUE_CHECKS, UNIQUE_CHECKS=0 */; 14 | /*!40014 SET @OLD_FOREIGN_KEY_CHECKS=@@FOREIGN_KEY_CHECKS, FOREIGN_KEY_CHECKS=0 */; 15 | /*!40101 SET @OLD_SQL_MODE=@@SQL_MODE, SQL_MODE='NO_AUTO_VALUE_ON_ZERO' */; 16 | /*!40111 SET @OLD_SQL_NOTES=@@SQL_NOTES, SQL_NOTES=0 */; 17 | 18 | -- 19 | -- Table structure for table `e2e_users` 20 | -- 21 | 22 | DROP TABLE IF EXISTS `e2e_users`; 23 | /*!40101 SET @saved_cs_client = @@character_set_client */; 24 | /*!50503 SET character_set_client = utf8mb4 */; 25 | CREATE TABLE `e2e_users` ( 26 | `id` char(36) NOT NULL, 27 | `created_at` datetime NOT NULL, 28 | `updated_at` datetime NOT NULL, 29 | `username` varchar(255) DEFAULT NULL, 30 | PRIMARY KEY (`id`) 31 | ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4; 32 | /*!40101 SET character_set_client = @saved_cs_client */; 33 | 34 | -- 35 | -- Table structure for table `schema_migration` 36 | -- 37 | 38 | DROP TABLE IF EXISTS `schema_migration`; 39 | /*!40101 SET @saved_cs_client = @@character_set_client */; 40 | /*!50503 SET character_set_client = utf8mb4 */; 41 | CREATE TABLE `schema_migration` ( 42 | `version` varchar(14) NOT NULL, 43 | UNIQUE KEY `schema_migration_version_idx` (`version`) 44 | ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4; 45 | /*!40101 SET character_set_client = @saved_cs_client */; 46 | /*!40103 SET TIME_ZONE=@OLD_TIME_ZONE */; 47 | 48 | /*!40101 SET SQL_MODE=@OLD_SQL_MODE */; 49 | /*!40014 SET FOREIGN_KEY_CHECKS=@OLD_FOREIGN_KEY_CHECKS */; 50 | /*!40014 SET UNIQUE_CHECKS=@OLD_UNIQUE_CHECKS */; 51 | /*!40101 SET CHARACTER_SET_CLIENT=@OLD_CHARACTER_SET_CLIENT */; 52 | /*!40101 SET CHARACTER_SET_RESULTS=@OLD_CHARACTER_SET_RESULTS */; 53 | /*!40101 SET COLLATION_CONNECTION=@OLD_COLLATION_CONNECTION */; 54 | /*!40111 SET SQL_NOTES=@OLD_SQL_NOTES */; 55 | 56 | -- Dump completed on 2020-09-03 11:40:22 57 | -------------------------------------------------------------------------------- /testdata/e2e/fixtures/mysql/down/10.sql: -------------------------------------------------------------------------------- 1 | -- MySQL dump 10.13 Distrib 8.0.21, for osx10.15 (x86_64) 2 | -- 3 | -- Host: 127.0.0.1 Database: pop_test 4 | -- ------------------------------------------------------ 5 | -- Server version 5.7.31 6 | 7 | /*!40101 SET @OLD_CHARACTER_SET_CLIENT=@@CHARACTER_SET_CLIENT */; 8 | /*!40101 SET @OLD_CHARACTER_SET_RESULTS=@@CHARACTER_SET_RESULTS */; 9 | /*!40101 SET @OLD_COLLATION_CONNECTION=@@COLLATION_CONNECTION */; 10 | /*!50503 SET NAMES utf8mb4 */; 11 | /*!40103 SET @OLD_TIME_ZONE=@@TIME_ZONE */; 12 | /*!40103 SET TIME_ZONE='+00:00' */; 13 | /*!40014 SET @OLD_UNIQUE_CHECKS=@@UNIQUE_CHECKS, UNIQUE_CHECKS=0 */; 14 | /*!40014 SET @OLD_FOREIGN_KEY_CHECKS=@@FOREIGN_KEY_CHECKS, FOREIGN_KEY_CHECKS=0 */; 15 | /*!40101 SET @OLD_SQL_MODE=@@SQL_MODE, SQL_MODE='NO_AUTO_VALUE_ON_ZERO' */; 16 | /*!40111 SET @OLD_SQL_NOTES=@@SQL_NOTES, SQL_NOTES=0 */; 17 | 18 | -- 19 | -- Table structure for table `e2e_user_posts` 20 | -- 21 | 22 | DROP TABLE IF EXISTS `e2e_user_posts`; 23 | /*!40101 SET @saved_cs_client = @@character_set_client */; 24 | /*!50503 SET character_set_client = utf8mb4 */; 25 | CREATE TABLE `e2e_user_posts` ( 26 | `id` char(36) NOT NULL, 27 | `user_id` char(36) NOT NULL, 28 | `slug` varchar(64) NOT NULL, 29 | `content` varchar(255) NOT NULL DEFAULT '', 30 | PRIMARY KEY (`id`), 31 | UNIQUE KEY `e2e_user_notes_slug_idx` (`slug`), 32 | KEY `e2e_user_notes_user_id_idx` (`user_id`), 33 | CONSTRAINT `e2e_user_posts_ibfk_1` FOREIGN KEY (`user_id`) REFERENCES `e2e_users` (`id`) ON DELETE CASCADE 34 | ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4; 35 | /*!40101 SET character_set_client = @saved_cs_client */; 36 | 37 | -- 38 | -- Table structure for table `e2e_users` 39 | -- 40 | 41 | DROP TABLE IF EXISTS `e2e_users`; 42 | /*!40101 SET @saved_cs_client = @@character_set_client */; 43 | /*!50503 SET character_set_client = utf8mb4 */; 44 | CREATE TABLE `e2e_users` ( 45 | `id` char(36) NOT NULL, 46 | `created_at` datetime NOT NULL, 47 | `updated_at` datetime NOT NULL, 48 | PRIMARY KEY (`id`) 49 | ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4; 50 | /*!40101 SET character_set_client = @saved_cs_client */; 51 | 52 | -- 53 | -- Table structure for table `schema_migration` 54 | -- 55 | 56 | DROP TABLE IF EXISTS `schema_migration`; 57 | /*!40101 SET @saved_cs_client = @@character_set_client */; 58 | /*!50503 SET character_set_client = utf8mb4 */; 59 | CREATE TABLE `schema_migration` ( 60 | `version` varchar(14) NOT NULL, 61 | UNIQUE KEY `schema_migration_version_idx` (`version`) 62 | ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4; 63 | /*!40101 SET character_set_client = @saved_cs_client */; 64 | /*!40103 SET TIME_ZONE=@OLD_TIME_ZONE */; 65 | 66 | /*!40101 SET SQL_MODE=@OLD_SQL_MODE */; 67 | /*!40014 SET FOREIGN_KEY_CHECKS=@OLD_FOREIGN_KEY_CHECKS */; 68 | /*!40014 SET UNIQUE_CHECKS=@OLD_UNIQUE_CHECKS */; 69 | /*!40101 SET CHARACTER_SET_CLIENT=@OLD_CHARACTER_SET_CLIENT */; 70 | /*!40101 SET CHARACTER_SET_RESULTS=@OLD_CHARACTER_SET_RESULTS */; 71 | /*!40101 SET COLLATION_CONNECTION=@OLD_COLLATION_CONNECTION */; 72 | /*!40111 SET SQL_NOTES=@OLD_SQL_NOTES */; 73 | 74 | -- Dump completed on 2020-09-03 11:40:18 75 | -------------------------------------------------------------------------------- /testdata/e2e/fixtures/mysql/down/11.sql: -------------------------------------------------------------------------------- 1 | -- MySQL dump 10.13 Distrib 8.0.21, for osx10.15 (x86_64) 2 | -- 3 | -- Host: 127.0.0.1 Database: pop_test 4 | -- ------------------------------------------------------ 5 | -- Server version 5.7.31 6 | 7 | /*!40101 SET @OLD_CHARACTER_SET_CLIENT=@@CHARACTER_SET_CLIENT */; 8 | /*!40101 SET @OLD_CHARACTER_SET_RESULTS=@@CHARACTER_SET_RESULTS */; 9 | /*!40101 SET @OLD_COLLATION_CONNECTION=@@COLLATION_CONNECTION */; 10 | /*!50503 SET NAMES utf8mb4 */; 11 | /*!40103 SET @OLD_TIME_ZONE=@@TIME_ZONE */; 12 | /*!40103 SET TIME_ZONE='+00:00' */; 13 | /*!40014 SET @OLD_UNIQUE_CHECKS=@@UNIQUE_CHECKS, UNIQUE_CHECKS=0 */; 14 | /*!40014 SET @OLD_FOREIGN_KEY_CHECKS=@@FOREIGN_KEY_CHECKS, FOREIGN_KEY_CHECKS=0 */; 15 | /*!40101 SET @OLD_SQL_MODE=@@SQL_MODE, SQL_MODE='NO_AUTO_VALUE_ON_ZERO' */; 16 | /*!40111 SET @OLD_SQL_NOTES=@@SQL_NOTES, SQL_NOTES=0 */; 17 | 18 | -- 19 | -- Table structure for table `e2e_user_posts` 20 | -- 21 | 22 | DROP TABLE IF EXISTS `e2e_user_posts`; 23 | /*!40101 SET @saved_cs_client = @@character_set_client */; 24 | /*!50503 SET character_set_client = utf8mb4 */; 25 | CREATE TABLE `e2e_user_posts` ( 26 | `id` char(36) NOT NULL, 27 | `user_id` char(36) NOT NULL, 28 | `slug` varchar(32) NOT NULL, 29 | `content` varchar(255) NOT NULL DEFAULT '', 30 | PRIMARY KEY (`id`), 31 | UNIQUE KEY `e2e_user_notes_slug_idx` (`slug`), 32 | KEY `e2e_user_notes_user_id_idx` (`user_id`), 33 | CONSTRAINT `e2e_user_posts_ibfk_1` FOREIGN KEY (`user_id`) REFERENCES `e2e_users` (`id`) ON DELETE CASCADE 34 | ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4; 35 | /*!40101 SET character_set_client = @saved_cs_client */; 36 | 37 | -- 38 | -- Table structure for table `e2e_users` 39 | -- 40 | 41 | DROP TABLE IF EXISTS `e2e_users`; 42 | /*!40101 SET @saved_cs_client = @@character_set_client */; 43 | /*!50503 SET character_set_client = utf8mb4 */; 44 | CREATE TABLE `e2e_users` ( 45 | `id` char(36) NOT NULL, 46 | `created_at` datetime NOT NULL, 47 | `updated_at` datetime NOT NULL, 48 | PRIMARY KEY (`id`) 49 | ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4; 50 | /*!40101 SET character_set_client = @saved_cs_client */; 51 | 52 | -- 53 | -- Table structure for table `schema_migration` 54 | -- 55 | 56 | DROP TABLE IF EXISTS `schema_migration`; 57 | /*!40101 SET @saved_cs_client = @@character_set_client */; 58 | /*!50503 SET character_set_client = utf8mb4 */; 59 | CREATE TABLE `schema_migration` ( 60 | `version` varchar(14) NOT NULL, 61 | UNIQUE KEY `schema_migration_version_idx` (`version`) 62 | ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4; 63 | /*!40101 SET character_set_client = @saved_cs_client */; 64 | /*!40103 SET TIME_ZONE=@OLD_TIME_ZONE */; 65 | 66 | /*!40101 SET SQL_MODE=@OLD_SQL_MODE */; 67 | /*!40014 SET FOREIGN_KEY_CHECKS=@OLD_FOREIGN_KEY_CHECKS */; 68 | /*!40014 SET UNIQUE_CHECKS=@OLD_UNIQUE_CHECKS */; 69 | /*!40101 SET CHARACTER_SET_CLIENT=@OLD_CHARACTER_SET_CLIENT */; 70 | /*!40101 SET CHARACTER_SET_RESULTS=@OLD_CHARACTER_SET_RESULTS */; 71 | /*!40101 SET COLLATION_CONNECTION=@OLD_COLLATION_CONNECTION */; 72 | /*!40111 SET SQL_NOTES=@OLD_SQL_NOTES */; 73 | 74 | -- Dump completed on 2020-09-03 11:40:18 75 | -------------------------------------------------------------------------------- /testdata/e2e/fixtures/mysql/down/12.sql: -------------------------------------------------------------------------------- 1 | -- MySQL dump 10.13 Distrib 8.0.21, for osx10.15 (x86_64) 2 | -- 3 | -- Host: 127.0.0.1 Database: pop_test 4 | -- ------------------------------------------------------ 5 | -- Server version 5.7.31 6 | 7 | /*!40101 SET @OLD_CHARACTER_SET_CLIENT=@@CHARACTER_SET_CLIENT */; 8 | /*!40101 SET @OLD_CHARACTER_SET_RESULTS=@@CHARACTER_SET_RESULTS */; 9 | /*!40101 SET @OLD_COLLATION_CONNECTION=@@COLLATION_CONNECTION */; 10 | /*!50503 SET NAMES utf8mb4 */; 11 | /*!40103 SET @OLD_TIME_ZONE=@@TIME_ZONE */; 12 | /*!40103 SET TIME_ZONE='+00:00' */; 13 | /*!40014 SET @OLD_UNIQUE_CHECKS=@@UNIQUE_CHECKS, UNIQUE_CHECKS=0 */; 14 | /*!40014 SET @OLD_FOREIGN_KEY_CHECKS=@@FOREIGN_KEY_CHECKS, FOREIGN_KEY_CHECKS=0 */; 15 | /*!40101 SET @OLD_SQL_MODE=@@SQL_MODE, SQL_MODE='NO_AUTO_VALUE_ON_ZERO' */; 16 | /*!40111 SET @OLD_SQL_NOTES=@@SQL_NOTES, SQL_NOTES=0 */; 17 | 18 | -- 19 | -- Table structure for table `e2e_authors` 20 | -- 21 | 22 | DROP TABLE IF EXISTS `e2e_authors`; 23 | /*!40101 SET @saved_cs_client = @@character_set_client */; 24 | /*!50503 SET character_set_client = utf8mb4 */; 25 | CREATE TABLE `e2e_authors` ( 26 | `id` char(36) NOT NULL, 27 | `created_at` datetime NOT NULL, 28 | `updated_at` datetime NOT NULL, 29 | PRIMARY KEY (`id`) 30 | ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4; 31 | /*!40101 SET character_set_client = @saved_cs_client */; 32 | 33 | -- 34 | -- Table structure for table `e2e_user_posts` 35 | -- 36 | 37 | DROP TABLE IF EXISTS `e2e_user_posts`; 38 | /*!40101 SET @saved_cs_client = @@character_set_client */; 39 | /*!50503 SET character_set_client = utf8mb4 */; 40 | CREATE TABLE `e2e_user_posts` ( 41 | `id` char(36) NOT NULL, 42 | `user_id` char(36) NOT NULL, 43 | `slug` varchar(32) NOT NULL, 44 | `content` varchar(255) NOT NULL DEFAULT '', 45 | PRIMARY KEY (`id`), 46 | UNIQUE KEY `e2e_user_notes_slug_idx` (`slug`), 47 | KEY `e2e_user_notes_user_id_idx` (`user_id`), 48 | CONSTRAINT `e2e_user_posts_ibfk_1` FOREIGN KEY (`user_id`) REFERENCES `e2e_authors` (`id`) ON DELETE CASCADE 49 | ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4; 50 | /*!40101 SET character_set_client = @saved_cs_client */; 51 | 52 | -- 53 | -- Table structure for table `schema_migration` 54 | -- 55 | 56 | DROP TABLE IF EXISTS `schema_migration`; 57 | /*!40101 SET @saved_cs_client = @@character_set_client */; 58 | /*!50503 SET character_set_client = utf8mb4 */; 59 | CREATE TABLE `schema_migration` ( 60 | `version` varchar(14) NOT NULL, 61 | UNIQUE KEY `schema_migration_version_idx` (`version`) 62 | ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4; 63 | /*!40101 SET character_set_client = @saved_cs_client */; 64 | /*!40103 SET TIME_ZONE=@OLD_TIME_ZONE */; 65 | 66 | /*!40101 SET SQL_MODE=@OLD_SQL_MODE */; 67 | /*!40014 SET FOREIGN_KEY_CHECKS=@OLD_FOREIGN_KEY_CHECKS */; 68 | /*!40014 SET UNIQUE_CHECKS=@OLD_UNIQUE_CHECKS */; 69 | /*!40101 SET CHARACTER_SET_CLIENT=@OLD_CHARACTER_SET_CLIENT */; 70 | /*!40101 SET CHARACTER_SET_RESULTS=@OLD_CHARACTER_SET_RESULTS */; 71 | /*!40101 SET COLLATION_CONNECTION=@OLD_COLLATION_CONNECTION */; 72 | /*!40111 SET SQL_NOTES=@OLD_SQL_NOTES */; 73 | 74 | -- Dump completed on 2020-09-03 11:40:18 75 | -------------------------------------------------------------------------------- /testdata/e2e/fixtures/mysql/down/13.sql: -------------------------------------------------------------------------------- 1 | -- MySQL dump 10.13 Distrib 8.0.21, for osx10.15 (x86_64) 2 | -- 3 | -- Host: 127.0.0.1 Database: pop_test 4 | -- ------------------------------------------------------ 5 | -- Server version 5.7.31 6 | 7 | /*!40101 SET @OLD_CHARACTER_SET_CLIENT=@@CHARACTER_SET_CLIENT */; 8 | /*!40101 SET @OLD_CHARACTER_SET_RESULTS=@@CHARACTER_SET_RESULTS */; 9 | /*!40101 SET @OLD_COLLATION_CONNECTION=@@COLLATION_CONNECTION */; 10 | /*!50503 SET NAMES utf8mb4 */; 11 | /*!40103 SET @OLD_TIME_ZONE=@@TIME_ZONE */; 12 | /*!40103 SET TIME_ZONE='+00:00' */; 13 | /*!40014 SET @OLD_UNIQUE_CHECKS=@@UNIQUE_CHECKS, UNIQUE_CHECKS=0 */; 14 | /*!40014 SET @OLD_FOREIGN_KEY_CHECKS=@@FOREIGN_KEY_CHECKS, FOREIGN_KEY_CHECKS=0 */; 15 | /*!40101 SET @OLD_SQL_MODE=@@SQL_MODE, SQL_MODE='NO_AUTO_VALUE_ON_ZERO' */; 16 | /*!40111 SET @OLD_SQL_NOTES=@@SQL_NOTES, SQL_NOTES=0 */; 17 | 18 | -- 19 | -- Table structure for table `e2e_authors` 20 | -- 21 | 22 | DROP TABLE IF EXISTS `e2e_authors`; 23 | /*!40101 SET @saved_cs_client = @@character_set_client */; 24 | /*!50503 SET character_set_client = utf8mb4 */; 25 | CREATE TABLE `e2e_authors` ( 26 | `id` char(36) NOT NULL, 27 | `created_at` datetime NOT NULL, 28 | `updated_at` datetime NOT NULL, 29 | PRIMARY KEY (`id`) 30 | ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4; 31 | /*!40101 SET character_set_client = @saved_cs_client */; 32 | 33 | -- 34 | -- Table structure for table `e2e_user_posts` 35 | -- 36 | 37 | DROP TABLE IF EXISTS `e2e_user_posts`; 38 | /*!40101 SET @saved_cs_client = @@character_set_client */; 39 | /*!50503 SET character_set_client = utf8mb4 */; 40 | CREATE TABLE `e2e_user_posts` ( 41 | `id` char(36) NOT NULL, 42 | `author_id` char(36) NOT NULL, 43 | `slug` varchar(32) NOT NULL, 44 | `content` varchar(255) NOT NULL DEFAULT '', 45 | PRIMARY KEY (`id`), 46 | UNIQUE KEY `e2e_user_notes_slug_idx` (`slug`), 47 | KEY `e2e_user_notes_user_id_idx` (`author_id`), 48 | CONSTRAINT `e2e_user_posts_ibfk_1` FOREIGN KEY (`author_id`) REFERENCES `e2e_authors` (`id`) ON DELETE CASCADE 49 | ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4; 50 | /*!40101 SET character_set_client = @saved_cs_client */; 51 | 52 | -- 53 | -- Table structure for table `schema_migration` 54 | -- 55 | 56 | DROP TABLE IF EXISTS `schema_migration`; 57 | /*!40101 SET @saved_cs_client = @@character_set_client */; 58 | /*!50503 SET character_set_client = utf8mb4 */; 59 | CREATE TABLE `schema_migration` ( 60 | `version` varchar(14) NOT NULL, 61 | UNIQUE KEY `schema_migration_version_idx` (`version`) 62 | ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4; 63 | /*!40101 SET character_set_client = @saved_cs_client */; 64 | /*!40103 SET TIME_ZONE=@OLD_TIME_ZONE */; 65 | 66 | /*!40101 SET SQL_MODE=@OLD_SQL_MODE */; 67 | /*!40014 SET FOREIGN_KEY_CHECKS=@OLD_FOREIGN_KEY_CHECKS */; 68 | /*!40014 SET UNIQUE_CHECKS=@OLD_UNIQUE_CHECKS */; 69 | /*!40101 SET CHARACTER_SET_CLIENT=@OLD_CHARACTER_SET_CLIENT */; 70 | /*!40101 SET CHARACTER_SET_RESULTS=@OLD_CHARACTER_SET_RESULTS */; 71 | /*!40101 SET COLLATION_CONNECTION=@OLD_COLLATION_CONNECTION */; 72 | /*!40111 SET SQL_NOTES=@OLD_SQL_NOTES */; 73 | 74 | -- Dump completed on 2020-09-03 11:40:17 75 | -------------------------------------------------------------------------------- /testdata/e2e/fixtures/mysql/down/3.sql: -------------------------------------------------------------------------------- 1 | -- MySQL dump 10.13 Distrib 8.0.21, for osx10.15 (x86_64) 2 | -- 3 | -- Host: 127.0.0.1 Database: pop_test 4 | -- ------------------------------------------------------ 5 | -- Server version 5.7.31 6 | 7 | /*!40101 SET @OLD_CHARACTER_SET_CLIENT=@@CHARACTER_SET_CLIENT */; 8 | /*!40101 SET @OLD_CHARACTER_SET_RESULTS=@@CHARACTER_SET_RESULTS */; 9 | /*!40101 SET @OLD_COLLATION_CONNECTION=@@COLLATION_CONNECTION */; 10 | /*!50503 SET NAMES utf8mb4 */; 11 | /*!40103 SET @OLD_TIME_ZONE=@@TIME_ZONE */; 12 | /*!40103 SET TIME_ZONE='+00:00' */; 13 | /*!40014 SET @OLD_UNIQUE_CHECKS=@@UNIQUE_CHECKS, UNIQUE_CHECKS=0 */; 14 | /*!40014 SET @OLD_FOREIGN_KEY_CHECKS=@@FOREIGN_KEY_CHECKS, FOREIGN_KEY_CHECKS=0 */; 15 | /*!40101 SET @OLD_SQL_MODE=@@SQL_MODE, SQL_MODE='NO_AUTO_VALUE_ON_ZERO' */; 16 | /*!40111 SET @OLD_SQL_NOTES=@@SQL_NOTES, SQL_NOTES=0 */; 17 | 18 | -- 19 | -- Table structure for table `e2e_user_notes` 20 | -- 21 | 22 | DROP TABLE IF EXISTS `e2e_user_notes`; 23 | /*!40101 SET @saved_cs_client = @@character_set_client */; 24 | /*!50503 SET character_set_client = utf8mb4 */; 25 | CREATE TABLE `e2e_user_notes` ( 26 | `id` char(36) NOT NULL, 27 | `user_id` char(36) NOT NULL, 28 | `notes` varchar(255) DEFAULT NULL, 29 | PRIMARY KEY (`id`), 30 | KEY `e2e_user_notes_user_id_idx` (`user_id`), 31 | CONSTRAINT `e2e_user_notes_ibfk_1` FOREIGN KEY (`user_id`) REFERENCES `e2e_users` (`id`) ON DELETE CASCADE 32 | ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4; 33 | /*!40101 SET character_set_client = @saved_cs_client */; 34 | 35 | -- 36 | -- Table structure for table `e2e_users` 37 | -- 38 | 39 | DROP TABLE IF EXISTS `e2e_users`; 40 | /*!40101 SET @saved_cs_client = @@character_set_client */; 41 | /*!50503 SET character_set_client = utf8mb4 */; 42 | CREATE TABLE `e2e_users` ( 43 | `id` char(36) NOT NULL, 44 | `created_at` datetime NOT NULL, 45 | `updated_at` datetime NOT NULL, 46 | `username` varchar(255) DEFAULT NULL, 47 | PRIMARY KEY (`id`) 48 | ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4; 49 | /*!40101 SET character_set_client = @saved_cs_client */; 50 | 51 | -- 52 | -- Table structure for table `schema_migration` 53 | -- 54 | 55 | DROP TABLE IF EXISTS `schema_migration`; 56 | /*!40101 SET @saved_cs_client = @@character_set_client */; 57 | /*!50503 SET character_set_client = utf8mb4 */; 58 | CREATE TABLE `schema_migration` ( 59 | `version` varchar(14) NOT NULL, 60 | UNIQUE KEY `schema_migration_version_idx` (`version`) 61 | ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4; 62 | /*!40101 SET character_set_client = @saved_cs_client */; 63 | /*!40103 SET TIME_ZONE=@OLD_TIME_ZONE */; 64 | 65 | /*!40101 SET SQL_MODE=@OLD_SQL_MODE */; 66 | /*!40014 SET FOREIGN_KEY_CHECKS=@OLD_FOREIGN_KEY_CHECKS */; 67 | /*!40014 SET UNIQUE_CHECKS=@OLD_UNIQUE_CHECKS */; 68 | /*!40101 SET CHARACTER_SET_CLIENT=@OLD_CHARACTER_SET_CLIENT */; 69 | /*!40101 SET CHARACTER_SET_RESULTS=@OLD_CHARACTER_SET_RESULTS */; 70 | /*!40101 SET COLLATION_CONNECTION=@OLD_COLLATION_CONNECTION */; 71 | /*!40111 SET SQL_NOTES=@OLD_SQL_NOTES */; 72 | 73 | -- Dump completed on 2020-09-03 11:40:21 74 | -------------------------------------------------------------------------------- /testdata/e2e/fixtures/mysql/up/0.sql: -------------------------------------------------------------------------------- 1 | -- MySQL dump 10.13 Distrib 8.0.21, for osx10.15 (x86_64) 2 | -- 3 | -- Host: 127.0.0.1 Database: pop_test 4 | -- ------------------------------------------------------ 5 | -- Server version 5.7.31 6 | 7 | /*!40101 SET @OLD_CHARACTER_SET_CLIENT=@@CHARACTER_SET_CLIENT */; 8 | /*!40101 SET @OLD_CHARACTER_SET_RESULTS=@@CHARACTER_SET_RESULTS */; 9 | /*!40101 SET @OLD_COLLATION_CONNECTION=@@COLLATION_CONNECTION */; 10 | /*!50503 SET NAMES utf8mb4 */; 11 | /*!40103 SET @OLD_TIME_ZONE=@@TIME_ZONE */; 12 | /*!40103 SET TIME_ZONE='+00:00' */; 13 | /*!40014 SET @OLD_UNIQUE_CHECKS=@@UNIQUE_CHECKS, UNIQUE_CHECKS=0 */; 14 | /*!40014 SET @OLD_FOREIGN_KEY_CHECKS=@@FOREIGN_KEY_CHECKS, FOREIGN_KEY_CHECKS=0 */; 15 | /*!40101 SET @OLD_SQL_MODE=@@SQL_MODE, SQL_MODE='NO_AUTO_VALUE_ON_ZERO' */; 16 | /*!40111 SET @OLD_SQL_NOTES=@@SQL_NOTES, SQL_NOTES=0 */; 17 | 18 | -- 19 | -- Table structure for table `e2e_users` 20 | -- 21 | 22 | DROP TABLE IF EXISTS `e2e_users`; 23 | /*!40101 SET @saved_cs_client = @@character_set_client */; 24 | /*!50503 SET character_set_client = utf8mb4 */; 25 | CREATE TABLE `e2e_users` ( 26 | `id` char(36) NOT NULL, 27 | `username` varchar(255) DEFAULT NULL, 28 | `created_at` datetime NOT NULL, 29 | `updated_at` datetime NOT NULL, 30 | PRIMARY KEY (`id`) 31 | ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4; 32 | /*!40101 SET character_set_client = @saved_cs_client */; 33 | 34 | -- 35 | -- Table structure for table `schema_migration` 36 | -- 37 | 38 | DROP TABLE IF EXISTS `schema_migration`; 39 | /*!40101 SET @saved_cs_client = @@character_set_client */; 40 | /*!50503 SET character_set_client = utf8mb4 */; 41 | CREATE TABLE `schema_migration` ( 42 | `version` varchar(14) NOT NULL, 43 | UNIQUE KEY `schema_migration_version_idx` (`version`) 44 | ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4; 45 | /*!40101 SET character_set_client = @saved_cs_client */; 46 | /*!40103 SET TIME_ZONE=@OLD_TIME_ZONE */; 47 | 48 | /*!40101 SET SQL_MODE=@OLD_SQL_MODE */; 49 | /*!40014 SET FOREIGN_KEY_CHECKS=@OLD_FOREIGN_KEY_CHECKS */; 50 | /*!40014 SET UNIQUE_CHECKS=@OLD_UNIQUE_CHECKS */; 51 | /*!40101 SET CHARACTER_SET_CLIENT=@OLD_CHARACTER_SET_CLIENT */; 52 | /*!40101 SET CHARACTER_SET_RESULTS=@OLD_CHARACTER_SET_RESULTS */; 53 | /*!40101 SET COLLATION_CONNECTION=@OLD_COLLATION_CONNECTION */; 54 | /*!40111 SET SQL_NOTES=@OLD_SQL_NOTES */; 55 | 56 | -- Dump completed on 2020-09-03 11:40:11 57 | -------------------------------------------------------------------------------- /testdata/e2e/fixtures/mysql/up/10.sql: -------------------------------------------------------------------------------- 1 | -- MySQL dump 10.13 Distrib 8.0.21, for osx10.15 (x86_64) 2 | -- 3 | -- Host: 127.0.0.1 Database: pop_test 4 | -- ------------------------------------------------------ 5 | -- Server version 5.7.31 6 | 7 | /*!40101 SET @OLD_CHARACTER_SET_CLIENT=@@CHARACTER_SET_CLIENT */; 8 | /*!40101 SET @OLD_CHARACTER_SET_RESULTS=@@CHARACTER_SET_RESULTS */; 9 | /*!40101 SET @OLD_COLLATION_CONNECTION=@@COLLATION_CONNECTION */; 10 | /*!50503 SET NAMES utf8mb4 */; 11 | /*!40103 SET @OLD_TIME_ZONE=@@TIME_ZONE */; 12 | /*!40103 SET TIME_ZONE='+00:00' */; 13 | /*!40014 SET @OLD_UNIQUE_CHECKS=@@UNIQUE_CHECKS, UNIQUE_CHECKS=0 */; 14 | /*!40014 SET @OLD_FOREIGN_KEY_CHECKS=@@FOREIGN_KEY_CHECKS, FOREIGN_KEY_CHECKS=0 */; 15 | /*!40101 SET @OLD_SQL_MODE=@@SQL_MODE, SQL_MODE='NO_AUTO_VALUE_ON_ZERO' */; 16 | /*!40111 SET @OLD_SQL_NOTES=@@SQL_NOTES, SQL_NOTES=0 */; 17 | 18 | -- 19 | -- Table structure for table `e2e_user_posts` 20 | -- 21 | 22 | DROP TABLE IF EXISTS `e2e_user_posts`; 23 | /*!40101 SET @saved_cs_client = @@character_set_client */; 24 | /*!50503 SET character_set_client = utf8mb4 */; 25 | CREATE TABLE `e2e_user_posts` ( 26 | `id` char(36) NOT NULL, 27 | `user_id` char(36) NOT NULL, 28 | `slug` varchar(32) NOT NULL, 29 | `content` varchar(255) NOT NULL DEFAULT '', 30 | PRIMARY KEY (`id`), 31 | UNIQUE KEY `e2e_user_notes_slug_idx` (`slug`), 32 | KEY `e2e_user_notes_user_id_idx` (`user_id`), 33 | CONSTRAINT `e2e_user_posts_ibfk_1` FOREIGN KEY (`user_id`) REFERENCES `e2e_users` (`id`) ON DELETE CASCADE 34 | ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4; 35 | /*!40101 SET character_set_client = @saved_cs_client */; 36 | 37 | -- 38 | -- Table structure for table `e2e_users` 39 | -- 40 | 41 | DROP TABLE IF EXISTS `e2e_users`; 42 | /*!40101 SET @saved_cs_client = @@character_set_client */; 43 | /*!50503 SET character_set_client = utf8mb4 */; 44 | CREATE TABLE `e2e_users` ( 45 | `id` char(36) NOT NULL, 46 | `created_at` datetime NOT NULL, 47 | `updated_at` datetime NOT NULL, 48 | PRIMARY KEY (`id`) 49 | ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4; 50 | /*!40101 SET character_set_client = @saved_cs_client */; 51 | 52 | -- 53 | -- Table structure for table `schema_migration` 54 | -- 55 | 56 | DROP TABLE IF EXISTS `schema_migration`; 57 | /*!40101 SET @saved_cs_client = @@character_set_client */; 58 | /*!50503 SET character_set_client = utf8mb4 */; 59 | CREATE TABLE `schema_migration` ( 60 | `version` varchar(14) NOT NULL, 61 | UNIQUE KEY `schema_migration_version_idx` (`version`) 62 | ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4; 63 | /*!40101 SET character_set_client = @saved_cs_client */; 64 | /*!40103 SET TIME_ZONE=@OLD_TIME_ZONE */; 65 | 66 | /*!40101 SET SQL_MODE=@OLD_SQL_MODE */; 67 | /*!40014 SET FOREIGN_KEY_CHECKS=@OLD_FOREIGN_KEY_CHECKS */; 68 | /*!40014 SET UNIQUE_CHECKS=@OLD_UNIQUE_CHECKS */; 69 | /*!40101 SET CHARACTER_SET_CLIENT=@OLD_CHARACTER_SET_CLIENT */; 70 | /*!40101 SET CHARACTER_SET_RESULTS=@OLD_CHARACTER_SET_RESULTS */; 71 | /*!40101 SET COLLATION_CONNECTION=@OLD_COLLATION_CONNECTION */; 72 | /*!40111 SET SQL_NOTES=@OLD_SQL_NOTES */; 73 | 74 | -- Dump completed on 2020-09-03 11:40:14 75 | -------------------------------------------------------------------------------- /testdata/e2e/fixtures/mysql/up/11.sql: -------------------------------------------------------------------------------- 1 | -- MySQL dump 10.13 Distrib 8.0.21, for osx10.15 (x86_64) 2 | -- 3 | -- Host: 127.0.0.1 Database: pop_test 4 | -- ------------------------------------------------------ 5 | -- Server version 5.7.31 6 | 7 | /*!40101 SET @OLD_CHARACTER_SET_CLIENT=@@CHARACTER_SET_CLIENT */; 8 | /*!40101 SET @OLD_CHARACTER_SET_RESULTS=@@CHARACTER_SET_RESULTS */; 9 | /*!40101 SET @OLD_COLLATION_CONNECTION=@@COLLATION_CONNECTION */; 10 | /*!50503 SET NAMES utf8mb4 */; 11 | /*!40103 SET @OLD_TIME_ZONE=@@TIME_ZONE */; 12 | /*!40103 SET TIME_ZONE='+00:00' */; 13 | /*!40014 SET @OLD_UNIQUE_CHECKS=@@UNIQUE_CHECKS, UNIQUE_CHECKS=0 */; 14 | /*!40014 SET @OLD_FOREIGN_KEY_CHECKS=@@FOREIGN_KEY_CHECKS, FOREIGN_KEY_CHECKS=0 */; 15 | /*!40101 SET @OLD_SQL_MODE=@@SQL_MODE, SQL_MODE='NO_AUTO_VALUE_ON_ZERO' */; 16 | /*!40111 SET @OLD_SQL_NOTES=@@SQL_NOTES, SQL_NOTES=0 */; 17 | 18 | -- 19 | -- Table structure for table `e2e_authors` 20 | -- 21 | 22 | DROP TABLE IF EXISTS `e2e_authors`; 23 | /*!40101 SET @saved_cs_client = @@character_set_client */; 24 | /*!50503 SET character_set_client = utf8mb4 */; 25 | CREATE TABLE `e2e_authors` ( 26 | `id` char(36) NOT NULL, 27 | `created_at` datetime NOT NULL, 28 | `updated_at` datetime NOT NULL, 29 | PRIMARY KEY (`id`) 30 | ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4; 31 | /*!40101 SET character_set_client = @saved_cs_client */; 32 | 33 | -- 34 | -- Table structure for table `e2e_user_posts` 35 | -- 36 | 37 | DROP TABLE IF EXISTS `e2e_user_posts`; 38 | /*!40101 SET @saved_cs_client = @@character_set_client */; 39 | /*!50503 SET character_set_client = utf8mb4 */; 40 | CREATE TABLE `e2e_user_posts` ( 41 | `id` char(36) NOT NULL, 42 | `user_id` char(36) NOT NULL, 43 | `slug` varchar(32) NOT NULL, 44 | `content` varchar(255) NOT NULL DEFAULT '', 45 | PRIMARY KEY (`id`), 46 | UNIQUE KEY `e2e_user_notes_slug_idx` (`slug`), 47 | KEY `e2e_user_notes_user_id_idx` (`user_id`), 48 | CONSTRAINT `e2e_user_posts_ibfk_1` FOREIGN KEY (`user_id`) REFERENCES `e2e_authors` (`id`) ON DELETE CASCADE 49 | ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4; 50 | /*!40101 SET character_set_client = @saved_cs_client */; 51 | 52 | -- 53 | -- Table structure for table `schema_migration` 54 | -- 55 | 56 | DROP TABLE IF EXISTS `schema_migration`; 57 | /*!40101 SET @saved_cs_client = @@character_set_client */; 58 | /*!50503 SET character_set_client = utf8mb4 */; 59 | CREATE TABLE `schema_migration` ( 60 | `version` varchar(14) NOT NULL, 61 | UNIQUE KEY `schema_migration_version_idx` (`version`) 62 | ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4; 63 | /*!40101 SET character_set_client = @saved_cs_client */; 64 | /*!40103 SET TIME_ZONE=@OLD_TIME_ZONE */; 65 | 66 | /*!40101 SET SQL_MODE=@OLD_SQL_MODE */; 67 | /*!40014 SET FOREIGN_KEY_CHECKS=@OLD_FOREIGN_KEY_CHECKS */; 68 | /*!40014 SET UNIQUE_CHECKS=@OLD_UNIQUE_CHECKS */; 69 | /*!40101 SET CHARACTER_SET_CLIENT=@OLD_CHARACTER_SET_CLIENT */; 70 | /*!40101 SET CHARACTER_SET_RESULTS=@OLD_CHARACTER_SET_RESULTS */; 71 | /*!40101 SET COLLATION_CONNECTION=@OLD_COLLATION_CONNECTION */; 72 | /*!40111 SET SQL_NOTES=@OLD_SQL_NOTES */; 73 | 74 | -- Dump completed on 2020-09-03 11:40:14 75 | -------------------------------------------------------------------------------- /testdata/e2e/fixtures/mysql/up/12.sql: -------------------------------------------------------------------------------- 1 | -- MySQL dump 10.13 Distrib 8.0.21, for osx10.15 (x86_64) 2 | -- 3 | -- Host: 127.0.0.1 Database: pop_test 4 | -- ------------------------------------------------------ 5 | -- Server version 5.7.31 6 | 7 | /*!40101 SET @OLD_CHARACTER_SET_CLIENT=@@CHARACTER_SET_CLIENT */; 8 | /*!40101 SET @OLD_CHARACTER_SET_RESULTS=@@CHARACTER_SET_RESULTS */; 9 | /*!40101 SET @OLD_COLLATION_CONNECTION=@@COLLATION_CONNECTION */; 10 | /*!50503 SET NAMES utf8mb4 */; 11 | /*!40103 SET @OLD_TIME_ZONE=@@TIME_ZONE */; 12 | /*!40103 SET TIME_ZONE='+00:00' */; 13 | /*!40014 SET @OLD_UNIQUE_CHECKS=@@UNIQUE_CHECKS, UNIQUE_CHECKS=0 */; 14 | /*!40014 SET @OLD_FOREIGN_KEY_CHECKS=@@FOREIGN_KEY_CHECKS, FOREIGN_KEY_CHECKS=0 */; 15 | /*!40101 SET @OLD_SQL_MODE=@@SQL_MODE, SQL_MODE='NO_AUTO_VALUE_ON_ZERO' */; 16 | /*!40111 SET @OLD_SQL_NOTES=@@SQL_NOTES, SQL_NOTES=0 */; 17 | 18 | -- 19 | -- Table structure for table `e2e_authors` 20 | -- 21 | 22 | DROP TABLE IF EXISTS `e2e_authors`; 23 | /*!40101 SET @saved_cs_client = @@character_set_client */; 24 | /*!50503 SET character_set_client = utf8mb4 */; 25 | CREATE TABLE `e2e_authors` ( 26 | `id` char(36) NOT NULL, 27 | `created_at` datetime NOT NULL, 28 | `updated_at` datetime NOT NULL, 29 | PRIMARY KEY (`id`) 30 | ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4; 31 | /*!40101 SET character_set_client = @saved_cs_client */; 32 | 33 | -- 34 | -- Table structure for table `e2e_user_posts` 35 | -- 36 | 37 | DROP TABLE IF EXISTS `e2e_user_posts`; 38 | /*!40101 SET @saved_cs_client = @@character_set_client */; 39 | /*!50503 SET character_set_client = utf8mb4 */; 40 | CREATE TABLE `e2e_user_posts` ( 41 | `id` char(36) NOT NULL, 42 | `author_id` char(36) NOT NULL, 43 | `slug` varchar(32) NOT NULL, 44 | `content` varchar(255) NOT NULL DEFAULT '', 45 | PRIMARY KEY (`id`), 46 | UNIQUE KEY `e2e_user_notes_slug_idx` (`slug`), 47 | KEY `e2e_user_notes_user_id_idx` (`author_id`), 48 | CONSTRAINT `e2e_user_posts_ibfk_1` FOREIGN KEY (`author_id`) REFERENCES `e2e_authors` (`id`) ON DELETE CASCADE 49 | ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4; 50 | /*!40101 SET character_set_client = @saved_cs_client */; 51 | 52 | -- 53 | -- Table structure for table `schema_migration` 54 | -- 55 | 56 | DROP TABLE IF EXISTS `schema_migration`; 57 | /*!40101 SET @saved_cs_client = @@character_set_client */; 58 | /*!50503 SET character_set_client = utf8mb4 */; 59 | CREATE TABLE `schema_migration` ( 60 | `version` varchar(14) NOT NULL, 61 | UNIQUE KEY `schema_migration_version_idx` (`version`) 62 | ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4; 63 | /*!40101 SET character_set_client = @saved_cs_client */; 64 | /*!40103 SET TIME_ZONE=@OLD_TIME_ZONE */; 65 | 66 | /*!40101 SET SQL_MODE=@OLD_SQL_MODE */; 67 | /*!40014 SET FOREIGN_KEY_CHECKS=@OLD_FOREIGN_KEY_CHECKS */; 68 | /*!40014 SET UNIQUE_CHECKS=@OLD_UNIQUE_CHECKS */; 69 | /*!40101 SET CHARACTER_SET_CLIENT=@OLD_CHARACTER_SET_CLIENT */; 70 | /*!40101 SET CHARACTER_SET_RESULTS=@OLD_CHARACTER_SET_RESULTS */; 71 | /*!40101 SET COLLATION_CONNECTION=@OLD_COLLATION_CONNECTION */; 72 | /*!40111 SET SQL_NOTES=@OLD_SQL_NOTES */; 73 | 74 | -- Dump completed on 2020-09-03 11:40:15 75 | -------------------------------------------------------------------------------- /testdata/e2e/fixtures/mysql/up/2.sql: -------------------------------------------------------------------------------- 1 | -- MySQL dump 10.13 Distrib 8.0.21, for osx10.15 (x86_64) 2 | -- 3 | -- Host: 127.0.0.1 Database: pop_test 4 | -- ------------------------------------------------------ 5 | -- Server version 5.7.31 6 | 7 | /*!40101 SET @OLD_CHARACTER_SET_CLIENT=@@CHARACTER_SET_CLIENT */; 8 | /*!40101 SET @OLD_CHARACTER_SET_RESULTS=@@CHARACTER_SET_RESULTS */; 9 | /*!40101 SET @OLD_COLLATION_CONNECTION=@@COLLATION_CONNECTION */; 10 | /*!50503 SET NAMES utf8mb4 */; 11 | /*!40103 SET @OLD_TIME_ZONE=@@TIME_ZONE */; 12 | /*!40103 SET TIME_ZONE='+00:00' */; 13 | /*!40014 SET @OLD_UNIQUE_CHECKS=@@UNIQUE_CHECKS, UNIQUE_CHECKS=0 */; 14 | /*!40014 SET @OLD_FOREIGN_KEY_CHECKS=@@FOREIGN_KEY_CHECKS, FOREIGN_KEY_CHECKS=0 */; 15 | /*!40101 SET @OLD_SQL_MODE=@@SQL_MODE, SQL_MODE='NO_AUTO_VALUE_ON_ZERO' */; 16 | /*!40111 SET @OLD_SQL_NOTES=@@SQL_NOTES, SQL_NOTES=0 */; 17 | 18 | -- 19 | -- Table structure for table `e2e_user_notes` 20 | -- 21 | 22 | DROP TABLE IF EXISTS `e2e_user_notes`; 23 | /*!40101 SET @saved_cs_client = @@character_set_client */; 24 | /*!50503 SET character_set_client = utf8mb4 */; 25 | CREATE TABLE `e2e_user_notes` ( 26 | `id` char(36) NOT NULL, 27 | `notes` varchar(255) DEFAULT NULL, 28 | `user_id` char(36) NOT NULL, 29 | PRIMARY KEY (`id`), 30 | KEY `e2e_user_notes_user_id_idx` (`user_id`), 31 | CONSTRAINT `e2e_user_notes_ibfk_1` FOREIGN KEY (`user_id`) REFERENCES `e2e_users` (`id`) ON DELETE CASCADE 32 | ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4; 33 | /*!40101 SET character_set_client = @saved_cs_client */; 34 | 35 | -- 36 | -- Table structure for table `e2e_users` 37 | -- 38 | 39 | DROP TABLE IF EXISTS `e2e_users`; 40 | /*!40101 SET @saved_cs_client = @@character_set_client */; 41 | /*!50503 SET character_set_client = utf8mb4 */; 42 | CREATE TABLE `e2e_users` ( 43 | `id` char(36) NOT NULL, 44 | `username` varchar(255) DEFAULT NULL, 45 | `created_at` datetime NOT NULL, 46 | `updated_at` datetime NOT NULL, 47 | PRIMARY KEY (`id`) 48 | ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4; 49 | /*!40101 SET character_set_client = @saved_cs_client */; 50 | 51 | -- 52 | -- Table structure for table `schema_migration` 53 | -- 54 | 55 | DROP TABLE IF EXISTS `schema_migration`; 56 | /*!40101 SET @saved_cs_client = @@character_set_client */; 57 | /*!50503 SET character_set_client = utf8mb4 */; 58 | CREATE TABLE `schema_migration` ( 59 | `version` varchar(14) NOT NULL, 60 | UNIQUE KEY `schema_migration_version_idx` (`version`) 61 | ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4; 62 | /*!40101 SET character_set_client = @saved_cs_client */; 63 | /*!40103 SET TIME_ZONE=@OLD_TIME_ZONE */; 64 | 65 | /*!40101 SET SQL_MODE=@OLD_SQL_MODE */; 66 | /*!40014 SET FOREIGN_KEY_CHECKS=@OLD_FOREIGN_KEY_CHECKS */; 67 | /*!40014 SET UNIQUE_CHECKS=@OLD_UNIQUE_CHECKS */; 68 | /*!40101 SET CHARACTER_SET_CLIENT=@OLD_CHARACTER_SET_CLIENT */; 69 | /*!40101 SET CHARACTER_SET_RESULTS=@OLD_CHARACTER_SET_RESULTS */; 70 | /*!40101 SET COLLATION_CONNECTION=@OLD_COLLATION_CONNECTION */; 71 | /*!40111 SET SQL_NOTES=@OLD_SQL_NOTES */; 72 | 73 | -- Dump completed on 2020-09-03 11:40:11 74 | -------------------------------------------------------------------------------- /testdata/e2e/fixtures/mysql/up/3.sql: -------------------------------------------------------------------------------- 1 | -- MySQL dump 10.13 Distrib 8.0.21, for osx10.15 (x86_64) 2 | -- 3 | -- Host: 127.0.0.1 Database: pop_test 4 | -- ------------------------------------------------------ 5 | -- Server version 5.7.31 6 | 7 | /*!40101 SET @OLD_CHARACTER_SET_CLIENT=@@CHARACTER_SET_CLIENT */; 8 | /*!40101 SET @OLD_CHARACTER_SET_RESULTS=@@CHARACTER_SET_RESULTS */; 9 | /*!40101 SET @OLD_COLLATION_CONNECTION=@@COLLATION_CONNECTION */; 10 | /*!50503 SET NAMES utf8mb4 */; 11 | /*!40103 SET @OLD_TIME_ZONE=@@TIME_ZONE */; 12 | /*!40103 SET TIME_ZONE='+00:00' */; 13 | /*!40014 SET @OLD_UNIQUE_CHECKS=@@UNIQUE_CHECKS, UNIQUE_CHECKS=0 */; 14 | /*!40014 SET @OLD_FOREIGN_KEY_CHECKS=@@FOREIGN_KEY_CHECKS, FOREIGN_KEY_CHECKS=0 */; 15 | /*!40101 SET @OLD_SQL_MODE=@@SQL_MODE, SQL_MODE='NO_AUTO_VALUE_ON_ZERO' */; 16 | /*!40111 SET @OLD_SQL_NOTES=@@SQL_NOTES, SQL_NOTES=0 */; 17 | 18 | -- 19 | -- Table structure for table `e2e_user_notes` 20 | -- 21 | 22 | DROP TABLE IF EXISTS `e2e_user_notes`; 23 | /*!40101 SET @saved_cs_client = @@character_set_client */; 24 | /*!50503 SET character_set_client = utf8mb4 */; 25 | CREATE TABLE `e2e_user_notes` ( 26 | `id` char(36) NOT NULL, 27 | `notes` varchar(255) DEFAULT NULL, 28 | `user_id` char(36) NOT NULL, 29 | `slug` varchar(64) DEFAULT NULL, 30 | PRIMARY KEY (`id`), 31 | KEY `e2e_user_notes_user_id_idx` (`user_id`), 32 | CONSTRAINT `e2e_user_notes_ibfk_1` FOREIGN KEY (`user_id`) REFERENCES `e2e_users` (`id`) ON DELETE CASCADE 33 | ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4; 34 | /*!40101 SET character_set_client = @saved_cs_client */; 35 | 36 | -- 37 | -- Table structure for table `e2e_users` 38 | -- 39 | 40 | DROP TABLE IF EXISTS `e2e_users`; 41 | /*!40101 SET @saved_cs_client = @@character_set_client */; 42 | /*!50503 SET character_set_client = utf8mb4 */; 43 | CREATE TABLE `e2e_users` ( 44 | `id` char(36) NOT NULL, 45 | `username` varchar(255) DEFAULT NULL, 46 | `created_at` datetime NOT NULL, 47 | `updated_at` datetime NOT NULL, 48 | PRIMARY KEY (`id`) 49 | ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4; 50 | /*!40101 SET character_set_client = @saved_cs_client */; 51 | 52 | -- 53 | -- Table structure for table `schema_migration` 54 | -- 55 | 56 | DROP TABLE IF EXISTS `schema_migration`; 57 | /*!40101 SET @saved_cs_client = @@character_set_client */; 58 | /*!50503 SET character_set_client = utf8mb4 */; 59 | CREATE TABLE `schema_migration` ( 60 | `version` varchar(14) NOT NULL, 61 | UNIQUE KEY `schema_migration_version_idx` (`version`) 62 | ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4; 63 | /*!40101 SET character_set_client = @saved_cs_client */; 64 | /*!40103 SET TIME_ZONE=@OLD_TIME_ZONE */; 65 | 66 | /*!40101 SET SQL_MODE=@OLD_SQL_MODE */; 67 | /*!40014 SET FOREIGN_KEY_CHECKS=@OLD_FOREIGN_KEY_CHECKS */; 68 | /*!40014 SET UNIQUE_CHECKS=@OLD_UNIQUE_CHECKS */; 69 | /*!40101 SET CHARACTER_SET_CLIENT=@OLD_CHARACTER_SET_CLIENT */; 70 | /*!40101 SET CHARACTER_SET_RESULTS=@OLD_CHARACTER_SET_RESULTS */; 71 | /*!40101 SET COLLATION_CONNECTION=@OLD_COLLATION_CONNECTION */; 72 | /*!40111 SET SQL_NOTES=@OLD_SQL_NOTES */; 73 | 74 | -- Dump completed on 2020-09-03 11:40:12 75 | -------------------------------------------------------------------------------- /testdata/e2e/fixtures/mysql/up/4.sql: -------------------------------------------------------------------------------- 1 | -- MySQL dump 10.13 Distrib 8.0.21, for osx10.15 (x86_64) 2 | -- 3 | -- Host: 127.0.0.1 Database: pop_test 4 | -- ------------------------------------------------------ 5 | -- Server version 5.7.31 6 | 7 | /*!40101 SET @OLD_CHARACTER_SET_CLIENT=@@CHARACTER_SET_CLIENT */; 8 | /*!40101 SET @OLD_CHARACTER_SET_RESULTS=@@CHARACTER_SET_RESULTS */; 9 | /*!40101 SET @OLD_COLLATION_CONNECTION=@@COLLATION_CONNECTION */; 10 | /*!50503 SET NAMES utf8mb4 */; 11 | /*!40103 SET @OLD_TIME_ZONE=@@TIME_ZONE */; 12 | /*!40103 SET TIME_ZONE='+00:00' */; 13 | /*!40014 SET @OLD_UNIQUE_CHECKS=@@UNIQUE_CHECKS, UNIQUE_CHECKS=0 */; 14 | /*!40014 SET @OLD_FOREIGN_KEY_CHECKS=@@FOREIGN_KEY_CHECKS, FOREIGN_KEY_CHECKS=0 */; 15 | /*!40101 SET @OLD_SQL_MODE=@@SQL_MODE, SQL_MODE='NO_AUTO_VALUE_ON_ZERO' */; 16 | /*!40111 SET @OLD_SQL_NOTES=@@SQL_NOTES, SQL_NOTES=0 */; 17 | 18 | -- 19 | -- Table structure for table `e2e_user_notes` 20 | -- 21 | 22 | DROP TABLE IF EXISTS `e2e_user_notes`; 23 | /*!40101 SET @saved_cs_client = @@character_set_client */; 24 | /*!50503 SET character_set_client = utf8mb4 */; 25 | CREATE TABLE `e2e_user_notes` ( 26 | `id` char(36) NOT NULL, 27 | `notes` varchar(255) DEFAULT NULL, 28 | `user_id` char(36) NOT NULL, 29 | `slug` varchar(64) DEFAULT NULL, 30 | PRIMARY KEY (`id`), 31 | KEY `e2e_user_notes_user_id_idx` (`user_id`), 32 | CONSTRAINT `e2e_user_notes_ibfk_1` FOREIGN KEY (`user_id`) REFERENCES `e2e_users` (`id`) ON DELETE CASCADE 33 | ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4; 34 | /*!40101 SET character_set_client = @saved_cs_client */; 35 | 36 | -- 37 | -- Table structure for table `e2e_users` 38 | -- 39 | 40 | DROP TABLE IF EXISTS `e2e_users`; 41 | /*!40101 SET @saved_cs_client = @@character_set_client */; 42 | /*!50503 SET character_set_client = utf8mb4 */; 43 | CREATE TABLE `e2e_users` ( 44 | `id` char(36) NOT NULL, 45 | `username` varchar(255) DEFAULT NULL, 46 | `created_at` datetime NOT NULL, 47 | `updated_at` datetime NOT NULL, 48 | PRIMARY KEY (`id`) 49 | ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4; 50 | /*!40101 SET character_set_client = @saved_cs_client */; 51 | 52 | -- 53 | -- Table structure for table `schema_migration` 54 | -- 55 | 56 | DROP TABLE IF EXISTS `schema_migration`; 57 | /*!40101 SET @saved_cs_client = @@character_set_client */; 58 | /*!50503 SET character_set_client = utf8mb4 */; 59 | CREATE TABLE `schema_migration` ( 60 | `version` varchar(14) NOT NULL, 61 | UNIQUE KEY `schema_migration_version_idx` (`version`) 62 | ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4; 63 | /*!40101 SET character_set_client = @saved_cs_client */; 64 | /*!40103 SET TIME_ZONE=@OLD_TIME_ZONE */; 65 | 66 | /*!40101 SET SQL_MODE=@OLD_SQL_MODE */; 67 | /*!40014 SET FOREIGN_KEY_CHECKS=@OLD_FOREIGN_KEY_CHECKS */; 68 | /*!40014 SET UNIQUE_CHECKS=@OLD_UNIQUE_CHECKS */; 69 | /*!40101 SET CHARACTER_SET_CLIENT=@OLD_CHARACTER_SET_CLIENT */; 70 | /*!40101 SET CHARACTER_SET_RESULTS=@OLD_CHARACTER_SET_RESULTS */; 71 | /*!40101 SET COLLATION_CONNECTION=@OLD_COLLATION_CONNECTION */; 72 | /*!40111 SET SQL_NOTES=@OLD_SQL_NOTES */; 73 | 74 | -- Dump completed on 2020-09-03 11:40:12 75 | -------------------------------------------------------------------------------- /testdata/e2e/fixtures/mysql/up/5.sql: -------------------------------------------------------------------------------- 1 | -- MySQL dump 10.13 Distrib 8.0.21, for osx10.15 (x86_64) 2 | -- 3 | -- Host: 127.0.0.1 Database: pop_test 4 | -- ------------------------------------------------------ 5 | -- Server version 5.7.31 6 | 7 | /*!40101 SET @OLD_CHARACTER_SET_CLIENT=@@CHARACTER_SET_CLIENT */; 8 | /*!40101 SET @OLD_CHARACTER_SET_RESULTS=@@CHARACTER_SET_RESULTS */; 9 | /*!40101 SET @OLD_COLLATION_CONNECTION=@@COLLATION_CONNECTION */; 10 | /*!50503 SET NAMES utf8mb4 */; 11 | /*!40103 SET @OLD_TIME_ZONE=@@TIME_ZONE */; 12 | /*!40103 SET TIME_ZONE='+00:00' */; 13 | /*!40014 SET @OLD_UNIQUE_CHECKS=@@UNIQUE_CHECKS, UNIQUE_CHECKS=0 */; 14 | /*!40014 SET @OLD_FOREIGN_KEY_CHECKS=@@FOREIGN_KEY_CHECKS, FOREIGN_KEY_CHECKS=0 */; 15 | /*!40101 SET @OLD_SQL_MODE=@@SQL_MODE, SQL_MODE='NO_AUTO_VALUE_ON_ZERO' */; 16 | /*!40111 SET @OLD_SQL_NOTES=@@SQL_NOTES, SQL_NOTES=0 */; 17 | 18 | -- 19 | -- Table structure for table `e2e_user_notes` 20 | -- 21 | 22 | DROP TABLE IF EXISTS `e2e_user_notes`; 23 | /*!40101 SET @saved_cs_client = @@character_set_client */; 24 | /*!50503 SET character_set_client = utf8mb4 */; 25 | CREATE TABLE `e2e_user_notes` ( 26 | `id` char(36) NOT NULL, 27 | `notes` varchar(255) DEFAULT NULL, 28 | `user_id` char(36) NOT NULL, 29 | `slug` varchar(64) NOT NULL, 30 | PRIMARY KEY (`id`), 31 | UNIQUE KEY `e2e_user_notes_slug_idx` (`slug`), 32 | KEY `e2e_user_notes_user_id_idx` (`user_id`), 33 | CONSTRAINT `e2e_user_notes_ibfk_1` FOREIGN KEY (`user_id`) REFERENCES `e2e_users` (`id`) ON DELETE CASCADE 34 | ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4; 35 | /*!40101 SET character_set_client = @saved_cs_client */; 36 | 37 | -- 38 | -- Table structure for table `e2e_users` 39 | -- 40 | 41 | DROP TABLE IF EXISTS `e2e_users`; 42 | /*!40101 SET @saved_cs_client = @@character_set_client */; 43 | /*!50503 SET character_set_client = utf8mb4 */; 44 | CREATE TABLE `e2e_users` ( 45 | `id` char(36) NOT NULL, 46 | `username` varchar(255) DEFAULT NULL, 47 | `created_at` datetime NOT NULL, 48 | `updated_at` datetime NOT NULL, 49 | PRIMARY KEY (`id`) 50 | ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4; 51 | /*!40101 SET character_set_client = @saved_cs_client */; 52 | 53 | -- 54 | -- Table structure for table `schema_migration` 55 | -- 56 | 57 | DROP TABLE IF EXISTS `schema_migration`; 58 | /*!40101 SET @saved_cs_client = @@character_set_client */; 59 | /*!50503 SET character_set_client = utf8mb4 */; 60 | CREATE TABLE `schema_migration` ( 61 | `version` varchar(14) NOT NULL, 62 | UNIQUE KEY `schema_migration_version_idx` (`version`) 63 | ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4; 64 | /*!40101 SET character_set_client = @saved_cs_client */; 65 | /*!40103 SET TIME_ZONE=@OLD_TIME_ZONE */; 66 | 67 | /*!40101 SET SQL_MODE=@OLD_SQL_MODE */; 68 | /*!40014 SET FOREIGN_KEY_CHECKS=@OLD_FOREIGN_KEY_CHECKS */; 69 | /*!40014 SET UNIQUE_CHECKS=@OLD_UNIQUE_CHECKS */; 70 | /*!40101 SET CHARACTER_SET_CLIENT=@OLD_CHARACTER_SET_CLIENT */; 71 | /*!40101 SET CHARACTER_SET_RESULTS=@OLD_CHARACTER_SET_RESULTS */; 72 | /*!40101 SET COLLATION_CONNECTION=@OLD_COLLATION_CONNECTION */; 73 | /*!40111 SET SQL_NOTES=@OLD_SQL_NOTES */; 74 | 75 | -- Dump completed on 2020-09-03 11:40:12 76 | -------------------------------------------------------------------------------- /testdata/e2e/fixtures/mysql/up/6.sql: -------------------------------------------------------------------------------- 1 | -- MySQL dump 10.13 Distrib 8.0.21, for osx10.15 (x86_64) 2 | -- 3 | -- Host: 127.0.0.1 Database: pop_test 4 | -- ------------------------------------------------------ 5 | -- Server version 5.7.31 6 | 7 | /*!40101 SET @OLD_CHARACTER_SET_CLIENT=@@CHARACTER_SET_CLIENT */; 8 | /*!40101 SET @OLD_CHARACTER_SET_RESULTS=@@CHARACTER_SET_RESULTS */; 9 | /*!40101 SET @OLD_COLLATION_CONNECTION=@@COLLATION_CONNECTION */; 10 | /*!50503 SET NAMES utf8mb4 */; 11 | /*!40103 SET @OLD_TIME_ZONE=@@TIME_ZONE */; 12 | /*!40103 SET TIME_ZONE='+00:00' */; 13 | /*!40014 SET @OLD_UNIQUE_CHECKS=@@UNIQUE_CHECKS, UNIQUE_CHECKS=0 */; 14 | /*!40014 SET @OLD_FOREIGN_KEY_CHECKS=@@FOREIGN_KEY_CHECKS, FOREIGN_KEY_CHECKS=0 */; 15 | /*!40101 SET @OLD_SQL_MODE=@@SQL_MODE, SQL_MODE='NO_AUTO_VALUE_ON_ZERO' */; 16 | /*!40111 SET @OLD_SQL_NOTES=@@SQL_NOTES, SQL_NOTES=0 */; 17 | 18 | -- 19 | -- Table structure for table `e2e_user_posts` 20 | -- 21 | 22 | DROP TABLE IF EXISTS `e2e_user_posts`; 23 | /*!40101 SET @saved_cs_client = @@character_set_client */; 24 | /*!50503 SET character_set_client = utf8mb4 */; 25 | CREATE TABLE `e2e_user_posts` ( 26 | `id` char(36) NOT NULL, 27 | `notes` varchar(255) DEFAULT NULL, 28 | `user_id` char(36) NOT NULL, 29 | `slug` varchar(64) NOT NULL, 30 | PRIMARY KEY (`id`), 31 | UNIQUE KEY `e2e_user_notes_slug_idx` (`slug`), 32 | KEY `e2e_user_notes_user_id_idx` (`user_id`), 33 | CONSTRAINT `e2e_user_posts_ibfk_1` FOREIGN KEY (`user_id`) REFERENCES `e2e_users` (`id`) ON DELETE CASCADE 34 | ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4; 35 | /*!40101 SET character_set_client = @saved_cs_client */; 36 | 37 | -- 38 | -- Table structure for table `e2e_users` 39 | -- 40 | 41 | DROP TABLE IF EXISTS `e2e_users`; 42 | /*!40101 SET @saved_cs_client = @@character_set_client */; 43 | /*!50503 SET character_set_client = utf8mb4 */; 44 | CREATE TABLE `e2e_users` ( 45 | `id` char(36) NOT NULL, 46 | `username` varchar(255) DEFAULT NULL, 47 | `created_at` datetime NOT NULL, 48 | `updated_at` datetime NOT NULL, 49 | PRIMARY KEY (`id`) 50 | ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4; 51 | /*!40101 SET character_set_client = @saved_cs_client */; 52 | 53 | -- 54 | -- Table structure for table `schema_migration` 55 | -- 56 | 57 | DROP TABLE IF EXISTS `schema_migration`; 58 | /*!40101 SET @saved_cs_client = @@character_set_client */; 59 | /*!50503 SET character_set_client = utf8mb4 */; 60 | CREATE TABLE `schema_migration` ( 61 | `version` varchar(14) NOT NULL, 62 | UNIQUE KEY `schema_migration_version_idx` (`version`) 63 | ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4; 64 | /*!40101 SET character_set_client = @saved_cs_client */; 65 | /*!40103 SET TIME_ZONE=@OLD_TIME_ZONE */; 66 | 67 | /*!40101 SET SQL_MODE=@OLD_SQL_MODE */; 68 | /*!40014 SET FOREIGN_KEY_CHECKS=@OLD_FOREIGN_KEY_CHECKS */; 69 | /*!40014 SET UNIQUE_CHECKS=@OLD_UNIQUE_CHECKS */; 70 | /*!40101 SET CHARACTER_SET_CLIENT=@OLD_CHARACTER_SET_CLIENT */; 71 | /*!40101 SET CHARACTER_SET_RESULTS=@OLD_CHARACTER_SET_RESULTS */; 72 | /*!40101 SET COLLATION_CONNECTION=@OLD_COLLATION_CONNECTION */; 73 | /*!40111 SET SQL_NOTES=@OLD_SQL_NOTES */; 74 | 75 | -- Dump completed on 2020-09-03 11:40:12 76 | -------------------------------------------------------------------------------- /testdata/e2e/fixtures/mysql/up/9.sql: -------------------------------------------------------------------------------- 1 | -- MySQL dump 10.13 Distrib 8.0.21, for osx10.15 (x86_64) 2 | -- 3 | -- Host: 127.0.0.1 Database: pop_test 4 | -- ------------------------------------------------------ 5 | -- Server version 5.7.31 6 | 7 | /*!40101 SET @OLD_CHARACTER_SET_CLIENT=@@CHARACTER_SET_CLIENT */; 8 | /*!40101 SET @OLD_CHARACTER_SET_RESULTS=@@CHARACTER_SET_RESULTS */; 9 | /*!40101 SET @OLD_COLLATION_CONNECTION=@@COLLATION_CONNECTION */; 10 | /*!50503 SET NAMES utf8mb4 */; 11 | /*!40103 SET @OLD_TIME_ZONE=@@TIME_ZONE */; 12 | /*!40103 SET TIME_ZONE='+00:00' */; 13 | /*!40014 SET @OLD_UNIQUE_CHECKS=@@UNIQUE_CHECKS, UNIQUE_CHECKS=0 */; 14 | /*!40014 SET @OLD_FOREIGN_KEY_CHECKS=@@FOREIGN_KEY_CHECKS, FOREIGN_KEY_CHECKS=0 */; 15 | /*!40101 SET @OLD_SQL_MODE=@@SQL_MODE, SQL_MODE='NO_AUTO_VALUE_ON_ZERO' */; 16 | /*!40111 SET @OLD_SQL_NOTES=@@SQL_NOTES, SQL_NOTES=0 */; 17 | 18 | -- 19 | -- Table structure for table `e2e_user_posts` 20 | -- 21 | 22 | DROP TABLE IF EXISTS `e2e_user_posts`; 23 | /*!40101 SET @saved_cs_client = @@character_set_client */; 24 | /*!50503 SET character_set_client = utf8mb4 */; 25 | CREATE TABLE `e2e_user_posts` ( 26 | `id` char(36) NOT NULL, 27 | `user_id` char(36) NOT NULL, 28 | `slug` varchar(64) NOT NULL, 29 | `content` varchar(255) NOT NULL DEFAULT '', 30 | PRIMARY KEY (`id`), 31 | UNIQUE KEY `e2e_user_notes_slug_idx` (`slug`), 32 | KEY `e2e_user_notes_user_id_idx` (`user_id`), 33 | CONSTRAINT `e2e_user_posts_ibfk_1` FOREIGN KEY (`user_id`) REFERENCES `e2e_users` (`id`) ON DELETE CASCADE 34 | ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4; 35 | /*!40101 SET character_set_client = @saved_cs_client */; 36 | 37 | -- 38 | -- Table structure for table `e2e_users` 39 | -- 40 | 41 | DROP TABLE IF EXISTS `e2e_users`; 42 | /*!40101 SET @saved_cs_client = @@character_set_client */; 43 | /*!50503 SET character_set_client = utf8mb4 */; 44 | CREATE TABLE `e2e_users` ( 45 | `id` char(36) NOT NULL, 46 | `created_at` datetime NOT NULL, 47 | `updated_at` datetime NOT NULL, 48 | PRIMARY KEY (`id`) 49 | ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4; 50 | /*!40101 SET character_set_client = @saved_cs_client */; 51 | 52 | -- 53 | -- Table structure for table `schema_migration` 54 | -- 55 | 56 | DROP TABLE IF EXISTS `schema_migration`; 57 | /*!40101 SET @saved_cs_client = @@character_set_client */; 58 | /*!50503 SET character_set_client = utf8mb4 */; 59 | CREATE TABLE `schema_migration` ( 60 | `version` varchar(14) NOT NULL, 61 | UNIQUE KEY `schema_migration_version_idx` (`version`) 62 | ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4; 63 | /*!40101 SET character_set_client = @saved_cs_client */; 64 | /*!40103 SET TIME_ZONE=@OLD_TIME_ZONE */; 65 | 66 | /*!40101 SET SQL_MODE=@OLD_SQL_MODE */; 67 | /*!40014 SET FOREIGN_KEY_CHECKS=@OLD_FOREIGN_KEY_CHECKS */; 68 | /*!40014 SET UNIQUE_CHECKS=@OLD_UNIQUE_CHECKS */; 69 | /*!40101 SET CHARACTER_SET_CLIENT=@OLD_CHARACTER_SET_CLIENT */; 70 | /*!40101 SET CHARACTER_SET_RESULTS=@OLD_CHARACTER_SET_RESULTS */; 71 | /*!40101 SET COLLATION_CONNECTION=@OLD_COLLATION_CONNECTION */; 72 | /*!40111 SET SQL_NOTES=@OLD_SQL_NOTES */; 73 | 74 | -- Dump completed on 2020-09-03 11:40:13 75 | -------------------------------------------------------------------------------- /testdata/e2e/fixtures/postgres/down/0.sql: -------------------------------------------------------------------------------- 1 | -- 2 | -- PostgreSQL database dump 3 | -- 4 | 5 | -- Dumped from database version 9.6.19 6 | -- Dumped by pg_dump version 12.4 7 | 8 | SET statement_timeout = 0; 9 | SET lock_timeout = 0; 10 | SET idle_in_transaction_session_timeout = 0; 11 | SET client_encoding = 'UTF8'; 12 | SET standard_conforming_strings = on; 13 | SELECT pg_catalog.set_config('search_path', '', false); 14 | SET check_function_bodies = false; 15 | SET xmloption = content; 16 | SET client_min_messages = warning; 17 | SET row_security = off; 18 | 19 | SET default_tablespace = ''; 20 | 21 | -- 22 | -- Name: schema_migration; Type: TABLE; Schema: public; Owner: postgres 23 | -- 24 | 25 | CREATE TABLE public.schema_migration ( 26 | version character varying(14) NOT NULL 27 | ); 28 | 29 | 30 | ALTER TABLE public.schema_migration OWNER TO postgres; 31 | 32 | -- 33 | -- Name: schema_migration_version_idx; Type: INDEX; Schema: public; Owner: postgres 34 | -- 35 | 36 | CREATE UNIQUE INDEX schema_migration_version_idx ON public.schema_migration USING btree (version); 37 | 38 | 39 | -- 40 | -- PostgreSQL database dump complete 41 | -- 42 | 43 | -------------------------------------------------------------------------------- /testdata/e2e/fixtures/postgres/down/1.sql: -------------------------------------------------------------------------------- 1 | -- 2 | -- PostgreSQL database dump 3 | -- 4 | 5 | -- Dumped from database version 9.6.19 6 | -- Dumped by pg_dump version 12.4 7 | 8 | SET statement_timeout = 0; 9 | SET lock_timeout = 0; 10 | SET idle_in_transaction_session_timeout = 0; 11 | SET client_encoding = 'UTF8'; 12 | SET standard_conforming_strings = on; 13 | SELECT pg_catalog.set_config('search_path', '', false); 14 | SET check_function_bodies = false; 15 | SET xmloption = content; 16 | SET client_min_messages = warning; 17 | SET row_security = off; 18 | 19 | SET default_tablespace = ''; 20 | 21 | -- 22 | -- Name: e2e_users; Type: TABLE; Schema: public; Owner: postgres 23 | -- 24 | 25 | CREATE TABLE public.e2e_users ( 26 | id uuid NOT NULL, 27 | created_at timestamp without time zone NOT NULL, 28 | updated_at timestamp without time zone NOT NULL, 29 | username character varying(255) 30 | ); 31 | 32 | 33 | ALTER TABLE public.e2e_users OWNER TO postgres; 34 | 35 | -- 36 | -- Name: schema_migration; Type: TABLE; Schema: public; Owner: postgres 37 | -- 38 | 39 | CREATE TABLE public.schema_migration ( 40 | version character varying(14) NOT NULL 41 | ); 42 | 43 | 44 | ALTER TABLE public.schema_migration OWNER TO postgres; 45 | 46 | -- 47 | -- Name: e2e_users e2e_users_pkey; Type: CONSTRAINT; Schema: public; Owner: postgres 48 | -- 49 | 50 | ALTER TABLE ONLY public.e2e_users 51 | ADD CONSTRAINT e2e_users_pkey PRIMARY KEY (id); 52 | 53 | 54 | -- 55 | -- Name: schema_migration_version_idx; Type: INDEX; Schema: public; Owner: postgres 56 | -- 57 | 58 | CREATE UNIQUE INDEX schema_migration_version_idx ON public.schema_migration USING btree (version); 59 | 60 | 61 | -- 62 | -- PostgreSQL database dump complete 63 | -- 64 | 65 | -------------------------------------------------------------------------------- /testdata/e2e/fixtures/postgres/down/10.sql: -------------------------------------------------------------------------------- 1 | -- 2 | -- PostgreSQL database dump 3 | -- 4 | 5 | -- Dumped from database version 9.6.19 6 | -- Dumped by pg_dump version 12.4 7 | 8 | SET statement_timeout = 0; 9 | SET lock_timeout = 0; 10 | SET idle_in_transaction_session_timeout = 0; 11 | SET client_encoding = 'UTF8'; 12 | SET standard_conforming_strings = on; 13 | SELECT pg_catalog.set_config('search_path', '', false); 14 | SET check_function_bodies = false; 15 | SET xmloption = content; 16 | SET client_min_messages = warning; 17 | SET row_security = off; 18 | 19 | SET default_tablespace = ''; 20 | 21 | -- 22 | -- Name: e2e_user_posts; Type: TABLE; Schema: public; Owner: postgres 23 | -- 24 | 25 | CREATE TABLE public.e2e_user_posts ( 26 | id uuid NOT NULL, 27 | user_id uuid NOT NULL, 28 | slug character varying(64) NOT NULL, 29 | content character varying(255) DEFAULT ''::character varying NOT NULL 30 | ); 31 | 32 | 33 | ALTER TABLE public.e2e_user_posts OWNER TO postgres; 34 | 35 | -- 36 | -- Name: e2e_users; Type: TABLE; Schema: public; Owner: postgres 37 | -- 38 | 39 | CREATE TABLE public.e2e_users ( 40 | id uuid NOT NULL, 41 | created_at timestamp without time zone NOT NULL, 42 | updated_at timestamp without time zone NOT NULL 43 | ); 44 | 45 | 46 | ALTER TABLE public.e2e_users OWNER TO postgres; 47 | 48 | -- 49 | -- Name: schema_migration; Type: TABLE; Schema: public; Owner: postgres 50 | -- 51 | 52 | CREATE TABLE public.schema_migration ( 53 | version character varying(14) NOT NULL 54 | ); 55 | 56 | 57 | ALTER TABLE public.schema_migration OWNER TO postgres; 58 | 59 | -- 60 | -- Name: e2e_user_posts e2e_user_notes_pkey; Type: CONSTRAINT; Schema: public; Owner: postgres 61 | -- 62 | 63 | ALTER TABLE ONLY public.e2e_user_posts 64 | ADD CONSTRAINT e2e_user_notes_pkey PRIMARY KEY (id); 65 | 66 | 67 | -- 68 | -- Name: e2e_users e2e_users_pkey; Type: CONSTRAINT; Schema: public; Owner: postgres 69 | -- 70 | 71 | ALTER TABLE ONLY public.e2e_users 72 | ADD CONSTRAINT e2e_users_pkey PRIMARY KEY (id); 73 | 74 | 75 | -- 76 | -- Name: e2e_user_notes_slug_idx; Type: INDEX; Schema: public; Owner: postgres 77 | -- 78 | 79 | CREATE UNIQUE INDEX e2e_user_notes_slug_idx ON public.e2e_user_posts USING btree (slug); 80 | 81 | 82 | -- 83 | -- Name: e2e_user_notes_user_id_idx; Type: INDEX; Schema: public; Owner: postgres 84 | -- 85 | 86 | CREATE INDEX e2e_user_notes_user_id_idx ON public.e2e_user_posts USING btree (user_id); 87 | 88 | 89 | -- 90 | -- Name: schema_migration_version_idx; Type: INDEX; Schema: public; Owner: postgres 91 | -- 92 | 93 | CREATE UNIQUE INDEX schema_migration_version_idx ON public.schema_migration USING btree (version); 94 | 95 | 96 | -- 97 | -- Name: e2e_user_posts e2e_user_notes_user_id_fkey; Type: FK CONSTRAINT; Schema: public; Owner: postgres 98 | -- 99 | 100 | ALTER TABLE ONLY public.e2e_user_posts 101 | ADD CONSTRAINT e2e_user_notes_user_id_fkey FOREIGN KEY (user_id) REFERENCES public.e2e_users(id) ON DELETE CASCADE; 102 | 103 | 104 | -- 105 | -- PostgreSQL database dump complete 106 | -- 107 | 108 | -------------------------------------------------------------------------------- /testdata/e2e/fixtures/postgres/down/11.sql: -------------------------------------------------------------------------------- 1 | -- 2 | -- PostgreSQL database dump 3 | -- 4 | 5 | -- Dumped from database version 9.6.19 6 | -- Dumped by pg_dump version 12.4 7 | 8 | SET statement_timeout = 0; 9 | SET lock_timeout = 0; 10 | SET idle_in_transaction_session_timeout = 0; 11 | SET client_encoding = 'UTF8'; 12 | SET standard_conforming_strings = on; 13 | SELECT pg_catalog.set_config('search_path', '', false); 14 | SET check_function_bodies = false; 15 | SET xmloption = content; 16 | SET client_min_messages = warning; 17 | SET row_security = off; 18 | 19 | SET default_tablespace = ''; 20 | 21 | -- 22 | -- Name: e2e_user_posts; Type: TABLE; Schema: public; Owner: postgres 23 | -- 24 | 25 | CREATE TABLE public.e2e_user_posts ( 26 | id uuid NOT NULL, 27 | user_id uuid NOT NULL, 28 | slug character varying(32) NOT NULL, 29 | content character varying(255) DEFAULT ''::character varying NOT NULL 30 | ); 31 | 32 | 33 | ALTER TABLE public.e2e_user_posts OWNER TO postgres; 34 | 35 | -- 36 | -- Name: e2e_users; Type: TABLE; Schema: public; Owner: postgres 37 | -- 38 | 39 | CREATE TABLE public.e2e_users ( 40 | id uuid NOT NULL, 41 | created_at timestamp without time zone NOT NULL, 42 | updated_at timestamp without time zone NOT NULL 43 | ); 44 | 45 | 46 | ALTER TABLE public.e2e_users OWNER TO postgres; 47 | 48 | -- 49 | -- Name: schema_migration; Type: TABLE; Schema: public; Owner: postgres 50 | -- 51 | 52 | CREATE TABLE public.schema_migration ( 53 | version character varying(14) NOT NULL 54 | ); 55 | 56 | 57 | ALTER TABLE public.schema_migration OWNER TO postgres; 58 | 59 | -- 60 | -- Name: e2e_user_posts e2e_user_notes_pkey; Type: CONSTRAINT; Schema: public; Owner: postgres 61 | -- 62 | 63 | ALTER TABLE ONLY public.e2e_user_posts 64 | ADD CONSTRAINT e2e_user_notes_pkey PRIMARY KEY (id); 65 | 66 | 67 | -- 68 | -- Name: e2e_users e2e_users_pkey; Type: CONSTRAINT; Schema: public; Owner: postgres 69 | -- 70 | 71 | ALTER TABLE ONLY public.e2e_users 72 | ADD CONSTRAINT e2e_users_pkey PRIMARY KEY (id); 73 | 74 | 75 | -- 76 | -- Name: e2e_user_notes_slug_idx; Type: INDEX; Schema: public; Owner: postgres 77 | -- 78 | 79 | CREATE UNIQUE INDEX e2e_user_notes_slug_idx ON public.e2e_user_posts USING btree (slug); 80 | 81 | 82 | -- 83 | -- Name: e2e_user_notes_user_id_idx; Type: INDEX; Schema: public; Owner: postgres 84 | -- 85 | 86 | CREATE INDEX e2e_user_notes_user_id_idx ON public.e2e_user_posts USING btree (user_id); 87 | 88 | 89 | -- 90 | -- Name: schema_migration_version_idx; Type: INDEX; Schema: public; Owner: postgres 91 | -- 92 | 93 | CREATE UNIQUE INDEX schema_migration_version_idx ON public.schema_migration USING btree (version); 94 | 95 | 96 | -- 97 | -- Name: e2e_user_posts e2e_user_notes_user_id_fkey; Type: FK CONSTRAINT; Schema: public; Owner: postgres 98 | -- 99 | 100 | ALTER TABLE ONLY public.e2e_user_posts 101 | ADD CONSTRAINT e2e_user_notes_user_id_fkey FOREIGN KEY (user_id) REFERENCES public.e2e_users(id) ON DELETE CASCADE; 102 | 103 | 104 | -- 105 | -- PostgreSQL database dump complete 106 | -- 107 | 108 | -------------------------------------------------------------------------------- /testdata/e2e/fixtures/postgres/down/3.sql: -------------------------------------------------------------------------------- 1 | -- 2 | -- PostgreSQL database dump 3 | -- 4 | 5 | -- Dumped from database version 9.6.19 6 | -- Dumped by pg_dump version 12.4 7 | 8 | SET statement_timeout = 0; 9 | SET lock_timeout = 0; 10 | SET idle_in_transaction_session_timeout = 0; 11 | SET client_encoding = 'UTF8'; 12 | SET standard_conforming_strings = on; 13 | SELECT pg_catalog.set_config('search_path', '', false); 14 | SET check_function_bodies = false; 15 | SET xmloption = content; 16 | SET client_min_messages = warning; 17 | SET row_security = off; 18 | 19 | SET default_tablespace = ''; 20 | 21 | -- 22 | -- Name: e2e_user_notes; Type: TABLE; Schema: public; Owner: postgres 23 | -- 24 | 25 | CREATE TABLE public.e2e_user_notes ( 26 | id uuid NOT NULL, 27 | user_id uuid NOT NULL, 28 | notes character varying(255) 29 | ); 30 | 31 | 32 | ALTER TABLE public.e2e_user_notes OWNER TO postgres; 33 | 34 | -- 35 | -- Name: e2e_users; Type: TABLE; Schema: public; Owner: postgres 36 | -- 37 | 38 | CREATE TABLE public.e2e_users ( 39 | id uuid NOT NULL, 40 | created_at timestamp without time zone NOT NULL, 41 | updated_at timestamp without time zone NOT NULL, 42 | username character varying(255) 43 | ); 44 | 45 | 46 | ALTER TABLE public.e2e_users OWNER TO postgres; 47 | 48 | -- 49 | -- Name: schema_migration; Type: TABLE; Schema: public; Owner: postgres 50 | -- 51 | 52 | CREATE TABLE public.schema_migration ( 53 | version character varying(14) NOT NULL 54 | ); 55 | 56 | 57 | ALTER TABLE public.schema_migration OWNER TO postgres; 58 | 59 | -- 60 | -- Name: e2e_user_notes e2e_user_notes_pkey; Type: CONSTRAINT; Schema: public; Owner: postgres 61 | -- 62 | 63 | ALTER TABLE ONLY public.e2e_user_notes 64 | ADD CONSTRAINT e2e_user_notes_pkey PRIMARY KEY (id); 65 | 66 | 67 | -- 68 | -- Name: e2e_users e2e_users_pkey; Type: CONSTRAINT; Schema: public; Owner: postgres 69 | -- 70 | 71 | ALTER TABLE ONLY public.e2e_users 72 | ADD CONSTRAINT e2e_users_pkey PRIMARY KEY (id); 73 | 74 | 75 | -- 76 | -- Name: e2e_user_notes_user_id_idx; Type: INDEX; Schema: public; Owner: postgres 77 | -- 78 | 79 | CREATE INDEX e2e_user_notes_user_id_idx ON public.e2e_user_notes USING btree (user_id); 80 | 81 | 82 | -- 83 | -- Name: schema_migration_version_idx; Type: INDEX; Schema: public; Owner: postgres 84 | -- 85 | 86 | CREATE UNIQUE INDEX schema_migration_version_idx ON public.schema_migration USING btree (version); 87 | 88 | 89 | -- 90 | -- Name: e2e_user_notes e2e_user_notes_user_id_fkey; Type: FK CONSTRAINT; Schema: public; Owner: postgres 91 | -- 92 | 93 | ALTER TABLE ONLY public.e2e_user_notes 94 | ADD CONSTRAINT e2e_user_notes_user_id_fkey FOREIGN KEY (user_id) REFERENCES public.e2e_users(id) ON DELETE CASCADE; 95 | 96 | 97 | -- 98 | -- PostgreSQL database dump complete 99 | -- 100 | 101 | -------------------------------------------------------------------------------- /testdata/e2e/fixtures/postgres/down/4.sql: -------------------------------------------------------------------------------- 1 | -- 2 | -- PostgreSQL database dump 3 | -- 4 | 5 | -- Dumped from database version 9.6.19 6 | -- Dumped by pg_dump version 12.4 7 | 8 | SET statement_timeout = 0; 9 | SET lock_timeout = 0; 10 | SET idle_in_transaction_session_timeout = 0; 11 | SET client_encoding = 'UTF8'; 12 | SET standard_conforming_strings = on; 13 | SELECT pg_catalog.set_config('search_path', '', false); 14 | SET check_function_bodies = false; 15 | SET xmloption = content; 16 | SET client_min_messages = warning; 17 | SET row_security = off; 18 | 19 | SET default_tablespace = ''; 20 | 21 | -- 22 | -- Name: e2e_user_notes; Type: TABLE; Schema: public; Owner: postgres 23 | -- 24 | 25 | CREATE TABLE public.e2e_user_notes ( 26 | id uuid NOT NULL, 27 | user_id uuid NOT NULL, 28 | slug character varying(64) NOT NULL, 29 | notes character varying(255) 30 | ); 31 | 32 | 33 | ALTER TABLE public.e2e_user_notes OWNER TO postgres; 34 | 35 | -- 36 | -- Name: e2e_users; Type: TABLE; Schema: public; Owner: postgres 37 | -- 38 | 39 | CREATE TABLE public.e2e_users ( 40 | id uuid NOT NULL, 41 | created_at timestamp without time zone NOT NULL, 42 | updated_at timestamp without time zone NOT NULL, 43 | username character varying(255) 44 | ); 45 | 46 | 47 | ALTER TABLE public.e2e_users OWNER TO postgres; 48 | 49 | -- 50 | -- Name: schema_migration; Type: TABLE; Schema: public; Owner: postgres 51 | -- 52 | 53 | CREATE TABLE public.schema_migration ( 54 | version character varying(14) NOT NULL 55 | ); 56 | 57 | 58 | ALTER TABLE public.schema_migration OWNER TO postgres; 59 | 60 | -- 61 | -- Name: e2e_user_notes e2e_user_notes_pkey; Type: CONSTRAINT; Schema: public; Owner: postgres 62 | -- 63 | 64 | ALTER TABLE ONLY public.e2e_user_notes 65 | ADD CONSTRAINT e2e_user_notes_pkey PRIMARY KEY (id); 66 | 67 | 68 | -- 69 | -- Name: e2e_users e2e_users_pkey; Type: CONSTRAINT; Schema: public; Owner: postgres 70 | -- 71 | 72 | ALTER TABLE ONLY public.e2e_users 73 | ADD CONSTRAINT e2e_users_pkey PRIMARY KEY (id); 74 | 75 | 76 | -- 77 | -- Name: e2e_user_notes_slug_idx; Type: INDEX; Schema: public; Owner: postgres 78 | -- 79 | 80 | CREATE UNIQUE INDEX e2e_user_notes_slug_idx ON public.e2e_user_notes USING btree (slug); 81 | 82 | 83 | -- 84 | -- Name: e2e_user_notes_user_id_idx; Type: INDEX; Schema: public; Owner: postgres 85 | -- 86 | 87 | CREATE INDEX e2e_user_notes_user_id_idx ON public.e2e_user_notes USING btree (user_id); 88 | 89 | 90 | -- 91 | -- Name: schema_migration_version_idx; Type: INDEX; Schema: public; Owner: postgres 92 | -- 93 | 94 | CREATE UNIQUE INDEX schema_migration_version_idx ON public.schema_migration USING btree (version); 95 | 96 | 97 | -- 98 | -- Name: e2e_user_notes e2e_user_notes_user_id_fkey; Type: FK CONSTRAINT; Schema: public; Owner: postgres 99 | -- 100 | 101 | ALTER TABLE ONLY public.e2e_user_notes 102 | ADD CONSTRAINT e2e_user_notes_user_id_fkey FOREIGN KEY (user_id) REFERENCES public.e2e_users(id) ON DELETE CASCADE; 103 | 104 | 105 | -- 106 | -- PostgreSQL database dump complete 107 | -- 108 | 109 | -------------------------------------------------------------------------------- /testdata/e2e/fixtures/postgres/down/5.sql: -------------------------------------------------------------------------------- 1 | -- 2 | -- PostgreSQL database dump 3 | -- 4 | 5 | -- Dumped from database version 9.6.19 6 | -- Dumped by pg_dump version 12.4 7 | 8 | SET statement_timeout = 0; 9 | SET lock_timeout = 0; 10 | SET idle_in_transaction_session_timeout = 0; 11 | SET client_encoding = 'UTF8'; 12 | SET standard_conforming_strings = on; 13 | SELECT pg_catalog.set_config('search_path', '', false); 14 | SET check_function_bodies = false; 15 | SET xmloption = content; 16 | SET client_min_messages = warning; 17 | SET row_security = off; 18 | 19 | SET default_tablespace = ''; 20 | 21 | -- 22 | -- Name: e2e_user_notes; Type: TABLE; Schema: public; Owner: postgres 23 | -- 24 | 25 | CREATE TABLE public.e2e_user_notes ( 26 | id uuid NOT NULL, 27 | user_id uuid NOT NULL, 28 | slug character varying(64) NOT NULL, 29 | notes character varying(255) 30 | ); 31 | 32 | 33 | ALTER TABLE public.e2e_user_notes OWNER TO postgres; 34 | 35 | -- 36 | -- Name: e2e_users; Type: TABLE; Schema: public; Owner: postgres 37 | -- 38 | 39 | CREATE TABLE public.e2e_users ( 40 | id uuid NOT NULL, 41 | created_at timestamp without time zone NOT NULL, 42 | updated_at timestamp without time zone NOT NULL, 43 | username character varying(255) 44 | ); 45 | 46 | 47 | ALTER TABLE public.e2e_users OWNER TO postgres; 48 | 49 | -- 50 | -- Name: schema_migration; Type: TABLE; Schema: public; Owner: postgres 51 | -- 52 | 53 | CREATE TABLE public.schema_migration ( 54 | version character varying(14) NOT NULL 55 | ); 56 | 57 | 58 | ALTER TABLE public.schema_migration OWNER TO postgres; 59 | 60 | -- 61 | -- Name: e2e_user_notes e2e_user_notes_pkey; Type: CONSTRAINT; Schema: public; Owner: postgres 62 | -- 63 | 64 | ALTER TABLE ONLY public.e2e_user_notes 65 | ADD CONSTRAINT e2e_user_notes_pkey PRIMARY KEY (id); 66 | 67 | 68 | -- 69 | -- Name: e2e_users e2e_users_pkey; Type: CONSTRAINT; Schema: public; Owner: postgres 70 | -- 71 | 72 | ALTER TABLE ONLY public.e2e_users 73 | ADD CONSTRAINT e2e_users_pkey PRIMARY KEY (id); 74 | 75 | 76 | -- 77 | -- Name: e2e_user_notes_slug_idx; Type: INDEX; Schema: public; Owner: postgres 78 | -- 79 | 80 | CREATE UNIQUE INDEX e2e_user_notes_slug_idx ON public.e2e_user_notes USING btree (slug); 81 | 82 | 83 | -- 84 | -- Name: e2e_user_notes_user_id_idx; Type: INDEX; Schema: public; Owner: postgres 85 | -- 86 | 87 | CREATE INDEX e2e_user_notes_user_id_idx ON public.e2e_user_notes USING btree (user_id); 88 | 89 | 90 | -- 91 | -- Name: schema_migration_version_idx; Type: INDEX; Schema: public; Owner: postgres 92 | -- 93 | 94 | CREATE UNIQUE INDEX schema_migration_version_idx ON public.schema_migration USING btree (version); 95 | 96 | 97 | -- 98 | -- Name: e2e_user_notes e2e_user_notes_user_id_fkey; Type: FK CONSTRAINT; Schema: public; Owner: postgres 99 | -- 100 | 101 | ALTER TABLE ONLY public.e2e_user_notes 102 | ADD CONSTRAINT e2e_user_notes_user_id_fkey FOREIGN KEY (user_id) REFERENCES public.e2e_users(id) ON DELETE CASCADE; 103 | 104 | 105 | -- 106 | -- PostgreSQL database dump complete 107 | -- 108 | 109 | -------------------------------------------------------------------------------- /testdata/e2e/fixtures/postgres/up/0.sql: -------------------------------------------------------------------------------- 1 | -- 2 | -- PostgreSQL database dump 3 | -- 4 | 5 | -- Dumped from database version 9.6.19 6 | -- Dumped by pg_dump version 12.4 7 | 8 | SET statement_timeout = 0; 9 | SET lock_timeout = 0; 10 | SET idle_in_transaction_session_timeout = 0; 11 | SET client_encoding = 'UTF8'; 12 | SET standard_conforming_strings = on; 13 | SELECT pg_catalog.set_config('search_path', '', false); 14 | SET check_function_bodies = false; 15 | SET xmloption = content; 16 | SET client_min_messages = warning; 17 | SET row_security = off; 18 | 19 | SET default_tablespace = ''; 20 | 21 | -- 22 | -- Name: e2e_users; Type: TABLE; Schema: public; Owner: postgres 23 | -- 24 | 25 | CREATE TABLE public.e2e_users ( 26 | id uuid NOT NULL, 27 | username character varying(255), 28 | created_at timestamp without time zone NOT NULL, 29 | updated_at timestamp without time zone NOT NULL 30 | ); 31 | 32 | 33 | ALTER TABLE public.e2e_users OWNER TO postgres; 34 | 35 | -- 36 | -- Name: schema_migration; Type: TABLE; Schema: public; Owner: postgres 37 | -- 38 | 39 | CREATE TABLE public.schema_migration ( 40 | version character varying(14) NOT NULL 41 | ); 42 | 43 | 44 | ALTER TABLE public.schema_migration OWNER TO postgres; 45 | 46 | -- 47 | -- Name: e2e_users e2e_users_pkey; Type: CONSTRAINT; Schema: public; Owner: postgres 48 | -- 49 | 50 | ALTER TABLE ONLY public.e2e_users 51 | ADD CONSTRAINT e2e_users_pkey PRIMARY KEY (id); 52 | 53 | 54 | -- 55 | -- Name: schema_migration_version_idx; Type: INDEX; Schema: public; Owner: postgres 56 | -- 57 | 58 | CREATE UNIQUE INDEX schema_migration_version_idx ON public.schema_migration USING btree (version); 59 | 60 | 61 | -- 62 | -- PostgreSQL database dump complete 63 | -- 64 | 65 | -------------------------------------------------------------------------------- /testdata/e2e/fixtures/postgres/up/10.sql: -------------------------------------------------------------------------------- 1 | -- 2 | -- PostgreSQL database dump 3 | -- 4 | 5 | -- Dumped from database version 9.6.19 6 | -- Dumped by pg_dump version 12.4 7 | 8 | SET statement_timeout = 0; 9 | SET lock_timeout = 0; 10 | SET idle_in_transaction_session_timeout = 0; 11 | SET client_encoding = 'UTF8'; 12 | SET standard_conforming_strings = on; 13 | SELECT pg_catalog.set_config('search_path', '', false); 14 | SET check_function_bodies = false; 15 | SET xmloption = content; 16 | SET client_min_messages = warning; 17 | SET row_security = off; 18 | 19 | SET default_tablespace = ''; 20 | 21 | -- 22 | -- Name: e2e_user_posts; Type: TABLE; Schema: public; Owner: postgres 23 | -- 24 | 25 | CREATE TABLE public.e2e_user_posts ( 26 | id uuid NOT NULL, 27 | user_id uuid NOT NULL, 28 | slug character varying(32) NOT NULL, 29 | content character varying(255) DEFAULT ''::character varying NOT NULL 30 | ); 31 | 32 | 33 | ALTER TABLE public.e2e_user_posts OWNER TO postgres; 34 | 35 | -- 36 | -- Name: e2e_users; Type: TABLE; Schema: public; Owner: postgres 37 | -- 38 | 39 | CREATE TABLE public.e2e_users ( 40 | id uuid NOT NULL, 41 | created_at timestamp without time zone NOT NULL, 42 | updated_at timestamp without time zone NOT NULL 43 | ); 44 | 45 | 46 | ALTER TABLE public.e2e_users OWNER TO postgres; 47 | 48 | -- 49 | -- Name: schema_migration; Type: TABLE; Schema: public; Owner: postgres 50 | -- 51 | 52 | CREATE TABLE public.schema_migration ( 53 | version character varying(14) NOT NULL 54 | ); 55 | 56 | 57 | ALTER TABLE public.schema_migration OWNER TO postgres; 58 | 59 | -- 60 | -- Name: e2e_user_posts e2e_user_notes_pkey; Type: CONSTRAINT; Schema: public; Owner: postgres 61 | -- 62 | 63 | ALTER TABLE ONLY public.e2e_user_posts 64 | ADD CONSTRAINT e2e_user_notes_pkey PRIMARY KEY (id); 65 | 66 | 67 | -- 68 | -- Name: e2e_users e2e_users_pkey; Type: CONSTRAINT; Schema: public; Owner: postgres 69 | -- 70 | 71 | ALTER TABLE ONLY public.e2e_users 72 | ADD CONSTRAINT e2e_users_pkey PRIMARY KEY (id); 73 | 74 | 75 | -- 76 | -- Name: e2e_user_notes_slug_idx; Type: INDEX; Schema: public; Owner: postgres 77 | -- 78 | 79 | CREATE UNIQUE INDEX e2e_user_notes_slug_idx ON public.e2e_user_posts USING btree (slug); 80 | 81 | 82 | -- 83 | -- Name: e2e_user_notes_user_id_idx; Type: INDEX; Schema: public; Owner: postgres 84 | -- 85 | 86 | CREATE INDEX e2e_user_notes_user_id_idx ON public.e2e_user_posts USING btree (user_id); 87 | 88 | 89 | -- 90 | -- Name: schema_migration_version_idx; Type: INDEX; Schema: public; Owner: postgres 91 | -- 92 | 93 | CREATE UNIQUE INDEX schema_migration_version_idx ON public.schema_migration USING btree (version); 94 | 95 | 96 | -- 97 | -- Name: e2e_user_posts e2e_user_notes_user_id_fkey; Type: FK CONSTRAINT; Schema: public; Owner: postgres 98 | -- 99 | 100 | ALTER TABLE ONLY public.e2e_user_posts 101 | ADD CONSTRAINT e2e_user_notes_user_id_fkey FOREIGN KEY (user_id) REFERENCES public.e2e_users(id) ON DELETE CASCADE; 102 | 103 | 104 | -- 105 | -- PostgreSQL database dump complete 106 | -- 107 | 108 | -------------------------------------------------------------------------------- /testdata/e2e/fixtures/postgres/up/2.sql: -------------------------------------------------------------------------------- 1 | -- 2 | -- PostgreSQL database dump 3 | -- 4 | 5 | -- Dumped from database version 9.6.19 6 | -- Dumped by pg_dump version 12.4 7 | 8 | SET statement_timeout = 0; 9 | SET lock_timeout = 0; 10 | SET idle_in_transaction_session_timeout = 0; 11 | SET client_encoding = 'UTF8'; 12 | SET standard_conforming_strings = on; 13 | SELECT pg_catalog.set_config('search_path', '', false); 14 | SET check_function_bodies = false; 15 | SET xmloption = content; 16 | SET client_min_messages = warning; 17 | SET row_security = off; 18 | 19 | SET default_tablespace = ''; 20 | 21 | -- 22 | -- Name: e2e_user_notes; Type: TABLE; Schema: public; Owner: postgres 23 | -- 24 | 25 | CREATE TABLE public.e2e_user_notes ( 26 | id uuid NOT NULL, 27 | notes character varying(255), 28 | user_id uuid NOT NULL 29 | ); 30 | 31 | 32 | ALTER TABLE public.e2e_user_notes OWNER TO postgres; 33 | 34 | -- 35 | -- Name: e2e_users; Type: TABLE; Schema: public; Owner: postgres 36 | -- 37 | 38 | CREATE TABLE public.e2e_users ( 39 | id uuid NOT NULL, 40 | username character varying(255), 41 | created_at timestamp without time zone NOT NULL, 42 | updated_at timestamp without time zone NOT NULL 43 | ); 44 | 45 | 46 | ALTER TABLE public.e2e_users OWNER TO postgres; 47 | 48 | -- 49 | -- Name: schema_migration; Type: TABLE; Schema: public; Owner: postgres 50 | -- 51 | 52 | CREATE TABLE public.schema_migration ( 53 | version character varying(14) NOT NULL 54 | ); 55 | 56 | 57 | ALTER TABLE public.schema_migration OWNER TO postgres; 58 | 59 | -- 60 | -- Name: e2e_user_notes e2e_user_notes_pkey; Type: CONSTRAINT; Schema: public; Owner: postgres 61 | -- 62 | 63 | ALTER TABLE ONLY public.e2e_user_notes 64 | ADD CONSTRAINT e2e_user_notes_pkey PRIMARY KEY (id); 65 | 66 | 67 | -- 68 | -- Name: e2e_users e2e_users_pkey; Type: CONSTRAINT; Schema: public; Owner: postgres 69 | -- 70 | 71 | ALTER TABLE ONLY public.e2e_users 72 | ADD CONSTRAINT e2e_users_pkey PRIMARY KEY (id); 73 | 74 | 75 | -- 76 | -- Name: e2e_user_notes_user_id_idx; Type: INDEX; Schema: public; Owner: postgres 77 | -- 78 | 79 | CREATE INDEX e2e_user_notes_user_id_idx ON public.e2e_user_notes USING btree (user_id); 80 | 81 | 82 | -- 83 | -- Name: schema_migration_version_idx; Type: INDEX; Schema: public; Owner: postgres 84 | -- 85 | 86 | CREATE UNIQUE INDEX schema_migration_version_idx ON public.schema_migration USING btree (version); 87 | 88 | 89 | -- 90 | -- Name: e2e_user_notes e2e_user_notes_user_id_fkey; Type: FK CONSTRAINT; Schema: public; Owner: postgres 91 | -- 92 | 93 | ALTER TABLE ONLY public.e2e_user_notes 94 | ADD CONSTRAINT e2e_user_notes_user_id_fkey FOREIGN KEY (user_id) REFERENCES public.e2e_users(id) ON DELETE CASCADE; 95 | 96 | 97 | -- 98 | -- PostgreSQL database dump complete 99 | -- 100 | 101 | -------------------------------------------------------------------------------- /testdata/e2e/fixtures/postgres/up/3.sql: -------------------------------------------------------------------------------- 1 | -- 2 | -- PostgreSQL database dump 3 | -- 4 | 5 | -- Dumped from database version 9.6.19 6 | -- Dumped by pg_dump version 12.4 7 | 8 | SET statement_timeout = 0; 9 | SET lock_timeout = 0; 10 | SET idle_in_transaction_session_timeout = 0; 11 | SET client_encoding = 'UTF8'; 12 | SET standard_conforming_strings = on; 13 | SELECT pg_catalog.set_config('search_path', '', false); 14 | SET check_function_bodies = false; 15 | SET xmloption = content; 16 | SET client_min_messages = warning; 17 | SET row_security = off; 18 | 19 | SET default_tablespace = ''; 20 | 21 | -- 22 | -- Name: e2e_user_notes; Type: TABLE; Schema: public; Owner: postgres 23 | -- 24 | 25 | CREATE TABLE public.e2e_user_notes ( 26 | id uuid NOT NULL, 27 | notes character varying(255), 28 | user_id uuid NOT NULL, 29 | slug character varying(64) 30 | ); 31 | 32 | 33 | ALTER TABLE public.e2e_user_notes OWNER TO postgres; 34 | 35 | -- 36 | -- Name: e2e_users; Type: TABLE; Schema: public; Owner: postgres 37 | -- 38 | 39 | CREATE TABLE public.e2e_users ( 40 | id uuid NOT NULL, 41 | username character varying(255), 42 | created_at timestamp without time zone NOT NULL, 43 | updated_at timestamp without time zone NOT NULL 44 | ); 45 | 46 | 47 | ALTER TABLE public.e2e_users OWNER TO postgres; 48 | 49 | -- 50 | -- Name: schema_migration; Type: TABLE; Schema: public; Owner: postgres 51 | -- 52 | 53 | CREATE TABLE public.schema_migration ( 54 | version character varying(14) NOT NULL 55 | ); 56 | 57 | 58 | ALTER TABLE public.schema_migration OWNER TO postgres; 59 | 60 | -- 61 | -- Name: e2e_user_notes e2e_user_notes_pkey; Type: CONSTRAINT; Schema: public; Owner: postgres 62 | -- 63 | 64 | ALTER TABLE ONLY public.e2e_user_notes 65 | ADD CONSTRAINT e2e_user_notes_pkey PRIMARY KEY (id); 66 | 67 | 68 | -- 69 | -- Name: e2e_users e2e_users_pkey; Type: CONSTRAINT; Schema: public; Owner: postgres 70 | -- 71 | 72 | ALTER TABLE ONLY public.e2e_users 73 | ADD CONSTRAINT e2e_users_pkey PRIMARY KEY (id); 74 | 75 | 76 | -- 77 | -- Name: e2e_user_notes_user_id_idx; Type: INDEX; Schema: public; Owner: postgres 78 | -- 79 | 80 | CREATE INDEX e2e_user_notes_user_id_idx ON public.e2e_user_notes USING btree (user_id); 81 | 82 | 83 | -- 84 | -- Name: schema_migration_version_idx; Type: INDEX; Schema: public; Owner: postgres 85 | -- 86 | 87 | CREATE UNIQUE INDEX schema_migration_version_idx ON public.schema_migration USING btree (version); 88 | 89 | 90 | -- 91 | -- Name: e2e_user_notes e2e_user_notes_user_id_fkey; Type: FK CONSTRAINT; Schema: public; Owner: postgres 92 | -- 93 | 94 | ALTER TABLE ONLY public.e2e_user_notes 95 | ADD CONSTRAINT e2e_user_notes_user_id_fkey FOREIGN KEY (user_id) REFERENCES public.e2e_users(id) ON DELETE CASCADE; 96 | 97 | 98 | -- 99 | -- PostgreSQL database dump complete 100 | -- 101 | 102 | -------------------------------------------------------------------------------- /testdata/e2e/fixtures/postgres/up/4.sql: -------------------------------------------------------------------------------- 1 | -- 2 | -- PostgreSQL database dump 3 | -- 4 | 5 | -- Dumped from database version 9.6.19 6 | -- Dumped by pg_dump version 12.4 7 | 8 | SET statement_timeout = 0; 9 | SET lock_timeout = 0; 10 | SET idle_in_transaction_session_timeout = 0; 11 | SET client_encoding = 'UTF8'; 12 | SET standard_conforming_strings = on; 13 | SELECT pg_catalog.set_config('search_path', '', false); 14 | SET check_function_bodies = false; 15 | SET xmloption = content; 16 | SET client_min_messages = warning; 17 | SET row_security = off; 18 | 19 | SET default_tablespace = ''; 20 | 21 | -- 22 | -- Name: e2e_user_notes; Type: TABLE; Schema: public; Owner: postgres 23 | -- 24 | 25 | CREATE TABLE public.e2e_user_notes ( 26 | id uuid NOT NULL, 27 | notes character varying(255), 28 | user_id uuid NOT NULL, 29 | slug character varying(64) 30 | ); 31 | 32 | 33 | ALTER TABLE public.e2e_user_notes OWNER TO postgres; 34 | 35 | -- 36 | -- Name: e2e_users; Type: TABLE; Schema: public; Owner: postgres 37 | -- 38 | 39 | CREATE TABLE public.e2e_users ( 40 | id uuid NOT NULL, 41 | username character varying(255), 42 | created_at timestamp without time zone NOT NULL, 43 | updated_at timestamp without time zone NOT NULL 44 | ); 45 | 46 | 47 | ALTER TABLE public.e2e_users OWNER TO postgres; 48 | 49 | -- 50 | -- Name: schema_migration; Type: TABLE; Schema: public; Owner: postgres 51 | -- 52 | 53 | CREATE TABLE public.schema_migration ( 54 | version character varying(14) NOT NULL 55 | ); 56 | 57 | 58 | ALTER TABLE public.schema_migration OWNER TO postgres; 59 | 60 | -- 61 | -- Name: e2e_user_notes e2e_user_notes_pkey; Type: CONSTRAINT; Schema: public; Owner: postgres 62 | -- 63 | 64 | ALTER TABLE ONLY public.e2e_user_notes 65 | ADD CONSTRAINT e2e_user_notes_pkey PRIMARY KEY (id); 66 | 67 | 68 | -- 69 | -- Name: e2e_users e2e_users_pkey; Type: CONSTRAINT; Schema: public; Owner: postgres 70 | -- 71 | 72 | ALTER TABLE ONLY public.e2e_users 73 | ADD CONSTRAINT e2e_users_pkey PRIMARY KEY (id); 74 | 75 | 76 | -- 77 | -- Name: e2e_user_notes_user_id_idx; Type: INDEX; Schema: public; Owner: postgres 78 | -- 79 | 80 | CREATE INDEX e2e_user_notes_user_id_idx ON public.e2e_user_notes USING btree (user_id); 81 | 82 | 83 | -- 84 | -- Name: schema_migration_version_idx; Type: INDEX; Schema: public; Owner: postgres 85 | -- 86 | 87 | CREATE UNIQUE INDEX schema_migration_version_idx ON public.schema_migration USING btree (version); 88 | 89 | 90 | -- 91 | -- Name: e2e_user_notes e2e_user_notes_user_id_fkey; Type: FK CONSTRAINT; Schema: public; Owner: postgres 92 | -- 93 | 94 | ALTER TABLE ONLY public.e2e_user_notes 95 | ADD CONSTRAINT e2e_user_notes_user_id_fkey FOREIGN KEY (user_id) REFERENCES public.e2e_users(id) ON DELETE CASCADE; 96 | 97 | 98 | -- 99 | -- PostgreSQL database dump complete 100 | -- 101 | 102 | -------------------------------------------------------------------------------- /testdata/e2e/fixtures/postgres/up/5.sql: -------------------------------------------------------------------------------- 1 | -- 2 | -- PostgreSQL database dump 3 | -- 4 | 5 | -- Dumped from database version 9.6.19 6 | -- Dumped by pg_dump version 12.4 7 | 8 | SET statement_timeout = 0; 9 | SET lock_timeout = 0; 10 | SET idle_in_transaction_session_timeout = 0; 11 | SET client_encoding = 'UTF8'; 12 | SET standard_conforming_strings = on; 13 | SELECT pg_catalog.set_config('search_path', '', false); 14 | SET check_function_bodies = false; 15 | SET xmloption = content; 16 | SET client_min_messages = warning; 17 | SET row_security = off; 18 | 19 | SET default_tablespace = ''; 20 | 21 | -- 22 | -- Name: e2e_user_notes; Type: TABLE; Schema: public; Owner: postgres 23 | -- 24 | 25 | CREATE TABLE public.e2e_user_notes ( 26 | id uuid NOT NULL, 27 | notes character varying(255), 28 | user_id uuid NOT NULL, 29 | slug character varying(64) NOT NULL 30 | ); 31 | 32 | 33 | ALTER TABLE public.e2e_user_notes OWNER TO postgres; 34 | 35 | -- 36 | -- Name: e2e_users; Type: TABLE; Schema: public; Owner: postgres 37 | -- 38 | 39 | CREATE TABLE public.e2e_users ( 40 | id uuid NOT NULL, 41 | username character varying(255), 42 | created_at timestamp without time zone NOT NULL, 43 | updated_at timestamp without time zone NOT NULL 44 | ); 45 | 46 | 47 | ALTER TABLE public.e2e_users OWNER TO postgres; 48 | 49 | -- 50 | -- Name: schema_migration; Type: TABLE; Schema: public; Owner: postgres 51 | -- 52 | 53 | CREATE TABLE public.schema_migration ( 54 | version character varying(14) NOT NULL 55 | ); 56 | 57 | 58 | ALTER TABLE public.schema_migration OWNER TO postgres; 59 | 60 | -- 61 | -- Name: e2e_user_notes e2e_user_notes_pkey; Type: CONSTRAINT; Schema: public; Owner: postgres 62 | -- 63 | 64 | ALTER TABLE ONLY public.e2e_user_notes 65 | ADD CONSTRAINT e2e_user_notes_pkey PRIMARY KEY (id); 66 | 67 | 68 | -- 69 | -- Name: e2e_users e2e_users_pkey; Type: CONSTRAINT; Schema: public; Owner: postgres 70 | -- 71 | 72 | ALTER TABLE ONLY public.e2e_users 73 | ADD CONSTRAINT e2e_users_pkey PRIMARY KEY (id); 74 | 75 | 76 | -- 77 | -- Name: e2e_user_notes_slug_idx; Type: INDEX; Schema: public; Owner: postgres 78 | -- 79 | 80 | CREATE UNIQUE INDEX e2e_user_notes_slug_idx ON public.e2e_user_notes USING btree (slug); 81 | 82 | 83 | -- 84 | -- Name: e2e_user_notes_user_id_idx; Type: INDEX; Schema: public; Owner: postgres 85 | -- 86 | 87 | CREATE INDEX e2e_user_notes_user_id_idx ON public.e2e_user_notes USING btree (user_id); 88 | 89 | 90 | -- 91 | -- Name: schema_migration_version_idx; Type: INDEX; Schema: public; Owner: postgres 92 | -- 93 | 94 | CREATE UNIQUE INDEX schema_migration_version_idx ON public.schema_migration USING btree (version); 95 | 96 | 97 | -- 98 | -- Name: e2e_user_notes e2e_user_notes_user_id_fkey; Type: FK CONSTRAINT; Schema: public; Owner: postgres 99 | -- 100 | 101 | ALTER TABLE ONLY public.e2e_user_notes 102 | ADD CONSTRAINT e2e_user_notes_user_id_fkey FOREIGN KEY (user_id) REFERENCES public.e2e_users(id) ON DELETE CASCADE; 103 | 104 | 105 | -- 106 | -- PostgreSQL database dump complete 107 | -- 108 | 109 | -------------------------------------------------------------------------------- /testdata/e2e/fixtures/postgres/up/6.sql: -------------------------------------------------------------------------------- 1 | -- 2 | -- PostgreSQL database dump 3 | -- 4 | 5 | -- Dumped from database version 9.6.19 6 | -- Dumped by pg_dump version 12.4 7 | 8 | SET statement_timeout = 0; 9 | SET lock_timeout = 0; 10 | SET idle_in_transaction_session_timeout = 0; 11 | SET client_encoding = 'UTF8'; 12 | SET standard_conforming_strings = on; 13 | SELECT pg_catalog.set_config('search_path', '', false); 14 | SET check_function_bodies = false; 15 | SET xmloption = content; 16 | SET client_min_messages = warning; 17 | SET row_security = off; 18 | 19 | SET default_tablespace = ''; 20 | 21 | -- 22 | -- Name: e2e_user_posts; Type: TABLE; Schema: public; Owner: postgres 23 | -- 24 | 25 | CREATE TABLE public.e2e_user_posts ( 26 | id uuid NOT NULL, 27 | notes character varying(255), 28 | user_id uuid NOT NULL, 29 | slug character varying(64) NOT NULL 30 | ); 31 | 32 | 33 | ALTER TABLE public.e2e_user_posts OWNER TO postgres; 34 | 35 | -- 36 | -- Name: e2e_users; Type: TABLE; Schema: public; Owner: postgres 37 | -- 38 | 39 | CREATE TABLE public.e2e_users ( 40 | id uuid NOT NULL, 41 | username character varying(255), 42 | created_at timestamp without time zone NOT NULL, 43 | updated_at timestamp without time zone NOT NULL 44 | ); 45 | 46 | 47 | ALTER TABLE public.e2e_users OWNER TO postgres; 48 | 49 | -- 50 | -- Name: schema_migration; Type: TABLE; Schema: public; Owner: postgres 51 | -- 52 | 53 | CREATE TABLE public.schema_migration ( 54 | version character varying(14) NOT NULL 55 | ); 56 | 57 | 58 | ALTER TABLE public.schema_migration OWNER TO postgres; 59 | 60 | -- 61 | -- Name: e2e_user_posts e2e_user_notes_pkey; Type: CONSTRAINT; Schema: public; Owner: postgres 62 | -- 63 | 64 | ALTER TABLE ONLY public.e2e_user_posts 65 | ADD CONSTRAINT e2e_user_notes_pkey PRIMARY KEY (id); 66 | 67 | 68 | -- 69 | -- Name: e2e_users e2e_users_pkey; Type: CONSTRAINT; Schema: public; Owner: postgres 70 | -- 71 | 72 | ALTER TABLE ONLY public.e2e_users 73 | ADD CONSTRAINT e2e_users_pkey PRIMARY KEY (id); 74 | 75 | 76 | -- 77 | -- Name: e2e_user_notes_slug_idx; Type: INDEX; Schema: public; Owner: postgres 78 | -- 79 | 80 | CREATE UNIQUE INDEX e2e_user_notes_slug_idx ON public.e2e_user_posts USING btree (slug); 81 | 82 | 83 | -- 84 | -- Name: e2e_user_notes_user_id_idx; Type: INDEX; Schema: public; Owner: postgres 85 | -- 86 | 87 | CREATE INDEX e2e_user_notes_user_id_idx ON public.e2e_user_posts USING btree (user_id); 88 | 89 | 90 | -- 91 | -- Name: schema_migration_version_idx; Type: INDEX; Schema: public; Owner: postgres 92 | -- 93 | 94 | CREATE UNIQUE INDEX schema_migration_version_idx ON public.schema_migration USING btree (version); 95 | 96 | 97 | -- 98 | -- Name: e2e_user_posts e2e_user_notes_user_id_fkey; Type: FK CONSTRAINT; Schema: public; Owner: postgres 99 | -- 100 | 101 | ALTER TABLE ONLY public.e2e_user_posts 102 | ADD CONSTRAINT e2e_user_notes_user_id_fkey FOREIGN KEY (user_id) REFERENCES public.e2e_users(id) ON DELETE CASCADE; 103 | 104 | 105 | -- 106 | -- PostgreSQL database dump complete 107 | -- 108 | 109 | -------------------------------------------------------------------------------- /testdata/e2e/fixtures/postgres/up/9.sql: -------------------------------------------------------------------------------- 1 | -- 2 | -- PostgreSQL database dump 3 | -- 4 | 5 | -- Dumped from database version 9.6.19 6 | -- Dumped by pg_dump version 12.4 7 | 8 | SET statement_timeout = 0; 9 | SET lock_timeout = 0; 10 | SET idle_in_transaction_session_timeout = 0; 11 | SET client_encoding = 'UTF8'; 12 | SET standard_conforming_strings = on; 13 | SELECT pg_catalog.set_config('search_path', '', false); 14 | SET check_function_bodies = false; 15 | SET xmloption = content; 16 | SET client_min_messages = warning; 17 | SET row_security = off; 18 | 19 | SET default_tablespace = ''; 20 | 21 | -- 22 | -- Name: e2e_user_posts; Type: TABLE; Schema: public; Owner: postgres 23 | -- 24 | 25 | CREATE TABLE public.e2e_user_posts ( 26 | id uuid NOT NULL, 27 | user_id uuid NOT NULL, 28 | slug character varying(64) NOT NULL, 29 | content character varying(255) DEFAULT ''::character varying NOT NULL 30 | ); 31 | 32 | 33 | ALTER TABLE public.e2e_user_posts OWNER TO postgres; 34 | 35 | -- 36 | -- Name: e2e_users; Type: TABLE; Schema: public; Owner: postgres 37 | -- 38 | 39 | CREATE TABLE public.e2e_users ( 40 | id uuid NOT NULL, 41 | created_at timestamp without time zone NOT NULL, 42 | updated_at timestamp without time zone NOT NULL 43 | ); 44 | 45 | 46 | ALTER TABLE public.e2e_users OWNER TO postgres; 47 | 48 | -- 49 | -- Name: schema_migration; Type: TABLE; Schema: public; Owner: postgres 50 | -- 51 | 52 | CREATE TABLE public.schema_migration ( 53 | version character varying(14) NOT NULL 54 | ); 55 | 56 | 57 | ALTER TABLE public.schema_migration OWNER TO postgres; 58 | 59 | -- 60 | -- Name: e2e_user_posts e2e_user_notes_pkey; Type: CONSTRAINT; Schema: public; Owner: postgres 61 | -- 62 | 63 | ALTER TABLE ONLY public.e2e_user_posts 64 | ADD CONSTRAINT e2e_user_notes_pkey PRIMARY KEY (id); 65 | 66 | 67 | -- 68 | -- Name: e2e_users e2e_users_pkey; Type: CONSTRAINT; Schema: public; Owner: postgres 69 | -- 70 | 71 | ALTER TABLE ONLY public.e2e_users 72 | ADD CONSTRAINT e2e_users_pkey PRIMARY KEY (id); 73 | 74 | 75 | -- 76 | -- Name: e2e_user_notes_slug_idx; Type: INDEX; Schema: public; Owner: postgres 77 | -- 78 | 79 | CREATE UNIQUE INDEX e2e_user_notes_slug_idx ON public.e2e_user_posts USING btree (slug); 80 | 81 | 82 | -- 83 | -- Name: e2e_user_notes_user_id_idx; Type: INDEX; Schema: public; Owner: postgres 84 | -- 85 | 86 | CREATE INDEX e2e_user_notes_user_id_idx ON public.e2e_user_posts USING btree (user_id); 87 | 88 | 89 | -- 90 | -- Name: schema_migration_version_idx; Type: INDEX; Schema: public; Owner: postgres 91 | -- 92 | 93 | CREATE UNIQUE INDEX schema_migration_version_idx ON public.schema_migration USING btree (version); 94 | 95 | 96 | -- 97 | -- Name: e2e_user_posts e2e_user_notes_user_id_fkey; Type: FK CONSTRAINT; Schema: public; Owner: postgres 98 | -- 99 | 100 | ALTER TABLE ONLY public.e2e_user_posts 101 | ADD CONSTRAINT e2e_user_notes_user_id_fkey FOREIGN KEY (user_id) REFERENCES public.e2e_users(id) ON DELETE CASCADE; 102 | 103 | 104 | -- 105 | -- PostgreSQL database dump complete 106 | -- 107 | 108 | -------------------------------------------------------------------------------- /testdata/e2e/fixtures/sqlite3/down/0.sql: -------------------------------------------------------------------------------- 1 | CREATE TABLE IF NOT EXISTS "schema_migration" ( 2 | "version" TEXT NOT NULL 3 | ); 4 | CREATE UNIQUE INDEX "schema_migration_version_idx" ON "schema_migration" (version); 5 | -------------------------------------------------------------------------------- /testdata/e2e/fixtures/sqlite3/down/1.sql: -------------------------------------------------------------------------------- 1 | CREATE TABLE IF NOT EXISTS "schema_migration" ( 2 | "version" TEXT NOT NULL 3 | ); 4 | CREATE UNIQUE INDEX "schema_migration_version_idx" ON "schema_migration" (version); 5 | CREATE TABLE IF NOT EXISTS "e2e_users" ( 6 | "id" TEXT PRIMARY KEY, 7 | "created_at" DATETIME NOT NULL, 8 | "updated_at" DATETIME NOT NULL 9 | , "username" TEXT); 10 | -------------------------------------------------------------------------------- /testdata/e2e/fixtures/sqlite3/down/10.sql: -------------------------------------------------------------------------------- 1 | CREATE TABLE IF NOT EXISTS "schema_migration" ( 2 | "version" TEXT NOT NULL 3 | ); 4 | CREATE UNIQUE INDEX "schema_migration_version_idx" ON "schema_migration" (version); 5 | CREATE TABLE IF NOT EXISTS "e2e_users" ( 6 | "id" TEXT PRIMARY KEY, 7 | "created_at" DATETIME NOT NULL, 8 | "updated_at" DATETIME NOT NULL 9 | ); 10 | CREATE TABLE IF NOT EXISTS "e2e_user_posts" ( 11 | "id" TEXT PRIMARY KEY, 12 | "user_id" char(36) NOT NULL, 13 | "slug" TEXT NOT NULL, 14 | "content" TEXT NOT NULL DEFAULT '', 15 | FOREIGN KEY (user_id) REFERENCES e2e_users (id) ON UPDATE NO ACTION ON DELETE CASCADE 16 | ); 17 | CREATE UNIQUE INDEX "e2e_user_notes_slug_idx" ON "e2e_user_posts" (slug); 18 | CREATE INDEX "e2e_user_notes_user_id_idx" ON "e2e_user_posts" (user_id); 19 | -------------------------------------------------------------------------------- /testdata/e2e/fixtures/sqlite3/down/11.sql: -------------------------------------------------------------------------------- 1 | CREATE TABLE IF NOT EXISTS "schema_migration" ( 2 | "version" TEXT NOT NULL 3 | ); 4 | CREATE UNIQUE INDEX "schema_migration_version_idx" ON "schema_migration" (version); 5 | CREATE TABLE IF NOT EXISTS "e2e_users" ( 6 | "id" TEXT PRIMARY KEY, 7 | "created_at" DATETIME NOT NULL, 8 | "updated_at" DATETIME NOT NULL 9 | ); 10 | CREATE TABLE IF NOT EXISTS "e2e_user_posts" ( 11 | "id" TEXT PRIMARY KEY, 12 | "user_id" char(36) NOT NULL, 13 | "slug" TEXT NOT NULL, 14 | "content" TEXT NOT NULL DEFAULT '', 15 | FOREIGN KEY ("user_id") REFERENCES "e2e_users" (id) ON UPDATE NO ACTION ON DELETE CASCADE 16 | ); 17 | CREATE INDEX "e2e_user_notes_user_id_idx" ON "e2e_user_posts" ("user_id"); 18 | CREATE UNIQUE INDEX "e2e_user_notes_slug_idx" ON "e2e_user_posts" (slug); 19 | -------------------------------------------------------------------------------- /testdata/e2e/fixtures/sqlite3/down/12.sql: -------------------------------------------------------------------------------- 1 | CREATE TABLE IF NOT EXISTS "schema_migration" ( 2 | "version" TEXT NOT NULL 3 | ); 4 | CREATE UNIQUE INDEX "schema_migration_version_idx" ON "schema_migration" (version); 5 | CREATE TABLE IF NOT EXISTS "e2e_authors" ( 6 | "id" TEXT PRIMARY KEY, 7 | "created_at" DATETIME NOT NULL, 8 | "updated_at" DATETIME NOT NULL 9 | ); 10 | CREATE TABLE IF NOT EXISTS "e2e_user_posts" ( 11 | "id" TEXT PRIMARY KEY, 12 | "user_id" char(36) NOT NULL, 13 | "slug" TEXT NOT NULL, 14 | "content" TEXT NOT NULL DEFAULT '', 15 | FOREIGN KEY ("user_id") REFERENCES e2e_authors (id) ON UPDATE NO ACTION ON DELETE CASCADE 16 | ); 17 | CREATE INDEX "e2e_user_notes_user_id_idx" ON "e2e_user_posts" ("user_id"); 18 | CREATE UNIQUE INDEX "e2e_user_notes_slug_idx" ON "e2e_user_posts" (slug); 19 | -------------------------------------------------------------------------------- /testdata/e2e/fixtures/sqlite3/down/13.sql: -------------------------------------------------------------------------------- 1 | CREATE TABLE IF NOT EXISTS "schema_migration" ( 2 | "version" TEXT NOT NULL 3 | ); 4 | CREATE UNIQUE INDEX "schema_migration_version_idx" ON "schema_migration" (version); 5 | CREATE TABLE IF NOT EXISTS "e2e_authors" ( 6 | "id" TEXT PRIMARY KEY, 7 | "created_at" DATETIME NOT NULL, 8 | "updated_at" DATETIME NOT NULL 9 | ); 10 | CREATE TABLE IF NOT EXISTS "e2e_user_posts" ( 11 | "id" TEXT PRIMARY KEY, 12 | "author_id" char(36) NOT NULL, 13 | "slug" TEXT NOT NULL, 14 | "content" TEXT NOT NULL DEFAULT '', 15 | FOREIGN KEY (author_id) REFERENCES e2e_authors (id) ON UPDATE NO ACTION ON DELETE CASCADE 16 | ); 17 | CREATE INDEX "e2e_user_notes_user_id_idx" ON "e2e_user_posts" (author_id); 18 | CREATE UNIQUE INDEX "e2e_user_notes_slug_idx" ON "e2e_user_posts" (slug); 19 | -------------------------------------------------------------------------------- /testdata/e2e/fixtures/sqlite3/down/14.sql: -------------------------------------------------------------------------------- 1 | CREATE TABLE IF NOT EXISTS "schema_migration" ( 2 | "version" TEXT NOT NULL 3 | ); 4 | CREATE UNIQUE INDEX "schema_migration_version_idx" ON "schema_migration" (version); 5 | CREATE TABLE IF NOT EXISTS "e2e_authors" ( 6 | "id" TEXT PRIMARY KEY, 7 | "created_at" DATETIME NOT NULL, 8 | "updated_at" DATETIME NOT NULL 9 | ); 10 | CREATE TABLE IF NOT EXISTS "e2e_user_posts" ( 11 | "id" TEXT PRIMARY KEY, 12 | "author_id" char(36), 13 | "slug" TEXT NOT NULL, 14 | "content" TEXT NOT NULL DEFAULT '', 15 | "published" bool NOT NULL DEFAULT FALSE, 16 | FOREIGN KEY (author_id) REFERENCES e2e_authors (id) ON UPDATE NO ACTION ON DELETE CASCADE 17 | ); 18 | CREATE UNIQUE INDEX "e2e_user_notes_slug_idx" ON "e2e_user_posts" (slug); 19 | CREATE INDEX "e2e_user_notes_user_id_idx" ON "e2e_user_posts" (author_id); 20 | -------------------------------------------------------------------------------- /testdata/e2e/fixtures/sqlite3/down/15.sql: -------------------------------------------------------------------------------- 1 | CREATE TABLE IF NOT EXISTS "schema_migration" ( 2 | "version" TEXT NOT NULL 3 | ); 4 | CREATE UNIQUE INDEX "schema_migration_version_idx" ON "schema_migration" (version); 5 | CREATE TABLE IF NOT EXISTS "e2e_authors" ( 6 | "id" TEXT PRIMARY KEY, 7 | "created_at" DATETIME NOT NULL, 8 | "updated_at" DATETIME NOT NULL 9 | ); 10 | CREATE TABLE IF NOT EXISTS "e2e_user_posts" ( 11 | "id" TEXT PRIMARY KEY, 12 | "author_id" char(36), 13 | "slug" TEXT NOT NULL, 14 | "content" TEXT NOT NULL DEFAULT '', 15 | "published" bool NOT NULL DEFAULT FALSE, 16 | FOREIGN KEY (author_id) REFERENCES e2e_authors (id) ON UPDATE NO ACTION ON DELETE CASCADE 17 | ); 18 | CREATE UNIQUE INDEX "e2e_user_notes_slug_idx" ON "e2e_user_posts" (slug); 19 | CREATE INDEX "e2e_user_notes_user_id_idx" ON "e2e_user_posts" (author_id); 20 | CREATE TABLE IF NOT EXISTS "e2e_flow" ( 21 | "id" TEXT PRIMARY KEY 22 | ); 23 | CREATE TABLE IF NOT EXISTS "e2e_address" ( 24 | "id" TEXT PRIMARY KEY 25 | ); 26 | CREATE TABLE IF NOT EXISTS "e2e_token" ( 27 | "id" TEXT PRIMARY KEY, 28 | "token" TEXT NOT NULL, 29 | "e2e_flow_id" char(36) NOT NULL, 30 | "e2e_address_id" char(36) NOT NULL, 31 | "expires_at" DATETIME NOT NULL DEFAULT '2000-01-01 00:00:00', 32 | "issued_at" DATETIME NOT NULL DEFAULT '2000-01-01 00:00:00', 33 | FOREIGN KEY (e2e_flow_id) REFERENCES e2e_flow (id) ON UPDATE NO ACTION ON DELETE CASCADE, 34 | FOREIGN KEY (e2e_address_id) REFERENCES e2e_address (id) ON UPDATE NO ACTION ON DELETE CASCADE 35 | ); 36 | CREATE UNIQUE INDEX "e2e_token_uq_idx" ON "e2e_token" (token); 37 | CREATE INDEX "e2e_token_idx" ON "e2e_token" (token); 38 | -------------------------------------------------------------------------------- /testdata/e2e/fixtures/sqlite3/down/2.sql: -------------------------------------------------------------------------------- 1 | CREATE TABLE IF NOT EXISTS "schema_migration" ( 2 | "version" TEXT NOT NULL 3 | ); 4 | CREATE UNIQUE INDEX "schema_migration_version_idx" ON "schema_migration" (version); 5 | CREATE TABLE IF NOT EXISTS "e2e_users" ( 6 | "id" TEXT PRIMARY KEY, 7 | "created_at" DATETIME NOT NULL, 8 | "updated_at" DATETIME NOT NULL 9 | , "username" TEXT); 10 | CREATE TABLE IF NOT EXISTS "e2e_user_notes" ( 11 | "id" TEXT PRIMARY KEY, 12 | "user_id" char(36) NOT NULL, 13 | "notes" TEXT, "title" TEXT NOT NULL DEFAULT '', 14 | FOREIGN KEY (user_id) REFERENCES e2e_users (id) ON UPDATE NO ACTION ON DELETE CASCADE 15 | ); 16 | CREATE INDEX "e2e_user_notes_user_id_idx" ON "e2e_user_notes" (user_id); 17 | CREATE INDEX "e2e_user_notes_title_idx" ON "e2e_user_notes" (title); 18 | -------------------------------------------------------------------------------- /testdata/e2e/fixtures/sqlite3/down/3.sql: -------------------------------------------------------------------------------- 1 | CREATE TABLE IF NOT EXISTS "schema_migration" ( 2 | "version" TEXT NOT NULL 3 | ); 4 | CREATE UNIQUE INDEX "schema_migration_version_idx" ON "schema_migration" (version); 5 | CREATE TABLE IF NOT EXISTS "e2e_users" ( 6 | "id" TEXT PRIMARY KEY, 7 | "created_at" DATETIME NOT NULL, 8 | "updated_at" DATETIME NOT NULL 9 | , "username" TEXT); 10 | CREATE TABLE IF NOT EXISTS "e2e_user_notes" ( 11 | "id" TEXT PRIMARY KEY, 12 | "user_id" char(36) NOT NULL, 13 | "notes" TEXT, 14 | FOREIGN KEY (user_id) REFERENCES e2e_users (id) ON UPDATE NO ACTION ON DELETE CASCADE 15 | ); 16 | CREATE INDEX "e2e_user_notes_user_id_idx" ON "e2e_user_notes" (user_id); 17 | -------------------------------------------------------------------------------- /testdata/e2e/fixtures/sqlite3/down/4.sql: -------------------------------------------------------------------------------- 1 | CREATE TABLE IF NOT EXISTS "schema_migration" ( 2 | "version" TEXT NOT NULL 3 | ); 4 | CREATE UNIQUE INDEX "schema_migration_version_idx" ON "schema_migration" (version); 5 | CREATE TABLE IF NOT EXISTS "e2e_users" ( 6 | "id" TEXT PRIMARY KEY, 7 | "created_at" DATETIME NOT NULL, 8 | "updated_at" DATETIME NOT NULL 9 | , "username" TEXT); 10 | CREATE TABLE IF NOT EXISTS "e2e_user_notes" ( 11 | "id" TEXT PRIMARY KEY, 12 | "user_id" char(36) NOT NULL, 13 | "slug" TEXT NOT NULL, "notes" TEXT, 14 | FOREIGN KEY (user_id) REFERENCES e2e_users (id) ON UPDATE NO ACTION ON DELETE CASCADE 15 | ); 16 | CREATE INDEX "e2e_user_notes_user_id_idx" ON "e2e_user_notes" (user_id); 17 | CREATE UNIQUE INDEX "e2e_user_notes_slug_idx" ON "e2e_user_notes" (slug); 18 | -------------------------------------------------------------------------------- /testdata/e2e/fixtures/sqlite3/down/5.sql: -------------------------------------------------------------------------------- 1 | CREATE TABLE IF NOT EXISTS "schema_migration" ( 2 | "version" TEXT NOT NULL 3 | ); 4 | CREATE UNIQUE INDEX "schema_migration_version_idx" ON "schema_migration" (version); 5 | CREATE TABLE IF NOT EXISTS "e2e_users" ( 6 | "id" TEXT PRIMARY KEY, 7 | "created_at" DATETIME NOT NULL, 8 | "updated_at" DATETIME NOT NULL 9 | , "username" TEXT); 10 | CREATE TABLE IF NOT EXISTS "e2e_user_notes" ( 11 | "id" TEXT PRIMARY KEY, 12 | "user_id" char(36) NOT NULL, 13 | "slug" TEXT NOT NULL, "notes" TEXT, 14 | FOREIGN KEY (user_id) REFERENCES e2e_users (id) ON UPDATE NO ACTION ON DELETE CASCADE 15 | ); 16 | CREATE INDEX "e2e_user_notes_user_id_idx" ON "e2e_user_notes" (user_id); 17 | CREATE UNIQUE INDEX "e2e_user_notes_slug_idx" ON "e2e_user_notes" (slug); 18 | -------------------------------------------------------------------------------- /testdata/e2e/fixtures/sqlite3/down/6.sql: -------------------------------------------------------------------------------- 1 | CREATE TABLE IF NOT EXISTS "schema_migration" ( 2 | "version" TEXT NOT NULL 3 | ); 4 | CREATE UNIQUE INDEX "schema_migration_version_idx" ON "schema_migration" (version); 5 | CREATE TABLE IF NOT EXISTS "e2e_users" ( 6 | "id" TEXT PRIMARY KEY, 7 | "created_at" DATETIME NOT NULL, 8 | "updated_at" DATETIME NOT NULL 9 | , "username" TEXT); 10 | CREATE TABLE IF NOT EXISTS "e2e_user_notes" ( 11 | "id" TEXT PRIMARY KEY, 12 | "user_id" char(36) NOT NULL, 13 | "slug" TEXT NOT NULL, "notes" TEXT, 14 | FOREIGN KEY (user_id) REFERENCES e2e_users (id) ON UPDATE NO ACTION ON DELETE CASCADE 15 | ); 16 | CREATE INDEX "e2e_user_notes_user_id_idx" ON "e2e_user_notes" (user_id); 17 | CREATE UNIQUE INDEX "e2e_user_notes_slug_idx" ON "e2e_user_notes" (slug); 18 | -------------------------------------------------------------------------------- /testdata/e2e/fixtures/sqlite3/down/7.sql: -------------------------------------------------------------------------------- 1 | CREATE TABLE IF NOT EXISTS "schema_migration" ( 2 | "version" TEXT NOT NULL 3 | ); 4 | CREATE UNIQUE INDEX "schema_migration_version_idx" ON "schema_migration" (version); 5 | CREATE TABLE IF NOT EXISTS "e2e_users" ( 6 | "id" TEXT PRIMARY KEY, 7 | "created_at" DATETIME NOT NULL, 8 | "updated_at" DATETIME NOT NULL 9 | , "username" TEXT); 10 | CREATE TABLE IF NOT EXISTS "e2e_user_posts" ( 11 | "id" TEXT PRIMARY KEY, 12 | "user_id" char(36) NOT NULL, 13 | "slug" TEXT NOT NULL, "notes" TEXT, 14 | FOREIGN KEY (user_id) REFERENCES e2e_users (id) ON UPDATE NO ACTION ON DELETE CASCADE 15 | ); 16 | CREATE INDEX "e2e_user_notes_user_id_idx" ON "e2e_user_posts" (user_id); 17 | CREATE UNIQUE INDEX "e2e_user_notes_slug_idx" ON "e2e_user_posts" (slug); 18 | -------------------------------------------------------------------------------- /testdata/e2e/fixtures/sqlite3/down/8.sql: -------------------------------------------------------------------------------- 1 | CREATE TABLE IF NOT EXISTS "schema_migration" ( 2 | "version" TEXT NOT NULL 3 | ); 4 | CREATE UNIQUE INDEX "schema_migration_version_idx" ON "schema_migration" (version); 5 | CREATE TABLE IF NOT EXISTS "e2e_users" ( 6 | "id" TEXT PRIMARY KEY, 7 | "created_at" DATETIME NOT NULL, 8 | "updated_at" DATETIME NOT NULL 9 | , "username" TEXT); 10 | CREATE TABLE IF NOT EXISTS "e2e_user_posts" ( 11 | "id" TEXT PRIMARY KEY, 12 | "user_id" char(36) NOT NULL, 13 | "slug" TEXT NOT NULL, 14 | "content" TEXT NOT NULL DEFAULT '', 15 | FOREIGN KEY (user_id) REFERENCES e2e_users (id) ON UPDATE NO ACTION ON DELETE CASCADE 16 | ); 17 | CREATE UNIQUE INDEX "e2e_user_notes_slug_idx" ON "e2e_user_posts" (slug); 18 | CREATE INDEX "e2e_user_notes_user_id_idx" ON "e2e_user_posts" (user_id); 19 | -------------------------------------------------------------------------------- /testdata/e2e/fixtures/sqlite3/down/9.sql: -------------------------------------------------------------------------------- 1 | CREATE TABLE IF NOT EXISTS "schema_migration" ( 2 | "version" TEXT NOT NULL 3 | ); 4 | CREATE UNIQUE INDEX "schema_migration_version_idx" ON "schema_migration" (version); 5 | CREATE TABLE IF NOT EXISTS "e2e_users" ( 6 | "id" TEXT PRIMARY KEY, 7 | "created_at" DATETIME NOT NULL, 8 | "updated_at" DATETIME NOT NULL 9 | , "name" TEXT); 10 | CREATE TABLE IF NOT EXISTS "e2e_user_posts" ( 11 | "id" TEXT PRIMARY KEY, 12 | "user_id" char(36) NOT NULL, 13 | "slug" TEXT NOT NULL, 14 | "content" TEXT NOT NULL DEFAULT '', 15 | FOREIGN KEY (user_id) REFERENCES e2e_users (id) ON UPDATE NO ACTION ON DELETE CASCADE 16 | ); 17 | CREATE UNIQUE INDEX "e2e_user_notes_slug_idx" ON "e2e_user_posts" (slug); 18 | CREATE INDEX "e2e_user_notes_user_id_idx" ON "e2e_user_posts" (user_id); 19 | -------------------------------------------------------------------------------- /testdata/e2e/fixtures/sqlite3/up/0.sql: -------------------------------------------------------------------------------- 1 | CREATE TABLE IF NOT EXISTS "schema_migration" ( 2 | "version" TEXT NOT NULL 3 | ); 4 | CREATE UNIQUE INDEX "schema_migration_version_idx" ON "schema_migration" (version); 5 | CREATE TABLE IF NOT EXISTS "e2e_users" ( 6 | "id" TEXT PRIMARY KEY, 7 | "username" TEXT, 8 | "created_at" DATETIME NOT NULL, 9 | "updated_at" DATETIME NOT NULL 10 | ); 11 | -------------------------------------------------------------------------------- /testdata/e2e/fixtures/sqlite3/up/1.sql: -------------------------------------------------------------------------------- 1 | CREATE TABLE IF NOT EXISTS "schema_migration" ( 2 | "version" TEXT NOT NULL 3 | ); 4 | CREATE UNIQUE INDEX "schema_migration_version_idx" ON "schema_migration" (version); 5 | CREATE TABLE IF NOT EXISTS "e2e_users" ( 6 | "id" TEXT PRIMARY KEY, 7 | "username" TEXT, 8 | "created_at" DATETIME NOT NULL, 9 | "updated_at" DATETIME NOT NULL 10 | ); 11 | CREATE TABLE IF NOT EXISTS "e2e_user_notes" ( 12 | "id" TEXT PRIMARY KEY, 13 | "notes" TEXT, 14 | "title" TEXT NOT NULL DEFAULT '', 15 | "user_id" char(36) NOT NULL, 16 | FOREIGN KEY (user_id) REFERENCES e2e_users (id) ON DELETE cascade 17 | ); 18 | CREATE INDEX "e2e_user_notes_user_id_idx" ON "e2e_user_notes" (user_id); 19 | CREATE INDEX "e2e_user_notes_title_idx" ON "e2e_user_notes" (title); 20 | -------------------------------------------------------------------------------- /testdata/e2e/fixtures/sqlite3/up/10.sql: -------------------------------------------------------------------------------- 1 | CREATE TABLE IF NOT EXISTS "schema_migration" ( 2 | "version" TEXT NOT NULL 3 | ); 4 | CREATE UNIQUE INDEX "schema_migration_version_idx" ON "schema_migration" (version); 5 | CREATE TABLE IF NOT EXISTS "e2e_users" ( 6 | "id" TEXT PRIMARY KEY, 7 | "created_at" DATETIME NOT NULL, 8 | "updated_at" DATETIME NOT NULL 9 | ); 10 | CREATE TABLE IF NOT EXISTS "e2e_user_posts" ( 11 | "id" TEXT PRIMARY KEY, 12 | "user_id" char(36) NOT NULL, 13 | "slug" TEXT NOT NULL, 14 | "content" TEXT NOT NULL DEFAULT '', 15 | FOREIGN KEY (user_id) REFERENCES e2e_users (id) ON UPDATE NO ACTION ON DELETE CASCADE 16 | ); 17 | CREATE INDEX "e2e_user_notes_user_id_idx" ON "e2e_user_posts" (user_id); 18 | CREATE UNIQUE INDEX "e2e_user_notes_slug_idx" ON "e2e_user_posts" (slug); 19 | -------------------------------------------------------------------------------- /testdata/e2e/fixtures/sqlite3/up/11.sql: -------------------------------------------------------------------------------- 1 | CREATE TABLE IF NOT EXISTS "schema_migration" ( 2 | "version" TEXT NOT NULL 3 | ); 4 | CREATE UNIQUE INDEX "schema_migration_version_idx" ON "schema_migration" (version); 5 | CREATE TABLE IF NOT EXISTS "e2e_authors" ( 6 | "id" TEXT PRIMARY KEY, 7 | "created_at" DATETIME NOT NULL, 8 | "updated_at" DATETIME NOT NULL 9 | ); 10 | CREATE TABLE IF NOT EXISTS "e2e_user_posts" ( 11 | "id" TEXT PRIMARY KEY, 12 | "user_id" char(36) NOT NULL, 13 | "slug" TEXT NOT NULL, 14 | "content" TEXT NOT NULL DEFAULT '', 15 | FOREIGN KEY (user_id) REFERENCES "e2e_authors" (id) ON UPDATE NO ACTION ON DELETE CASCADE 16 | ); 17 | CREATE INDEX "e2e_user_notes_user_id_idx" ON "e2e_user_posts" (user_id); 18 | CREATE UNIQUE INDEX "e2e_user_notes_slug_idx" ON "e2e_user_posts" (slug); 19 | -------------------------------------------------------------------------------- /testdata/e2e/fixtures/sqlite3/up/12.sql: -------------------------------------------------------------------------------- 1 | CREATE TABLE IF NOT EXISTS "schema_migration" ( 2 | "version" TEXT NOT NULL 3 | ); 4 | CREATE UNIQUE INDEX "schema_migration_version_idx" ON "schema_migration" (version); 5 | CREATE TABLE IF NOT EXISTS "e2e_authors" ( 6 | "id" TEXT PRIMARY KEY, 7 | "created_at" DATETIME NOT NULL, 8 | "updated_at" DATETIME NOT NULL 9 | ); 10 | CREATE TABLE IF NOT EXISTS "e2e_user_posts" ( 11 | "id" TEXT PRIMARY KEY, 12 | "author_id" char(36) NOT NULL, 13 | "slug" TEXT NOT NULL, 14 | "content" TEXT NOT NULL DEFAULT '', 15 | FOREIGN KEY ("author_id") REFERENCES "e2e_authors" (id) ON UPDATE NO ACTION ON DELETE CASCADE 16 | ); 17 | CREATE INDEX "e2e_user_notes_user_id_idx" ON "e2e_user_posts" ("author_id"); 18 | CREATE UNIQUE INDEX "e2e_user_notes_slug_idx" ON "e2e_user_posts" (slug); 19 | -------------------------------------------------------------------------------- /testdata/e2e/fixtures/sqlite3/up/13.sql: -------------------------------------------------------------------------------- 1 | CREATE TABLE IF NOT EXISTS "schema_migration" ( 2 | "version" TEXT NOT NULL 3 | ); 4 | CREATE UNIQUE INDEX "schema_migration_version_idx" ON "schema_migration" (version); 5 | CREATE TABLE IF NOT EXISTS "e2e_authors" ( 6 | "id" TEXT PRIMARY KEY, 7 | "created_at" DATETIME NOT NULL, 8 | "updated_at" DATETIME NOT NULL 9 | ); 10 | CREATE TABLE IF NOT EXISTS "e2e_user_posts" ( 11 | "id" TEXT PRIMARY KEY, 12 | "author_id" char(36), 13 | "slug" TEXT NOT NULL, 14 | "content" TEXT NOT NULL DEFAULT '', 15 | "published" bool NOT NULL DEFAULT FALSE, 16 | FOREIGN KEY (author_id) REFERENCES e2e_authors (id) ON UPDATE NO ACTION ON DELETE CASCADE 17 | ); 18 | CREATE UNIQUE INDEX "e2e_user_notes_slug_idx" ON "e2e_user_posts" (slug); 19 | CREATE INDEX "e2e_user_notes_user_id_idx" ON "e2e_user_posts" (author_id); 20 | -------------------------------------------------------------------------------- /testdata/e2e/fixtures/sqlite3/up/14.sql: -------------------------------------------------------------------------------- 1 | CREATE TABLE IF NOT EXISTS "schema_migration" ( 2 | "version" TEXT NOT NULL 3 | ); 4 | CREATE UNIQUE INDEX "schema_migration_version_idx" ON "schema_migration" (version); 5 | CREATE TABLE IF NOT EXISTS "e2e_authors" ( 6 | "id" TEXT PRIMARY KEY, 7 | "created_at" DATETIME NOT NULL, 8 | "updated_at" DATETIME NOT NULL 9 | ); 10 | CREATE TABLE IF NOT EXISTS "e2e_user_posts" ( 11 | "id" TEXT PRIMARY KEY, 12 | "author_id" char(36), 13 | "slug" TEXT NOT NULL, 14 | "content" TEXT NOT NULL DEFAULT '', 15 | "published" bool NOT NULL DEFAULT FALSE, 16 | FOREIGN KEY (author_id) REFERENCES e2e_authors (id) ON UPDATE NO ACTION ON DELETE CASCADE 17 | ); 18 | CREATE UNIQUE INDEX "e2e_user_notes_slug_idx" ON "e2e_user_posts" (slug); 19 | CREATE INDEX "e2e_user_notes_user_id_idx" ON "e2e_user_posts" (author_id); 20 | CREATE TABLE IF NOT EXISTS "e2e_flow" ( 21 | "id" TEXT PRIMARY KEY 22 | ); 23 | CREATE TABLE IF NOT EXISTS "e2e_address" ( 24 | "id" TEXT PRIMARY KEY 25 | ); 26 | CREATE TABLE IF NOT EXISTS "e2e_token" ( 27 | "id" TEXT PRIMARY KEY, 28 | "token" TEXT NOT NULL, 29 | "e2e_flow_id" char(36) NOT NULL, 30 | "e2e_address_id" char(36) NOT NULL, 31 | FOREIGN KEY (e2e_flow_id) REFERENCES e2e_flow (id) ON DELETE cascade, 32 | FOREIGN KEY (e2e_address_id) REFERENCES e2e_address (id) ON DELETE cascade 33 | ); 34 | CREATE UNIQUE INDEX "e2e_token_uq_idx" ON "e2e_token" (token); 35 | CREATE INDEX "e2e_token_idx" ON "e2e_token" (token); 36 | -------------------------------------------------------------------------------- /testdata/e2e/fixtures/sqlite3/up/15.sql: -------------------------------------------------------------------------------- 1 | CREATE TABLE IF NOT EXISTS "schema_migration" ( 2 | "version" TEXT NOT NULL 3 | ); 4 | CREATE UNIQUE INDEX "schema_migration_version_idx" ON "schema_migration" (version); 5 | CREATE TABLE IF NOT EXISTS "e2e_authors" ( 6 | "id" TEXT PRIMARY KEY, 7 | "created_at" DATETIME NOT NULL, 8 | "updated_at" DATETIME NOT NULL 9 | ); 10 | CREATE TABLE IF NOT EXISTS "e2e_user_posts" ( 11 | "id" TEXT PRIMARY KEY, 12 | "author_id" char(36), 13 | "slug" TEXT NOT NULL, 14 | "content" TEXT NOT NULL DEFAULT '', 15 | "published" bool NOT NULL DEFAULT FALSE, 16 | FOREIGN KEY (author_id) REFERENCES e2e_authors (id) ON UPDATE NO ACTION ON DELETE CASCADE 17 | ); 18 | CREATE UNIQUE INDEX "e2e_user_notes_slug_idx" ON "e2e_user_posts" (slug); 19 | CREATE INDEX "e2e_user_notes_user_id_idx" ON "e2e_user_posts" (author_id); 20 | CREATE TABLE IF NOT EXISTS "e2e_flow" ( 21 | "id" TEXT PRIMARY KEY 22 | ); 23 | CREATE TABLE IF NOT EXISTS "e2e_address" ( 24 | "id" TEXT PRIMARY KEY 25 | ); 26 | CREATE TABLE IF NOT EXISTS "e2e_token" ( 27 | "id" TEXT PRIMARY KEY, 28 | "token" TEXT NOT NULL, 29 | "e2e_flow_id" char(36), 30 | "e2e_address_id" char(36) NOT NULL, 31 | "expires_at" DATETIME NOT NULL DEFAULT '2000-01-01 00:00:00', 32 | "issued_at" DATETIME NOT NULL DEFAULT '2000-01-01 00:00:00', 33 | FOREIGN KEY (e2e_address_id) REFERENCES e2e_address (id) ON UPDATE NO ACTION ON DELETE CASCADE, 34 | FOREIGN KEY (e2e_flow_id) REFERENCES e2e_flow (id) ON UPDATE NO ACTION ON DELETE CASCADE 35 | ); 36 | CREATE INDEX "e2e_token_idx" ON "e2e_token" (token); 37 | CREATE UNIQUE INDEX "e2e_token_uq_idx" ON "e2e_token" (token); 38 | -------------------------------------------------------------------------------- /testdata/e2e/fixtures/sqlite3/up/2.sql: -------------------------------------------------------------------------------- 1 | CREATE TABLE IF NOT EXISTS "schema_migration" ( 2 | "version" TEXT NOT NULL 3 | ); 4 | CREATE UNIQUE INDEX "schema_migration_version_idx" ON "schema_migration" (version); 5 | CREATE TABLE IF NOT EXISTS "e2e_users" ( 6 | "id" TEXT PRIMARY KEY, 7 | "username" TEXT, 8 | "created_at" DATETIME NOT NULL, 9 | "updated_at" DATETIME NOT NULL 10 | ); 11 | CREATE TABLE IF NOT EXISTS "e2e_user_notes" ( 12 | "id" TEXT PRIMARY KEY, 13 | "notes" TEXT, 14 | "user_id" char(36) NOT NULL, 15 | FOREIGN KEY (user_id) REFERENCES e2e_users (id) ON UPDATE NO ACTION ON DELETE CASCADE 16 | ); 17 | CREATE INDEX "e2e_user_notes_user_id_idx" ON "e2e_user_notes" (user_id); 18 | -------------------------------------------------------------------------------- /testdata/e2e/fixtures/sqlite3/up/3.sql: -------------------------------------------------------------------------------- 1 | CREATE TABLE IF NOT EXISTS "schema_migration" ( 2 | "version" TEXT NOT NULL 3 | ); 4 | CREATE UNIQUE INDEX "schema_migration_version_idx" ON "schema_migration" (version); 5 | CREATE TABLE IF NOT EXISTS "e2e_users" ( 6 | "id" TEXT PRIMARY KEY, 7 | "username" TEXT, 8 | "created_at" DATETIME NOT NULL, 9 | "updated_at" DATETIME NOT NULL 10 | ); 11 | CREATE TABLE IF NOT EXISTS "e2e_user_notes" ( 12 | "id" TEXT PRIMARY KEY, 13 | "notes" TEXT, 14 | "user_id" char(36) NOT NULL, "slug" TEXT, 15 | FOREIGN KEY (user_id) REFERENCES e2e_users (id) ON UPDATE NO ACTION ON DELETE CASCADE 16 | ); 17 | CREATE INDEX "e2e_user_notes_user_id_idx" ON "e2e_user_notes" (user_id); 18 | -------------------------------------------------------------------------------- /testdata/e2e/fixtures/sqlite3/up/4.sql: -------------------------------------------------------------------------------- 1 | CREATE TABLE IF NOT EXISTS "schema_migration" ( 2 | "version" TEXT NOT NULL 3 | ); 4 | CREATE UNIQUE INDEX "schema_migration_version_idx" ON "schema_migration" (version); 5 | CREATE TABLE IF NOT EXISTS "e2e_users" ( 6 | "id" TEXT PRIMARY KEY, 7 | "username" TEXT, 8 | "created_at" DATETIME NOT NULL, 9 | "updated_at" DATETIME NOT NULL 10 | ); 11 | CREATE TABLE IF NOT EXISTS "e2e_user_notes" ( 12 | "id" TEXT PRIMARY KEY, 13 | "notes" TEXT, 14 | "user_id" char(36) NOT NULL, "slug" TEXT, 15 | FOREIGN KEY (user_id) REFERENCES e2e_users (id) ON UPDATE NO ACTION ON DELETE CASCADE 16 | ); 17 | CREATE INDEX "e2e_user_notes_user_id_idx" ON "e2e_user_notes" (user_id); 18 | -------------------------------------------------------------------------------- /testdata/e2e/fixtures/sqlite3/up/5.sql: -------------------------------------------------------------------------------- 1 | CREATE TABLE IF NOT EXISTS "schema_migration" ( 2 | "version" TEXT NOT NULL 3 | ); 4 | CREATE UNIQUE INDEX "schema_migration_version_idx" ON "schema_migration" (version); 5 | CREATE TABLE IF NOT EXISTS "e2e_users" ( 6 | "id" TEXT PRIMARY KEY, 7 | "username" TEXT, 8 | "created_at" DATETIME NOT NULL, 9 | "updated_at" DATETIME NOT NULL 10 | ); 11 | CREATE TABLE IF NOT EXISTS "e2e_user_notes" ( 12 | "id" TEXT PRIMARY KEY, 13 | "notes" TEXT, 14 | "user_id" char(36) NOT NULL, 15 | "slug" TEXT NOT NULL, 16 | FOREIGN KEY (user_id) REFERENCES e2e_users (id) ON UPDATE NO ACTION ON DELETE CASCADE 17 | ); 18 | CREATE INDEX "e2e_user_notes_user_id_idx" ON "e2e_user_notes" (user_id); 19 | CREATE UNIQUE INDEX "e2e_user_notes_slug_idx" ON "e2e_user_notes" (slug); 20 | -------------------------------------------------------------------------------- /testdata/e2e/fixtures/sqlite3/up/6.sql: -------------------------------------------------------------------------------- 1 | CREATE TABLE IF NOT EXISTS "schema_migration" ( 2 | "version" TEXT NOT NULL 3 | ); 4 | CREATE UNIQUE INDEX "schema_migration_version_idx" ON "schema_migration" (version); 5 | CREATE TABLE IF NOT EXISTS "e2e_users" ( 6 | "id" TEXT PRIMARY KEY, 7 | "username" TEXT, 8 | "created_at" DATETIME NOT NULL, 9 | "updated_at" DATETIME NOT NULL 10 | ); 11 | CREATE TABLE IF NOT EXISTS "e2e_user_posts" ( 12 | "id" TEXT PRIMARY KEY, 13 | "notes" TEXT, 14 | "user_id" char(36) NOT NULL, 15 | "slug" TEXT NOT NULL, 16 | FOREIGN KEY (user_id) REFERENCES e2e_users (id) ON UPDATE NO ACTION ON DELETE CASCADE 17 | ); 18 | CREATE INDEX "e2e_user_notes_user_id_idx" ON "e2e_user_posts" (user_id); 19 | CREATE UNIQUE INDEX "e2e_user_notes_slug_idx" ON "e2e_user_posts" (slug); 20 | -------------------------------------------------------------------------------- /testdata/e2e/fixtures/sqlite3/up/7.sql: -------------------------------------------------------------------------------- 1 | CREATE TABLE IF NOT EXISTS "schema_migration" ( 2 | "version" TEXT NOT NULL 3 | ); 4 | CREATE UNIQUE INDEX "schema_migration_version_idx" ON "schema_migration" (version); 5 | CREATE TABLE IF NOT EXISTS "e2e_users" ( 6 | "id" TEXT PRIMARY KEY, 7 | "username" TEXT, 8 | "created_at" DATETIME NOT NULL, 9 | "updated_at" DATETIME NOT NULL 10 | ); 11 | CREATE TABLE IF NOT EXISTS "e2e_user_posts" ( 12 | "id" TEXT PRIMARY KEY, 13 | "user_id" char(36) NOT NULL, 14 | "slug" TEXT NOT NULL, 15 | "content" TEXT NOT NULL DEFAULT '', 16 | FOREIGN KEY (user_id) REFERENCES e2e_users (id) ON UPDATE NO ACTION ON DELETE CASCADE 17 | ); 18 | CREATE UNIQUE INDEX "e2e_user_notes_slug_idx" ON "e2e_user_posts" (slug); 19 | CREATE INDEX "e2e_user_notes_user_id_idx" ON "e2e_user_posts" (user_id); 20 | -------------------------------------------------------------------------------- /testdata/e2e/fixtures/sqlite3/up/8.sql: -------------------------------------------------------------------------------- 1 | CREATE TABLE IF NOT EXISTS "schema_migration" ( 2 | "version" TEXT NOT NULL 3 | ); 4 | CREATE UNIQUE INDEX "schema_migration_version_idx" ON "schema_migration" (version); 5 | CREATE TABLE IF NOT EXISTS "e2e_users" ( 6 | "id" TEXT PRIMARY KEY, 7 | "name" TEXT, 8 | "created_at" DATETIME NOT NULL, 9 | "updated_at" DATETIME NOT NULL 10 | ); 11 | CREATE TABLE IF NOT EXISTS "e2e_user_posts" ( 12 | "id" TEXT PRIMARY KEY, 13 | "user_id" char(36) NOT NULL, 14 | "slug" TEXT NOT NULL, 15 | "content" TEXT NOT NULL DEFAULT '', 16 | FOREIGN KEY (user_id) REFERENCES e2e_users (id) ON UPDATE NO ACTION ON DELETE CASCADE 17 | ); 18 | CREATE UNIQUE INDEX "e2e_user_notes_slug_idx" ON "e2e_user_posts" (slug); 19 | CREATE INDEX "e2e_user_notes_user_id_idx" ON "e2e_user_posts" (user_id); 20 | -------------------------------------------------------------------------------- /testdata/e2e/fixtures/sqlite3/up/9.sql: -------------------------------------------------------------------------------- 1 | CREATE TABLE IF NOT EXISTS "schema_migration" ( 2 | "version" TEXT NOT NULL 3 | ); 4 | CREATE UNIQUE INDEX "schema_migration_version_idx" ON "schema_migration" (version); 5 | CREATE TABLE IF NOT EXISTS "e2e_user_posts" ( 6 | "id" TEXT PRIMARY KEY, 7 | "user_id" char(36) NOT NULL, 8 | "slug" TEXT NOT NULL, 9 | "content" TEXT NOT NULL DEFAULT '', 10 | FOREIGN KEY (user_id) REFERENCES e2e_users (id) ON UPDATE NO ACTION ON DELETE CASCADE 11 | ); 12 | CREATE UNIQUE INDEX "e2e_user_notes_slug_idx" ON "e2e_user_posts" (slug); 13 | CREATE INDEX "e2e_user_notes_user_id_idx" ON "e2e_user_posts" (user_id); 14 | CREATE TABLE IF NOT EXISTS "e2e_users" ( 15 | "id" TEXT PRIMARY KEY, 16 | "created_at" DATETIME NOT NULL, 17 | "updated_at" DATETIME NOT NULL 18 | ); 19 | -------------------------------------------------------------------------------- /testdata/e2e/go.mod: -------------------------------------------------------------------------------- 1 | module e2e 2 | 3 | go 1.16 4 | 5 | require ( 6 | github.com/gobuffalo/pop/v6 v6.0.4 7 | github.com/jackc/pgx/v4 v4.16.1 8 | github.com/stretchr/testify v1.8.0 9 | ) 10 | -------------------------------------------------------------------------------- /testdata/e2e/integration_test.go: -------------------------------------------------------------------------------- 1 | // +build e2e 2 | 3 | package e2e_test 4 | 5 | import ( 6 | "os" 7 | "testing" 8 | 9 | "github.com/gobuffalo/pop/v6" 10 | _ "github.com/jackc/pgx/v4/stdlib" 11 | "github.com/stretchr/testify/require" 12 | "github.com/stretchr/testify/suite" 13 | ) 14 | 15 | func TestSpecificSuites(t *testing.T) { 16 | require.NoError(t, pop.LoadConfigFile()) 17 | 18 | switch d := os.Getenv("SODA_DIALECT"); d { 19 | case "postgres": 20 | suite.Run(t, &PostgreSQLSuite{}) 21 | case "cockroach": 22 | suite.Run(t, &CockroachSuite{}) 23 | case "mysql": 24 | suite.Run(t, &MySQLSuite{}) 25 | case "sqlite": 26 | suite.Run(t, &SQLiteSuite{}) 27 | default: 28 | t.Fatalf("Got unsupported dialect: %s", d) 29 | } 30 | } 31 | -------------------------------------------------------------------------------- /testdata/e2e/migrations/20191100000001_users.down.fizz: -------------------------------------------------------------------------------- 1 | drop_table("e2e_users") 2 | -------------------------------------------------------------------------------- /testdata/e2e/migrations/20191100000001_users.up.fizz: -------------------------------------------------------------------------------- 1 | create_table("e2e_users") { 2 | t.Column("id", "uuid", {"primary": true}) 3 | t.Column("username", "string", {"null": true}) 4 | } 5 | -------------------------------------------------------------------------------- /testdata/e2e/migrations/20191100000002_user_notes.down.fizz: -------------------------------------------------------------------------------- 1 | drop_table("e2e_user_notes") 2 | -------------------------------------------------------------------------------- /testdata/e2e/migrations/20191100000002_user_notes.up.fizz: -------------------------------------------------------------------------------- 1 | create_table("e2e_user_notes") { 2 | t.Column("id", "uuid", {"primary": true}) 3 | t.Column("notes", "string", {"null": true}) 4 | t.Column("title", "string", {"size": 64, "default": ""}) 5 | 6 | t.Column("user_id", "uuid") 7 | t.ForeignKey("user_id", {"e2e_users": ["id"]}, {"on_delete": "cascade"}) 8 | 9 | t.DisableTimestamps() 10 | } 11 | 12 | add_index("e2e_user_notes", "user_id", {"name": "e2e_user_notes_user_id_idx"}) 13 | add_index("e2e_user_notes", "title", {"name": "e2e_user_notes_title_idx"}) 14 | -------------------------------------------------------------------------------- /testdata/e2e/migrations/20191100000003_user_notes_drop_title.down.fizz: -------------------------------------------------------------------------------- 1 | add_column("e2e_user_notes", "title", "string", { "default": "", "size": 64 }) 2 | add_index("e2e_user_notes", "title", {"name": "e2e_user_notes_title_idx"}) 3 | -------------------------------------------------------------------------------- /testdata/e2e/migrations/20191100000003_user_notes_drop_title.up.fizz: -------------------------------------------------------------------------------- 1 | drop_column("e2e_user_notes", "title") 2 | -------------------------------------------------------------------------------- /testdata/e2e/migrations/20191100000004_user_notes_add_slug.down.fizz: -------------------------------------------------------------------------------- 1 | drop_column("e2e_user_notes", "slug") 2 | -------------------------------------------------------------------------------- /testdata/e2e/migrations/20191100000004_user_notes_add_slug.up.fizz: -------------------------------------------------------------------------------- 1 | add_column("e2e_user_notes", "slug", "string", { "null": true, "size": 64 }) 2 | -------------------------------------------------------------------------------- /testdata/e2e/migrations/20191100000005_user_notes_add_slug.down.fizz: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/gobuffalo/fizz/43801550a873dc15679c4639639ac28b85ecc043/testdata/e2e/migrations/20191100000005_user_notes_add_slug.down.fizz -------------------------------------------------------------------------------- /testdata/e2e/migrations/20191100000005_user_notes_add_slug.up.fizz: -------------------------------------------------------------------------------- 1 | sql("UPDATE e2e_user_notes SET slug='';") 2 | -------------------------------------------------------------------------------- /testdata/e2e/migrations/20191100000006_user_notes_add_slug.down.fizz: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/gobuffalo/fizz/43801550a873dc15679c4639639ac28b85ecc043/testdata/e2e/migrations/20191100000006_user_notes_add_slug.down.fizz -------------------------------------------------------------------------------- /testdata/e2e/migrations/20191100000006_user_notes_add_slug.up.fizz: -------------------------------------------------------------------------------- 1 | change_column("e2e_user_notes", "slug", "string", { "size": 64 }) 2 | add_index("e2e_user_notes", "slug", { "unique":true, "name": "e2e_user_notes_slug_idx"}) 3 | -------------------------------------------------------------------------------- /testdata/e2e/migrations/20191100000007_user_notes_rename.down.fizz: -------------------------------------------------------------------------------- 1 | rename_table("e2e_user_posts","e2e_user_notes") 2 | -------------------------------------------------------------------------------- /testdata/e2e/migrations/20191100000007_user_notes_rename.up.fizz: -------------------------------------------------------------------------------- 1 | rename_table("e2e_user_notes", "e2e_user_posts") 2 | -------------------------------------------------------------------------------- /testdata/e2e/migrations/20191100000008_user_notes_rename_notes.down.fizz: -------------------------------------------------------------------------------- 1 | drop_column("e2e_user_posts", "content") 2 | add_column("e2e_user_posts", "notes", "string", {"null": true}) 3 | -------------------------------------------------------------------------------- /testdata/e2e/migrations/20191100000008_user_notes_rename_notes.up.fizz: -------------------------------------------------------------------------------- 1 | add_column("e2e_user_posts", "content", "string", {"default": ""}) 2 | drop_column("e2e_user_posts", "notes") 3 | -------------------------------------------------------------------------------- /testdata/e2e/migrations/20191100000009_users_username.down.fizz: -------------------------------------------------------------------------------- 1 | rename_column("e2e_users", "name", "username") 2 | -------------------------------------------------------------------------------- /testdata/e2e/migrations/20191100000009_users_username.up.fizz: -------------------------------------------------------------------------------- 1 | rename_column("e2e_users", "username", "name") 2 | -------------------------------------------------------------------------------- /testdata/e2e/migrations/20191100000010_users_drop_name.down.fizz: -------------------------------------------------------------------------------- 1 | add_column("e2e_users", "name", "string", {"null": true}) 2 | -------------------------------------------------------------------------------- /testdata/e2e/migrations/20191100000010_users_drop_name.up.fizz: -------------------------------------------------------------------------------- 1 | drop_column("e2e_users", "name") 2 | -------------------------------------------------------------------------------- /testdata/e2e/migrations/20191100000011_user_posts_change_column.down.fizz: -------------------------------------------------------------------------------- 1 | change_column("e2e_user_posts", "slug", "string", { "size": 64 }) 2 | -------------------------------------------------------------------------------- /testdata/e2e/migrations/20191100000011_user_posts_change_column.up.fizz: -------------------------------------------------------------------------------- 1 | change_column("e2e_user_posts", "slug", "string", { "size": 32 }) -------------------------------------------------------------------------------- /testdata/e2e/migrations/20191100000012_rename_user.down.fizz: -------------------------------------------------------------------------------- 1 | rename_table("e2e_authors", "e2e_users") 2 | -------------------------------------------------------------------------------- /testdata/e2e/migrations/20191100000012_rename_user.up.fizz: -------------------------------------------------------------------------------- 1 | rename_table("e2e_users", "e2e_authors") 2 | -------------------------------------------------------------------------------- /testdata/e2e/migrations/20191100000013_rename_user_notes_user.down.fizz: -------------------------------------------------------------------------------- 1 | rename_column("e2e_user_posts", "author_id", "user_id") 2 | -------------------------------------------------------------------------------- /testdata/e2e/migrations/20191100000013_rename_user_notes_user.up.fizz: -------------------------------------------------------------------------------- 1 | rename_column("e2e_user_posts", "user_id", "author_id") 2 | -------------------------------------------------------------------------------- /testdata/e2e/migrations/20191100000014_rename_user_add_published.down.fizz: -------------------------------------------------------------------------------- 1 | drop_column("e2e_user_posts", "published") 2 | change_column("e2e_user_posts", "author_id", "uuid") 3 | -------------------------------------------------------------------------------- /testdata/e2e/migrations/20191100000014_rename_user_add_published.up.fizz: -------------------------------------------------------------------------------- 1 | add_column("e2e_user_posts", "published", "bool", {"default_raw": "FALSE"}) 2 | change_column("e2e_user_posts", "author_id", "uuid", {"null": true}) 3 | -------------------------------------------------------------------------------- /testdata/e2e/migrations/20191100000015_auto_fk.down.fizz: -------------------------------------------------------------------------------- 1 | drop_table("e2e_token") 2 | drop_table("e2e_flow") 3 | drop_table("e2e_address") 4 | -------------------------------------------------------------------------------- /testdata/e2e/migrations/20191100000015_auto_fk.up.fizz: -------------------------------------------------------------------------------- 1 | create_table("e2e_flow") { 2 | t.DisableTimestamps() 3 | 4 | t.Column("id", "uuid", {"primary": true}) 5 | } 6 | 7 | create_table("e2e_address") { 8 | t.DisableTimestamps() 9 | 10 | t.Column("id", "uuid", {"primary": true}) 11 | } 12 | 13 | create_table("e2e_token") { 14 | t.DisableTimestamps() 15 | 16 | t.Column("id", "uuid", {"primary": true}) 17 | 18 | t.Column("token", "string", {"size": 64}) 19 | 20 | t.Column("e2e_flow_id", "uuid") 21 | t.ForeignKey("e2e_flow_id", {"e2e_flow": ["id"]}, {"on_delete": "cascade"}) 22 | 23 | t.Column("e2e_address_id", "uuid") 24 | t.ForeignKey("e2e_address_id", {"e2e_address": ["id"]}, {"on_delete": "cascade"}) 25 | } 26 | 27 | add_index("e2e_token", ["token"], { "unique": true, "name": "e2e_token_uq_idx" }) 28 | add_index("e2e_token", ["token"], { "name": "e2e_token_idx" }) 29 | -------------------------------------------------------------------------------- /testdata/e2e/migrations/20191100000016_rename_auto_fk.down.fizz: -------------------------------------------------------------------------------- 1 | change_column("e2e_token", "e2e_flow_id", "uuid") 2 | -------------------------------------------------------------------------------- /testdata/e2e/migrations/20191100000016_rename_auto_fk.up.fizz: -------------------------------------------------------------------------------- 1 | add_column("e2e_token", "expires_at", "timestamp", { "default": "2000-01-01 00:00:00" }) 2 | add_column("e2e_token", "issued_at", "timestamp", { "default": "2000-01-01 00:00:00" }) 3 | change_column("e2e_token", "e2e_flow_id", "uuid", {"null": true}) 4 | -------------------------------------------------------------------------------- /testdata/e2e/mysql_test.go: -------------------------------------------------------------------------------- 1 | package e2e_test 2 | 3 | import ( 4 | "github.com/gobuffalo/pop/v6" 5 | "github.com/stretchr/testify/suite" 6 | ) 7 | 8 | type MySQLSuite struct { 9 | suite.Suite 10 | } 11 | 12 | func (s *MySQLSuite) Test_MySQL_MigrationSteps() { 13 | r := s.Require() 14 | 15 | c, err := pop.Connect("mysql") 16 | r.NoError(err) 17 | r.NoError(retryOpen(c)) 18 | 19 | run(&s.Suite, c, runTestData(&s.Suite, c, false)) 20 | } 21 | -------------------------------------------------------------------------------- /testdata/e2e/postgres_test.go: -------------------------------------------------------------------------------- 1 | package e2e_test 2 | 3 | import ( 4 | "github.com/gobuffalo/pop/v6" 5 | "github.com/stretchr/testify/suite" 6 | ) 7 | 8 | type PostgreSQLSuite struct { 9 | suite.Suite 10 | } 11 | 12 | func (s *PostgreSQLSuite) Test_PostgreSQL_MigrationSteps() { 13 | r := s.Require() 14 | 15 | c, err := pop.Connect("postgres") 16 | r.NoError(err) 17 | r.NoError(retryOpen(c)) 18 | 19 | run(&s.Suite, c, runTestData(&s.Suite, c, true)) 20 | } 21 | -------------------------------------------------------------------------------- /testdata/e2e/sqlite3_test.go: -------------------------------------------------------------------------------- 1 | package e2e_test 2 | 3 | import ( 4 | "io/ioutil" 5 | 6 | "github.com/gobuffalo/pop/v6" 7 | "github.com/stretchr/testify/suite" 8 | ) 9 | 10 | type SQLiteSuite struct { 11 | suite.Suite 12 | } 13 | 14 | func (s *SQLiteSuite) Test_SQLite_MigrationSteps() { 15 | r := s.Require() 16 | 17 | td, err := ioutil.TempDir("", "pop-e2e-sqlite") 18 | r.NoError(err) 19 | 20 | c, err := pop.NewConnection(&pop.ConnectionDetails{URL: "sqlite3://" + td + "db.sql?mode=rwc&_fk=true"}) 21 | r.NoError(err) 22 | r.NoError(c.Open(), "%s", c.URL()) 23 | r.NoError(c.RawQuery("SELECT 1").Exec(), "%s", c.URL()) 24 | 25 | run(&s.Suite, c, runTestData(&s.Suite, c, false)) 26 | } 27 | -------------------------------------------------------------------------------- /testdata/migrations/.gitignore: -------------------------------------------------------------------------------- 1 | schema.sql -------------------------------------------------------------------------------- /testdata/migrations/20160808213308_setup_tests.down.fizz: -------------------------------------------------------------------------------- 1 | drop_table("users") 2 | drop_table("good_friends") 3 | drop_table("validatable_cars") 4 | drop_table("not_validatable_cars") 5 | drop_table("callbacks_users") 6 | drop_table("books") 7 | drop_table("cars") -------------------------------------------------------------------------------- /testdata/migrations/20160808213308_setup_tests.up.fizz: -------------------------------------------------------------------------------- 1 | create_table("users") { 2 | t.Column("name", "string") 3 | t.Column("alive", "boolean", {null: true}) 4 | t.Column("birth_date", "timestamp", {null: true}) 5 | t.Column("bio", "text", {null: true}) 6 | t.Column("price", "numeric", {null: true, default: "1.00"}) 7 | t.Column("email", "string", {default: "foo@example.com", size: 50}) 8 | } 9 | 10 | create_table("good_friends") { 11 | t.Column("first_name", "string") 12 | t.Column("last_name", "string") 13 | t.DisableTimestamps() 14 | } 15 | 16 | create_table("validatable_cars") { 17 | t.Column("name", "string") 18 | } 19 | 20 | create_table("not_validatable_cars") { 21 | t.Column("name", "string") 22 | } 23 | 24 | create_table("callbacks_users") { 25 | t.Column("before_s", "string") 26 | t.Column("before_c", "string") 27 | t.Column("before_u", "string") 28 | t.Column("before_d", "string") 29 | t.Column("after_s", "string") 30 | t.Column("after_c", "string") 31 | t.Column("after_u", "string") 32 | t.Column("after_d", "string") 33 | t.Column("after_f", "string") 34 | } 35 | 36 | create_table("books") { 37 | t.Column("title", "string") 38 | t.Column("user_id", "int", {null: true}) 39 | t.Column("isbn", "string", {size: 50}) 40 | } 41 | 42 | create_table("taxis") { 43 | t.Column("model", "string") 44 | t.Column("user_id", "int", {null: true}) 45 | } 46 | -------------------------------------------------------------------------------- /testdata/migrations/20160808213310_setup_tests2.down.fizz: -------------------------------------------------------------------------------- 1 | drop_table("songs") 2 | drop_table("course_codes") 3 | drop_table("courses") 4 | {{ if eq .Dialect "postgres" }} 5 | drop_table("cakes") 6 | {{ end }} 7 | -------------------------------------------------------------------------------- /testdata/migrations/20160808213310_setup_tests2.up.fizz: -------------------------------------------------------------------------------- 1 | create_table("songs") { 2 | t.Column("id", "uuid", {primary: true}) 3 | t.Column("u_id", "int", {null: true}) 4 | t.Column("title", "string") 5 | t.Column("composed_by_id", "int", {null: true}) 6 | } 7 | 8 | create_table("composers") { 9 | t.Column("name", "string") 10 | } 11 | 12 | create_table("writers") { 13 | t.Column("name", "string") 14 | t.Column("book_id", "int") 15 | } 16 | 17 | create_table("addresses") { 18 | t.Column("street", "string") 19 | t.Column("house_number", "int") 20 | } 21 | 22 | create_table("users_addresses") { 23 | t.Column("user_id", "int") 24 | t.Column("address_id", "int") 25 | } 26 | 27 | create_table("courses") { 28 | t.Column("id", "uuid", {primary: true}) 29 | } 30 | 31 | create_table("course_codes") { 32 | t.Column("id", "uuid", {primary: true}) 33 | t.Column("course_id", "uuid") 34 | } 35 | 36 | if (dialect == "postgres") { 37 | create_table("cakes") { 38 | t.Column("int_slice", "int[]", {null: true}) 39 | t.Column("float_slice", "numeric[]", {null: true}) 40 | t.Column("string_slice", "varchar[]", {null: true}) 41 | } 42 | } 43 | 44 | add_column("books", "description", "string", {default: ""}) 45 | change_column("books", "description", "string", {default: "test", "size": 100}) 46 | add_index("books","description") 47 | rename_index("books","books_description_idx","books_description_index") 48 | -------------------------------------------------------------------------------- /testdata/migrations/multiple/20180413210602_create_users.mysql.up.sql: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/gobuffalo/fizz/43801550a873dc15679c4639639ac28b85ecc043/testdata/migrations/multiple/20180413210602_create_users.mysql.up.sql -------------------------------------------------------------------------------- /testdata/migrations/multiple/20180413210602_create_users.postgres.up.sql: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/gobuffalo/fizz/43801550a873dc15679c4639639ac28b85ecc043/testdata/migrations/multiple/20180413210602_create_users.postgres.up.sql -------------------------------------------------------------------------------- /testdata/migrations/multiple/20180413210602_create_users.sqlite3.up.sql: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/gobuffalo/fizz/43801550a873dc15679c4639639ac28b85ecc043/testdata/migrations/multiple/20180413210602_create_users.sqlite3.up.sql -------------------------------------------------------------------------------- /testdata/migrations/multiple/20180413210602_create_users.up.sql: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/gobuffalo/fizz/43801550a873dc15679c4639639ac28b85ecc043/testdata/migrations/multiple/20180413210602_create_users.up.sql -------------------------------------------------------------------------------- /translator.go: -------------------------------------------------------------------------------- 1 | package fizz 2 | 3 | // Translator describes the common interface to define a fizz 4 | // to SQL translator. 5 | type Translator interface { 6 | CreateTable(Table) (string, error) 7 | DropTable(Table) (string, error) 8 | RenameTable([]Table) (string, error) 9 | AddColumn(Table) (string, error) 10 | ChangeColumn(Table) (string, error) 11 | DropColumn(Table) (string, error) 12 | RenameColumn(Table) (string, error) 13 | AddIndex(Table) (string, error) 14 | DropIndex(Table) (string, error) 15 | RenameIndex(Table) (string, error) 16 | AddForeignKey(Table) (string, error) 17 | DropForeignKey(Table) (string, error) 18 | } 19 | -------------------------------------------------------------------------------- /translators/mariadb.go: -------------------------------------------------------------------------------- 1 | package translators 2 | 3 | // MariaDB is a MariaDB-specific translator. 4 | type MariaDB struct { 5 | *MySQL 6 | } 7 | 8 | // NewMariaDB constructs a new MariaDB translator. 9 | func NewMariaDB(url, name string) *MariaDB { 10 | md := NewMySQL(url, name) 11 | md.strDefaultSize = 191 12 | return &MariaDB{ 13 | MySQL: md, 14 | } 15 | } 16 | 17 | func (MariaDB) Name() string { 18 | return "mariadb" 19 | } 20 | -------------------------------------------------------------------------------- /translators/mariadb_test.go: -------------------------------------------------------------------------------- 1 | package translators_test 2 | 3 | import ( 4 | "fmt" 5 | 6 | "github.com/gobuffalo/fizz" 7 | "github.com/gobuffalo/fizz/translators" 8 | ) 9 | 10 | var _ fizz.Translator = (*translators.MariaDB)(nil) 11 | var mat = translators.NewMariaDB("", "") 12 | 13 | func init() { 14 | u := "%s:%s@(%s:%s)/%s?parseTime=true&multiStatements=true&readTimeout=1s&collation=%s" 15 | u = fmt.Sprintf(u, getEnv("MYSQL_USER", "root"), getEnv("MYSQL_PASSWORD", ""), getEnv("MYSQL_HOST", "127.0.0.1"), getEnv("MYSQL_PORT", "3306"), "pop_test", "utf8mb4_general_ci") 16 | mat = translators.NewMariaDB(u, "pop_test") 17 | } 18 | 19 | func (p *MariaDBSuite) Test_MySQL_SchemaMigration() { 20 | r := p.Require() 21 | ddl := `CREATE TABLE ` + "`schema_migrations`" + ` ( 22 | ` + "`version`" + ` VARCHAR (191) NOT NULL 23 | ) ENGINE=InnoDB; 24 | CREATE UNIQUE INDEX ` + "`version_idx`" + ` ON ` + "`schema_migrations`" + ` (` + "`version`" + `);` 25 | res, err := mat.CreateTable(fizz.Table{ 26 | Name: "schema_migrations", 27 | Columns: []fizz.Column{ 28 | {Name: "version", ColType: "string"}, 29 | }, 30 | Indexes: []fizz.Index{ 31 | {Name: "version_idx", Columns: []string{"version"}, Unique: true}, 32 | }, 33 | }) 34 | r.NoError(err) 35 | r.Equal(ddl, res) 36 | } 37 | -------------------------------------------------------------------------------- /translators/schema_test.go: -------------------------------------------------------------------------------- 1 | package translators_test 2 | 3 | import ( 4 | "github.com/gobuffalo/fizz" 5 | "github.com/gobuffalo/fizz/translators" 6 | ) 7 | 8 | func (s *SchemaSuite) buildSchema() translators.Schema { 9 | schema := map[string]*fizz.Table{} 10 | ta := fizz.NewTable("testTable", nil) 11 | ta.Column("testColumn", "type", nil) 12 | ta.Indexes = append(ta.Indexes, fizz.Index{Name: "testIndex"}) 13 | schema["testTable"] = &ta 14 | return translators.CreateSchema("name", "url", schema) 15 | } 16 | 17 | func (s *SchemaSuite) Test_Schema_TableInfo() { 18 | r := s.Require() 19 | ts := s.buildSchema() 20 | t, err := ts.TableInfo("testTable") 21 | r.NoError(err) 22 | r.Equal("testTable", t.Name) 23 | } 24 | 25 | func (s *SchemaSuite) Test_Schema_ColumnInfo() { 26 | r := s.Require() 27 | ts := s.buildSchema() 28 | c, err := ts.ColumnInfo("testTable", "testCOLUMN") 29 | r.NoError(err) 30 | r.Equal("testColumn", c.Name) 31 | } 32 | 33 | func (s *SchemaSuite) Test_Schema_IndexInfo() { 34 | r := s.Require() 35 | ts := s.buildSchema() 36 | c, err := ts.IndexInfo("testTable", "testindEX") 37 | r.NoError(err) 38 | r.Equal("testIndex", c.Name) 39 | } 40 | -------------------------------------------------------------------------------- /translators/sqlite_meta_test.go: -------------------------------------------------------------------------------- 1 | package translators 2 | 3 | import ( 4 | "testing" 5 | 6 | "github.com/stretchr/testify/assert" 7 | ) 8 | 9 | func TestCanonicalizeSQLiteTable(t *testing.T) { 10 | assert.Equal(t, "e2e_users", canonicalizeSQLiteTable("_e2e_users_tmp")) 11 | assert.Equal(t, "e2e_users_tmp", canonicalizeSQLiteTable("_e2e_users_tmp_tmp")) 12 | assert.Equal(t, "e2e_users_tmp", canonicalizeSQLiteTable("e2e_users_tmp")) 13 | assert.Equal(t, "_e2e_users_tm", canonicalizeSQLiteTable("_e2e_users_tm")) 14 | assert.Equal(t, "_e2e_users_tmp_", canonicalizeSQLiteTable("_e2e_users_tmp_")) 15 | } 16 | -------------------------------------------------------------------------------- /translators/translators_test.go: -------------------------------------------------------------------------------- 1 | package translators_test 2 | 3 | import ( 4 | "os" 5 | "testing" 6 | 7 | "github.com/stretchr/testify/suite" 8 | ) 9 | 10 | type CockroachSuite struct { 11 | suite.Suite 12 | } 13 | 14 | type PostgreSQLSuite struct { 15 | suite.Suite 16 | } 17 | 18 | type MySQLSuite struct { 19 | suite.Suite 20 | } 21 | 22 | type MariaDBSuite struct { 23 | suite.Suite 24 | } 25 | 26 | type MsSqlServerSQLSuite struct { 27 | suite.Suite 28 | } 29 | 30 | type SQLiteSuite struct { 31 | suite.Suite 32 | } 33 | 34 | type SchemaSuite struct { 35 | suite.Suite 36 | } 37 | 38 | func TestSpecificSuites(t *testing.T) { 39 | switch os.Getenv("SODA_DIALECT") { 40 | case "postgres": 41 | suite.Run(t, &PostgreSQLSuite{}) 42 | case "cockroach": 43 | suite.Run(t, &CockroachSuite{}) 44 | case "mysql", "mysql_travis": 45 | suite.Run(t, &MySQLSuite{}) 46 | case "mariadb": 47 | suite.Run(t, &MariaDBSuite{}) 48 | case "sqlserver": 49 | suite.Run(t, &MsSqlServerSQLSuite{}) 50 | case "sqlite": 51 | suite.Run(t, &SQLiteSuite{}) 52 | } 53 | 54 | suite.Run(t, &SchemaSuite{}) 55 | } 56 | 57 | func getEnv(key, defaultValue string) string { 58 | if v, found := os.LookupEnv(key); found { 59 | return v 60 | } 61 | return defaultValue 62 | } 63 | -------------------------------------------------------------------------------- /version.go: -------------------------------------------------------------------------------- 1 | package fizz 2 | 3 | // Version gives the current fizz version. 4 | const Version = "v1.14.3" 5 | --------------------------------------------------------------------------------