示例#1
0
def test_bad_rollback_flow_change_char_type_that_safe():
    # forward
    migrate(['bad_rollback_flow_change_char_type_that_safe_app'])

    # backward
    with pytest.raises(UnsafeOperationException):
        migrate(['bad_rollback_flow_change_char_type_that_safe_app', '0001'])
示例#2
0
def test_bad_rollback_flow_drop_column_with_notnull():
    # forward
    migrate(['bad_rollback_flow_drop_column_with_notnull_app'])

    # backward
    with pytest.raises(UnsafeOperationException):
        migrate(['bad_rollback_flow_drop_column_with_notnull_app', '0001'])
示例#3
0
def test_good_flow():
    # forward
    if settings.DATABASES['default']['HOST'] in ['pg14', 'postgis14']:
        # related to https://www.postgresql.org/message-id/3175925.1637428221%40sss.pgh.pa.us bug
        migrate(['good_flow_app', '0045'])
    else:
        migrate(['good_flow_app'])

    # backward
    migrate(['good_flow_app', 'zero'])
示例#4
0
def test_migrate_isnotnull_check_constraints():
    migrate()
    assert_constraints(null=0, check=1)
    run_management_command(['--force'] if settings.
                           DATABASES['default']['HOST'] in ['pg95'] else None)
    assert_constraints(null=1, check=0)
示例#5
0
def test_bad_flow_add_column_with_default():
    # forward
    with pytest.raises(UnsafeOperationException):
        migrate(['bad_flow_add_column_with_default_app'])
示例#6
0
def test_good_flow_create_and_drop_index_concurrently():
    # forward
    migrate(['good_flow_app_concurrently'])

    # backward
    migrate(['good_flow_app_concurrently', 'zero'])
示例#7
0
def test_good_flow():
    # forward
    migrate(['good_flow_app'])

    # backward
    migrate(['good_flow_app', 'zero'])
示例#8
0
def test_bad_flow_change_char_type_that_unsafe():
    # forward
    with pytest.raises(UnsafeOperationException):
        migrate(['bad_flow_change_char_type_that_unsafe_app'])
示例#9
0
def test_decimal_to_float_app():
    # forward
    migrate(['decimal_to_float_app'])

    # backward
    migrate(['decimal_to_float_app', 'zero'])
示例#10
0
def test_good_flow_alter_table_with_same_db_table():
    # forward
    migrate(['good_flow_alter_table_with_same_db_table'])

    # backward
    migrate(['good_flow_alter_table_with_same_db_table', 'zero'])