aboutsummaryrefslogtreecommitdiffstats
path: root/activerecord/test/schema
diff options
context:
space:
mode:
authorRaimonds Simanovskis <raimonds.simanovskis@gmail.com>2009-03-22 23:50:05 +0200
committerRaimonds Simanovskis <raimonds.simanovskis@gmail.com>2009-08-06 23:40:59 +0300
commit963570b51ce4d95b046a441dd1c413dc6fcec8b4 (patch)
treef3b8aab53e280d1e042f9ec00dbe1360c55742d9 /activerecord/test/schema
parent04fea8a07ba94d381b03fae4a657077a7b966229 (diff)
downloadrails-963570b51ce4d95b046a441dd1c413dc6fcec8b4.tar.gz
rails-963570b51ce4d95b046a441dd1c413dc6fcec8b4.tar.bz2
rails-963570b51ce4d95b046a441dd1c413dc6fcec8b4.zip
added additional objects necessary for OracleAdapter specific tests
if OracleAdapter is used then use VARCHAR2(4000) instead of CLOB datatype as CLOB data type has many limitations in Oracle SELECT WHERE clause which causes many unit test failures
Diffstat (limited to 'activerecord/test/schema')
-rw-r--r--activerecord/test/schema/oracle_specific_schema.rb27
-rw-r--r--activerecord/test/schema/schema.rb24
2 files changed, 48 insertions, 3 deletions
diff --git a/activerecord/test/schema/oracle_specific_schema.rb b/activerecord/test/schema/oracle_specific_schema.rb
index 2d87f34625..3314687445 100644
--- a/activerecord/test/schema/oracle_specific_schema.rb
+++ b/activerecord/test/schema/oracle_specific_schema.rb
@@ -2,6 +2,10 @@ ActiveRecord::Schema.define do
execute "drop table test_oracle_defaults" rescue nil
execute "drop sequence test_oracle_defaults_seq" rescue nil
+ execute "drop sequence companies_nonstd_seq" rescue nil
+ execute "drop synonym subjects" rescue nil
+ execute "drop table defaults" rescue nil
+ execute "drop sequence defaults_seq" rescue nil
execute <<-SQL
create table test_oracle_defaults (
@@ -16,4 +20,27 @@ create table test_oracle_defaults (
create sequence test_oracle_defaults_seq minvalue 10000
SQL
+ execute "create sequence companies_nonstd_seq minvalue 10000"
+
+ execute "create synonym subjects for topics"
+
+ execute <<-SQL
+ CREATE TABLE defaults (
+ id integer not null,
+ modified_date date default sysdate,
+ modified_date_function date default sysdate,
+ fixed_date date default to_date('2004-01-01', 'YYYY-MM-DD'),
+ modified_time date default sysdate,
+ modified_time_function date default sysdate,
+ fixed_time date default TO_DATE('2004-01-01 00:00:00', 'YYYY-MM-DD HH24:MI:SS'),
+ char1 varchar2(1) default 'Y',
+ char2 varchar2(50) default 'a varchar field',
+ char3 clob default 'a text field',
+ positive_integer integer default 1,
+ negative_integer integer default -1,
+ decimal_number number(3,2) default 2.78
+ )
+ SQL
+ execute "create sequence defaults_seq minvalue 10000"
+
end
diff --git a/activerecord/test/schema/schema.rb b/activerecord/test/schema/schema.rb
index 1e47cdbaf6..5752d6fa40 100644
--- a/activerecord/test/schema/schema.rb
+++ b/activerecord/test/schema/schema.rb
@@ -104,7 +104,13 @@ ActiveRecord::Schema.define do
create_table :comments, :force => true do |t|
t.integer :post_id, :null => false
- t.text :body, :null => false
+ # use VARCHAR2(4000) instead of CLOB datatype as CLOB data type has many limitations in
+ # Oracle SELECT WHERE clause which causes many unit test failures
+ if current_adapter?(:OracleAdapter)
+ t.string :body, :null => false, :limit => 4000
+ else
+ t.text :body, :null => false
+ end
t.string :type
end
@@ -350,7 +356,13 @@ ActiveRecord::Schema.define do
create_table :posts, :force => true do |t|
t.integer :author_id
t.string :title, :null => false
- t.text :body, :null => false
+ # use VARCHAR2(4000) instead of CLOB datatype as CLOB data type has many limitations in
+ # Oracle SELECT WHERE clause which causes many unit test failures
+ if current_adapter?(:OracleAdapter)
+ t.string :body, :null => false, :limit => 4000
+ else
+ t.text :body, :null => false
+ end
t.string :type
t.integer :comments_count, :default => 0
t.integer :taggings_count, :default => 0
@@ -423,7 +435,13 @@ ActiveRecord::Schema.define do
t.datetime :written_on
t.time :bonus_time
t.date :last_read
- t.text :content
+ # use VARCHAR2(4000) instead of CLOB datatype as CLOB data type has many limitations in
+ # Oracle SELECT WHERE clause which causes many unit test failures
+ if current_adapter?(:OracleAdapter)
+ t.string :content, :limit => 4000
+ else
+ t.text :content
+ end
t.boolean :approved, :default => true
t.integer :replies_count, :default => 0
t.integer :parent_id