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

Old stored procedure not updated #76

Closed
Ch4s3 opened this issue Jul 29, 2016 · 1 comment
Closed

Old stored procedure not updated #76

Ch4s3 opened this issue Jul 29, 2016 · 1 comment

Comments

@Ch4s3
Copy link
Contributor

Ch4s3 commented Jul 29, 2016

I have a column that was changed from integer to float and the stored procedure keeps reverting to the integer type and breaking on insert with the following error:

PG::InvalidTextRepresentationapp/models/concerns/upsertable.rb:15
ERROR: invalid input syntax for integer: 

I've tried dropping the database and recreating it to regenerate new procedures and then committing those. It still breaks on my staging environment as though the procedures are being restored or recreated incorrectly.

@pnomolos
Copy link
Collaborator

pnomolos commented Sep 21, 2016

@Ch4s3 If you run something like the following you can clear all currently existing functions created by upsert:

    # We do this so it clears all versions of the functions
    Upsert::MergeFunction::NAME_PREFIX = "upsert"
    # Following example is for Sequel, replace it with 
    # whatever you need to get a direct connection in your app
    DB.synchronize do |conn|
      Upsert.clear_database_functions(conn)
    end

I have a rake task that is run after deployment so fresh versions of the functions are available every time.

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

2 participants