|
182 | 182 | end |
183 | 183 |
|
184 | 184 | 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 |
191 | 202 | 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)") |
196 | 203 | end |
197 | 204 |
|
198 | 205 | add_index(:companies, [:firm_id, :type], name: "company_include_index", include: [:name, :account_id]) |
|
0 commit comments