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

Deleting schema with data linked to a parent causes crash #44

Closed
leifmadsen opened this issue Nov 19, 2015 · 5 comments
Closed

Deleting schema with data linked to a parent causes crash #44

leifmadsen opened this issue Nov 19, 2015 · 5 comments

Comments

@leifmadsen
Copy link

When deleting a schema that has data associated with it, which has a parent object, the FOREIGN KEY constraint fails, and causes gohan to crash.

Log:

13:08:07.777 gohan.schema INFO  Loading schema ./provisioning_schema.yaml ...
13:08:07.779 gohan.schema WARNING  Overwriting schema device_type
13:08:07.779 gohan.schema WARNING  Overwriting schema server
13:08:07.780 gohan.schema WARNING  Overwriting schema customer
13:08:07.781 gohan.schema WARNING  Overwriting schema device
13:08:07.782 gohan.db CRITICAL  Error during deleting table:FOREIGN KEY constraint failed

It does seem to delete the schema and remove it from the YAML file, however the database constraint fails, and causes the crash to happen.

@nati
Copy link
Contributor

nati commented Nov 19, 2015

@leifmadsen you are using drop_on_create, right?

@leifmadsen
Copy link
Author

@nati yes sir, currently using drop_on_create (I'm working on schema creation right now in the dev environment)

@nati
Copy link
Contributor

nati commented Nov 19, 2015

@leifmadsen Thanks! I'll take a look

nati added a commit that referenced this issue Dec 1, 2015
In this commit, we sort schemas by dependency using Tarjan's algorithm,
so that users don't need to sort it manually.

Fixes bug: #44
Fixes bug: #45
@nati nati closed this as completed Dec 2, 2015
@leifmadsen
Copy link
Author

Thanks!

@nati
Copy link
Contributor

nati commented Dec 4, 2015

your welcome!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants