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
46 47 48 49 50 51 52 53 |
# File 'lib/activerecord-multi-tenant/migrations.rb', line 46 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(\"#{[:partition_key]}\", id)" end ret end |
#orig_create_table ⇒ Object
45 |
# File 'lib/activerecord-multi-tenant/migrations.rb', line 45 alias :orig_create_table :create_table |