class ActiveSchema::Table

Public Class Methods

new(connection, table_name, table_opts, columns) click to toggle source
# File lib/active_schema/table.rb, line 4
def initialize connection, table_name, table_opts, columns
  @connection, @table_name, @table_opts, @columns =
    connection, table_name, table_opts, columns
end

Public Instance Methods

create() click to toggle source
# File lib/active_schema/table.rb, line 9
def create
  @connection.create_table(@table_name, @table_opts) do |t|
    @columns.each_pair do |name,(type,opts)|
      t.column(name, type, opts)
    end
  end
end
exists?() click to toggle source
# File lib/active_schema/table.rb, line 17
def exists?
  @connection.table_exists?(@table_name)
end