-
Notifications
You must be signed in to change notification settings - Fork 71
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
Place function definitions at the beginning of schema in order to use it below #33
Comments
Hello again, is there any update on this? I believe there must be a way to easily achieve this by adding a kind of priority order to Fx#create_function on schema dumps. We are manually changing back the order on every commit, because we have indexes depending on our function and crashes our build / tests pipelines if is not done before committing. Thanks again |
@teoljungberg would you accept a pull request fixing this? Thanks |
I'd be happy receiving a PR for adding this if it's behind a configuration flag, and that the existing behavior is kept intact. |
I'm running into this problem too. I used a function as a default value in a table. create_table "somethings" do
# ...
t.string "some_column", default: -> { "my_postgres_function()" } Fails on Works great if i manually move the This was my use case for using Any chance of movement on this? |
Fixed by #53. |
We are experiencing a problem with the way the dump is generated into the schema.
Generated schema puts function definitions at the bottom
This creates a failure when loading the schema at our test suite because it tries first to create the index depending in the function that was not defined yet.
If we manually change the order, and define the function just after enabling extensions we experience no problem at all, but every migration/dump resets the default order making this fail.
Probably a fix for this might be defining the functions at the beginning of the schema in order to have it available for the rest of the code.
Thank you.
The text was updated successfully, but these errors were encountered: