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

Fix SystemStackError in schema_dumper.rb in combination with strong_migrations #257

Closed
wants to merge 1 commit into from
Closed
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
19 changes: 8 additions & 11 deletions lib/activerecord-multi-tenant/migrations.rb
Original file line number Diff line number Diff line change
Expand Up @@ -82,14 +82,10 @@ def create_table(table_name, options = {}, &block)
end
ActiveRecord::ConnectionAdapters::SchemaStatements.prepend(MultiTenant::SchemaStatementsExtensions)

module ActiveRecord
class SchemaDumper
private

alias initialize_without_citus initialize

module MultiTenant
module SchemaDumper
def initialize(connection, options = {})
initialize_without_citus(connection, options)
super(connection, options)

citus_version =
begin
Expand All @@ -113,11 +109,8 @@ def initialize(connection, options = {})
end
end

# Support for create_distributed_table & create_reference_table
alias table_without_citus table

def table(table, stream)
table_without_citus(table, stream)
super(table, stream)
table_name = remove_prefix_and_suffix(table)
distribution_column = @distribution_columns[table_name]
if distribution_column
Expand All @@ -130,3 +123,7 @@ def table(table, stream)
end
end
end

ActiveSupport.on_load(:active_record) do
ActiveRecord::SchemaDumper.prepend(MultiTenant::SchemaDumper)
end