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
72 73 74 75 76 77 78 79 |
# File 'lib/activerecord-multi-tenant/migrations.rb', line 72 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
71 |
# File 'lib/activerecord-multi-tenant/migrations.rb', line 71 alias orig_create_table create_table |