-
Notifications
You must be signed in to change notification settings - Fork 77
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
Trying to get Logidze working #50
Comments
Hi! Which PostgreSQL version do you use? |
@SimonDKnight ping) |
Closed as stale |
I got the same error. ydakuka@Yauheni-Work:~/virtual_box/project$ ruby -v
ruby 2.4.1p111 (2017-03-22 revision 58053) [x86_64-linux]
ydakuka@Yauheni-Work:~/virtual_box/project$ rails -v
Rails 5.1.4
ydakuka@Yauheni-Work:~/virtual_box/project$ psql --version
psql (PostgreSQL) 9.5.10 ydakuka@Yauheni-Work:~/virtual_box/project$ rails db:migrate
== 20171230234326 AddLogidzeToUsers: migrating ================================
-- add_column(:users, :log_data, :jsonb)
-> 0.0008s
-- execute(" CREATE TRIGGER logidze_on_users\n BEFORE UPDATE OR INSERT ON users FOR EACH ROW\n WHEN (coalesce(current_setting('logidze.disabled'), '') <> 'on')\n EXECUTE PROCEDURE logidze_logger(null, 'updated_at');\n")
rails aborted!
StandardError: An error has occurred, this and all later migrations canceled:
PG::UndefinedFunction: ERROR: function logidze_logger() does not exist
: CREATE TRIGGER logidze_on_users
BEFORE UPDATE OR INSERT ON users FOR EACH ROW
WHEN (coalesce(current_setting('logidze.disabled'), '') <> 'on')
EXECUTE PROCEDURE logidze_logger(null, 'updated_at'); |
@ydakuka this is not the same; your error says that there is no |
Ignore the below - I discovered the issue was with the apartment gem (here). For anyone running into this issue in the future, apartment does not run sql execute statements in pg schemas. I hope you don't mind me commenting on a closed issue, but I'm getting the same issue as ydakuka above, but while using the apartment gem like SimonGKnight. It appears that my initial logidze migration isn't being run across the pg schemas I have, which is causing it to throw the 'function not found' error. Any ideas? |
Hi @derekgstevens! Check this section from the It explains how to enhance schemas with raw SQL (that's exactly what we need to install Logidze). |
@palkan Is raw SQL required when using Apartment + Logidze or do the previous instructions (steps 1-3) work as well? Update: I had Apartment and Logidze working well together before I needed to reset my DB but I can't get back to a working state. I've tried every combination of steps on that link. In my seeds.rb, I create a tenant. If I use |
@archonic Looks like your schema doesn't have |
I've had the error above when I had the xxx_enable_hstore.rb migration. I removed it since I figured it wasn't required when this is in my schema.rb.
I'm not using a structure.sql file. Interestingly it seems to have not installed
More info: |
I have a minimal logidze + apartment application here which has the same issue: If you create then update a document in the public schema, logidze will populate |
@archonic Thanks for sharing an examples app! I made it work, here is a PR with a description: archonic/logidze-apartment#1 |
Beauty! 🙌 Thanks very much. Let me know if I can buy you a beer 😄 |
😺 Do you deliver to Moscow?)) |
https://twitter.com/palkan_tula/status/996002315701284865 Totally agree. Sounds like an idea for an app. How about an email money transfer to the email on your profile? |
@archonic You can send me a postcard. That would be fair enough) |
Hey @archonic! Hope you're doing well. It looks like Could you please remind me? |
Hey! Now I wish I hadn't deleted it. I don't have it locally either, but the fix is in another repo. Let me see if I can find it. |
https://github.com/archonic/logidze-apartment I'm not sure where the fix was but that's an example that can safely run Update: I just remembered a minor important detail about apartment. It will run migrations in tenants with |
@archonic Thanks! |
Hi, I am having some issues getting Logidze working. I have followed your install instructions and whenever I try to create I get the following error
Any ideas?
I am using the Apartment gem which is tenanting my customers using postgres schemas, perhaps this is the problem?
The text was updated successfully, but these errors were encountered: