Module: Skr::DB::CommandRecorder
- Defined in:
- lib/skr/db/migration_helpers.rb
Instance Method Summary collapse
- #create_skr_table(*args) ⇒ Object
- #drop_skr_table(*args) ⇒ Object
- #invert_create_skr_table(args) ⇒ Object
- #invert_skr_add_index(args) ⇒ Object
- #skr_add_index(*args) ⇒ Object
Instance Method Details
#create_skr_table(*args) ⇒ Object
128 129 130 |
# File 'lib/skr/db/migration_helpers.rb', line 128 def create_skr_table(*args) record(:create_skr_table, args) end |
#drop_skr_table(*args) ⇒ Object
132 133 134 |
# File 'lib/skr/db/migration_helpers.rb', line 132 def drop_skr_table(*args) record(:drop_skr_table, args) end |
#invert_create_skr_table(args) ⇒ Object
136 137 138 139 140 141 142 143 144 145 146 147 |
# File 'lib/skr/db/migration_helpers.rb', line 136 def invert_create_skr_table(args) from_table, to_table, = *args ||= {} if [:name] = {name: [:name]} elsif [:column] = {column: [:column]} else = to_table end [:drop_skr_table, [from_table, ]] end |
#invert_skr_add_index(args) ⇒ Object
152 153 154 155 |
# File 'lib/skr/db/migration_helpers.rb', line 152 def invert_skr_add_index(args) table, column = *args [:remove_skr_index, [table, column]] end |
#skr_add_index(*args) ⇒ Object
149 150 151 |
# File 'lib/skr/db/migration_helpers.rb', line 149 def skr_add_index(*args) record(:skr_add_index,args) end |