palkan / logidze

Database changes log for Rails
MIT License
1.6k stars 76 forks source link

PG::UndefinedFunction: ERROR: function hstore(model_name) does not exist #220

Closed matgaw closed 1 year ago

matgaw commented 1 year ago

Tell us about your environment

**Ruby Version:2.7.6

**Rails Version:5.2.6

**PostgreSQL Version:13.9

**Logidze Version:1.2.2

What did you do?

I have logidze set up properly on my local development environment. However, when I deployed this to heroku, I get the following error on every update of a model:


ERROR:  function hstore(MY_MODEL_NAME) does not exist
LINE 2:                 hstore(NEW.*) - hstore(OLD.*)
                        ^
HINT:  No function matches the given name and argument types. You might need to add explicit type casts.
QUERY:  SELECT hstore_to_jsonb_loose(
                hstore(NEW.*) - hstore(OLD.*)
            )
CONTEXT:  PL/pgSQL function logidze_logger() line 109 at assignment

where MY_MODEL_NAME is name of my class.

I am sure that hstore extension is enabled, and things like this work in the database:

select hstore(row(1,2));

Also all migrations are run, including logidze_install and enabling hstore.

Any help?

matgaw commented 1 year ago

RESOLVED:

Turns out that heroku is adding all new database extensions to heroku_ext schema. I had to add the following to my database.yml:

schema_search_path: public,heroku_ext

Not really related with logidze itself.