Skip to content

Commit 5e99977

Browse files
committed
wip 3
1 parent a71fb07 commit 5e99977

File tree

1 file changed

+17
-10
lines changed

1 file changed

+17
-10
lines changed

activerecord/test/schema/postgresql_specific_schema.rb

Lines changed: 17 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -182,17 +182,24 @@
182182
end
183183

184184
if supports_partitioned_indexes?
185-
create_table(:measurements, id: false, force: true, options: "PARTITION BY LIST (city_id)") do |t|
186-
t.string :city_id, null: false
187-
t.date :logdate, null: false
188-
t.integer :peaktemp
189-
t.integer :unitsales
190-
t.index [:logdate, :city_id], unique: true
185+
begin
186+
@previous_unlogged_tables = ActiveRecord::ConnectionAdapters::PostgreSQLAdapter.create_unlogged_tables
187+
ActiveRecord::ConnectionAdapters::PostgreSQLAdapter.create_unlogged_tables = false
188+
189+
create_table(:measurements, id: false, force: true, options: "PARTITION BY LIST (city_id)") do |t|
190+
t.string :city_id, null: false
191+
t.date :logdate, null: false
192+
t.integer :peaktemp
193+
t.integer :unitsales
194+
t.index [:logdate, :city_id], unique: true
195+
end
196+
create_table(:measurements_toronto, id: false, force: true,
197+
options: "PARTITION OF measurements FOR VALUES IN (1)")
198+
create_table(:measurements_concepcion, id: false, force: true,
199+
options: "PARTITION OF measurements FOR VALUES IN (2)")
200+
ensure
201+
ActiveRecord::ConnectionAdapters::PostgreSQLAdapter.create_unlogged_tables = @previous_unlogged_tables
191202
end
192-
create_table(:measurements_toronto, id: false, force: true,
193-
options: "PARTITION OF measurements FOR VALUES IN (1)")
194-
create_table(:measurements_concepcion, id: false, force: true,
195-
options: "PARTITION OF measurements FOR VALUES IN (2)")
196203
end
197204

198205
add_index(:companies, [:firm_id, :type], name: "company_include_index", include: [:name, :account_id])

0 commit comments

Comments
 (0)