Skip to content

Commit 839257f

Browse files
committed
Adding a SqlServerChronic class with :utc timezone to use for future date/time/datetime tests. Removing some old comments. One creates for FK/PK test tables.
1 parent 1c56d8c commit 839257f

File tree

2 files changed

+11
-16
lines changed

2 files changed

+11
-16
lines changed

test/cases/sqlserver_helper.rb

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,9 @@
1515
class TableWithRealColumn < ActiveRecord::Base; end
1616
class FkTestHasFk < ActiveRecord::Base ; end
1717
class FkTestHasPk < ActiveRecord::Base ; end
18+
class SqlServerChronic < ActiveRecord::Base
19+
default_timezone = :utc
20+
end
1821

1922
# Change the text database type to support ActiveRecord's tests for = on text columns which
2023
# is not supported in SQL Server text columns, so use varchar(8000) instead.

test/schema/sqlserver_specific_schema.rb

Lines changed: 8 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -5,17 +5,6 @@
55
end
66

77
create_table :defaults, :force => true do |t|
8-
# NOTE: These are the other columns from the postgresql specific schema
9-
# however, there aren't any tests for them yet, so no point creating them.
10-
# modified_date date default CURRENT_DATE,
11-
# modified_date_function date default now(),
12-
# fixed_date date default '2004-01-01',
13-
# modified_time timestamp default CURRENT_TIMESTAMP,
14-
# modified_time_function timestamp default now(),
15-
# fixed_time timestamp default '2004-01-01 00:00:00.000000-00',
16-
# char1 char(1) default 'Y',
17-
# char2 character varying(50) default 'a varchar field',
18-
# char3 text default 'a text field',
198
t.column :positive_integer, :integer, :default => 1
209
t.column :negative_integer, :integer, :default => -1
2110
t.column :decimal_number, :decimal, :precision => 3, :scale => 2, :default => 2.78
@@ -29,12 +18,15 @@
2918
t.column :string_with_pretend_null_four, :string, :default => '(NULL)'
3019
end
3120

32-
33-
create_table :fk_test_has_fks, :force => true do |t|
34-
t.integer :fk_id, :null => false
35-
end
36-
create_table :fk_test_has_pks, :force => true do |t|
21+
create_table :sql_server_chronics, :force => true do |t|
22+
t.column :date, :date
23+
t.column :time, :time
24+
t.column :datetime, :datetime
25+
t.column :timestamp, :timestamp
3726
end
27+
28+
create_table(:fk_test_has_fks, :force => true) { |t| t.column(:fk_id, :integer, :null => false) }
29+
create_table(:fk_test_has_pks, :force => true) { }
3830
execute <<-ADDFKSQL
3931
ALTER TABLE fk_test_has_fks
4032
ADD CONSTRAINT FK__fk_test_has_fk_fk_id

0 commit comments

Comments
 (0)