blob: 6c98a4f93496685d7e4389c3f154560cfbfad402 (
plain) (
blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
|
sql = <<-SQL
DROP TABLE IF EXISTS users;
CREATE TABLE users (
id INTEGER NOT NULL PRIMARY KEY,
name VARCHAR(255) NOT NULL
);
DROP TABLE IF EXISTS photos;
CREATE TABLE photos (
id INTEGER NOT NULL PRIMARY KEY,
user_id INTEGER NOT NULL,
camera_id INTEGER NOT NULL
);
SQL
sql.split(/;/).select(&:present?).each do |sql_statement|
ActiveRecord::Base.connection.execute sql_statement
end
|