activerecord-cockroachdb-adapter 8.0.2 → 8.1.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (239) hide show
  1. checksums.yaml +4 -4
  2. data/CHANGELOG.md +7 -0
  3. data/CONTRIBUTING.md +10 -17
  4. data/Gemfile +2 -1
  5. data/Rakefile +0 -19
  6. data/lib/active_record/connection_adapters/cockroachdb/column.rb +66 -24
  7. data/lib/active_record/connection_adapters/cockroachdb/database_statements.rb +13 -3
  8. data/lib/active_record/connection_adapters/cockroachdb/database_tasks.rb +1 -1
  9. data/lib/active_record/connection_adapters/cockroachdb/oid/spatial.rb +34 -19
  10. data/lib/active_record/connection_adapters/cockroachdb/quoting.rb +19 -3
  11. data/lib/active_record/connection_adapters/cockroachdb/referential_integrity.rb +87 -55
  12. data/lib/active_record/connection_adapters/cockroachdb/schema_statements.rb +181 -102
  13. data/lib/active_record/connection_adapters/cockroachdb_adapter.rb +42 -25
  14. data/lib/version.rb +1 -1
  15. data/test/cases/adapter_test.rb +98 -0
  16. data/test/cases/adapters/cockroachdb/referential_integrity_test.rb +51 -0
  17. data/test/cases/adapters/postgresql/active_schema_test.rb +71 -0
  18. data/test/cases/adapters/postgresql/change_schema_test.rb +75 -0
  19. data/test/cases/adapters/postgresql/connection_test.rb +46 -0
  20. data/test/cases/adapters/postgresql/ddl_test.rb +326 -0
  21. data/test/cases/adapters/postgresql/interval_test.rb +131 -0
  22. data/test/cases/adapters/postgresql/nested_class_test.rb +22 -0
  23. data/test/cases/adapters/postgresql/numeric_test.rb +28 -0
  24. data/test/cases/adapters/postgresql/postgis_test.rb +185 -0
  25. data/test/cases/adapters/postgresql/postgresql_adapter_test.rb +115 -0
  26. data/test/cases/adapters/postgresql/quoting_test.rb +30 -0
  27. data/test/cases/adapters/postgresql/schema_statements_test.rb +29 -0
  28. data/test/cases/adapters/postgresql/serial_test.rb +199 -0
  29. data/test/cases/adapters/postgresql/spatial_queries_test.rb +118 -0
  30. data/test/cases/adapters/postgresql/spatial_setup_test.rb +18 -0
  31. data/test/cases/adapters/postgresql/spatial_type_test.rb +41 -0
  32. data/test/cases/adapters/postgresql/timestamp_test.rb +58 -0
  33. data/test/cases/adapters/postgresql/virtual_column_test.rb +39 -0
  34. data/test/cases/associations/eager_load_nested_include_test.rb +111 -0
  35. data/test/cases/associations/left_outer_join_association_test.rb +30 -0
  36. data/test/cases/associations_test.rb +108 -0
  37. data/test/cases/base_test.rb +31 -0
  38. data/test/cases/comment_test.rb +75 -0
  39. data/test/cases/connection_adapters/type_test.rb +28 -0
  40. data/test/cases/database_configurations/resolver_test.rb +24 -0
  41. data/test/cases/defaults_test.rb +45 -0
  42. data/test/cases/dirty_test.rb +24 -0
  43. data/test/cases/fixtures_test.rb +541 -0
  44. data/test/cases/helper_cockroachdb.rb +232 -0
  45. data/test/cases/inheritance_test.rb +42 -0
  46. data/test/cases/invertible_migration_test.rb +73 -0
  47. data/test/cases/marshal_serialization_test.rb +45 -0
  48. data/test/cases/migration/change_schema_test.rb +140 -0
  49. data/test/cases/migration/check_constraint_test.rb +125 -0
  50. data/test/cases/migration/columns_test.rb +50 -0
  51. data/test/cases/migration/create_join_table_test.rb +66 -0
  52. data/test/cases/migration/foreign_key_test.rb +390 -0
  53. data/test/cases/migration/hidden_column_test.rb +70 -0
  54. data/test/cases/migration/references_foreign_key_test.rb +124 -0
  55. data/test/cases/migration_test.rb +120 -0
  56. data/test/cases/persistence_test.rb +33 -0
  57. data/test/cases/primary_keys_test.rb +134 -0
  58. data/test/cases/relation/aost_test.rb +57 -0
  59. data/test/cases/relation/or_test.rb +26 -0
  60. data/test/cases/relation/table_hints_test.rb +124 -0
  61. data/test/cases/relation_test.rb +26 -0
  62. data/test/cases/relations_test.rb +29 -0
  63. data/test/cases/schema_dumper_test.rb +221 -0
  64. data/test/cases/show_create_test.rb +14 -0
  65. data/test/cases/strict_loading_test.rb +34 -0
  66. data/test/cases/tasks/cockroachdb_rake_test.rb +113 -0
  67. data/test/cases/test_fixtures_test.rb +57 -0
  68. data/test/cases/transactions_test.rb +51 -0
  69. data/test/cases/unsafe_raw_sql_test.rb +22 -0
  70. data/test/config.yml +23 -0
  71. data/test/excludes/ActiveRecord/AdapterTest.rb +3 -0
  72. data/test/excludes/ActiveRecord/AdapterTestWithoutTransaction.rb +25 -0
  73. data/test/excludes/ActiveRecord/ConnectionAdapters/PoolConfig/ResolverTest.rb +1 -0
  74. data/test/excludes/ActiveRecord/ConnectionAdapters/PostgreSQLAdapter/BindParameterTest.rb +15 -0
  75. data/test/excludes/ActiveRecord/ConnectionAdapters/PostgreSQLAdapter/QuotingTest.rb +22 -0
  76. data/test/excludes/ActiveRecord/ConnectionAdapters/PostgreSQLAdapterPreventWritesLegacyTest.rb +1 -0
  77. data/test/excludes/ActiveRecord/ConnectionAdapters/PostgreSQLAdapterPreventWritesTest.rb +1 -0
  78. data/test/excludes/ActiveRecord/ConnectionAdapters/PostgreSQLAdapterTest.rb +40 -0
  79. data/test/excludes/ActiveRecord/ConnectionAdapters/RegistrationIsolatedTest.rb +14 -0
  80. data/test/excludes/ActiveRecord/Encryption/EncryptionPerformanceTest.rb +1 -0
  81. data/test/excludes/ActiveRecord/Encryption/EnvelopeEncryptionPerformanceTest.rb +1 -0
  82. data/test/excludes/ActiveRecord/Encryption/ExtendedDeterministicQueriesPerformanceTest.rb +1 -0
  83. data/test/excludes/ActiveRecord/Encryption/StoragePerformanceTest.rb +2 -0
  84. data/test/excludes/ActiveRecord/InstrumentationTest.rb +16 -0
  85. data/test/excludes/ActiveRecord/InvertibleMigrationTest.rb +2 -0
  86. data/test/excludes/ActiveRecord/Migration/ChangeSchemaTest.rb +7 -0
  87. data/test/excludes/ActiveRecord/Migration/CheckConstraintTest.rb +6 -0
  88. data/test/excludes/ActiveRecord/Migration/ColumnsTest.rb +4 -0
  89. data/test/excludes/ActiveRecord/Migration/CompatibilityTest.rb +50 -0
  90. data/test/excludes/ActiveRecord/Migration/CompositeForeignKeyTest.rb +2 -0
  91. data/test/excludes/ActiveRecord/Migration/CreateJoinTableTest.rb +2 -0
  92. data/test/excludes/ActiveRecord/Migration/ForeignKeyInCreateTest.rb +1 -0
  93. data/test/excludes/ActiveRecord/Migration/ForeignKeyTest.rb +35 -0
  94. data/test/excludes/ActiveRecord/Migration/InvalidOptionsTest.rb +14 -0
  95. data/test/excludes/ActiveRecord/Migration/PGChangeSchemaTest.rb +8 -0
  96. data/test/excludes/ActiveRecord/Migration/ReferencesForeignKeyTest.rb +7 -0
  97. data/test/excludes/ActiveRecord/Migration/ReferencesIndexTest.rb +7 -0
  98. data/test/excludes/ActiveRecord/Migration/ReferencesStatementsTest.rb +3 -0
  99. data/test/excludes/ActiveRecord/MysqlDBCreateWithInvalidPermissionsTest.rb +1 -0
  100. data/test/excludes/ActiveRecord/OrTest.rb +1 -0
  101. data/test/excludes/ActiveRecord/PostgreSQLStructureDumpTest.rb +10 -0
  102. data/test/excludes/ActiveRecord/PostgresqlConnectionTest.rb +12 -0
  103. data/test/excludes/ActiveRecord/PostgresqlTransactionNestedTest.rb +14 -0
  104. data/test/excludes/ActiveRecord/PostgresqlTransactionTest.rb +4 -0
  105. data/test/excludes/ActiveRecord/RelationTest.rb +2 -0
  106. data/test/excludes/ActiveRecord/TooManyOrTest.rb +1 -0
  107. data/test/excludes/ActiveSupportSubclassWithFixturesTest.rb +1 -0
  108. data/test/excludes/AssociationDeprecationTest/NotifyModeTest.rb +2 -0
  109. data/test/excludes/AssociationDeprecationTest/RaiseBacktraceModeTest.rb +2 -0
  110. data/test/excludes/AssociationDeprecationTest/RaiseModeTest.rb +2 -0
  111. data/test/excludes/AssociationDeprecationTest/WarnBacktraceModeTest.rb +2 -0
  112. data/test/excludes/AssociationDeprecationTest/WarnModeTest.rb +2 -0
  113. data/test/excludes/AssociationDeprecationTest/fix_backtrace_cleaner.rb +10 -0
  114. data/test/excludes/BasicsTest.rb +1 -0
  115. data/test/excludes/BulkAlterTableMigrationsTest.rb +7 -0
  116. data/test/excludes/CalculationsTest.rb +4 -0
  117. data/test/excludes/CommentTest.rb +2 -0
  118. data/test/excludes/CoreTest.rb +1 -0
  119. data/test/excludes/CreateOrFindByWithinTransactions.rb +3 -0
  120. data/test/excludes/DefaultsUsingMultipleSchemasAndDomainTest.rb +7 -0
  121. data/test/excludes/DirtyTest.rb +3 -0
  122. data/test/excludes/EachTest.rb +8 -0
  123. data/test/excludes/EagerLoadPolyAssocsTest.rb +1 -0
  124. data/test/excludes/ExplicitlyNamedIndexMigrationTest.rb +1 -0
  125. data/test/excludes/FixturesResetPkSequenceTest.rb +3 -0
  126. data/test/excludes/FixturesTest.rb +21 -0
  127. data/test/excludes/FixturesWithForeignKeyViolationsTest.rb +2 -0
  128. data/test/excludes/ForeignTableTest.rb +10 -0
  129. data/test/excludes/InheritanceComputeTypeTest.rb +1 -0
  130. data/test/excludes/LeftOuterJoinAssociationTest.rb +2 -0
  131. data/test/excludes/LegacyPrimaryKeyTest/V4_2.rb +6 -0
  132. data/test/excludes/LegacyPrimaryKeyTest/V5_0.rb +6 -0
  133. data/test/excludes/MarshalSerializationTest.rb +4 -0
  134. data/test/excludes/MaterializedViewTest.rb +13 -0
  135. data/test/excludes/MigrationTest.rb +2 -0
  136. data/test/excludes/MultiDbMigratorTest.rb +2 -0
  137. data/test/excludes/NestedRelationScopingTest.rb +1 -0
  138. data/test/excludes/OrTest.rb +1 -0
  139. data/test/excludes/PersistenceTest.rb +3 -0
  140. data/test/excludes/PessimisticLockingTest.rb +1 -0
  141. data/test/excludes/PostgreSQLExplainTest.rb +7 -0
  142. data/test/excludes/PostgreSQLGeometricLineTest.rb +3 -0
  143. data/test/excludes/PostgreSQLGeometricTypesTest.rb +7 -0
  144. data/test/excludes/PostgreSQLPartitionsTest.rb +1 -0
  145. data/test/excludes/PostgreSQLReferentialIntegrityTest.rb +14 -0
  146. data/test/excludes/PostgresqlArrayTest.rb +21 -0
  147. data/test/excludes/PostgresqlBigSerialTest.rb +7 -0
  148. data/test/excludes/PostgresqlBitStringTest.rb +2 -0
  149. data/test/excludes/PostgresqlByteaTest.rb +1 -0
  150. data/test/excludes/PostgresqlCitextTest.rb +7 -0
  151. data/test/excludes/PostgresqlCollationTest.rb +5 -0
  152. data/test/excludes/PostgresqlCompositeTest.rb +2 -0
  153. data/test/excludes/PostgresqlCompositeWithCustomOIDTest.rb +2 -0
  154. data/test/excludes/PostgresqlDataTypeTest.rb +9 -0
  155. data/test/excludes/PostgresqlDefaultExpressionTest.rb +1 -0
  156. data/test/excludes/PostgresqlDeferredConstraintsTest.rb +3 -0
  157. data/test/excludes/PostgresqlDomainTest.rb +2 -0
  158. data/test/excludes/PostgresqlExtensionMigrationTest.rb +5 -0
  159. data/test/excludes/PostgresqlFullTextTest.rb +3 -0
  160. data/test/excludes/PostgresqlGeometricTest.rb +4 -0
  161. data/test/excludes/PostgresqlHstoreTest.rb +45 -0
  162. data/test/excludes/PostgresqlInfinityTest.rb +5 -0
  163. data/test/excludes/PostgresqlIntervalTest.rb +1 -0
  164. data/test/excludes/PostgresqlJSONBTest.rb +27 -0
  165. data/test/excludes/PostgresqlJSONTest.rb +27 -0
  166. data/test/excludes/PostgresqlLtreeTest.rb +4 -0
  167. data/test/excludes/PostgresqlMoneyTest.rb +12 -0
  168. data/test/excludes/PostgresqlNetworkTest.rb +69 -0
  169. data/test/excludes/PostgresqlNumberTest.rb +1 -0
  170. data/test/excludes/PostgresqlPointTest.rb +15 -0
  171. data/test/excludes/PostgresqlRangeTest.rb +3 -0
  172. data/test/excludes/PostgresqlRenameTableTest.rb +2 -0
  173. data/test/excludes/PostgresqlSerialTest.rb +7 -0
  174. data/test/excludes/PostgresqlTimestampFixtureTest.rb +2 -0
  175. data/test/excludes/PostgresqlTimestampMigrationTest.rb +3 -0
  176. data/test/excludes/PostgresqlTypeLookupTest.rb +2 -0
  177. data/test/excludes/PostgresqlUUIDGenerationTest.rb +7 -0
  178. data/test/excludes/PostgresqlUUIDTest.rb +1 -0
  179. data/test/excludes/PostgresqlVirtualColumnTest.rb +17 -0
  180. data/test/excludes/PostgresqlXMLTest.rb +5 -0
  181. data/test/excludes/PrimaryKeyIntegerNilDefaultTest.rb +1 -0
  182. data/test/excludes/PrimaryKeyIntegerTest.rb +3 -0
  183. data/test/excludes/PrimaryKeysTest.rb +2 -0
  184. data/test/excludes/RelationMergingTest.rb +15 -0
  185. data/test/excludes/RelationTest.rb +3 -0
  186. data/test/excludes/ReservedWordsMigrationTest.rb +1 -0
  187. data/test/excludes/SameNameDifferentDatabaseFixturesTest.rb +1 -0
  188. data/test/excludes/SanitizeTest.rb +13 -0
  189. data/test/excludes/SchemaAuthorizationTest.rb +8 -0
  190. data/test/excludes/SchemaCreateTableOptionsTest.rb +2 -0
  191. data/test/excludes/SchemaDumperDefaultsTest.rb +1 -0
  192. data/test/excludes/SchemaDumperTest.rb +11 -0
  193. data/test/excludes/SchemaForeignKeyTest.rb +1 -0
  194. data/test/excludes/SchemaIndexNullsOrderTest.rb +2 -0
  195. data/test/excludes/SchemaIndexOpclassTest.rb +3 -0
  196. data/test/excludes/SchemaTest.rb +49 -0
  197. data/test/excludes/SequenceNameDetectionTestCases/CollidedSequenceNameTest.rb +1 -0
  198. data/test/excludes/SequenceNameDetectionTestCases/LongerSequenceNameDetectionTest.rb +1 -0
  199. data/test/excludes/StrictLoadingFixturesTest.rb +1 -0
  200. data/test/excludes/TestFixturesTest.rb +1 -0
  201. data/test/excludes/TransactionInstrumentationTest.rb +1 -0
  202. data/test/excludes/TransactionIsolationTest.rb +1 -0
  203. data/test/excludes/TypeTest.rb +1 -0
  204. data/test/excludes/UniquenessValidationTest.rb +2 -0
  205. data/test/excludes/UnloggedTablesTest.rb +3 -0
  206. data/test/excludes/UnsafeRawSqlTest.rb +2 -0
  207. data/test/excludes/UpdateableViewTest.rb +5 -0
  208. data/test/excludes/WithAnnotationsTest.rb +6 -0
  209. data/test/models/building.rb +4 -0
  210. data/test/models/spatial_model.rb +5 -0
  211. data/test/schema/cockroachdb_specific_schema.rb +218 -0
  212. data/test/support/copy_cat.rb +83 -0
  213. data/test/support/exclude_from_transactional_tests.rb +33 -0
  214. data/test/support/paths_cockroachdb.rb +46 -0
  215. data/test/support/rake_helpers.rb +37 -0
  216. data/test/support/sql_logger.rb +55 -0
  217. data/test/support/template_creator.rb +114 -0
  218. metadata +422 -34
  219. data/.editorconfig +0 -7
  220. data/.github/issue_template.md +0 -46
  221. data/.github/reproduction_scripts/migrations.rb +0 -60
  222. data/.github/reproduction_scripts/models_and_database.rb +0 -49
  223. data/.github/workflows/ci.yml +0 -96
  224. data/.github/workflows/docker.yml +0 -57
  225. data/.gitignore +0 -18
  226. data/.gitmodules +0 -0
  227. data/activerecord-cockroachdb-adapter.gemspec +0 -38
  228. data/bin/console +0 -36
  229. data/bin/console_schemas/default.rb +0 -11
  230. data/bin/console_schemas/schemas.rb +0 -23
  231. data/bin/setup +0 -8
  232. data/bin/start-cockroachdb +0 -33
  233. data/build/Dockerfile +0 -14
  234. data/build/config.teamcity.yml +0 -31
  235. data/build/local-test.sh +0 -32
  236. data/build/teamcity-test.sh +0 -76
  237. data/docker.sh +0 -35
  238. data/lib/active_record/connection_adapters/cockroachdb/spatial_column_info.rb +0 -60
  239. data/setup.sql +0 -18
@@ -0,0 +1,14 @@
1
+ exclude "test_#resolve_raises_if_the_adapter_is_using_the_pre_7.2_adapter_registration_API", "One adapter is missing in the test, added below"
2
+
3
+ test "#resolve raises if the adapter is using the pre 7.2 adapter registration API with CRDB" do
4
+ exception = assert_raises(ActiveRecord::AdapterNotFound) do
5
+ ActiveRecord::ConnectionAdapters.resolve("fake_legacy")
6
+ end
7
+
8
+ assert_equal(
9
+ "Database configuration specifies nonexistent 'fake_legacy' adapter. Available adapters are: abstract, cockroachdb, fake, mysql2, postgresql, sqlite3, trilogy. Ensure that the adapter is spelled correctly in config/database.yml and that you've added the necessary adapter gem to your Gemfile if it's not in the list of available adapters.",
10
+ exception.message
11
+ )
12
+ ensure
13
+ ActiveRecord::ConnectionAdapters.instance_variable_get(:@adapters).delete("fake_legacy")
14
+ end
@@ -0,0 +1 @@
1
+ exclude :test_reading_an_encrypted_attribute_multiple_times_is_as_fast_as_reading_a_regular_attribute, "Test is flaky and tests an internal rails feature"
@@ -0,0 +1 @@
1
+ exclude :test_performance_when_saving_records, "Test is flaky and tests an internal rails feature"
@@ -0,0 +1 @@
1
+ exclude "test_finding_without_prepared_statement_caching_by_encrypted_columns_(deterministic)", "Test is flaky and tests an internal rails feature"
@@ -0,0 +1,2 @@
1
+ exclude :test_storage_overload_storing_keys_is_acceptable_for_EnvelopeEncryptionKeyProvider, "Test is flaky and tests an internal rails feature"
2
+ exclude :test_storage_overload_storing_keys_is_acceptable_for_DerivedSecretKeyProvider, "Test is flaky and tests an internal rails feature"
@@ -0,0 +1,16 @@
1
+ require "support/copy_cat"
2
+
3
+ # We override this test since in our codebase, there is a SCHEMA call
4
+ # made with `SHOW max_identifier_length`.
5
+ # TODO: We should however inspect why that is.
6
+ #
7
+ # See https://github.com/cockroachdb/activerecord-cockroachdb-adapter/issues/392
8
+ #
9
+ # From: notification.first
10
+ # To: notification.last
11
+ CopyCat.copy_methods(self, self, :test_payload_name_on_eager_load) do
12
+ def on_send(node)
13
+ return super unless node in [:send, [:lvar, :notification], :first]
14
+ replace(node.loc.expression, "notification.last")
15
+ end
16
+ end
@@ -0,0 +1,2 @@
1
+ exclude :test_migrate_enable_and_disable_extension, "CockroachDB doesn't support enabling/disabling extensions."
2
+ exclude :test_migrate_revert_change_column_default, "The test fails because type information is stripped from string column default values when the default is changed in the database. Possibly caused by https://github.com/cockroachdb/cockroach/issues/47285."
@@ -0,0 +1,7 @@
1
+ exclude :test_change_column_quotes_column_names, "This functionality is not yet implemented in CockroachDB. See https://github.com/cockroachdb/cockroach/issues/9851"
2
+ exclude :test_create_table_without_id, "Tables cannot be created without a pk in CockroachDB"
3
+ exclude :test_create_table_with_limits, "The only assertion that fails is on the default sql_type; this is bigint instead of integer in CockroachDB"
4
+ exclude :test_add_column_with_primary_key_attribute, "PK can be re-assigned to a new column, but it must be done in a separate statement. In other words, the target column must already exist. See https://www.cockroachlabs.com/docs/v20.1/alter-primary-key.html"
5
+ exclude :test_drop_table_if_exists, "It's not possible to check for the result of an operation in the same txn as which the operation is performed"
6
+ exclude :test_change_column_null, "It's not possible to check for the result of an operation in the same txn as which the operation is performed"
7
+ exclude :test_keeping_default_and_notnull_constraints_on_change, "It's not possible to check for the result of an operation in the same txn as which the operation is performed"
@@ -0,0 +1,6 @@
1
+ exclude :test_validate_check_constraint_by_name, "This test is failing with transactions due to cockroachdb/cockroach#19444"
2
+ exclude :test_remove_check_constraint, "This test is failing with transactions due to cockroachdb/cockroach#19444"
3
+ exclude :test_check_constraints, "Re-implementing because some constraints are now written in parenthesis"
4
+ exclude :test_add_check_constraint, "Re-implementing because some constraints are now written in parenthesis"
5
+ exclude :test_schema_dumping_with_validate_false, "Re-implementing because some constraints are now written in parenthesis"
6
+ exclude :test_schema_dumping_with_validate_true, "Re-implementing because some constraints are now written in parenthesis"
@@ -0,0 +1,4 @@
1
+ exclude :test_change_column, "This operation is not currently supported in CockroachDB, see cockroachdb/cockroach#9851"
2
+ exclude :test_change_column_default, "This test fails because type information is stripped from string column default values when the default is changed in the database. Possibly caused by https://github.com/cockroachdb/cockroach/issues/47285."
3
+ exclude :test_change_column_default_with_from_and_to, "This test fails because type information is stripped from string column default values when the default is changed in the database. Possibly caused by https://github.com/cockroachdb/cockroach/issues/47285."
4
+ exclude :test_remove_column_with_multi_column_index, "This test fails because it lacks the requisite CASCADE clause to fully remove the column"
@@ -0,0 +1,50 @@
1
+ exclude :test_legacy_change_column_with_null_executes_update, "Skipping until we can triage further. See https://github.com/cockroachdb/activerecord-cockroachdb-adapter/issues/48"
2
+ exclude :test_legacy_add_foreign_key_with_deferrable_true, "CRDB does not support DEFERRABLE constraints"
3
+ exclude :test_disable_extension_on_7_0, "CRDB does not support enabling/disabling extensions."
4
+
5
+ # exclude :test_add_index_errors_on_too_long_name_7_0, "The max length in CRDB is 128, not 64."
6
+ # exclude :test_create_table_add_index_errors_on_too_long_name_7_0, "The max length in CRDB is 128, not 64."
7
+
8
+ require "support/copy_cat"
9
+
10
+ CopyCat.copy_methods(self, self,
11
+ :test_add_index_errors_on_too_long_name_7_0,
12
+ :test_create_table_add_index_errors_on_too_long_name_7_0
13
+ ) do
14
+ def on_sym(node)
15
+ return unless node.children[0] == :very_long_column_name_to_test_with
16
+
17
+ insert_after(node.loc.expression, "_and_actually_way_longer_because_cockroach_is_in_the_128_game")
18
+ end
19
+ end
20
+
21
+ # CockroachDB does not support DDL transactions. Hence the migration is
22
+ # not rolled back and the already removed index is not restored.
23
+ #
24
+ # From:
25
+ # if current_adapter?(:PostgreSQLAdapter, :SQLite3Adapter)
26
+ # assert_equal 2, foreign_keys.size
27
+ # else
28
+ # assert_equal 1, foreign_keys.size
29
+ # end
30
+ # To:
31
+ # assert_equal 1, foreign_keys.size
32
+ CopyCat.copy_methods(self, self, :test_remove_foreign_key_on_8_0) do
33
+ def on_if(node)
34
+ return unless node in
35
+ [:if,
36
+ [:send, nil, :current_adapter?,
37
+ [:sym, :PostgreSQLAdapter],
38
+ [:sym, :SQLite3Adapter]],
39
+ [:send, nil, :assert_equal,
40
+ [:int, 2],
41
+ [:send,
42
+ [:lvar, :foreign_keys], :size]],
43
+ [:send, nil, :assert_equal,
44
+ [:int, 1],
45
+ [:send,
46
+ [:lvar, :foreign_keys], :size]] => else_block]
47
+
48
+ replace(node.loc.expression, else_block.location.expression.source)
49
+ end
50
+ end
@@ -0,0 +1,2 @@
1
+ exclude :test_add_composite_foreign_key_raises_without_options, "Updated regexp to remove quotes"
2
+ exclude :test_schema_dumping, ExcludeMessage::VALIDATE_BUG
@@ -0,0 +1,2 @@
1
+ exclude :test_create_join_table_with_index, "Results of an operation cannot be accessed prior to completion of that operation's transaction. See https://www.cockroachlabs.com/docs/v19.2/architecture/transaction-layer.html#transaction-conflicts"
2
+ exclude :test_create_and_drop_join_table_with_common_prefix, "Results of an operation cannot be accessed prior to completion of that operation's transaction. See https://www.cockroachlabs.com/docs/v19.2/architecture/transaction-layer.html#transaction-conflicts"
@@ -0,0 +1 @@
1
+ exclude :test_foreign_keys, "Skipping until we can triage further. See https://github.com/cockroachdb/activerecord-cockroachdb-adapter/issues/48"
@@ -0,0 +1,35 @@
1
+ exclude :test_add_foreign_key_inferes_column, "This test fails due to the transactional nature of the test. Disabling transactions will make the test pass."
2
+ exclude :test_add_foreign_key_with_column, "This test fails due to the transactional nature of the test. Disabling transactions will make the test pass."
3
+ exclude :test_add_on_delete_restrict_foreign_key, "This test fails due to the transactional nature of the test. Disabling transactions will make the test pass."
4
+ exclude :test_add_on_delete_cascade_foreign_key, "This test fails due to the transactional nature of the test. Disabling transactions will make the test pass."
5
+ exclude :test_add_on_delete_nullify_foreign_key, "This test fails due to the transactional nature of the test. Disabling transactions will make the test pass."
6
+ exclude :test_add_foreign_key_with_on_update, "This test fails due to the transactional nature of the test. Disabling transactions will make the test pass."
7
+ exclude :test_foreign_key_exists, "This test fails due to the transactional nature of the test. Disabling transactions will make the test pass."
8
+ exclude :test_foreign_key_exists_by_column, "This test fails due to the transactional nature of the test. Disabling transactions will make the test pass."
9
+ exclude :test_foreign_key_exists_by_name, "This test fails due to the transactional nature of the test. Disabling transactions will make the test pass."
10
+ exclude :test_remove_foreign_key_inferes_column, "This test fails due to the transactional nature of the test. Disabling transactions will make the test pass."
11
+ exclude :test_remove_foreign_key_by_column, "This test fails due to the transactional nature of the test. Disabling transactions will make the test pass."
12
+ exclude :test_remove_foreign_key_by_symbol_column, "This test fails due to the transactional nature of the test. Disabling transactions will make the test pass."
13
+ exclude :test_remove_foreign_key_by_name, "This test fails due to the transactional nature of the test. Disabling transactions will make the test pass."
14
+ exclude :test_add_invalid_foreign_key, "This test fails due to the transactional nature of the test. Disabling transactions will make the test pass."
15
+ exclude :test_validate_foreign_key_infers_column, "This test fails due to the transactional nature of the test. Disabling transactions will make the test pass."
16
+ exclude :test_validate_foreign_key_by_column, "This test fails due to the transactional nature of the test. Disabling transactions will make the test pass."
17
+ exclude :test_validate_foreign_key_by_symbol_column, "This test fails due to the transactional nature of the test. Disabling transactions will make the test pass."
18
+ exclude :test_validate_foreign_key_by_name, "This test fails due to the transactional nature of the test. Disabling transactions will make the test pass."
19
+ exclude :test_validate_constraint_by_name, "This test fails due to the transactional nature of the test. Disabling transactions will make the test pass."
20
+ exclude :test_schema_dumping, "This test fails due to the transactional nature of the test. Disabling transactions will make the test pass."
21
+ exclude :test_schema_dumping_on_delete_and_on_update_options, ExcludeMessage::VALIDATE_BUG
22
+ exclude :test_schema_dumping_with_validate_false, ExcludeMessage::VALIDATE_BUG
23
+ exclude :test_schema_dumping_with_validate_true, ExcludeMessage::VALIDATE_BUG
24
+ exclude :test_schema_dumping_with_custom_fk_ignore_pattern, ExcludeMessage::VALIDATE_BUG
25
+ exclude :test_add_foreign_key_is_reversible, "This test fails due to the transactional nature of the test. Disabling transactions will make the test pass."
26
+ exclude :test_foreign_key_constraint_is_not_cached_incorrectly, "This test fails due to the transactional nature of the test. Disabling transactions will make the test pass."
27
+ exclude :test_add_foreign_key_with_prefix, "This test fails due to the transactional nature of the test. Disabling transactions will make the test pass."
28
+ exclude :test_add_foreign_key_with_suffix, "This test fails due to the transactional nature of the test. Disabling transactions will make the test pass."
29
+ exclude :test_foreign_keys, "Skipping until we can triage further. See https://github.com/cockroachdb/activerecord-cockroachdb-adapter/issues/48"
30
+ exclude :test_schema_dumping_with_options, "Skipping until we can triage further. See https://github.com/cockroachdb/activerecord-cockroachdb-adapter/issues/48"
31
+ exclude :test_remove_foreign_key_by_the_select_one_on_the_same_table, "This test fails due to the transactional nature of the test. Disabling transactions will make the test pass."
32
+ exclude :test_remove_foreign_key_with_if_exists_not_set, "This test fails due to the transactional nature of the test. Disabling transactions will make the test pass."
33
+ exclude :test_remove_foreign_key_with_if_exists_set, "This test fails due to the transactional nature of the test. Disabling transactions will make the test pass."
34
+ exclude :test_add_foreign_key_with_if_not_exists_not_set, "This test fails due to the transactional nature of the test. Disabling transactions will make the test pass."
35
+ exclude :test_add_foreign_key_with_if_not_exists_set, "This test fails due to the transactional nature of the test. Disabling transactions will make the test pass."
@@ -0,0 +1,14 @@
1
+ module Ext
2
+ def invalid_add_column_option_exception_message(key)
3
+ default_keys = [":limit", ":precision", ":scale", ":default", ":null", ":collation", ":comment", ":primary_key", ":if_exists", ":if_not_exists"]
4
+
5
+ # PostgreSQL specific options
6
+ default_keys.concat([":array", ":using", ":cast_as", ":as", ":type", ":enum_type", ":stored"])
7
+
8
+ # CockroachDB specific options
9
+ default_keys.concat([":srid", ":has_z", ":has_m", ":geographic", ":spatial_type", ":hidden"])
10
+
11
+ "Unknown key: :#{key}. Valid keys are: #{default_keys.join(", ")}"
12
+ end
13
+ end
14
+ prepend Ext
@@ -0,0 +1,8 @@
1
+ exclude :test_change_string_to_date, "Changing column data types is not supported in a transaction in CockroachDB. See https://github.com/cockroachdb/cockroach/issues/9851."
2
+ exclude :test_change_type_with_symbol, "Changing column data types is not supported in a transaction in CockroachDB. See https://github.com/cockroachdb/cockroach/issues/9851."
3
+ exclude :test_change_type_with_symbol_with_timestamptz, "Changing column data types is not supported in a transaction in CockroachDB. See https://github.com/cockroachdb/cockroach/issues/9851."
4
+ exclude :test_change_type_with_symbol_using_datetime, "Changing column data types is not supported in a transaction in CockroachDB. See https://github.com/cockroachdb/cockroach/issues/9851."
5
+ exclude :test_change_type_with_symbol_using_timestamp_with_timestamptz_as_default, "Changing column data types is not supported in a transaction in CockroachDB. See https://github.com/cockroachdb/cockroach/issues/9851."
6
+ exclude :test_change_type_with_symbol_with_timestamptz_as_default, "Changing column data types is not supported in a transaction in CockroachDB. See https://github.com/cockroachdb/cockroach/issues/9851."
7
+ exclude :test_change_type_with_symbol_using_datetime_with_timestamptz_as_default, "Changing column data types is not supported in a transaction in CockroachDB. See https://github.com/cockroachdb/cockroach/issues/9851."
8
+ exclude :test_change_type_with_array, "Changing column data types is not supported in a transaction in CockroachDB. See https://github.com/cockroachdb/cockroach/issues/9851."
@@ -0,0 +1,7 @@
1
+ exclude :test_foreign_keys_can_be_created_while_changing_the_table, "Results of an operation cannot be accessed prior to completion of that operation's transaction. See https://www.cockroachlabs.com/docs/v19.2/architecture/transaction-layer.html#transaction-conflicts"
2
+ exclude :test_foreign_keys_accept_options_when_changing_the_table, "Results of an operation cannot be accessed prior to completion of that operation's transaction. See https://www.cockroachlabs.com/docs/v19.2/architecture/transaction-layer.html#transaction-conflicts"
3
+ exclude :test_foreign_key_column_can_be_removed, "Results of an operation cannot be accessed prior to completion of that operation's transaction. See https://www.cockroachlabs.com/docs/v19.2/architecture/transaction-layer.html#transaction-conflicts"
4
+ exclude :test_removing_column_removes_foreign_key, "Results of an operation cannot be accessed prior to completion of that operation's transaction. See https://www.cockroachlabs.com/docs/v19.2/architecture/transaction-layer.html#transaction-conflicts"
5
+ exclude :test_foreign_key_methods_respect_pluralize_table_names, "Results of an operation cannot be accessed prior to completion of that operation's transaction. See https://www.cockroachlabs.com/docs/v19.2/architecture/transaction-layer.html#transaction-conflicts"
6
+ exclude :test_multiple_foreign_keys_can_be_removed_to_the_selected_one, "Results of an operation cannot be accessed prior to completion of that operation's transaction. See https://www.cockroachlabs.com/docs/v19.2/architecture/transaction-layer.html#transaction-conflicts"
7
+ exclude :test_multiple_foreign_keys_can_be_added_to_the_same_table, "Results of an operation cannot be accessed prior to completion of that operation's transaction. See https://www.cockroachlabs.com/docs/v19.2/architecture/transaction-layer.html#transaction-conflicts"
@@ -0,0 +1,7 @@
1
+ exclude :test_creates_index_by_default_even_if_index_option_is_not_passed, "Skipping until we can triage further. See https://github.com/cockroachdb/activerecord-cockroachdb-adapter/issues/48"
2
+ exclude :test_creates_index_for_existing_table_even_if_index_option_is_not_passed, "Skipping until we can triage further. See https://github.com/cockroachdb/activerecord-cockroachdb-adapter/issues/48"
3
+ exclude :test_creates_index_with_options, "Skipping until we can triage further. See https://github.com/cockroachdb/activerecord-cockroachdb-adapter/issues/48"
4
+ exclude :test_creates_polymorphic_index_for_existing_table, "Skipping until we can triage further. See https://github.com/cockroachdb/activerecord-cockroachdb-adapter/issues/48"
5
+ exclude :test_creates_index_for_existing_table, "Skipping until we can triage further. See https://github.com/cockroachdb/activerecord-cockroachdb-adapter/issues/48"
6
+ exclude :test_creates_polymorphic_index, "Skipping until we can triage further. See https://github.com/cockroachdb/activerecord-cockroachdb-adapter/issues/48"
7
+ exclude :test_creates_index, "Skipping until we can triage further. See https://github.com/cockroachdb/activerecord-cockroachdb-adapter/issues/48"
@@ -0,0 +1,3 @@
1
+ exclude :test_deletes_reference_type_column, "Skipping until we can triage further. See https://github.com/cockroachdb/activerecord-cockroachdb-adapter/issues/48"
2
+ exclude :test_does_not_delete_reference_type_column, "Skipping until we can triage further. See https://github.com/cockroachdb/activerecord-cockroachdb-adapter/issues/48"
3
+ exclude :test_deletes_polymorphic_index, "Skipping until we can triage further. See https://github.com/cockroachdb/activerecord-cockroachdb-adapter/issues/48"
@@ -0,0 +1 @@
1
+ exclude :test_raises_error, "No link with MySQL"
@@ -0,0 +1 @@
1
+ exclude :test_or_when_grouping, "Skipping until we can triage further. See https://github.com/cockroachdb/activerecord-cockroachdb-adapter/issues/48"
@@ -0,0 +1,10 @@
1
+ exclude :test_structure_dump, "Skipping for now because the exclusion of postgis tables from the SchemaDumper is causing the test to fail due to expected argument mismatch (because our arguments include the excluded tables)."
2
+ exclude :test_structure_dump_execution_fails, "Skipping for now because the exclusion of postgis tables from the SchemaDumper is causing the test to fail due to expected argument mismatch (because our arguments include the excluded tables)."
3
+ exclude :test_structure_dump_with_dump_schemas_string, "Skipping for now because the exclusion of postgis tables from the SchemaDumper is causing the test to fail due to expected argument mismatch (because our arguments include the excluded tables)."
4
+ exclude :test_structure_dump_with_extra_flags, "Skipping for now because the exclusion of postgis tables from the SchemaDumper is causing the test to fail due to expected argument mismatch (because our arguments include the excluded tables)."
5
+ exclude :test_structure_dump_with_schema_search_path, "Skipping for now because the exclusion of postgis tables from the SchemaDumper is causing the test to fail due to expected argument mismatch (because our arguments include the excluded tables)."
6
+ exclude :test_structure_dump_with_schema_search_path_and_dump_schemas_all, "Skipping for now because the exclusion of postgis tables from the SchemaDumper is causing the test to fail due to expected argument mismatch (because our arguments include the excluded tables)."
7
+ exclude :test_structure_dump_with_hash_extra_flags_for_a_different_driver, "Skipping for now because the exclusion of postgis tables from the SchemaDumper is causing the test to fail due to expected argument mismatch (because our arguments include the excluded tables)."
8
+ exclude :test_structure_dump_with_ssl_env, "Skipping for now because the exclusion of postgis tables from the SchemaDumper is causing the test to fail due to expected argument mismatch (because our arguments include the excluded tables)."
9
+ exclude :test_structure_dump_with_env, "Skipping for now because the exclusion of postgis tables from the SchemaDumper is causing the test to fail due to expected argument mismatch (because our arguments include the excluded tables)."
10
+ exclude :test_structure_dump_with_hash_extra_flags_for_the_correct_driver, "Skipping for now because the exclusion of postgis tables from the SchemaDumper is causing the test to fail due to expected argument mismatch (because our arguments include the excluded tables)."
@@ -0,0 +1,12 @@
1
+ exclude :test_get_and_release_advisory_lock, "Skipping until we can triage further. See https://github.com/cockroachdb/activerecord-cockroachdb-adapter/issues/48"
2
+ exclude :test_reconnection_after_actual_disconnection_with_verify, "Skipping until we can triage further. See https://github.com/cockroachdb/activerecord-cockroachdb-adapter/issues/48"
3
+ exclude :test_reset, "Skipping until we can triage further. See https://github.com/cockroachdb/activerecord-cockroachdb-adapter/issues/48"
4
+ exclude :test_release_non_existent_advisory_lock, "Skipping until we can triage further. See https://github.com/cockroachdb/activerecord-cockroachdb-adapter/issues/48"
5
+ exclude :test_table_alias_length_logs_name, "Skipping until we can triage further. See https://github.com/cockroachdb/activerecord-cockroachdb-adapter/issues/48"
6
+ exclude :test_statement_key_is_logged, "Skipping until we can triage further. See https://github.com/cockroachdb/activerecord-cockroachdb-adapter/issues/48"
7
+ exclude :test_connection_options, "Skipping until we can triage further. See https://github.com/cockroachdb/activerecord-cockroachdb-adapter/issues/48"
8
+ exclude :test_reset_with_transaction, "Skipping until we can triage further. See https://github.com/cockroachdb/activerecord-cockroachdb-adapter/issues/48"
9
+ exclude :test_set_session_variable_true, "Re-implemented with a CockroachDB compatible session variable."
10
+ exclude :test_set_session_variable_false, "Re-implemented with a CockroachDB compatible session variable."
11
+ exclude :test_set_session_variable_nil, "Re-implemented with a CockroachDB compatible session variable."
12
+ exclude :test_set_session_variable_default, "Re-implemented with a CockroachDB compatible session variable."
@@ -0,0 +1,14 @@
1
+
2
+ # > In CRDB SERIALIZABLE, reads block on in-progress writes for
3
+ # > as long as those writes are in progress. However, PG does
4
+ # > not have this "read block on write" behavior, and so rather
5
+ # > than allowing the left-hand-side to execute, it must instead
6
+ # > abort that transaction. Both are valid ways to implement SERIALIZABLE.
7
+ #
8
+ # See discussion: https://github.com/cockroachdb/activerecord-cockroachdb-adapter/pull/333
9
+ message = "SERIALIZABLE transactions are different in CockroachDB."
10
+
11
+ exclude :test_deadlock_raises_Deadlocked_inside_nested_SavepointTransaction, message
12
+ exclude :test_unserializable_transaction_raises_SerializationFailure_inside_nested_SavepointTransaction, message
13
+ exclude :test_SerializationFailure_inside_nested_SavepointTransaction_is_recoverable, message
14
+ exclude :test_deadlock_inside_nested_SavepointTransaction_is_recoverable, message
@@ -0,0 +1,4 @@
1
+ exclude :test_raises_LockWaitTimeout_when_lock_wait_timeout_exceeded, "The test tries to set lock_timeout, but lock_timeout is not supported by CockroachDB."
2
+ exclude :test_raises_QueryCanceled_when_canceling_statement_due_to_user_request, "CockroachDB doesn't support pg_cancel_backend()."
3
+ exclude :test_raises_Deadlocked_when_a_deadlock_is_encountered, "Causes CI to hand. Skip while debugging."
4
+ exclude :test_raises_SerializationFailure_when_a_serialization_failure_occurs, "Skipping until we can triage further. See https://github.com/cockroachdb/activerecord-cockroachdb-adapter/issues/48"
@@ -0,0 +1,2 @@
1
+ exclude :test_relation_with_annotation_filters_sql_comment_delimiters, "This test is overridden for CockroachDB because this adapter adds quotes to numeric values."
2
+ exclude :test_relation_with_annotation_includes_comment_in_to_sql, "This test is overridden for CockroachDB because this adapter adds quotes to numeric values."
@@ -0,0 +1 @@
1
+ exclude :test_too_many_or, "This test takes a very long time to run, so we are skipping until we can fix it later."
@@ -0,0 +1 @@
1
+ exclude :test_foo, "Skipping until we can triage further. See https://github.com/cockroachdb/activerecord-cockroachdb-adapter/issues/48"
@@ -0,0 +1,2 @@
1
+ require_relative "fix_backtrace_cleaner"
2
+ include(FixBacktraceCleaner)
@@ -0,0 +1,2 @@
1
+ require_relative "fix_backtrace_cleaner"
2
+ include(FixBacktraceCleaner)
@@ -0,0 +1,2 @@
1
+ require_relative "fix_backtrace_cleaner"
2
+ include(FixBacktraceCleaner)
@@ -0,0 +1,2 @@
1
+ require_relative "fix_backtrace_cleaner"
2
+ include(FixBacktraceCleaner)
@@ -0,0 +1,2 @@
1
+ require_relative "fix_backtrace_cleaner"
2
+ include(FixBacktraceCleaner)
@@ -0,0 +1,10 @@
1
+ module FixBacktraceCleaner
2
+ def setup
3
+ super
4
+ bc = ActiveSupport::BacktraceCleaner.new
5
+ bc.remove_silencers!
6
+ bc.remove_filters!
7
+ bc.add_silencer { !_1.include?(::AssociationDeprecationTest::TestCase::THIS_FILE) }
8
+ ActiveRecord::LogSubscriber.backtrace_cleaner = bc
9
+ end
10
+ end
@@ -0,0 +1 @@
1
+ exclude :test_column_names_are_escaped, "Rewritten for CockroachDB"
@@ -0,0 +1,7 @@
1
+ exclude :test_changing_columns, "Type conversion from DATE to TIMESTAMP requires overwriting existing values which is not yet implemented. https://github.com/cockroachdb/cockroach/issues/9851"
2
+ exclude :test_changing_column_null_with_default, "Type conversion from DATE to TIMESTAMP requires overwriting existing values which is not yet implemented. https://github.com/cockroachdb/cockroach/issues/9851"
3
+
4
+ exclude :test_adding_indexes, "Need to reference the specific query count for CockroachDB"
5
+ exclude :test_removing_index, "Need to reference the specific query count for CockroachDB"
6
+ exclude :test_adding_multiple_columns, "Need to reference the specific query count for CockroachDB"
7
+ exclude :test_changing_index, "Need to reference the specific query count for CockroachDB"
@@ -0,0 +1,4 @@
1
+ exclude :test_group_by_with_order_by_virtual_count_attribute, "Ordering with virtual count attributes is not supported against CockroachDB."
2
+ exclude :test_group_by_with_limit, "The test fails because ActiveRecord strips out the query order clause making it impossible to guarantee the results order. See bug issue https://github.com/rails/rails/issues/38936."
3
+ exclude :test_group_by_with_offset, "The test fails because ActiveRecord strips out the query order clause making it impossible to guarantee the results order. See bug issue https://github.com/rails/rails/issues/38936."
4
+ exclude :test_group_by_with_limit_and_offset, "The test fails because ActiveRecord strips out the query order clause making it impossible to guarantee the results order. See bug issue https://github.com/rails/rails/issues/38936."
@@ -0,0 +1,2 @@
1
+ exclude :test_remove_comment_from_column, "The test fails because altered columns cannot change comments. We implement our own version."
2
+ exclude :test_schema_dump_with_comments, "The test fails because altered columns cannot change comments. We implement our own version."
@@ -0,0 +1 @@
1
+ exclude :test_pretty_print_persisted, "Skipping until we can triage further. See https://github.com/cockroachdb/activerecord-cockroachdb-adapter/issues/48"
@@ -0,0 +1,3 @@
1
+ ref = "See issue https://github.com/cockroachdb/activerecord-cockroachdb-adapter/issues/306"
2
+ exclude :test_multiple_find_or_create_by_bang_within_transactions, ref
3
+ exclude :test_multiple_find_or_create_by_within_transactions, ref
@@ -0,0 +1,7 @@
1
+ message = "Custom domains are not supported. See https://github.com/cockroachdb/cockroach/issues/27796"
2
+ exclude :test_text_defaults_in_new_schema_when_overriding_domain, message
3
+ exclude :test_string_defaults_in_new_schema_when_overriding_domain, message
4
+ exclude :test_decimal_defaults_in_new_schema_when_overriding_domain, message
5
+ exclude :test_bpchar_defaults_in_new_schema_when_overriding_domain, message
6
+ exclude :test_text_defaults_after_updating_column_default, message
7
+ exclude :test_default_containing_quote_and_colons, message
@@ -0,0 +1,3 @@
1
+ exclude :test_field_named_field, "Rails transactional tests are being used while making schema changes. See https://www.cockroachlabs.com/docs/stable/online-schema-changes.html#limited-support-for-schema-changes-within-transactions."
2
+ exclude :test_partial_update_with_optimistic_locking, "Skipping until we can triage further. See https://github.com/cockroachdb/activerecord-cockroachdb-adapter/issues/48"
3
+ exclude :test_virtual_attributes_are_not_written_with_partial_writes_off, "Skipping until we can triage further. See https://github.com/cockroachdb/activerecord-cockroachdb-adapter/issues/48"
@@ -0,0 +1,8 @@
1
+ require "support/copy_cat"
2
+
3
+ # CockroachDB doesn't update schema information when adding an
4
+ # index until the transaction is done. Hence impossible to delete
5
+ # this index before completion of the transaction.
6
+ exclude_from_transactional_tests :test_in_batches_iterating_using_custom_columns
7
+ exclude_from_transactional_tests :test_in_batches_with_custom_columns_raises_when_non_unique_columns
8
+ exclude_from_transactional_tests :test_in_batches_when_loaded_iterates_using_custom_column
@@ -0,0 +1 @@
1
+ exclude :test_include_query, "The test setup doesn't properly handle random unique primary keys. This is a bug in ActiveRecord, so exclude the test until it's fixed there. See https://github.com/rails/rails/pull/38883. Note: any bug fix is unlikely to be backported to older versions of Rails."
@@ -0,0 +1 @@
1
+ exclude :test_drop_index_by_name, "This isn't supported by CockroachDB; see https://www.cockroachlabs.com/docs/stable/online-schema-changes.html#examples-of-statements-that-fail for more information"
@@ -0,0 +1,3 @@
1
+ exclude "test_resets_to_min_pk_with_specified_pk_and_sequence", "This test doesn't work against CockroachDB because serial primary keys default to using unique_rowid() instead of a sequence. See https://www.cockroachlabs.com/docs/v19.2/serial.html#modes-of-operation"
2
+ exclude "test_resets_to_min_pk_with_default_pk_and_sequence", "This test doesn't work against CockroachDB because serial primary keys default to using unique_rowid() instead of a sequence. See https://www.cockroachlabs.com/docs/v19.2/serial.html#modes-of-operation"
3
+ exclude "test_create_fixtures_resets_sequences_when_not_cached", "This test doesn't work against CockroachDB because serial primary keys default to using unique_rowid() instead of a sequence. See https://www.cockroachlabs.com/docs/v19.2/serial.html#modes-of-operation"
@@ -0,0 +1,21 @@
1
+ exclude :test_bulk_insert_multiple_table_with_a_multi_statement_query, "Skipping until we can triage further. See https://github.com/cockroachdb/activerecord-cockroachdb-adapter/issues/48"
2
+ exclude :test_bulk_insert_with_a_multi_statement_query_in_a_nested_transaction, "Skipping until we can triage further. See https://github.com/cockroachdb/activerecord-cockroachdb-adapter/issues/48"
3
+ exclude :test_clean_fixtures, "Skipping the PostgreSQL test, but reimplemented for CockroachDB in test/cases/fixtures_test.rb"
4
+ exclude :test_auto_value_on_primary_key, "Skipping the PostgreSQL test, but reimplemented for CockroachDB in test/cases/fixtures_test.rb"
5
+ exclude :test_multiple_clean_fixtures, "Skipping the PostgreSQL test, but reimplemented for CockroachDB in test/cases/fixtures_test.rb"
6
+ exclude :test_bulk_insert_with_a_multi_statement_query_raises_an_exception_when_any_insert_fails, "Skipping the PostgreSQL test, but reimplemented for CockroachDB in test/cases/fixtures_test.rb"
7
+ exclude :test_inserts_with_pre_and_suffix, "Skipping the PostgreSQL test, but reimplemented for CockroachDB in test/cases/fixtures_test.rb"
8
+ exclude :test_create_symbol_fixtures, "Skipping the PostgreSQL test, but reimplemented for CockroachDB in test/cases/fixtures_test.rb"
9
+
10
+ module Replacement
11
+ def test_insert_with_default_function
12
+ before = Time.now.utc
13
+ create_fixtures("aircrafts")
14
+ after = Time.now.utc
15
+
16
+ aircraft = Aircraft.find_by(name: "boeing-with-no-manufactured-at")
17
+ assert before <= aircraft.manufactured_at && aircraft.manufactured_at <= after
18
+ end
19
+ end
20
+
21
+ prepend Replacement
@@ -0,0 +1,2 @@
1
+ exclude :test_raises_fk_violations, 'Re-implemented our own version that does not use transactional tests.'
2
+ exclude :test_does_not_raise_if_no_fk_violations, 'Re-implemented our own version that does not use transactional tests.'
@@ -0,0 +1,10 @@
1
+ exclude :test_attribute_names, "Skipping until we can triage further. See https://github.com/cockroachdb/activerecord-cockroachdb-adapter/issues/48"
2
+ exclude :test_foreign_tables, "Skipping until we can triage further. See https://github.com/cockroachdb/activerecord-cockroachdb-adapter/issues/48"
3
+ exclude :test_table_exists, "Skipping until we can triage further. See https://github.com/cockroachdb/activerecord-cockroachdb-adapter/issues/48"
4
+ exclude :test_attributes, "Skipping until we can triage further. See https://github.com/cockroachdb/activerecord-cockroachdb-adapter/issues/48"
5
+ exclude :test_update_record, "Skipping until we can triage further. See https://github.com/cockroachdb/activerecord-cockroachdb-adapter/issues/48"
6
+ exclude :test_delete_record, "Skipping until we can triage further. See https://github.com/cockroachdb/activerecord-cockroachdb-adapter/issues/48"
7
+ exclude :test_foreign_table_exists, "Skipping until we can triage further. See https://github.com/cockroachdb/activerecord-cockroachdb-adapter/issues/48"
8
+ exclude :test_insert_record, "Skipping until we can triage further. See https://github.com/cockroachdb/activerecord-cockroachdb-adapter/issues/48"
9
+ exclude :test_foreign_tables_are_valid_data_sources, "Skipping until we can triage further. See https://github.com/cockroachdb/activerecord-cockroachdb-adapter/issues/48"
10
+ exclude :test_does_not_have_a_primary_key, "Skipping until we can triage further. See https://github.com/cockroachdb/activerecord-cockroachdb-adapter/issues/48"
@@ -0,0 +1 @@
1
+ exclude :test_inheritance_new_with_subclass_as_default, "The test fails because type information is stripped from string column default values when the default is changed in the database. Possibly caused by https://github.com/cockroachdb/cockroach/issues/47285."
@@ -0,0 +1,2 @@
1
+ exclude :test_construct_finder_sql_applies_aliases_tables_on_association_conditions, "The test fails because the query result order is not guaranteed."
2
+ exclude :test_does_not_override_select, "The select query fails because strings cannot be concated non-strings in CockroachDB."
@@ -0,0 +1,6 @@
1
+ exclude :test_legacy_primary_key_in_create_table_should_be_integer, "Skipping until we can triage further. See https://github.com/cockroachdb/activerecord-cockroachdb-adapter/issues/48"
2
+ exclude :test_legacy_primary_key_should_be_auto_incremented, "Skipping until we can triage further. See https://github.com/cockroachdb/activerecord-cockroachdb-adapter/issues/48"
3
+ exclude :test_legacy_integer_primary_key_should_not_be_auto_incremented, "Skipping until we can triage further. See https://github.com/cockroachdb/activerecord-cockroachdb-adapter/issues/48"
4
+ exclude :test_add_column_with_legacy_primary_key_should_be_integer, "Skipping until we can triage further. See https://github.com/cockroachdb/activerecord-cockroachdb-adapter/issues/48"
5
+ exclude :test_legacy_join_table_foreign_keys_should_be_integer, "Skipping until we can triage further. See https://github.com/cockroachdb/activerecord-cockroachdb-adapter/issues/48"
6
+ exclude :test_legacy_primary_key_in_change_table_should_be_integer, "Skipping until we can triage further. See https://github.com/cockroachdb/activerecord-cockroachdb-adapter/issues/48"
@@ -0,0 +1,6 @@
1
+ exclude :test_legacy_integer_primary_key_should_not_be_auto_incremented, "Skipping until we can triage further. See https://github.com/cockroachdb/activerecord-cockroachdb-adapter/issues/48"
2
+ exclude :test_legacy_primary_key_in_create_table_should_be_integer, "Skipping until we can triage further. See https://github.com/cockroachdb/activerecord-cockroachdb-adapter/issues/48"
3
+ exclude :test_legacy_join_table_foreign_keys_should_be_integer, "Skipping until we can triage further. See https://github.com/cockroachdb/activerecord-cockroachdb-adapter/issues/48"
4
+ exclude :test_legacy_primary_key_in_change_table_should_be_integer, "Skipping until we can triage further. See https://github.com/cockroachdb/activerecord-cockroachdb-adapter/issues/48"
5
+ exclude :test_legacy_primary_key_should_be_auto_incremented, "Skipping until we can triage further. See https://github.com/cockroachdb/activerecord-cockroachdb-adapter/issues/48"
6
+ exclude :test_add_column_with_legacy_primary_key_should_be_integer, "Skipping until we can triage further. See https://github.com/cockroachdb/activerecord-cockroachdb-adapter/issues/48"
@@ -0,0 +1,4 @@
1
+ exclude :test_deserializing_rails_6_1_marshal_basic, "This uses the adapter name to find a file. We run our own version that specifies which file to use."
2
+ exclude :test_deserializing_rails_6_1_marshal_with_loaded_association_cache, "This uses the adapter name to find a file. We run our own version that specifies which file to use."
3
+ exclude :test_deserializing_rails_7_1_marshal_basic, "This uses the adapter name to find a file. We run our own version that specifies which file to use."
4
+ exclude :test_deserializing_rails_7_1_marshal_with_loaded_association_cache, "This uses the adapter name to find a file. We run our own version that specifies which file to use."
@@ -0,0 +1,13 @@
1
+ # frozen_string_literal: true
2
+
3
+
4
+ # Materialized views in CRDB do not show up in `pg_class` in
5
+ # the transaction they are created. Try this again to see if
6
+ # it changed:
7
+ #
8
+ # ```sql
9
+ # BEGIN;
10
+ # CREATE MATERIALIZED VIEW foo AS SELECT 1;
11
+ # SELECT * FROM pg_class WHERE relname = 'foo';
12
+ # ```
13
+ self.use_transactional_tests = false
@@ -0,0 +1,2 @@
1
+ exclude :test_add_table_with_decimals, "CockroachDB uses 64-bit signed integers, whereas the default for PG is 32-bit. The Rails test does not accommodate the 64-bit case"
2
+ exclude :test_remove_column_with_if_not_exists_not_set, "We re-implement our own version. CockroachDB does not include the table name in a 'column does not exist' message."
@@ -0,0 +1,2 @@
1
+ # We can't add and remove a column in the same transaction with CockroachDB
2
+ exclude_from_transactional_tests :test_internal_metadata_stores_environment
@@ -0,0 +1 @@
1
+ exclude :test_merge_options, "Skipping until we can triage further. See https://github.com/cockroachdb/activerecord-cockroachdb-adapter/issues/48"
@@ -0,0 +1 @@
1
+ exclude :test_or_when_grouping, "This test produces a non-deterministic result. See rails/rails#38978 for fix; patch replicated in adapter test"
@@ -0,0 +1,3 @@
1
+ exclude :test_model_with_no_auto_populated_fields_still_returns_primary_key_after_insert, "This test is using PL-PGSQL not compatible with CockroachDB"
2
+ exclude :test_reset_column_information_resets_children, "This test fails because the column is created in the same transaction in which the test attempts to assert/operate further."
3
+ exclude :test_fills_auto_populated_columns_on_creation, "See https://github.com/cockroachdb/activerecord-cockroachdb-adapter/issues/308"
@@ -0,0 +1 @@
1
+ exclude :test_lock_sending_custom_lock_statement, "NOWAIT lock wait policy is not supported by CockroachDB. See https://github.com/cockroachdb/cockroach/issues/40476."
@@ -0,0 +1,7 @@
1
+ exclude :test_explain_with_eager_loading, "Skipping until we can triage further. See https://github.com/cockroachdb/activerecord-cockroachdb-adapter/issues/48"
2
+ exclude :test_explain_for_one_query, "Skipping until we can triage further. See https://github.com/cockroachdb/activerecord-cockroachdb-adapter/issues/48"
3
+
4
+ no_options = "Explain options are not yet supported by this adapter. See https://github.com/cockroachdb/activerecord-cockroachdb-adapter/issues/301"
5
+ exclude :test_explain_with_options_as_symbols, no_options
6
+ exclude :test_explain_with_options_as_strings, no_options
7
+ exclude :test_explain_options_with_eager_loading, no_options
@@ -0,0 +1,3 @@
1
+ exclude :test_geometric_line_type, "Geometric types are not supported in CockroachDB. See https://github.com/cockroachdb/cockroach/issues/21286."
2
+ exclude :test_alternative_format_line_type, "Geometric types are not supported in CockroachDB. See https://github.com/cockroachdb/cockroach/issues/21286."
3
+ exclude :test_schema_dumping_for_line_type, "Geometric types are not supported in CockroachDB. See https://github.com/cockroachdb/cockroach/issues/21286."
@@ -0,0 +1,7 @@
1
+ exclude :test_creating_column_with_point_type, "Geometric types are not supported in CockroachDB. See https://github.com/cockroachdb/cockroach/issues/21286."
2
+ exclude :test_creating_column_with_line_type, "Geometric types are not supported in CockroachDB. See https://github.com/cockroachdb/cockroach/issues/21286."
3
+ exclude :test_creating_column_with_lseg_type, "Geometric types are not supported in CockroachDB. See https://github.com/cockroachdb/cockroach/issues/21286."
4
+ exclude :test_creating_column_with_box_type, "Geometric types are not supported in CockroachDB. See https://github.com/cockroachdb/cockroach/issues/21286."
5
+ exclude :test_creating_column_with_path_type, "Geometric types are not supported in CockroachDB. See https://github.com/cockroachdb/cockroach/issues/21286."
6
+ exclude :test_creating_column_with_polygon_type, "Geometric types are not supported in CockroachDB. See https://github.com/cockroachdb/cockroach/issues/21286."
7
+ exclude :test_creating_column_with_circle_type, "Geometric types are not supported in CockroachDB. See https://github.com/cockroachdb/cockroach/issues/21286."
@@ -0,0 +1 @@
1
+ exclude :test_partitions_table_exists, "Skipping until we can triage further. See https://github.com/cockroachdb/activerecord-cockroachdb-adapter/issues/48"
@@ -0,0 +1,14 @@
1
+ exclude :test_should_reraise_invalid_foreign_key_exception_and_show_warning,
2
+ "CockroachDB has a different limitation as there is no " \
3
+ "'DISABLE TRIGGER' statement."
4
+
5
+ break_tx = "CockroachDB will always alter transactions when " \
6
+ "trying to disable referential integrity. Either it cannot " \
7
+ "work within transaction, or autocommit_before_ddl is set " \
8
+ "and transactions will be committed."
9
+ exclude :test_does_not_break_transactions, break_tx
10
+ exclude :test_does_not_break_nested_transactions, break_tx
11
+
12
+ exclude :test_only_catch_active_record_errors_others_bubble_up,
13
+ "Reimplemented in test/cases/adapters/cockroachdb/referential_integrity_test.rb" \
14
+ " to use a different trigger for the error."