Sha256: 5fee08f14db8b94679863b177b64a32e8374dfe159a643549eb0a797ab5de48d

Contents?: true

Size: 702 Bytes

Versions: 9

Compression:

Stored size: 702 Bytes

Contents

sql = <<-SQL
  DROP TABLE IF EXISTS users;
  CREATE TABLE users (
    id INTEGER NOT NULL AUTO_INCREMENT PRIMARY KEY,
    name VARCHAR(255) NOT NULL
  );

  DROP TABLE IF EXISTS photos;
  CREATE TABLE photos (
    id INTEGER NOT NULL AUTO_INCREMENT PRIMARY KEY,
    user_id INTEGER NOT NULL,
    camera_id INTEGER NOT NULL
  );
  DROP TABLE IF EXISTS developers;
  CREATE TABLE developers (
    id INTEGER NOT NULL AUTO_INCREMENT PRIMARY KEY,
    name VARCHAR(255) NOT NULL,
    salary INTEGER NOT NULL,
    department VARCHAR(255) NOT NULL,
    created_at TIMESTAMP NOT NULL
  );
SQL

sql.split(/;/).select(&:present?).each do |sql_statement|
  ActiveRecord::Base.connection.execute sql_statement
end

Version data entries

9 entries across 9 versions & 2 rubygems

Version Path
arel-1.0.1 spec/support/schemas/mysql_schema.rb
arel-1.0.0 spec/support/schemas/mysql_schema.rb
arel-1.0.0.rc1 spec/support/schemas/mysql_schema.rb
arel-compat-0.4.0 spec/support/schemas/mysql_schema.rb
arel-0.4.0 spec/support/schemas/mysql_schema.rb
arel-0.3.3 spec/support/schemas/mysql_schema.rb
arel-0.3.2 spec/support/schemas/mysql_schema.rb
arel-0.3.1 spec/schemas/mysql_schema.rb
arel-0.3.0 spec/schemas/mysql_schema.rb