Module: ActiveRecord::ConnectionAdapters::SchemaStatements
- Defined in:
- lib/activerecord-multi-tenant/migrations.rb
Instance Method Summary collapse
Instance Method Details
#create_table(table_name, options = {}, &block) ⇒ Object
74 75 76 77 78 79 80 81 |
# File 'lib/activerecord-multi-tenant/migrations.rb', line 74 def create_table(table_name, = {}, &block) ret = orig_create_table(table_name, **.except(:partition_key), &block) if [:id] != false && [:partition_key] && [:partition_key].to_s != 'id' execute "ALTER TABLE #{table_name} DROP CONSTRAINT #{table_name}_pkey" execute "ALTER TABLE #{table_name} ADD PRIMARY KEY(\"#{[:partition_key]}\", id)" end ret end |
#orig_create_table ⇒ Object
72 |
# File 'lib/activerecord-multi-tenant/migrations.rb', line 72 alias orig_create_table create_table |