#!/usr/bin/env bats load $BATS_TEST_DIRNAME/helper/common.bash setup() { setup_common dolt sql <" ]] || false dolt sql -q "insert into test (pk,c0,c1,c2,c3,c4,c5) values (0,0,0,0,0,0,0)" run dolt diff [ "$status" -eq 0 ] [[ "$output" =~ "| c0" ]] || false [[ "$output" =~ "+ | 0" ]] || false dolt sql -q "alter table test drop column c0" dolt diff } @test "schema-changes: dolt diff on schema changes rename primary key" { dolt add test dolt commit -m "committed table so we can see diffs" dolt sql -q "alter table test rename column pk to pk1" run dolt diff [ "$status" -eq 0 ] [[ "$output" =~ "pk1" ]] || false } @test "schema-changes: adding and dropping column should produce no diff" { dolt add test dolt commit -m "committed table so we can see diffs" dolt sql -q "alter table test add c0 bigint" dolt sql -q "alter table test drop column c0" run dolt diff [ "$status" -eq 0 ] [ "$output" = "" ] } @test "schema-changes: schema diff should show primary keys in output" { dolt add test dolt commit -m "committed table so we can see diffs" dolt sql -q 'alter table test rename column c2 to column2' run dolt diff --schema [ "$status" -eq 0 ] [[ "$output" =~ "PRIMARY KEY" ]] || false } @test "schema-changes: changing column does not allow nulls in primary key" { dolt sql < | 1 | 1 | NULL | | < | 2 | 2 | 2 | | > | 2 | 2 | NULL | +---+-----+-----+------+ EOF ) [[ "$output" =~ "$EXPECTED" ]] || false }