@@ -138,18 +138,18 @@ def test_timestamps_with_and_without_zones
138
138
end
139
139
end
140
140
141
- def test_timestamps_without_null_set_null_to_false_on_create_table
141
+ def test_timestamps_with_implicit_default_on_create_table
142
142
ActiveRecord ::Schema . define do
143
143
create_table :has_timestamps do |t |
144
144
t . timestamps
145
145
end
146
146
end
147
147
148
- assert @connection . column_exists? ( :has_timestamps , :created_at , null : false )
149
- assert @connection . column_exists? ( :has_timestamps , :updated_at , null : false )
148
+ assert @connection . column_exists? ( :has_timestamps , :created_at , precision : 6 , null : false )
149
+ assert @connection . column_exists? ( :has_timestamps , :updated_at , precision : 6 , null : false )
150
150
end
151
151
152
- def test_timestamps_without_null_set_null_to_false_on_change_table
152
+ def test_timestamps_with_implicit_default_on_change_table
153
153
ActiveRecord ::Schema . define do
154
154
create_table :has_timestamps
155
155
@@ -158,12 +158,12 @@ def test_timestamps_without_null_set_null_to_false_on_change_table
158
158
end
159
159
end
160
160
161
- assert @connection . column_exists? ( :has_timestamps , :created_at , null : false )
162
- assert @connection . column_exists? ( :has_timestamps , :updated_at , null : false )
161
+ assert @connection . column_exists? ( :has_timestamps , :created_at , precision : 6 , null : false )
162
+ assert @connection . column_exists? ( :has_timestamps , :updated_at , precision : 6 , null : false )
163
163
end
164
164
165
165
if ActiveRecord ::Base . lease_connection . supports_bulk_alter?
166
- def test_timestamps_without_null_set_null_to_false_on_change_table_with_bulk
166
+ def test_timestamps_with_implicit_default_on_change_table_with_bulk
167
167
ActiveRecord ::Schema . define do
168
168
create_table :has_timestamps
169
169
@@ -172,69 +172,18 @@ def test_timestamps_without_null_set_null_to_false_on_change_table_with_bulk
172
172
end
173
173
end
174
174
175
- assert @connection . column_exists? ( :has_timestamps , :created_at , null : false )
176
- assert @connection . column_exists? ( :has_timestamps , :updated_at , null : false )
175
+ assert @connection . column_exists? ( :has_timestamps , :created_at , precision : 6 , null : false )
176
+ assert @connection . column_exists? ( :has_timestamps , :updated_at , precision : 6 , null : false )
177
177
end
178
178
end
179
179
180
- def test_timestamps_without_null_set_null_to_false_on_add_timestamps
180
+ def test_timestamps_with_implicit_default_on_add_timestamps
181
181
ActiveRecord ::Schema . define do
182
182
create_table :has_timestamps
183
183
add_timestamps :has_timestamps , default : Time . now
184
184
end
185
185
186
- assert @connection . column_exists? ( :has_timestamps , :created_at , null : false )
187
- assert @connection . column_exists? ( :has_timestamps , :updated_at , null : false )
188
- end
189
-
190
- if supports_datetime_with_precision?
191
- def test_timestamps_sets_precision_on_create_table
192
- ActiveRecord ::Schema . define do
193
- create_table :has_timestamps do |t |
194
- t . timestamps
195
- end
196
- end
197
-
198
- assert @connection . column_exists? ( :has_timestamps , :created_at , precision : 6 , null : false )
199
- assert @connection . column_exists? ( :has_timestamps , :updated_at , precision : 6 , null : false )
200
- end
201
-
202
- def test_timestamps_sets_precision_on_change_table
203
- ActiveRecord ::Schema . define do
204
- create_table :has_timestamps
205
-
206
- change_table :has_timestamps do |t |
207
- t . timestamps default : Time . now
208
- end
209
- end
210
-
211
- assert @connection . column_exists? ( :has_timestamps , :created_at , precision : 6 , null : false )
212
- assert @connection . column_exists? ( :has_timestamps , :updated_at , precision : 6 , null : false )
213
- end
214
-
215
- if ActiveRecord ::Base . lease_connection . supports_bulk_alter?
216
- def test_timestamps_sets_precision_on_change_table_with_bulk
217
- ActiveRecord ::Schema . define do
218
- create_table :has_timestamps
219
-
220
- change_table :has_timestamps , bulk : true do |t |
221
- t . timestamps default : Time . now
222
- end
223
- end
224
-
225
- assert @connection . column_exists? ( :has_timestamps , :created_at , precision : 6 , null : false )
226
- assert @connection . column_exists? ( :has_timestamps , :updated_at , precision : 6 , null : false )
227
- end
228
- end
229
-
230
- def test_timestamps_sets_precision_on_add_timestamps
231
- ActiveRecord ::Schema . define do
232
- create_table :has_timestamps
233
- add_timestamps :has_timestamps , default : Time . now
234
- end
235
-
236
- assert @connection . column_exists? ( :has_timestamps , :created_at , precision : 6 , null : false )
237
- assert @connection . column_exists? ( :has_timestamps , :updated_at , precision : 6 , null : false )
238
- end
186
+ assert @connection . column_exists? ( :has_timestamps , :created_at , precision : 6 , null : false )
187
+ assert @connection . column_exists? ( :has_timestamps , :updated_at , precision : 6 , null : false )
239
188
end
240
189
end
0 commit comments