Skip to content

Commit

Permalink
no deferred constraints
Browse files Browse the repository at this point in the history
  • Loading branch information
BuonOmo committed Sep 2, 2024
1 parent b23cb90 commit 376f181
Show file tree
Hide file tree
Showing 5 changed files with 37 additions and 18 deletions.
23 changes: 23 additions & 0 deletions test/cases/migration/compatibility_test.rb
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
# # frozen_string_literal: true

# require "cases/helper_cockroachdb"
# require "support/copy_cat"

# module ActiveRecord
# module CockroachDB
# class Migration
# class CompatibilityTest < ActiveRecord::Migration::CompatibilityTest
# CopyCat.copy_methods(self, ActiveRecord::Migration::CompatibilityTest,
# :test_add_index_errors_on_too_long_name_7_0,
# :test_create_table_add_index_errors_on_too_long_name_7_0
# ) do
# def on_sym(node)
# return unless node.children[0] == :very_long_column_name_to_test_with

# insert_after(node.loc.expression, "_and_actually_way_longer_because_cockroach_is_in_the_128_game")
# end
# end
# end
# end
# end
# end
12 changes: 1 addition & 11 deletions test/cases/migration_test.rb
Original file line number Diff line number Diff line change
Expand Up @@ -10,17 +10,7 @@ class MigrationTest < ActiveRecord::TestCase

fixtures :people

def setup
super
%w(reminders people_reminders prefix_reminders_suffix p_things_s).each do |table|
Reminder.lease_connection.drop_table(table) rescue nil
end
Reminder.reset_column_information
@verbose_was, ActiveRecord::Migration.verbose = ActiveRecord::Migration.verbose, false
@schema_migration = ActiveRecord::Base.lease_connection.schema_migration
@internal_metadata = ActiveRecord::Base.lease_connection.internal_metadata
ActiveRecord::Base.lease_connection.schema_cache.clear!
end
CopyCat.copy_methods(self, ::MigrationTest, :setup)

teardown do
ActiveRecord::Base.table_name_prefix = ""
Expand Down
2 changes: 1 addition & 1 deletion test/cases/schema_dumper_test.rb
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ class SchemaDumperTest < ActiveRecord::TestCase
self.use_transactional_tests = false

setup do
@schema_migration = ActiveRecord::Base.lease_connection.schema_migration
@schema_migration = ActiveRecord::Base.connection_pool.schema_migration
@schema_migration.create_table
end

Expand Down
15 changes: 9 additions & 6 deletions test/excludes/PostgresqlDataTypeTest.rb
Original file line number Diff line number Diff line change
@@ -1,6 +1,9 @@
exclude :test_text_columns_are_limitless_the_upper_limit_is_one_GB, "Skipping until we can triage further. See https://github.com/cockroachdb/activerecord-cockroachdb-adapter/issues/48"
exclude :test_data_type_of_oid_types, "Skipping until we can triage further. See https://github.com/cockroachdb/activerecord-cockroachdb-adapter/issues/48"
exclude :test_update_oid, "Skipping until we can triage further. See https://github.com/cockroachdb/activerecord-cockroachdb-adapter/issues/48"
exclude :test_data_type_of_time_types, "Skipping until we can triage further. See https://github.com/cockroachdb/activerecord-cockroachdb-adapter/issues/48"
exclude :test_oid_values, "Skipping until we can triage further. See https://github.com/cockroachdb/activerecord-cockroachdb-adapter/issues/48"
exclude :test_time_values, "Skipping until we can triage further. See https://github.com/cockroachdb/activerecord-cockroachdb-adapter/issues/48"

ago_msg = "'ago' is not supported in CRDB's interval parsing. Test ignored. See #340"
exclude :test_text_columns_are_limitless_the_upper_limit_is_one_GB, ago_msg
exclude :test_data_type_of_oid_types, ago_msg
exclude :test_update_oid, ago_msg
exclude :test_data_type_of_time_types, ago_msg
exclude :test_oid_values, ago_msg
exclude :test_time_values, ago_msg
exclude :test_update_large_time_in_seconds, ago_msg
3 changes: 3 additions & 0 deletions test/excludes/PostgresqlDeferredConstraintsTest.rb
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
instance_methods.grep(/\Atest_/).each do |m|
exclude m, "CockroachDB doesn't support 'SET CONSTRAINTS ...'"
end

0 comments on commit 376f181

Please sign in to comment.