class Ryakuzu::MigrationService
Attributes
columns[RW]
old_table[RW]
table[RW]
Public Class Methods
new(params = {})
click to toggle source
# File lib/ryakuzu/services/migration_service.rb, line 5 def initialize(params = {}) @columns = params['column'] @table = params['name'] @old_table = params['old_name'] end
Public Instance Methods
call()
click to toggle source
# File lib/ryakuzu/services/migration_service.rb, line 11 def call run_table_migration(old_table, table) if table != old_table columns.each_slice(2) do |k, v| run_column_migration(v[1], k[1], table) if k[1] != v[1] end end
Private Instance Methods
run_column_migration(old_name, new_name, table)
click to toggle source
# File lib/ryakuzu/services/migration_service.rb, line 25 def run_column_migration(old_name, new_name, table) Ryakuzu::ColumnService.new(old_name, new_name, table).call end
run_table_migration(old_table, new_table)
click to toggle source
# File lib/ryakuzu/services/migration_service.rb, line 21 def run_table_migration(old_table, new_table) Ryakuzu::TableService.new(old_table, new_table).call end