Skip to content

Adding exception hunter breaks the apartment gem #97

Description

@CR1AT0RS

Bug report:

  • Expected Behavior:
  • Actual Behavior:
pry(main)> Apartment::Tenant.create('tesla')
     (1.0ms) CREATE SCHEMA "tesla"  []
    SQL (0.2ms) CREATE EXTENSION IF NOT EXISTS "pg_trgm"  []
    SQL (0.1ms) CREATE EXTENSION IF NOT EXISTS "plpgsql"  []
     (0.2ms) DROP TABLE IF EXISTS "active_storage_attachments" CASCADE  []
     (7.2ms) CREATE TABLE "active_storage_attachments" ("id" bigserial primary key, "name" character varying NOT NULL, "record_type" character varying NOT NULL, "record_id" bigint NOT NULL, "blob_id" bigint NOT NULL, "created_at" timestamp NOT NULL)  []
     (1.3ms) CREATE  INDEX  "index_active_storage_attachments_on_blob_id" ON "active_storage_attachments"  ("blob_id")  []
     (1.7ms) CREATE UNIQUE INDEX  "index_active_storage_attachments_uniqueness" ON "active_storage_attachments"  ("record_type", "record_id", "name", "blob_id")  []
     (0.2ms) DROP TABLE IF EXISTS "active_storage_blobs" CASCADE  []
     (4.5ms) CREATE TABLE "active_storage_blobs" ("id" bigserial primary key, "key" character varying NOT NULL, "filename" character varying NOT NULL, "content_type" character varying, "metadata" text, "byte_size" bigint NOT NULL, "checksum" character varying NOT NULL, "created_at" timestamp NOT NULL)  []
     (1.4ms) CREATE UNIQUE INDEX  "index_active_storage_blobs_on_key" ON "active_storage_blobs"  ("key")  []
     (0.3ms) DROP TABLE IF EXISTS "admin_users" CASCADE  []
     (4.3ms) CREATE TABLE "admin_users" ("id" serial NOT NULL PRIMARY KEY, "email" character varying DEFAULT '' NOT NULL, "encrypted_password" character varying DEFAULT '' NOT NULL, "reset_password_token" character varying, "reset_password_sent_at" timestamp, "remember_created_at" timestamp, "sign_in_count" integer DEFAULT 0 NOT NULL, "current_sign_in_at" timestamp, "last_sign_in_at" timestamp, "current_sign_in_ip" inet, "last_sign_in_ip" inet, "created_at" timestamp NOT NULL, "updated_at" timestamp NOT NULL)  []
     (1.4ms) CREATE UNIQUE INDEX  "index_admin_users_on_email" ON "admin_users"  ("email")  []
     (1.6ms) CREATE UNIQUE INDEX  "index_admin_users_on_reset_password_token" ON "admin_users"  ("reset_password_token")  []
     (0.4ms) DROP TABLE IF EXISTS "delayed_jobs" CASCADE  []
     (6.5ms) CREATE TABLE "delayed_jobs" ("id" serial NOT NULL PRIMARY KEY, "priority" integer DEFAULT 0 NOT NULL, "attempts" integer DEFAULT 0 NOT NULL, "handler" text NOT NULL, "last_error" text, "run_at" timestamp, "locked_at" timestamp, "failed_at" timestamp, "locked_by" character varying, "queue" character varying, "created_at" timestamp, "updated_at" timestamp)  []
     (1.7ms) CREATE  INDEX  "delayed_jobs_priority" ON "delayed_jobs"  ("priority", "run_at")  []
     (0.5ms) DROP TABLE IF EXISTS "exception_hunter_error_groups" CASCADE  []
     (5.3ms) CREATE TABLE "exception_hunter_error_groups" ("id" bigserial primary key, "error_class_name" character varying NOT NULL, "message" character varying, "status" integer DEFAULT 0, "tags" text[] DEFAULT '{}', "created_at" timestamp(6) NOT NULL, "updated_at" timestamp(6) NOT NULL)  []
     (0.8ms) CREATE  INDEX  "index_exception_hunter_error_groups_on_message" ON "exception_hunter_error_groups" USING gin ("message" gin_trgm_ops)  []
ActiveRecord::StatementInvalid: PG::UndefinedObject: ERROR:  operator class "gin_trgm_ops" does not exist for access method "gin"

from /Users/narya/.rvm/gems/ruby-2.7.1/gems/activerecord-6.0.3.2/lib/active_record/connection_adapters/postgresql/database_statements.rb:92:in `async_exec'
Caused by PG::UndefinedObject: ERROR:  operator class "gin_trgm_ops" does not exist for access method "gin"

from /Users/narya/.rvm/gems/ruby-2.7.1/gems/activerecord-6.0.3.2/lib/active_record/connection_adapters/postgresql/database_statements.rb:92:in `async_exec'
  • Steps to Reproduce:

    1. install apartment gem: https://github.com/rails-on-services/apartment
    2. bundle exec rails generate apartment:install
    3. Bind to user model etc.
    4. Apartment::Tenant.create('atlas')
  • Version of the repo: latest

  • Ruby and Rails Version: 2.7.1 and 6.0.3

  • Rails Stacktrace: this can be found in the log/development.log or log/test.log, if this is applicable.

The problem is that its not able to copy the schema from the exception_hunter gem

I have tried testing this with different rails api projects and all gems except the "exception_hunter_error" table. It breaks on that. I have postgres with "gin_trgm_ops"

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions