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

mkMigrationTable is broken #4

Open
xldenis opened this issue Oct 13, 2016 · 2 comments
Open

mkMigrationTable is broken #4

xldenis opened this issue Oct 13, 2016 · 2 comments

Comments

@xldenis
Copy link
Contributor

xldenis commented Oct 13, 2016

I'm aware this is still an in development method but mkMigrationTable generates invalid sql for all checks, defaults and foreign keys.

  • No way to specify column constraints such as UNIQUE, NOT NULL, properties such as the size of string fields, etc...
  • Primary Keys are not generated as primary keys in sql
  • the code generating the insert of custom checks is invalid
@expipiplus1
Copy link

Additionally, there needs to be some dependency tracking between the statements to make sure they are executed in order.

They should probably be put into a single transaction (with BEGIN and COMMIT) to prevent concurrent access hullaballoos.

As an alternative to these, just a single create statement could be generated with constraints inside instead of creating a table and then altering it.

@mageshb
Copy link
Contributor

mageshb commented Jan 6, 2017

Create statement and it's constraint could be merged. I couldn't find a strong reason for it to be separate.
Merging that alone won't solve all the dependency issues.
We need to create a DAG between the statement and topologically sort it and execute in that order to avoid sql errors.
At least in postgres, we can run those DDL statement in single transaction but its tricky in db like mysql which doesn't have transaction support for DDL.

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

No branches or pull requests

3 participants