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
41 42 43 44 45 46 47 48 |
# File 'lib/activerecord-multi-tenant/migrations.rb', line 41 def create_table(table_name, = {}, &block) ret = orig_create_table(table_name, .except(:partition_key), &block) if [: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(id, \"#{options[:partition_key]}\")" end ret end |
#orig_create_table ⇒ Object
40 |
# File 'lib/activerecord-multi-tenant/migrations.rb', line 40 alias :orig_create_table :create_table |