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

[bug] default state is sometimes invalid if the DB column has a default value too #6

Open
smudge opened this issue Apr 20, 2019 · 5 comments

Comments

@smudge
Copy link
Member

smudge commented Apr 20, 2019

TODO: Put the steps for reproducing this here.

@RowanMcDonald
Copy link

I ran into this issue running steady_state on sqlite where you can't have a null: false column without a default. I'll write up a minimal repro and put together a pr in the next week or so.

@smudge
Copy link
Member Author

smudge commented Nov 18, 2022

This issue came up again. Adding default: 'pending' to the status column (in a migration) would make it impossible to start the state machine in any state that doesn't have from: 'pending' on it.

@smudge
Copy link
Member Author

smudge commented Nov 18, 2022

I think it would make sense for this gem to somehow detect when a column-level default is getting applied and raise a warning/exception.

@rzane
Copy link

rzane commented Nov 29, 2022

This is possible! Here's an example:

irb> SomeModel.columns_hash['status'].default
=> "pending"

@ABaldwinHunter
Copy link

OMG running into this now too!

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

4 participants