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
26 27 28 29 30 31 32 33 |
# File 'lib/activerecord-multi-tenant/migrations.rb', line 26 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
25 |
# File 'lib/activerecord-multi-tenant/migrations.rb', line 25 alias :orig_create_table :create_table |