Skip to content

Commit

Permalink
enable experimential type conversion
Browse files Browse the repository at this point in the history
  • Loading branch information
timgraham committed Aug 29, 2020
1 parent fc0e2f2 commit 2410992
Show file tree
Hide file tree
Showing 2 changed files with 17 additions and 8 deletions.
6 changes: 6 additions & 0 deletions django_cockroachdb/base.py
Original file line number Diff line number Diff line change
Expand Up @@ -62,6 +62,12 @@ def check_constraints(self, table_names=None):
# method is a no-op.
pass

def init_connection_state(self):
super().init_connection_state()
if self.features.is_cockroachdb_20_2:
with self.connection.cursor() as cursor:
cursor.execute('SET enable_experimental_alter_column_type_general = true')

def chunked_cursor(self):
return self.cursor()

Expand Down
19 changes: 11 additions & 8 deletions django_cockroachdb/creation.py
Original file line number Diff line number Diff line change
Expand Up @@ -106,25 +106,20 @@ def mark_expected_failures(self):
# tablespace SQL because cockroachdb automatically indexes foreign
# keys.
'model_options.test_tablespaces.TablespacesTests.test_tablespace_for_many_to_many_field',
# Unsupported type conversion: https://github.com/cockroachdb/cockroach/issues/9851
# ALTER COLUMN TYPE requiring rewrite of on-disk data is currently
# not supported for columns that are part of an index.
# https://go.crdb.dev/issue/47636
'migrations.test_executor.ExecutorTests.test_alter_id_type_with_fk',
'migrations.test_operations.OperationTests.test_alter_field_pk_fk',
'migrations.test_operations.OperationTests.test_alter_field_reloads_state_on_fk_target_changes',
'migrations.test_operations.OperationTests.test_alter_field_reloads_state_on_fk_with_to_field_related_name_target_type_change', # noqa
'migrations.test_operations.OperationTests.test_alter_field_reloads_state_on_fk_with_to_field_target_changes', # noqa
'migrations.test_operations.OperationTests.test_alter_field_reloads_state_on_fk_with_to_field_target_type_change', # noqa
'migrations.test_operations.OperationTests.test_alter_fk_non_fk',
'migrations.test_operations.OperationTests.test_rename_field_reloads_state_on_fk_target_changes',
'schema.tests.SchemaTests.test_alter_auto_field_to_char_field',
'schema.tests.SchemaTests.test_alter_autofield_pk_to_smallautofield_pk_sequence_owner',
'schema.tests.SchemaTests.test_alter_text_field_to_date_field',
'schema.tests.SchemaTests.test_alter_text_field_to_datetime_field',
'schema.tests.SchemaTests.test_alter_text_field_to_time_field',
'schema.tests.SchemaTests.test_alter_textual_field_keep_null_status',
'schema.tests.SchemaTests.test_char_field_pk_to_auto_field',
'schema.tests.SchemaTests.test_char_field_with_db_index_to_fk',
'schema.tests.SchemaTests.test_m2m_rename_field_in_target_model',
'schema.tests.SchemaTests.test_rename',
'schema.tests.SchemaTests.test_text_field_with_db_index_to_fk',
# cockroachdb doesn't support dropping the primary key.
'schema.tests.SchemaTests.test_alter_int_pk_to_int_unique',
Expand Down Expand Up @@ -166,6 +161,14 @@ def mark_expected_failures(self):
# CharField max_length is ignored. CharField is introspected as
# TextField.
'introspection.tests.IntrospectionTests.test_get_table_description_col_lengths',
# Unsupported type conversion: https://github.com/cockroachdb/cockroach/issues/9851
'migrations.test_operations.OperationTests.test_alter_fk_non_fk',
'schema.tests.SchemaTests.test_alter_text_field_to_date_field',
'schema.tests.SchemaTests.test_alter_text_field_to_datetime_field',
'schema.tests.SchemaTests.test_alter_text_field_to_time_field',
'schema.tests.SchemaTests.test_alter_textual_field_keep_null_status',
'schema.tests.SchemaTests.test_m2m_rename_field_in_target_model',
'schema.tests.SchemaTests.test_rename',
)

for test_name in expected_failures:
Expand Down

0 comments on commit 2410992

Please sign in to comment.