class CreateTableJob

Public Instance Methods

perform(table) click to toggle source
# File natural-backend/app/jobs/create_table_job.rb, line 4
def perform(table)
  db_user = ::Natural::DatabaseUser.new(table.database.project.db_username,
                                        table.database.project.db_password)
  database = ::Natural::Database.new(table.database.database_identifier)
  connection = ::Natural::Connection.new
  connection.db_user = db_user
  connection.database = database

  connection.establish_connection

  table = ::Natural::Table.new(table.name)
  table.connection = connection

  table.create

  connection.close
end