|
1 | | -exclude :test_schema_names, "Custom schemas are not supported in CockroachDB. See https://github.com/cockroachdb/cockroach/issues/26443." |
2 | | -exclude :test_create_schema, "Custom schemas are not supported in CockroachDB. See https://github.com/cockroachdb/cockroach/issues/26443." |
3 | | -exclude :test_raise_create_schema_with_existing_schema, "Custom schemas are not supported in CockroachDB. See https://github.com/cockroachdb/cockroach/issues/26443." |
4 | | -exclude :test_drop_schema, "Custom schemas are not supported in CockroachDB. See https://github.com/cockroachdb/cockroach/issues/26443." |
5 | | -exclude :test_drop_schema_if_exists, "Custom schemas are not supported in CockroachDB. See https://github.com/cockroachdb/cockroach/issues/26443." |
6 | | -exclude :test_habtm_table_name_with_schema, "Custom schemas are not supported in CockroachDB. See https://github.com/cockroachdb/cockroach/issues/26443." |
7 | | -exclude :test_drop_schema_with_nonexisting_schema, "Custom schemas are not supported in CockroachDB. See https://github.com/cockroachdb/cockroach/issues/26443." |
8 | | -exclude :test_raise_wrapped_exception_on_bad_prepare, "Custom schemas are not supported in CockroachDB. See https://github.com/cockroachdb/cockroach/issues/26443." |
9 | | -exclude :test_schema_change_with_prepared_stmt, "Custom schemas are not supported in CockroachDB. See https://github.com/cockroachdb/cockroach/issues/26443." |
10 | | -exclude :test_data_source_exists?, "Custom schemas are not supported in CockroachDB. See https://github.com/cockroachdb/cockroach/issues/26443." |
11 | | -exclude :test_data_source_exists_when_on_schema_search_path, "Custom schemas are not supported in CockroachDB. See https://github.com/cockroachdb/cockroach/issues/26443." |
12 | | -exclude :test_data_source_exists_when_not_on_schema_search_path, "Custom schemas are not supported in CockroachDB. See https://github.com/cockroachdb/cockroach/issues/26443." |
13 | | -exclude :test_data_source_exists_wrong_schema, "Custom schemas are not supported in CockroachDB. See https://github.com/cockroachdb/cockroach/issues/26443." |
14 | | -exclude :test_data_source_exists_quoted_names, "Custom schemas are not supported in CockroachDB. See https://github.com/cockroachdb/cockroach/issues/26443." |
15 | | -exclude :test_data_source_exists_quoted_table, "Custom schemas are not supported in CockroachDB. See https://github.com/cockroachdb/cockroach/issues/26443." |
16 | | -exclude :test_with_schema_prefixed_table_name, "Custom schemas are not supported in CockroachDB. See https://github.com/cockroachdb/cockroach/issues/26443." |
17 | | -exclude :test_with_schema_prefixed_capitalized_table_name, "Custom schemas are not supported in CockroachDB. See https://github.com/cockroachdb/cockroach/issues/26443." |
18 | | -exclude :test_with_schema_search_path, "Custom schemas are not supported in CockroachDB. See https://github.com/cockroachdb/cockroach/issues/26443." |
19 | | -exclude :test_proper_encoding_of_table_name, "Custom schemas are not supported in CockroachDB. See https://github.com/cockroachdb/cockroach/issues/26443." |
20 | | -exclude :test_classes_with_qualified_schema_name, "Custom schemas are not supported in CockroachDB. See https://github.com/cockroachdb/cockroach/issues/26443." |
21 | | -exclude :test_raise_on_unquoted_schema_name, "Custom schemas are not supported in CockroachDB. See https://github.com/cockroachdb/cockroach/issues/26443." |
22 | | -exclude :test_without_schema_search_path, "Custom schemas are not supported in CockroachDB. See https://github.com/cockroachdb/cockroach/issues/26443." |
23 | | -exclude :test_ignore_nil_schema_search_path, "Custom schemas are not supported in CockroachDB. See https://github.com/cockroachdb/cockroach/issues/26443." |
24 | | -exclude :test_index_name_exists, "Custom schemas are not supported in CockroachDB. See https://github.com/cockroachdb/cockroach/issues/26443." |
25 | | -exclude :test_dump_indexes_for_schema_one, "Custom schemas are not supported in CockroachDB. See https://github.com/cockroachdb/cockroach/issues/26443." |
26 | | -exclude :test_dump_indexes_for_schema_two, "Custom schemas are not supported in CockroachDB. See https://github.com/cockroachdb/cockroach/issues/26443." |
27 | | -exclude :test_dump_indexes_for_schema_multiple_schemas_in_search_path, "Custom schemas are not supported in CockroachDB. See https://github.com/cockroachdb/cockroach/issues/26443." |
28 | | -exclude :test_dump_indexes_for_table_with_scheme_specified_in_name, "Custom schemas are not supported in CockroachDB. See https://github.com/cockroachdb/cockroach/issues/26443." |
29 | | -exclude :test_with_uppercase_index_name, "Custom schemas are not supported in CockroachDB. See https://github.com/cockroachdb/cockroach/issues/26443." |
30 | | -exclude :test_remove_index_when_schema_specified, "Custom schemas are not supported in CockroachDB. See https://github.com/cockroachdb/cockroach/issues/26443." |
31 | | -exclude :test_primary_key_with_schema_specified, "Custom schemas are not supported in CockroachDB. See https://github.com/cockroachdb/cockroach/issues/26443." |
32 | | -exclude :test_primary_key_assuming_schema_search_path, "Custom schemas are not supported in CockroachDB. See https://github.com/cockroachdb/cockroach/issues/26443." |
33 | | -exclude :test_pk_and_sequence_for_with_schema_specified, "Custom schemas are not supported in CockroachDB. See https://github.com/cockroachdb/cockroach/issues/26443." |
34 | | -exclude :test_current_schema, "Custom schemas are not supported in CockroachDB. See https://github.com/cockroachdb/cockroach/issues/26443." |
35 | | -exclude :test_prepared_statements_with_multiple_schemas, "Custom schemas are not supported in CockroachDB. See https://github.com/cockroachdb/cockroach/issues/26443." |
36 | | -exclude :test_schema_exists?, "Custom schemas are not supported in CockroachDB. See https://github.com/cockroachdb/cockroach/issues/26443." |
37 | | -exclude :test_reset_pk_sequence, "Custom schemas are not supported in CockroachDB. See https://github.com/cockroachdb/cockroach/issues/26443." |
38 | | -exclude :test_set_pk_sequence, "Custom schemas are not supported in CockroachDB. See https://github.com/cockroachdb/cockroach/issues/26443." |
| 1 | +exclude :test_set_pk_sequence, "Skipping until we can triage further. See https://github.com/cockroachdb/activerecord-cockroachdb-adapter/issues/48" |
| 2 | +exclude :test_pk_and_sequence_for_with_schema_specified, "Skipping until we can triage further. See https://github.com/cockroachdb/activerecord-cockroachdb-adapter/issues/48" |
| 3 | + |
| 4 | +# This hack allows us to redefine the |
| 5 | +# setup. We are using various weird |
| 6 | +# routes that might be simplified: |
| 7 | +# 1. We use `Ext` to prepend to the |
| 8 | +# current class to be sure `#setup` |
| 9 | +# is overriden. |
| 10 | +# 2. Current is a reference to self to |
| 11 | +# access it in `Ext` |
| 12 | +# 3. const_missing is used to avoid |
| 13 | +# having to rewrite every constant. |
| 14 | +Current = self |
| 15 | +module Ext |
| 16 | + def self.const_missing(const) |
| 17 | + Current.const_get(const) |
| 18 | + end |
| 19 | + |
| 20 | + def setup |
| 21 | + @connection = ActiveRecord::Base.connection |
| 22 | + @connection.execute "SET default_int_size = 4" |
| 23 | + @connection.execute "SET serial_normalization = sql_sequence_cached" |
| 24 | + @connection.execute "CREATE SCHEMA #{SCHEMA_NAME}" |
| 25 | + @connection.execute "CREATE TABLE #{SCHEMA_NAME}.#{TABLE_NAME} (#{COLUMNS.join(',')})" |
| 26 | + @connection.execute "CREATE TABLE #{SCHEMA_NAME}.\"#{TABLE_NAME}.table\" (#{COLUMNS.join(',')})" |
| 27 | + @connection.execute "CREATE TABLE #{SCHEMA_NAME}.\"#{CAPITALIZED_TABLE_NAME}\" (#{COLUMNS.join(',')})" |
| 28 | + @connection.execute "CREATE SCHEMA #{SCHEMA2_NAME}" |
| 29 | + @connection.execute "CREATE TABLE #{SCHEMA2_NAME}.#{TABLE_NAME} (#{COLUMNS.join(',')})" |
| 30 | + @connection.execute "CREATE INDEX #{INDEX_A_NAME} ON #{SCHEMA_NAME}.#{TABLE_NAME} USING btree (#{INDEX_A_COLUMN});" |
| 31 | + @connection.execute "CREATE INDEX #{INDEX_A_NAME} ON #{SCHEMA2_NAME}.#{TABLE_NAME} USING btree (#{INDEX_A_COLUMN});" |
| 32 | + @connection.execute "CREATE INDEX #{INDEX_B_NAME} ON #{SCHEMA_NAME}.#{TABLE_NAME} USING btree (#{INDEX_B_COLUMN_S1});" |
| 33 | + @connection.execute "CREATE INDEX #{INDEX_B_NAME} ON #{SCHEMA2_NAME}.#{TABLE_NAME} USING btree (#{INDEX_B_COLUMN_S2});" |
| 34 | + @connection.execute "CREATE INDEX #{INDEX_C_NAME} ON #{SCHEMA_NAME}.#{TABLE_NAME} USING gin (#{INDEX_C_COLUMN});" |
| 35 | + @connection.execute "CREATE INDEX #{INDEX_C_NAME} ON #{SCHEMA2_NAME}.#{TABLE_NAME} USING gin (#{INDEX_C_COLUMN});" |
| 36 | + @connection.execute "CREATE INDEX #{INDEX_D_NAME} ON #{SCHEMA_NAME}.#{TABLE_NAME} USING btree (#{INDEX_D_COLUMN} DESC);" |
| 37 | + @connection.execute "CREATE INDEX #{INDEX_D_NAME} ON #{SCHEMA2_NAME}.#{TABLE_NAME} USING btree (#{INDEX_D_COLUMN} DESC);" |
| 38 | + @connection.execute "CREATE INDEX #{INDEX_E_NAME} ON #{SCHEMA_NAME}.#{TABLE_NAME} USING gin (#{INDEX_E_COLUMN});" |
| 39 | + @connection.execute "CREATE INDEX #{INDEX_E_NAME} ON #{SCHEMA2_NAME}.#{TABLE_NAME} USING gin (#{INDEX_E_COLUMN});" |
| 40 | + @connection.execute "CREATE TABLE #{SCHEMA_NAME}.#{PK_TABLE_NAME} (id serial primary key)" |
| 41 | + @connection.execute "CREATE TABLE #{SCHEMA2_NAME}.#{PK_TABLE_NAME} (id serial primary key)" |
| 42 | + @connection.execute "CREATE SEQUENCE #{SCHEMA_NAME}.#{UNMATCHED_SEQUENCE_NAME}" |
| 43 | + @connection.execute "CREATE TABLE #{SCHEMA_NAME}.#{UNMATCHED_PK_TABLE_NAME} (id integer NOT NULL DEFAULT nextval('#{SCHEMA_NAME}.#{UNMATCHED_SEQUENCE_NAME}'::regclass), CONSTRAINT unmatched_pkey PRIMARY KEY (id))" |
| 44 | + end |
| 45 | + |
| 46 | + def teardown |
| 47 | + @connection.execute "SET default_int_size = DEFAULT" |
| 48 | + @connection.execute "SET serial_normalization = DEFAULT" |
| 49 | + super |
| 50 | + end |
| 51 | +end |
| 52 | +prepend Ext |
0 commit comments