Permalink
Browse files

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
  • Loading branch information...
rsim committed Mar 22, 2009
1 parent 04fea8a commit 963570b51ce4d95b046a441dd1c413dc6fcec8b4
Showing with 48 additions and 3 deletions.
  1. +27 −0 activerecord/test/schema/oracle_specific_schema.rb
  2. +21 −3 activerecord/test/schema/schema.rb
@@ -2,6 +2,10 @@
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 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
@@ -104,7 +104,13 @@ def create_table(*args, &block)
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 @@ def create_table(*args, &block)
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 @@ def create_table(*args, &block)
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

0 comments on commit 963570b

Please sign in to comment.