diff options
author | Emilio Tagua <miloops@gmail.com> | 2010-03-12 11:34:01 -0300 |
---|---|---|
committer | Emilio Tagua <miloops@gmail.com> | 2010-03-12 11:34:01 -0300 |
commit | 602722922c8365afcb3e9bed3721d61756322353 (patch) | |
tree | 8e07cc7fdf6662b77f4c7b0fb9aa6ccf55c7530a /spec/support/schemas/postgresql_schema.rb | |
parent | 5e76aa7962c4e02c67c1e1515e6ae1b5ca6190a7 (diff) | |
parent | cbb524122c6132ba37661934c09b540a68b1c64d (diff) | |
download | rails-602722922c8365afcb3e9bed3721d61756322353.tar.gz rails-602722922c8365afcb3e9bed3721d61756322353.tar.bz2 rails-602722922c8365afcb3e9bed3721d61756322353.zip |
Merge branch 'master' of github.com:brynary/arel
Diffstat (limited to 'spec/support/schemas/postgresql_schema.rb')
-rw-r--r-- | spec/support/schemas/postgresql_schema.rb | 26 |
1 files changed, 26 insertions, 0 deletions
diff --git a/spec/support/schemas/postgresql_schema.rb b/spec/support/schemas/postgresql_schema.rb new file mode 100644 index 0000000000..23a48f5ad8 --- /dev/null +++ b/spec/support/schemas/postgresql_schema.rb @@ -0,0 +1,26 @@ +sql = <<-SQL + DROP TABLE IF EXISTS users; + CREATE TABLE users ( + id SERIAL PRIMARY KEY NOT NULL, + name VARCHAR(255) NOT NULL + ); + + DROP TABLE IF EXISTS photos; + CREATE TABLE photos ( + id SERIAL PRIMARY KEY NOT NULL, + user_id INTEGER NOT NULL, + camera_id INTEGER NOT NULL + ); + DROP TABLE IF EXISTS developers; + CREATE TABLE developers ( + id SERIAL PRIMARY KEY NOT NULL, + 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 |