def test_modify_enum(): diff = ref_diff.ref_range_diff(ARGS, git.Repo(), SHAS['create-enum'], SHAS['modify-enum'], GLOB) shadiff, = diff.values() assert shadiff == { ('enum', 'letters'): ["alter type letters add value 'c';"] }
def test_create_enum(): diff = ref_diff.ref_range_diff(ARGS, git.Repo(), SHAS['create-ext'], SHAS['create-enum'], GLOB) shadiff, = diff.values() assert shadiff == { ('enum', 'letters'): ["create type letters as enum ('a', 'b');"] }
def test_addcol(): diff = ref_diff.ref_range_diff(ARGS, git.Repo(), SHAS['create-t1'], SHAS['add-t1-col'], GLOB) assert diff == { SHAS['add-t1-col']: { 't1': ['alter table t1 add column b int;'] }, }
def test_creat_ext(): diff = ref_diff.ref_range_diff(ARGS, git.Repo(), SHAS['unsup-alter-col'], SHAS['create-ext'], GLOB) shadiff, = diff.values() # sorry: annoying that this has comments in here. # it happens because diffing.diff() passes through the raw stmt for new keys, and the parser attaches comments assert shadiff == { ('ext', '"uuid-ossp"'): [ '-- sql.sql\n-- example schema file with git history we rely on in tests\n\ncreate extension if not exists "uuid-ossp";' ] }
def test_add_multi_commit(): diff = ref_diff.ref_range_diff(ARGS, git.Repo(), SHAS['create-t1'], SHAS['add-t2-t1a'], GLOB) assert diff == { SHAS['add-t1-col']: { 't1': ['alter table t1 add column b int;'], }, SHAS['add-t2-t1a']: { 't1': ['create index t1a on t1 (a);'], 't2': ['create table t2 (a int primary key);'], }, }
def test_create(): diff = ref_diff.ref_range_diff(ARGS, git.Repo(), SHAS['create-t1'], SHAS['add-t1-col'], GLOB) raise NotImplementedError