Module: PgPower::Migration::CommandRecorder::SchemaMethods
- Included in:
- PgPower::Migration::CommandRecorder
- Defined in:
- lib/pg_power/migration/command_recorder/schema_methods.rb
Overview
Provides methods to extend ActiveRecord::Migration::CommandRecorder to support multi schemas feature.
Instance Method Summary collapse
-
#create_schema(*args) ⇒ Object
:nodoc:.
-
#drop_schema(*args) ⇒ Object
:nodoc:.
-
#invert_create_schema(args) ⇒ Object
:nodoc:.
-
#invert_drop_schema(args) ⇒ Object
:nodoc:.
-
#invert_move_table_to_schema(args) ⇒ Object
:nodoc:.
-
#move_table_to_schema(*args) ⇒ Object
:nodoc:.
Instance Method Details
#create_schema(*args) ⇒ Object
:nodoc:
5 6 7 |
# File 'lib/pg_power/migration/command_recorder/schema_methods.rb', line 5 def create_schema(*args) record(:create_schema, args) end |
#drop_schema(*args) ⇒ Object
:nodoc:
10 11 12 |
# File 'lib/pg_power/migration/command_recorder/schema_methods.rb', line 10 def drop_schema(*args) record(:drop_schema, args) end |
#invert_create_schema(args) ⇒ Object
:nodoc:
20 21 22 |
# File 'lib/pg_power/migration/command_recorder/schema_methods.rb', line 20 def invert_create_schema(args) [:drop_schema, [args.first]] end |
#invert_drop_schema(args) ⇒ Object
:nodoc:
25 26 27 |
# File 'lib/pg_power/migration/command_recorder/schema_methods.rb', line 25 def invert_drop_schema(args) [:create_schema, [args.first]] end |
#invert_move_table_to_schema(args) ⇒ Object
:nodoc:
30 31 32 33 34 35 36 37 38 |
# File 'lib/pg_power/migration/command_recorder/schema_methods.rb', line 30 def invert_move_table_to_schema(args) table_name = args.first current_schema = args.second new_schema, table = ::PgPower::Tools.to_schema_and_table(table_name) invert_args = ["#{current_schema}.#{table}", new_schema] [:move_table_to_schema, invert_args] end |
#move_table_to_schema(*args) ⇒ Object
:nodoc:
15 16 17 |
# File 'lib/pg_power/migration/command_recorder/schema_methods.rb', line 15 def move_table_to_schema(*args) record(:move_table_to_schema, args) end |