|
5 | 5 | # with an explanation of why they don't work. |
6 | 6 |
|
7 | 7 | ActiveRecord::Schema.define do |
8 | | - ActiveRecord::TestCase.enable_extension!("uuid-ossp", ActiveRecord::Base.lease_connection) |
9 | | - ActiveRecord::TestCase.enable_extension!("pgcrypto", ActiveRecord::Base.lease_connection) if ActiveRecord::Base.lease_connection.supports_pgcrypto_uuid? |
| 8 | + ActiveRecord::TestCase.enable_extension!("uuid-ossp", connection) |
| 9 | + ActiveRecord::TestCase.enable_extension!("pgcrypto", connection) if connection.supports_pgcrypto_uuid? |
10 | 10 |
|
11 | 11 | uuid_default = connection.supports_pgcrypto_uuid? ? {} : { default: "uuid_generate_v4()" } |
12 | 12 |
|
|
45 | 45 | t.string :char2, limit: 50, default: "a varchar field" |
46 | 46 | t.text :char3, default: "a text field" |
47 | 47 | t.bigint :bigint_default, default: -> { "0::bigint" } |
| 48 | + t.binary :binary_default_function, default: -> { "convert_to('A', 'UTF8')" } |
48 | 49 | t.text :multiline_default, default: "--- [] |
49 | 50 |
|
50 | 51 | " |
|
177 | 178 | t.integer :position_1 |
178 | 179 | t.integer :position_2 |
179 | 180 | t.integer :position_3 |
| 181 | + t.integer :position_4 |
180 | 182 |
|
181 | | - # CockroachDB does not support deferrable, hence these three lines have been simplified. |
| 183 | + # CockroachDB does not support deferrable, hence these four lines have been simplified. |
182 | 184 | t.unique_constraint :position_1, name: "test_unique_constraints_position_1" |
183 | 185 | t.unique_constraint :position_2, name: "test_unique_constraints_position_2" |
184 | 186 | t.unique_constraint :position_3, name: "test_unique_constraints_position_3" |
| 187 | + t.unique_constraint :position_4, name: "test_unique_constraints_position_4" |
185 | 188 | end |
186 | 189 |
|
187 | 190 | if supports_partitioned_indexes? |
|
200 | 203 |
|
201 | 204 | add_index(:companies, [:firm_id, :type], name: "company_include_index", include: [:name, :account_id]) |
202 | 205 |
|
| 206 | + # In the original PostgreSQL schema, there would be a table here, populated using triggers. |
| 207 | + # This is not supported by Cockroachdb so we removed that bit. |
| 208 | + |
203 | 209 | create_table :buildings, force: true do |t| |
204 | 210 | t.st_point :coordinates, srid: 3857 |
205 | 211 | t.st_point :latlon, srid: 4326, geographic: true |
|
0 commit comments