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

dialect/sql/schema: add name to versioned migration files #2375

Merged
merged 3 commits into from Mar 7, 2022

Conversation

imhuytq
Copy link
Contributor

@imhuytq imhuytq commented Mar 4, 2022

Currently, golang-migrate will not be able to scan versioned migration files generated because the filename does not match this pattern: ^([0-9]+)_(.*).(down|up).(. *)$. So to satisfy the above pattern, we need to add names for the versioned migration files.

Another thing is that we should not execute Planner.WritePlan if there are no changes. Otherwise, it will generate empty migration files.

@masseelch masseelch changed the title Adds name to versioned migration files dialect/sql/schema: add name to versioned migration files Mar 7, 2022
@masseelch masseelch merged commit ddddc1d into ent:master Mar 7, 2022
@masseelch
Copy link
Collaborator

Hey @imhuytq, thank you your contribution.

@all-contributors please add @imhuytq for code.

@allcontributors
Copy link
Contributor

@masseelch

I've put up a pull request to add @imhuytq! 🎉

zeevmoney added a commit to zeevmoney/ent that referenced this pull request Mar 15, 2022
* master:
  doc/website/blog: versioned migrations (ent#2387)
  build(deps): bump github.com/spf13/cobra from 1.3.0 to 1.4.0 (ent#2386)
  go: upgrade atlas for tidb support (ent#2394)
  dialect/sql/schema: add method to create a named versioned migration … (ent#2385)
  docs: add maorlipchuk as a contributor for code (ent#2381)
  entc/gen: set Ref and Inverse for edge contains both From and To
  schema/field: expose RType.Implements method (ent#2379)
  docs: add imhuytq as a contributor for code (ent#2378)
  dialect/sql/schema: add name to versioned migration files (ent#2375)
  all: update atlasgo.io to latest (ent#2376)
  dialect/sql/schema: fix bug in atlas integration when working WithDropIndex/WithDropColumn (ent#2374)
  build(deps): bump actions/checkout from 2.4.0 to 3 (ent#2372)
  build(deps): bump actions/setup-node from 2.5.1 to 3 (ent#2365)
gitlawr pushed a commit to gitlawr/ent that referenced this pull request Apr 13, 2022
* add name to versioned migration files

* Skip writing migration files if the plan has no changes
gitlawr pushed a commit to seal-io/ent that referenced this pull request Apr 13, 2022
* add name to versioned migration files

* Skip writing migration files if the plan has no changes
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants