Skip to content

Commit

Permalink
entc/integration: additional schema changes for migration (ent#2403)
Browse files Browse the repository at this point in the history
  • Loading branch information
a8m authored and gitlawr committed Apr 13, 2022
1 parent f37cd63 commit 4d8db4f
Show file tree
Hide file tree
Showing 13 changed files with 43 additions and 6 deletions.
1 change: 1 addition & 0 deletions doc/md/versioned-migrations.md
Expand Up @@ -65,6 +65,7 @@ import (

"ariga.io/atlas/sql/migrate"
"entgo.io/ent/dialect/sql/schema"
_ "github.com/go-sql-driver/mysql"
)

func main() {
Expand Down
2 changes: 1 addition & 1 deletion entc/integration/migrate/entv1/migrate/schema.go

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

3 changes: 2 additions & 1 deletion entc/integration/migrate/entv1/schema/user.go
Expand Up @@ -39,7 +39,8 @@ func (User) Fields() []ent.Field {
MaxLen(255),
field.Enum("state").
Optional().
Values("logged_in", "logged_out"),
Values("logged_in", "logged_out").
Default("logged_in"),
field.String("status").
Optional(),
field.String("workplace").
Expand Down
3 changes: 3 additions & 0 deletions entc/integration/migrate/entv1/user/user.go

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

10 changes: 10 additions & 0 deletions entc/integration/migrate/entv1/user_create.go

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

2 changes: 1 addition & 1 deletion entc/integration/migrate/entv2/migrate/schema.go

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

3 changes: 2 additions & 1 deletion entc/integration/migrate/entv2/schema/user.go
Expand Up @@ -81,7 +81,8 @@ func (User) Fields() []ent.Field {
// adding enum to the `state` column.
field.Enum("state").
Optional().
Values("logged_in", "logged_out", "online"),
Values("logged_in", "logged_out", "online").
Default("logged_in"),
// convert string to enum.
field.Enum("status").
Optional().
Expand Down
3 changes: 3 additions & 0 deletions entc/integration/migrate/entv2/user/user.go

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

4 changes: 4 additions & 0 deletions entc/integration/migrate/entv2/user_create.go

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

2 changes: 1 addition & 1 deletion entc/integration/migrate/versioned/migrate/schema.go

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

3 changes: 2 additions & 1 deletion entc/integration/migrate/versioned/schema/user.go
Expand Up @@ -38,7 +38,8 @@ func (User) Fields() []ent.Field {
MaxLen(255),
field.Enum("state").
Optional().
Values("logged_in", "logged_out"),
Values("logged_in", "logged_out").
Default("logged_in"),
field.String("status").
Optional(),
field.String("workplace").
Expand Down
3 changes: 3 additions & 0 deletions entc/integration/migrate/versioned/user/user.go

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

10 changes: 10 additions & 0 deletions entc/integration/migrate/versioned/user_create.go

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

0 comments on commit 4d8db4f

Please sign in to comment.