aboutsummaryrefslogblamecommitdiffstats
path: root/spec/support/schemas/mysql_schema.rb
blob: a2e913d756fd19afeabb564ce4e3cd9482f32792 (plain) (tree)
1
2
3
4
5
6
7
8
9
10
11
12
13












                                                   




                                                   

                                     
    



                                                         
   
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