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 | |
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')
-rw-r--r-- | spec/support/schemas/mysql_schema.rb | 26 | ||||
-rw-r--r-- | spec/support/schemas/oracle_schema.rb | 20 | ||||
-rw-r--r-- | spec/support/schemas/postgresql_schema.rb | 26 | ||||
-rw-r--r-- | spec/support/schemas/sqlite3_schema.rb | 26 |
4 files changed, 98 insertions, 0 deletions
diff --git a/spec/support/schemas/mysql_schema.rb b/spec/support/schemas/mysql_schema.rb new file mode 100644 index 0000000000..a2e913d756 --- /dev/null +++ b/spec/support/schemas/mysql_schema.rb @@ -0,0 +1,26 @@ +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 diff --git a/spec/support/schemas/oracle_schema.rb b/spec/support/schemas/oracle_schema.rb new file mode 100644 index 0000000000..c8207c8d98 --- /dev/null +++ b/spec/support/schemas/oracle_schema.rb @@ -0,0 +1,20 @@ +ActiveRecord::Schema.define do + suppress_messages do + create_table :users, :primary_key_trigger => true, :force => true do |t| + t.string :name, :limit => 255, :null => false + end + + create_table :photos, :primary_key_trigger => true, :force => true do |t| + t.integer :user_id + t.integer :camera_id + end + + create_table :developers, :primary_key_trigger => true, :force => true do |t| + t.string :name, :limit => 255, :null => false + t.integer :salary + t.string :department, :limit => 255, :null => false + t.timestamp :created_at, :null => false + end + + end +end 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 diff --git a/spec/support/schemas/sqlite3_schema.rb b/spec/support/schemas/sqlite3_schema.rb new file mode 100644 index 0000000000..c1fed70859 --- /dev/null +++ b/spec/support/schemas/sqlite3_schema.rb @@ -0,0 +1,26 @@ +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 + ); + DROP TABLE IF EXISTS developers; + CREATE TABLE developers ( + id INTEGER NOT NULL 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 |