Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix(engine/dolphin): support enum in ALTER definition #2680

Merged
merged 6 commits into from
Oct 13, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
31 changes: 31 additions & 0 deletions internal/endtoend/testdata/enum_alter_change/mysql/go/db.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

60 changes: 60 additions & 0 deletions internal/endtoend/testdata/enum_alter_change/mysql/go/models.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

37 changes: 37 additions & 0 deletions internal/endtoend/testdata/enum_alter_change/mysql/go/query.sql.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 2 additions & 0 deletions internal/endtoend/testdata/enum_alter_change/mysql/query.sql
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
-- name: ListAuthors :many
select * from authors;
9 changes: 9 additions & 0 deletions internal/endtoend/testdata/enum_alter_change/mysql/schema.sql
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
-- similar to issue https://github.com/sqlc-dev/sqlc/issues/1503

CREATE TABLE authors (
id bigint primary key,
status enum("ok", "init") default "init" not null
);

-- remove this alter to see the change in models.go
ALTER TABLE authors CHANGE status status enum('init', 'done', 'canceled', 'processing', 'waiting') default "init" not null;
13 changes: 13 additions & 0 deletions internal/endtoend/testdata/enum_alter_change/mysql/sqlc.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
{
"version": "1",
"packages": [
{
"name": "querytest",
"path": "go",
"schema": "schema.sql",
"queries": "query.sql",
"engine": "mysql",
"omit_unused_structs": true
}
]
}
31 changes: 31 additions & 0 deletions internal/endtoend/testdata/enum_alter_modify/mysql/go/db.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

60 changes: 60 additions & 0 deletions internal/endtoend/testdata/enum_alter_modify/mysql/go/models.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

37 changes: 37 additions & 0 deletions internal/endtoend/testdata/enum_alter_modify/mysql/go/query.sql.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 2 additions & 0 deletions internal/endtoend/testdata/enum_alter_modify/mysql/query.sql
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
-- name: ListAuthors :many
select * from authors;
9 changes: 9 additions & 0 deletions internal/endtoend/testdata/enum_alter_modify/mysql/schema.sql
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
-- similar to issue https://github.com/sqlc-dev/sqlc/issues/1503

CREATE TABLE authors (
id bigint primary key,
status enum("ok", "init") default "init" not null
);

-- remove this alter to see the change in models.go
ALTER TABLE authors MODIFY status enum('init', 'done', 'canceled', 'processing', 'waiting') default "init" not null;
13 changes: 13 additions & 0 deletions internal/endtoend/testdata/enum_alter_modify/mysql/sqlc.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
{
"version": "1",
"packages": [
{
"name": "querytest",
"path": "go",
"schema": "schema.sql",
"queries": "query.sql",
"engine": "mysql",
"omit_unused_structs": true
}
]
}
Loading
Loading