Skip to content

Commit 5e4d570

Browse files
committed
Add the sql server specific stuff from rails.
Added the sql server specific schema and an extension to aaa_create_tables_test that will ensure we load / test this from the new adapter specific schema root.
1 parent 9fefb42 commit 5e4d570

File tree

2 files changed

+41
-0
lines changed

2 files changed

+41
-0
lines changed
Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
require 'cases/helper'
2+
require "cases/aaa_create_tables_test"
3+
4+
# TODO Should this really be in the same test class as the "real" one in rails?
5+
class AAACreateTablesTest < ActiveRecord::TestCase
6+
def test_load_sqlserver_specific_schema
7+
eval(File.read(File.expand_path(File.join(File.dirname(__FILE__), '..', 'schema', 'sqlserver_specific_schema.rb'))))
8+
assert true
9+
end
10+
end
Lines changed: 31 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,31 @@
1+
ActiveRecord::Schema.define do
2+
create_table :table_with_real_columns, :force => true do |t|
3+
t.column :real_number, :real
4+
end
5+
6+
create_table :defaults, :force => true do |t|
7+
# NOTE: These are the other columns from the postgresql specific schema
8+
# however, there aren't any tests for them yet, so no point creating them.
9+
# modified_date date default CURRENT_DATE,
10+
# modified_date_function date default now(),
11+
# fixed_date date default '2004-01-01',
12+
# modified_time timestamp default CURRENT_TIMESTAMP,
13+
# modified_time_function timestamp default now(),
14+
# fixed_time timestamp default '2004-01-01 00:00:00.000000-00',
15+
# char1 char(1) default 'Y',
16+
# char2 character varying(50) default 'a varchar field',
17+
# char3 text default 'a text field',
18+
19+
t.column :positive_integer, :integer, :default => 1
20+
t.column :negative_integer, :integer, :default => -1
21+
t.column :decimal_number, :decimal, :precision => 3, :scale => 2, :default => 2.78
22+
end
23+
24+
create_table :string_defaults, :force => true do |t|
25+
t.column :string_with_null_default, :string, :default => nil
26+
t.column :string_with_pretend_null_one, :string, :default => 'null'
27+
t.column :string_with_pretend_null_two, :string, :default => '(null)'
28+
t.column :string_with_pretend_null_three, :string, :default => 'NULL'
29+
t.column :string_with_pretend_null_four, :string, :default => '(NULL)'
30+
end
31+
end

0 commit comments

Comments
 (0)