Sha256: c1b160cdd32bbb3c60186b9f7919527da095cb6f061adf2ea64ac2e1312fb5f5

Contents?: true

Size: 461 Bytes

Versions: 2

Compression:

Stored size: 461 Bytes

Contents

module Ryakuzu
  class TableService
    attr_accessor :old_table, :new_table

    def initialize(old_table, new_table)
      @old_table = old_table
      @new_table = new_table
    end

    def call
      text = text_migration
      Ryakuzu::RunMigration.new(old_table: old_table, new_table: new_table.tableize).call(new_table.tableize, text, 'table')
    end

    def text_migration
      "rename_table :#{old_table}, :#{new_table.tableize}"
    end
  end
end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
ryakuzu-0.3.0 lib/ryakuzu/services/table_service.rb
ryakuzu-0.2.6 app/services/ryakuzu/table_service.rb