Module: PgSaurus::Migration::CommandRecorder::SchemaMethods
- Included in:
- PgSaurus::Migration::CommandRecorder
- Defined in:
- lib/pg_saurus/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:.
-
#create_schema_if_not_exists(*args) ⇒ Object
:nodoc:.
-
#drop_schema(*args) ⇒ Object
:nodoc:.
-
#drop_schema_if_exists(*args) ⇒ Object
:nodoc:.
-
#invert_create_schema(args) ⇒ Object
:nodoc:.
-
#invert_create_schema_if_not_exists(*args) ⇒ Object
:nodoc:.
-
#invert_drop_schema(args) ⇒ Object
:nodoc:.
-
#invert_drop_schema_if_exists(*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_saurus/migration/command_recorder/schema_methods.rb', line 5 def create_schema(*args) record(:create_schema, args) end |
#create_schema_if_not_exists(*args) ⇒ Object
:nodoc:
20 21 22 |
# File 'lib/pg_saurus/migration/command_recorder/schema_methods.rb', line 20 def create_schema_if_not_exists(*args) record(:create_schema_if_not_exists, args) end |
#drop_schema(*args) ⇒ Object
:nodoc:
10 11 12 |
# File 'lib/pg_saurus/migration/command_recorder/schema_methods.rb', line 10 def drop_schema(*args) record(:drop_schema, args) end |
#drop_schema_if_exists(*args) ⇒ Object
:nodoc:
25 26 27 |
# File 'lib/pg_saurus/migration/command_recorder/schema_methods.rb', line 25 def drop_schema_if_exists(*args) record(:drop_schema_if_exists, args) end |
#invert_create_schema(args) ⇒ Object
:nodoc:
30 31 32 |
# File 'lib/pg_saurus/migration/command_recorder/schema_methods.rb', line 30 def invert_create_schema(args) [:drop_schema, [args.first]] end |
#invert_create_schema_if_not_exists(*args) ⇒ Object
:nodoc:
51 52 53 |
# File 'lib/pg_saurus/migration/command_recorder/schema_methods.rb', line 51 def invert_create_schema_if_not_exists(*args) [:drop_schema_if_exists, args] end |
#invert_drop_schema(args) ⇒ Object
:nodoc:
35 36 37 |
# File 'lib/pg_saurus/migration/command_recorder/schema_methods.rb', line 35 def invert_drop_schema(args) [:create_schema, [args.first]] end |
#invert_drop_schema_if_exists(*args) ⇒ Object
:nodoc:
56 57 58 |
# File 'lib/pg_saurus/migration/command_recorder/schema_methods.rb', line 56 def invert_drop_schema_if_exists(*args) [:create_schema_if_not_exists, args] end |
#invert_move_table_to_schema(args) ⇒ Object
:nodoc:
40 41 42 43 44 45 46 47 48 |
# File 'lib/pg_saurus/migration/command_recorder/schema_methods.rb', line 40 def invert_move_table_to_schema(args) table_name = args.first current_schema = args.second new_schema, table = ::PgSaurus::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_saurus/migration/command_recorder/schema_methods.rb', line 15 def move_table_to_schema(*args) record(:move_table_to_schema, args) end |