File tree Expand file tree Collapse file tree 1 file changed +22
-3
lines changed Expand file tree Collapse file tree 1 file changed +22
-3
lines changed Original file line number Diff line number Diff line change @@ -1300,15 +1300,34 @@ up performance but adds a risk of data loss if the database crashes. It is
1300
1300
highly recommended that you do not enable this in a production environment.
1301
1301
Defaults to ` false` in all environments.
1302
1302
1303
+ To enable this for tests:
1304
+
1305
+ ` ` ` ruby
1306
+ # config/environments/test.rb
1307
+
1308
+ ActiveSupport.on_load(:active_record_postgresqladapter) do
1309
+ self.create_unlogged_tables = true
1310
+ end
1311
+ ` ` `
1312
+
1303
1313
# ### `ActiveRecord::ConnectionAdapters::PostgreSQLAdapter.datetime_type`
1304
1314
1305
1315
Controls what native type the Active Record PostgreSQL adapter should use when you call ` datetime` in
1306
1316
a migration or schema. It takes a symbol which must correspond to one of the
1307
1317
configured ` NATIVE_DATABASE_TYPES` . The default is ` :timestamp` , meaning
1308
1318
` t.datetime` in a migration will create a " timestamp without time zone" column.
1309
- To use " timestamp with time zone" , change this to ` :timestamptz` in an
1310
- initializer. You should run ` bin/rails db:migrate` to rebuild your schema.rb
1311
- if you change this.
1319
+
1320
+ To use " timestamp with time zone" :
1321
+
1322
+ ` ` ` ruby
1323
+ # config/application.rb
1324
+
1325
+ ActiveSupport.on_load(:active_record_postgresqladapter) do
1326
+ self.datetime_type = :timestamptz
1327
+ end
1328
+ ` ` `
1329
+
1330
+ You should run ` bin/rails db:migrate` to rebuild your schema.rb if you change this.
1312
1331
1313
1332
# ### `ActiveRecord::SchemaDumper.ignore_tables`
1314
1333
You can’t perform that action at this time.
0 commit comments