diff --git a/go/libraries/doltcore/sqle/enginetest/ddl_queries.go b/go/libraries/doltcore/sqle/enginetest/ddl_queries.go index 1eeffc1f2d..b1e70e02e9 100755 --- a/go/libraries/doltcore/sqle/enginetest/ddl_queries.go +++ b/go/libraries/doltcore/sqle/enginetest/ddl_queries.go @@ -678,6 +678,7 @@ var BrokenDDLScripts = []queries.ScriptTest{ Name: "table with commit column should maintain its data in diff", SetUpScript: []string{ "CREATE TABLE t (pk int PRIMARY KEY, commit text);", + "CALL DOLT_ADD('.');", "set @Commit1 = dolt_commit('-am', 'creating table t');", "INSERT INTO t VALUES (1, 'hi');", "set @Commit2 = dolt_commit('-am', 'insert data');", diff --git a/go/libraries/doltcore/sqle/enginetest/dolt_engine_test.go b/go/libraries/doltcore/sqle/enginetest/dolt_engine_test.go index 9fa0865a3f..84ce7026e4 100644 --- a/go/libraries/doltcore/sqle/enginetest/dolt_engine_test.go +++ b/go/libraries/doltcore/sqle/enginetest/dolt_engine_test.go @@ -114,6 +114,7 @@ func TestSingleScript(t *testing.T) { Name: "truncate table", SetUpScript: []string{ "create table t (a int primary key auto_increment, b int)", + "call dolt_add('.')", "call dolt_commit('-am', 'empty table')", "call dolt_branch('branch1')", "call dolt_branch('branch2')", @@ -247,6 +248,7 @@ func TestSingleScriptPrepared(t *testing.T) { s := []setup.SetupScript{ { "create table test (pk int primary key, c1 int)", + "call dolt_add('.')", "insert into test values (0,0), (1,1);", "set @Commit1 = dolt_commit('-am', 'creating table');", "call dolt_branch('-c', 'main', 'newb')", @@ -773,6 +775,7 @@ func TestDoltRevisionDbScripts(t *testing.T) { setupScripts := []setup.SetupScript{ {"create table t01 (pk int primary key, c1 int)"}, + {"call dolt_add('.');"}, {"call dolt_commit('-am', 'creating table t01 on main');"}, {"insert into t01 values (1, 1), (2, 2);"}, {"call dolt_commit('-am', 'adding rows to table t01 on main');"}, @@ -1010,6 +1013,7 @@ func TestSingleTransactionScript(t *testing.T) { Name: "allow commit conflicts on, conflict on dolt_merge", SetUpScript: []string{ "CREATE TABLE test (pk int primary key, val int)", + "CALL DOLT_ADD('.')", "INSERT INTO test VALUES (0, 0)", "SELECT DOLT_COMMIT('-a', '-m', 'initial table');", }, diff --git a/go/libraries/doltcore/sqle/enginetest/dolt_harness.go b/go/libraries/doltcore/sqle/enginetest/dolt_harness.go index bfa1a949b6..fe0235a6a6 100644 --- a/go/libraries/doltcore/sqle/enginetest/dolt_harness.go +++ b/go/libraries/doltcore/sqle/enginetest/dolt_harness.go @@ -166,6 +166,7 @@ func commitScripts(dbs []string) []setup.SetupScript { for i := range dbs { db := dbs[i] commitCmds = append(commitCmds, fmt.Sprintf("use %s", db)) + commitCmds = append(commitCmds, "call dolt_add('.')") commitCmds = append(commitCmds, fmt.Sprintf("call dolt_commit('--allow-empty', '-am', 'checkpoint enginetest database %s', '--date', '1970-01-01T12:00:00')", db)) } commitCmds = append(commitCmds, "use mydb") @@ -438,6 +439,8 @@ func (d *DoltHarness) SnapshotTable(db sql.VersionedDatabase, name string, asOf ctx := enginetest.NewContext(d) _, iter, err := e.Query(ctx, + "CALL DOLT_ADD('.')") + _, iter, err = e.Query(ctx, "SELECT COMMIT('-am', 'test commit');") require.NoError(d.t, err) _, err = sql.RowIterToRows(ctx, nil, iter) diff --git a/go/libraries/doltcore/sqle/enginetest/dolt_queries.go b/go/libraries/doltcore/sqle/enginetest/dolt_queries.go index a72ead6313..41f29c9c19 100644 --- a/go/libraries/doltcore/sqle/enginetest/dolt_queries.go +++ b/go/libraries/doltcore/sqle/enginetest/dolt_queries.go @@ -36,16 +36,19 @@ var ViewsWithAsOfScriptTest = queries.ScriptTest{ "CALL dolt_commit('--allow-empty', '-m', 'cm0');", "CREATE TABLE t1 (pk int PRIMARY KEY AUTO_INCREMENT, c0 int);", + "CALL dolt_add('.')", "CALL dolt_commit('-am', 'cm1');", "INSERT INTO t1 (c0) VALUES (1), (2);", "CALL dolt_commit('-am', 'cm2');", "CREATE TABLE t2 (pk int PRIMARY KEY AUTO_INCREMENT, vc varchar(100));", + "CALL dolt_add('.')", "CALL dolt_commit('-am', 'cm3');", "INSERT INTO t2 (vc) VALUES ('one'), ('two');", "CALL dolt_commit('-am', 'cm4');", "CREATE VIEW v1 as select * from t1 union select * from t2", + "call dolt_add('.');", "CALL dolt_commit('-am', 'cm5');", }, Assertions: []queries.ScriptTestAssertion{ @@ -86,6 +89,7 @@ var ShowCreateTableAsOfScriptTest = queries.ScriptTest{ SetUpScript: []string{ "set @Commit0 = hashof('main');", "create table a (pk int primary key, c1 int);", + "call dolt_add('.');", "set @Commit1 = dolt_commit('-am', 'creating table a');", "alter table a add column c2 varchar(20);", "set @Commit2 = dolt_commit('-am', 'adding column c2');", @@ -141,6 +145,7 @@ var DescribeTableAsOfScriptTest = queries.ScriptTest{ SetUpScript: []string{ "set @Commit0 = dolt_commit('--allow-empty', '-m', 'before creating table a');", "create table a (pk int primary key, c1 int);", + "call dolt_add('.');", "set @Commit1 = dolt_commit('-am', 'creating table a');", "alter table a add column c2 varchar(20);", "set @Commit2 = dolt_commit('-am', 'adding column c2');", @@ -182,6 +187,7 @@ var DoltRevisionDbScripts = []queries.ScriptTest{ Name: "database revision specs: tag-qualified revision spec", SetUpScript: []string{ "create table t01 (pk int primary key, c1 int)", + "call dolt_add('.')", "call dolt_commit('-am', 'creating table t01 on main');", "insert into t01 values (1, 1), (2, 2);", "call dolt_commit('-am', 'adding rows to table t01 on main');", @@ -244,6 +250,7 @@ var DoltRevisionDbScripts = []queries.ScriptTest{ Name: "database revision specs: branch-qualified revision spec", SetUpScript: []string{ "create table t01 (pk int primary key, c1 int)", + "call dolt_add('.')", "call dolt_commit('-am', 'creating table t01 on main');", "insert into t01 values (1, 1), (2, 2);", "call dolt_commit('-am', 'adding rows to table t01 on main');", @@ -354,6 +361,7 @@ var DoltScripts = []queries.ScriptTest{ Name: "test as of indexed join (https://github.com/dolthub/dolt/issues/2189)", SetUpScript: []string{ "create table a (pk int primary key, c1 int)", + "call DOLT_ADD('.')", "insert into a values (1,1), (2,2), (3,3)", "select DOLT_COMMIT('-a', '-m', 'first commit')", "insert into a values (4,4), (5,5), (6,6)", @@ -462,6 +470,7 @@ var DoltScripts = []queries.ScriptTest{ Name: "Prepared ASOF", SetUpScript: []string{ "create table test (pk int primary key, c1 int)", + "call dolt_add('.')", "insert into test values (0,0), (1,1);", "set @Commit1 = dolt_commit('-am', 'creating table');", "call dolt_branch('-c', 'main', 'newb')", @@ -545,6 +554,7 @@ var DoltUserPrivTests = []queries.UserPrivilegeTest{ SetUpScript: []string{ "CREATE TABLE mydb.test (pk BIGINT PRIMARY KEY);", "CREATE TABLE mydb.test2 (pk BIGINT PRIMARY KEY);", + "CALL DOLT_ADD('.')", "SELECT DOLT_COMMIT('-am', 'creating tables test and test2');", "INSERT INTO mydb.test VALUES (1);", "SELECT DOLT_COMMIT('-am', 'inserting into test');", @@ -659,6 +669,7 @@ var HistorySystemTableScriptTests = []queries.ScriptTest{ Name: "empty table", SetUpScript: []string{ "create table t (n int, c varchar(20));", + "call dolt_add('.')", "set @Commit1 = dolt_commit('-am', 'creating table t');", }, Assertions: []queries.ScriptTestAssertion{ @@ -673,6 +684,7 @@ var HistorySystemTableScriptTests = []queries.ScriptTest{ SetUpScript: []string{ "create table foo1 (n int, de varchar(20));", "insert into foo1 values (1, 'Ein'), (2, 'Zwei'), (3, 'Drei');", + "call dolt_add('.')", "set @Commit1 = dolt_commit('-am', 'inserting into foo1', '--date', '2022-08-06T12:00:00');", "update foo1 set de='Eins' where n=1;", @@ -704,6 +716,7 @@ var HistorySystemTableScriptTests = []queries.ScriptTest{ Name: "primary key table: basic cases", SetUpScript: []string{ "create table t1 (n int primary key, de varchar(20));", + "call dolt_add('.')", "insert into t1 values (1, 'Eins'), (2, 'Zwei'), (3, 'Drei');", "set @Commit1 = dolt_commit('-am', 'inserting into t1', '--date', '2022-08-06T12:00:01');", @@ -771,6 +784,7 @@ var HistorySystemTableScriptTests = []queries.ScriptTest{ Name: "index by primary key", SetUpScript: []string{ "create table t1 (pk int primary key, c int);", + "call dolt_add('.')", "insert into t1 values (1,2), (3,4)", "set @Commit1 = dolt_commit('-am', 'initial table');", "insert into t1 values (5,6), (7,8)", @@ -829,6 +843,7 @@ var HistorySystemTableScriptTests = []queries.ScriptTest{ Name: "adding an index", SetUpScript: []string{ "create table t1 (pk int primary key, c int);", + "call dolt_add('.')", "insert into t1 values (1,2), (3,4)", "set @Commit1 = dolt_commit('-am', 'initial table');", "insert into t1 values (5,6), (7,8)", @@ -875,6 +890,7 @@ var HistorySystemTableScriptTests = []queries.ScriptTest{ Name: "primary key table: non-pk column drops and adds", SetUpScript: []string{ "create table t (pk int primary key, c1 int, c2 varchar(20));", + "call dolt_add('.')", "insert into t values (1, 2, '3'), (4, 5, '6');", "set @Commit1 = DOLT_COMMIT('-am', 'creating table t');", @@ -914,6 +930,7 @@ var HistorySystemTableScriptTests = []queries.ScriptTest{ Name: "primary key table: non-pk column type changes", SetUpScript: []string{ "create table t (pk int primary key, c1 int, c2 varchar(20));", + "call dolt_add('.')", "insert into t values (1, 2, '3'), (4, 5, '6');", "set @Commit1 = DOLT_COMMIT('-am', 'creating table t');", "alter table t modify column c2 int;", @@ -939,10 +956,12 @@ var HistorySystemTableScriptTests = []queries.ScriptTest{ Name: "primary key table: rename table", SetUpScript: []string{ "create table t (pk int primary key, c1 int, c2 varchar(20));", + "call dolt_add('.')", "insert into t values (1, 2, '3'), (4, 5, '6');", "set @Commit1 = DOLT_COMMIT('-am', 'creating table t');", "alter table t rename to t2;", + "call dolt_add('.')", "set @Commit2 = DOLT_COMMIT('-am', 'renaming table to t2');", }, Assertions: []queries.ScriptTestAssertion{ @@ -964,6 +983,7 @@ var HistorySystemTableScriptTests = []queries.ScriptTest{ Name: "primary key table: delete and recreate table", SetUpScript: []string{ "create table t (pk int primary key, c1 int, c2 varchar(20));", + "call dolt_add('.')", "insert into t values (1, 2, '3'), (4, 5, '6');", "set @Commit1 = DOLT_COMMIT('-am', 'creating table t');", @@ -971,6 +991,7 @@ var HistorySystemTableScriptTests = []queries.ScriptTest{ "set @Commit2 = DOLT_COMMIT('-am', 'dropping table t');", "create table t (pk int primary key, c1 int);", + "call dolt_add('.')", "set @Commit3 = DOLT_COMMIT('-am', 'recreating table t');", }, Assertions: []queries.ScriptTestAssertion{ @@ -1226,6 +1247,7 @@ var MergeScripts = []queries.ScriptTest{ Name: "CALL DOLT_MERGE ff correctly works with autocommit off", SetUpScript: []string{ "CREATE TABLE test (pk int primary key)", + "call DOLT_ADD('.')", "INSERT INTO test VALUES (0),(1),(2);", "SET autocommit = 0", "SELECT DOLT_COMMIT('-a', '-m', 'Step 1');", @@ -1259,6 +1281,7 @@ var MergeScripts = []queries.ScriptTest{ Name: "CALL DOLT_MERGE no-ff correctly works with autocommit off", SetUpScript: []string{ "CREATE TABLE test (pk int primary key)", + "call DOLT_ADD('.')", "INSERT INTO test VALUES (0),(1),(2);", "SET autocommit = 0", "SELECT DOLT_COMMIT('-a', '-m', 'Step 1', '--date', '2022-08-06T12:00:00');", @@ -1296,6 +1319,7 @@ var MergeScripts = []queries.ScriptTest{ Name: "CALL DOLT_MERGE without conflicts correctly works with autocommit off with commit flag", SetUpScript: []string{ "CREATE TABLE test (pk int primary key)", + "call DOLT_ADD('.')", "INSERT INTO test VALUES (0),(1),(2);", "SET autocommit = 0", "SELECT DOLT_COMMIT('-a', '-m', 'Step 1', '--date', '2022-08-06T12:00:01');", @@ -1369,6 +1393,7 @@ var MergeScripts = []queries.ScriptTest{ Name: "CALL DOLT_MERGE with conflicts can be correctly resolved when autocommit is off", SetUpScript: []string{ "CREATE TABLE test (pk int primary key, val int)", + "call DOLT_ADD('.')", "INSERT INTO test VALUES (0, 0)", "SET autocommit = 0", "SELECT DOLT_COMMIT('-a', '-m', 'Step 1', '--date', '2022-08-06T12:00:01');", @@ -1423,6 +1448,7 @@ var MergeScripts = []queries.ScriptTest{ Name: "CALL DOLT_MERGE ff & squash correctly works with autocommit off", SetUpScript: []string{ "CREATE TABLE test (pk int primary key)", + "call DOLT_ADD('.')", "INSERT INTO test VALUES (0),(1),(2);", "SET autocommit = 0", "SELECT DOLT_COMMIT('-a', '-m', 'Step 1');", @@ -1455,6 +1481,7 @@ var MergeScripts = []queries.ScriptTest{ Name: "CALL DOLT_MERGE ff & squash with a checkout in between", SetUpScript: []string{ "CREATE TABLE test (pk int primary key)", + "call DOLT_ADD('.')", "INSERT INTO test VALUES (0),(1),(2);", "SET autocommit = 0", "SELECT DOLT_COMMIT('-a', '-m', 'Step 1');", @@ -1483,6 +1510,7 @@ var MergeScripts = []queries.ScriptTest{ Name: "CALL DOLT_MERGE ff", SetUpScript: []string{ "CREATE TABLE test (pk int primary key)", + "CALL DOLT_ADD('.')", "INSERT INTO test VALUES (0),(1),(2);", "SELECT DOLT_COMMIT('-a', '-m', 'Step 1');", "SELECT DOLT_CHECKOUT('-b', 'feature-branch')", @@ -1515,6 +1543,7 @@ var MergeScripts = []queries.ScriptTest{ Name: "CALL DOLT_MERGE no-ff", SetUpScript: []string{ "CREATE TABLE test (pk int primary key)", + "CALL DOLT_ADD('.')", "INSERT INTO test VALUES (0),(1),(2);", "SELECT DOLT_COMMIT('-a', '-m', 'Step 1');", "SELECT DOLT_CHECKOUT('-b', 'feature-branch')", @@ -1551,6 +1580,7 @@ var MergeScripts = []queries.ScriptTest{ Name: "CALL DOLT_MERGE with no conflicts works", SetUpScript: []string{ "CREATE TABLE test (pk int primary key)", + "CALL DOLT_ADD('.')", "INSERT INTO test VALUES (0),(1),(2);", "SELECT DOLT_COMMIT('-a', '-m', 'Step 1', '--date', '2022-08-06T12:00:00');", "SELECT DOLT_CHECKOUT('-b', 'feature-branch')", @@ -1625,6 +1655,7 @@ var MergeScripts = []queries.ScriptTest{ Name: "CALL DOLT_MERGE with conflict is queryable and committable with dolt_allow_commit_conflicts on", SetUpScript: []string{ "CREATE TABLE test (pk int primary key, val int)", + "CALL DOLT_ADD('.')", "INSERT INTO test VALUES (0, 0)", "SELECT DOLT_COMMIT('-a', '-m', 'Step 1');", "SELECT DOLT_CHECKOUT('-b', 'feature-branch')", @@ -1679,6 +1710,7 @@ var MergeScripts = []queries.ScriptTest{ Name: "CALL DOLT_MERGE with conflicts can be aborted when autocommit is off", SetUpScript: []string{ "CREATE TABLE test (pk int primary key, val int)", + "CALL DOLT_ADD('.')", "INSERT INTO test VALUES (0, 0)", "SET autocommit = 0", "SELECT DOLT_COMMIT('-a', '-m', 'Step 1');", @@ -1729,6 +1761,7 @@ var MergeScripts = []queries.ScriptTest{ Name: "CALL DOLT_MERGE complains when a merge overrides local changes", SetUpScript: []string{ "CREATE TABLE test (pk int primary key, val int)", + "CALL DOLT_ADD('.')", "INSERT INTO test VALUES (0, 0)", "SET autocommit = 0", "SELECT DOLT_COMMIT('-a', '-m', 'Step 1');", @@ -1750,6 +1783,7 @@ var MergeScripts = []queries.ScriptTest{ Name: "Drop and add primary key on two branches converges to same schema", SetUpScript: []string{ "create table t1 (i int);", + "call dolt_add('.');", "call dolt_commit('-am', 't1 table')", "call dolt_checkout('-b', 'b1')", "alter table t1 add primary key(i)", @@ -1780,6 +1814,7 @@ var MergeScripts = []queries.ScriptTest{ "CREATE table parent (pk int PRIMARY KEY, col1 int);", "CREATE table child (pk int PRIMARY KEY, parent_fk int, FOREIGN KEY (parent_fk) REFERENCES parent(pk));", "CREATE table other (pk int);", + "CALL DOLT_ADD('.')", "INSERT INTO parent VALUES (1, 1), (2, 2);", "CALL DOLT_COMMIT('-am', 'setup');", "CALL DOLT_BRANCH('branch1');", @@ -1808,6 +1843,7 @@ var MergeScripts = []queries.ScriptTest{ SetUpScript: []string{ "CREATE TABLE parent (pk BIGINT PRIMARY KEY, v1 BIGINT, INDEX(v1));", "CREATE TABLE child (pk BIGINT PRIMARY KEY, v1 BIGINT, CONSTRAINT fk_name FOREIGN KEY (v1) REFERENCES parent (v1));", + "CALL DOLT_ADD('.')", "INSERT INTO parent VALUES (10, 1), (20, 2), (30, 2);", "INSERT INTO child VALUES (1, 1);", "CALL DOLT_COMMIT('-am', 'MC1');", @@ -1850,6 +1886,7 @@ var MergeScripts = []queries.ScriptTest{ SetUpScript: []string{ "SET dolt_force_transaction_commit = on;", "CREATE TABLE t (pk int PRIMARY KEY, col1 int UNIQUE);", + "CALL dolt_add('.')", "CALL DOLT_COMMIT('-am', 'create table');", "CALL DOLT_CHECKOUT('-b', 'right');", @@ -1880,6 +1917,7 @@ var MergeScripts = []queries.ScriptTest{ SetUpScript: []string{ "SET dolt_force_transaction_commit = on;", "CREATE TABLE t (pk int PRIMARY KEY, col1 int UNIQUE);", + "CALL DOLT_ADD('.')", "INSERT INTO t VALUES (1, 1), (2, 2);", "CALL DOLT_COMMIT('-am', 'create table');", @@ -1911,6 +1949,7 @@ var MergeScripts = []queries.ScriptTest{ SetUpScript: []string{ "SET dolt_force_transaction_commit = on;", "CREATE TABLE t (pk int PRIMARY KEY, col1 int UNIQUE);", + "CALL DOLT_ADD('.')", "INSERT INTO t VALUES (1, 1), (2, 2);", "CALL DOLT_COMMIT('-am', 'create table');", @@ -1942,6 +1981,7 @@ var MergeScripts = []queries.ScriptTest{ SetUpScript: []string{ "SET dolt_force_transaction_commit = on;", "CREATE TABLE t (pk int PRIMARY KEY, col1 int, col2 int, UNIQUE col1_col2_u (col1, col2));", + "CALL DOLT_ADD('.')", "INSERT INTO T VALUES (1, 1, 1), (2, NULL, NULL);", "CALL DOLT_COMMIT('-am', 'setup');", @@ -1978,6 +2018,7 @@ var MergeScripts = []queries.ScriptTest{ SetUpScript: []string{ "SET dolt_force_transaction_commit = on;", "CREATE TABLE t (pk int PRIMARY KEY, col1 int);", + "CALL DOLT_ADD('.')", "INSERT INTO t VALUES (1, 1), (2, 1);", "CALL DOLT_COMMIT('-am', 'table and data');", @@ -2007,11 +2048,13 @@ var MergeScripts = []queries.ScriptTest{ "SET dolt_allow_commit_conflicts = on;", "CALL DOLT_CHECKOUT('-b', 'other');", "CREATE TABLE t (pk int PRIMARY key, col1 int, extracol int);", + "CALL DOLT_ADD('.')", "INSERT into t VALUES (1, 1, 1);", "CALL DOLT_COMMIT('-am', 'right');", "CALL DOLT_CHECKOUT('main');", "CREATE TABLE t (pk int PRIMARY key, col1 int);", + "CALL DOLT_ADD('.')", "INSERT into t VALUES (2, 2);", "CALL DOLT_COMMIT('-am', 'left');", }, @@ -2028,11 +2071,13 @@ var MergeScripts = []queries.ScriptTest{ "SET dolt_allow_commit_conflicts = on;", "CALL DOLT_CHECKOUT('-b', 'other');", "CREATE TABLE t (pk int PRIMARY key, col1 int);", + "CALL DOLT_ADD('.')", "INSERT into t VALUES (1, 1);", "CALL DOLT_COMMIT('-am', 'right');", "CALL DOLT_CHECKOUT('main');", "CREATE TABLE t (pk int PRIMARY key, col1 int);", + "CALL DOLT_ADD('.')", "INSERT into t VALUES (2, 2);", "CALL DOLT_COMMIT('-am', 'left');", }, @@ -2053,11 +2098,13 @@ var MergeScripts = []queries.ScriptTest{ "SET dolt_allow_commit_conflicts = on;", "CALL DOLT_CHECKOUT('-b', 'other');", "CREATE TABLE t (pk int PRIMARY key, col1 int);", + "CALL DOLT_ADD('.')", "INSERT into t VALUES (1, -1);", "CALL DOLT_COMMIT('-am', 'right');", "CALL DOLT_CHECKOUT('main');", "CREATE TABLE t (pk int PRIMARY key, col1 int);", + "CALL DOLT_ADD('.')", "INSERT into t VALUES (1, 1);", "CALL DOLT_COMMIT('-am', 'left');", }, @@ -2113,6 +2160,7 @@ var MergeScripts = []queries.ScriptTest{ Name: "dolt_merge() works with no auto increment overlap", SetUpScript: []string{ "CREATE TABLE t (pk int PRIMARY KEY AUTO_INCREMENT, c0 int);", + "CALL DOLT_ADD('.')", "INSERT INTO t (c0) VALUES (1), (2);", "CALL dolt_commit('-a', '-m', 'cm1');", "CALL dolt_checkout('-b', 'test');", @@ -2147,6 +2195,7 @@ var MergeScripts = []queries.ScriptTest{ Name: "dolt_merge() (3way) works with no auto increment overlap", SetUpScript: []string{ "CREATE TABLE t (pk int PRIMARY KEY AUTO_INCREMENT, c0 int);", + "CALL DOLT_ADD('.')", "INSERT INTO t (c0) VALUES (1);", "CALL dolt_commit('-a', '-m', 'cm1');", "CALL dolt_checkout('-b', 'test');", @@ -2256,6 +2305,7 @@ var Dolt1MergeScripts = []queries.ScriptTest{ Name: "Merge errors if the primary key types have changed (even if the new type has the same NomsKind)", SetUpScript: []string{ "CREATE TABLE t (pk1 bigint, pk2 bigint, PRIMARY KEY (pk1, pk2));", + "CALL DOLT_ADD('.')", "CALL DOLT_COMMIT('-am', 'setup');", "CALL DOLT_CHECKOUT('-b', 'right');", @@ -2282,6 +2332,7 @@ var KeylessMergeCVsAndConflictsScripts = []queries.ScriptTest{ SetUpScript: []string{ "SET dolt_force_transaction_commit = on;", "CREATE table t (col1 int, col2 int UNIQUE);", + "CALL DOLT_ADD('.')", "CALL DOLT_COMMIT('-am', 'setup');", "CALL DOLT_CHECKOUT('-b', 'right');", @@ -2313,6 +2364,7 @@ var KeylessMergeCVsAndConflictsScripts = []queries.ScriptTest{ "SET dolt_force_transaction_commit = on;", "CREATE table parent (pk int PRIMARY KEY);", "CREATE table child (parent_fk int, FOREIGN KEY (parent_fk) REFERENCES parent (pk));", + "CALL DOLT_ADD('.')", "INSERT INTO parent VALUES (1);", "CALL DOLT_COMMIT('-am', 'setup');", @@ -2348,6 +2400,7 @@ var KeylessMergeCVsAndConflictsScripts = []queries.ScriptTest{ SetUpScript: []string{ "SET dolt_allow_commit_conflicts = on;", "CREATE table t (col1 int, col2 int);", + "CALL DOLT_ADD('.')", "CALL DOLT_COMMIT('-am', 'setup');", "CALL DOLT_CHECKOUT('-b', 'right');", @@ -2377,6 +2430,7 @@ var DoltConflictTableNameTableTests = []queries.ScriptTest{ SetUpScript: []string{ "SET dolt_allow_commit_conflicts = on;", "CREATE table t (pk int PRIMARY KEY, col1 int);", + "CALL DOLT_ADD('.')", "INSERT INTO t VALUES (1, 1);", "INSERT INTO t VALUES (2, 2);", "INSERT INTO t VALUES (3, 3);", @@ -2418,6 +2472,7 @@ var DoltConflictTableNameTableTests = []queries.ScriptTest{ SetUpScript: []string{ "SET dolt_allow_commit_conflicts = on;", "CREATE table t (col1 int);", + "CALL DOLT_ADD('.')", "INSERT INTO t VALUES (1), (2), (3), (4), (6);", "CALL DOLT_COMMIT('-am', 'init');", @@ -2468,6 +2523,7 @@ var MergeArtifactsScripts = []queries.ScriptTest{ "SET dolt_allow_commit_conflicts = on", "CALL DOLT_CHECKOUT('-b', 'conflicts1');", "CREATE table t (pk int PRIMARY KEY, col1 int);", + "CALL DOLT_ADD('.')", "CALL DOLT_COMMIT('-am', 'create table');", "CALL DOLT_BRANCH('conflicts2');", @@ -2565,6 +2621,7 @@ var MergeArtifactsScripts = []queries.ScriptTest{ SetUpScript: []string{ "SET dolt_allow_commit_conflicts = on", "CREATE table t (pk int PRIMARY KEY, col1 int);", + "CALL DOLT_ADD('.')", "CALL DOLT_COMMIT('-am', 'create table');", "INSERT INTO t VALUES (1, 1);", "CALL DOLT_COMMIT('-am', 'insert pk 1');", @@ -2611,6 +2668,7 @@ var MergeArtifactsScripts = []queries.ScriptTest{ "CALL DOLT_CHECKOUT('-b', 'viol1');", "CREATE TABLE parent (pk int PRIMARY KEY);", "CREATE TABLE child (pk int PRIMARY KEY, fk int, FOREIGN KEY (fk) REFERENCES parent (pk));", + "CALL DOLT_ADD('.')", "CALL DOLT_COMMIT('-am', 'setup table');", "CALL DOLT_BRANCH('viol2');", "CALL DOLT_BRANCH('other3');", @@ -2728,6 +2786,7 @@ var MergeArtifactsScripts = []queries.ScriptTest{ SetUpScript: []string{ "SET dolt_force_transaction_commit = on;", "CREATE TABLE t (pk int PRIMARY KEY, col1 int UNIQUE);", + "CALL DOLT_ADD('.')", "CALL DOLT_COMMIT('-am', 'create table t');", "CALL DOLT_BRANCH('right');", "CALL DOLT_BRANCH('left2');", @@ -2812,6 +2871,7 @@ var MergeArtifactsScripts = []queries.ScriptTest{ SetUpScript: []string{ "SET dolt_force_transaction_commit = on;", "CREATE TABLE t (pk int PRIMARY KEY, col1 int);", + "CALL DOLT_ADD('.')", "INSERT INTO t VALUES (1, 1), (2, 1);", "CALL DOLT_COMMIT('-am', 'table and data');", @@ -2855,6 +2915,7 @@ var MergeArtifactsScripts = []queries.ScriptTest{ FOREIGN KEY (col1) REFERENCES parent(col1), FOREIGN KEY (col2) REFERENCES parent(col2) );`, + "CALL DOLT_ADD('.')", "INSERT INTO parent VALUES (1, 1, 1);", "CALL DOLT_COMMIT('-am', 'initial');", @@ -2886,6 +2947,7 @@ var MergeArtifactsScripts = []queries.ScriptTest{ SetUpScript: []string{ "SET dolt_force_transaction_commit = on;", "CREATE table t (pk int PRIMARY KEY, col1 int UNIQUE, col2 int UNIQUE);", + "CALL DOLT_ADD('.')", "CALL DOLT_COMMIT('-am', 'setup');", "CALL DOLT_CHECKOUT('-b', 'right');", @@ -2919,6 +2981,7 @@ var OldFormatMergeConflictsAndCVsScripts = []queries.ScriptTest{ "CREATE table parent (pk int PRIMARY KEY, col1 int);", "CREATE table child (pk int PRIMARY KEY, parent_fk int, FOREIGN KEY (parent_fk) REFERENCES parent(pk));", "CREATE table other (pk int);", + "CALL DOLT_ADD('.')", "INSERT INTO parent VALUES (1, 1), (2, 2);", "CALL DOLT_COMMIT('-am', 'setup');", "CALL DOLT_BRANCH('branch1');", @@ -3055,6 +3118,7 @@ var OldFormatMergeConflictsAndCVsScripts = []queries.ScriptTest{ SetUpScript: []string{ "CREATE table parent (pk int PRIMARY KEY, col1 int);", "CREATE table child (pk int PRIMARY KEY, parent_fk int, FOREIGN KEY (parent_fk) REFERENCES parent(pk));", + "CALL DOLT_ADD('.')", "INSERT INTO parent VALUES (1, 1), (2, 1);", "CALL DOLT_COMMIT('-am', 'create table with data');", "CALL DOLT_BRANCH('other');", @@ -3128,6 +3192,7 @@ var OldFormatMergeConflictsAndCVsScripts = []queries.ScriptTest{ SetUpScript: []string{ "CREATE table parent (pk int PRIMARY KEY, col1 int);", "CREATE table child (pk int PRIMARY KEY, parent_fk int, FOREIGN KEY (parent_fk) REFERENCES parent(pk));", + "CALL DOLT_ADD('.')", "INSERT INTO parent VALUES (1, 1), (2, 1);", "CALL DOLT_COMMIT('-am', 'create table with data');", "CALL DOLT_BRANCH('other');", @@ -3202,6 +3267,7 @@ var OldFormatMergeConflictsAndCVsScripts = []queries.ScriptTest{ SetUpScript: []string{ "SET dolt_force_transaction_commit = on;", "CREATE TABLE t (pk int PRIMARY KEY, col1 int);", + "CALL DOLT_ADD('.')", "CALL DOLT_COMMIT('-am', 'table');", "CALL DOLT_BRANCH('right');", "INSERT INTO t VALUES (1, 1), (2, 1);", @@ -3239,6 +3305,7 @@ var OldFormatMergeConflictsAndCVsScripts = []queries.ScriptTest{ SetUpScript: []string{ "SET dolt_force_transaction_commit = on;", "CREATE TABLE t (pk int PRIMARY KEY, col1 int);", + "CALL DOLT_ADD('.');", "INSERT INTO t VALUES (1, 1), (2, 1);", "CALL DOLT_COMMIT('-am', 'table and data');", @@ -3400,6 +3467,7 @@ var DoltBranchScripts = []queries.ScriptTest{ Name: "Create branch from startpoint", SetUpScript: []string{ "create table a (x int)", + "call dolt_add('.')", "set @commit1 = (select DOLT_COMMIT('-am', 'add table a'));", }, Assertions: []queries.ScriptTestAssertion{ @@ -3436,6 +3504,7 @@ var DoltReset = []queries.ScriptTest{ Name: "CALL DOLT_RESET('--hard') should reset the merge state after uncommitted merge", SetUpScript: []string{ "CREATE TABLE test1 (pk int NOT NULL, c1 int, c2 int, PRIMARY KEY (pk));", + "CALL DOLT_ADD('.')", "INSERT INTO test1 values (0,1,1);", "CALL DOLT_COMMIT('-am', 'added table')", @@ -3463,6 +3532,7 @@ var DoltReset = []queries.ScriptTest{ SetUpScript: []string{ "SET dolt_allow_commit_conflicts = on", "CREATE TABLE test1 (pk int NOT NULL, c1 int, c2 int, PRIMARY KEY (pk));", + "CALL DOLT_ADD('.')", "INSERT INTO test1 values (0,1,1);", "CALL DOLT_COMMIT('-am', 'added table')", @@ -3491,6 +3561,7 @@ var DiffSystemTableScriptTests = []queries.ScriptTest{ Name: "base case: added rows", SetUpScript: []string{ "create table t (pk int primary key, c1 int, c2 int);", + "call dolt_add('.')", "insert into t values (1, 2, 3), (4, 5, 6);", "set @Commit1 = (select DOLT_COMMIT('-am', 'creating table t'));", }, @@ -3512,6 +3583,7 @@ var DiffSystemTableScriptTests = []queries.ScriptTest{ Name: "base case: modified rows", SetUpScript: []string{ "create table t (pk int primary key, c1 int, c2 int);", + "call dolt_add('.')", "insert into t values (1, 2, 3), (4, 5, 6);", "set @Commit1 = (select DOLT_COMMIT('-am', 'creating table t'));", @@ -3535,6 +3607,7 @@ var DiffSystemTableScriptTests = []queries.ScriptTest{ Name: "base case: deleted row", SetUpScript: []string{ "create table t (pk int primary key, c1 int, c2 int);", + "call dolt_add('.')", "insert into t values (1, 2, 3), (4, 5, 6);", "set @Commit1 = (select DOLT_COMMIT('-am', 'creating table t'));", @@ -3559,6 +3632,7 @@ var DiffSystemTableScriptTests = []queries.ScriptTest{ Name: "table drop and recreate with overlapping schema", SetUpScript: []string{ "create table t (pk int primary key, c int);", + "call dolt_add('.')", "insert into t values (1, 2), (3, 4);", "set @Commit1 = (select DOLT_COMMIT('-am', 'creating table t'));", @@ -3566,6 +3640,7 @@ var DiffSystemTableScriptTests = []queries.ScriptTest{ "set @Commit2 = (select DOLT_COMMIT('-am', 'dropping table t'));", "create table t (pk int primary key, c int);", + "call dolt_add('.')", "insert into t values (100, 200), (300, 400);", "set @Commit3 = (select DOLT_COMMIT('-am', 'recreating table t'));", }, @@ -3588,6 +3663,7 @@ var DiffSystemTableScriptTests = []queries.ScriptTest{ Name: "column drop", SetUpScript: []string{ "create table t (pk int primary key, c1 int, c2 int);", + "call dolt_add('.')", "insert into t values (1, 2, 3), (4, 5, 6);", "set @Commit1 = (select DOLT_COMMIT('-am', 'creating table t'));", @@ -3620,6 +3696,7 @@ var DiffSystemTableScriptTests = []queries.ScriptTest{ Name: "column drop and recreate with same type", SetUpScript: []string{ "create table t (pk int primary key, c int);", + "call dolt_add('.')", "insert into t values (1, 2), (3, 4);", "set @Commit1 = (select DOLT_COMMIT('-am', 'creating table t'));", @@ -3662,6 +3739,7 @@ var DiffSystemTableScriptTests = []queries.ScriptTest{ Name: "column drop, then rename column with same type to same name", SetUpScript: []string{ "create table t (pk int primary key, c1 int, c2 int);", + "call dolt_add('.')", "insert into t values (1, 2, 3), (4, 5, 6);", "set @Commit1 = (select DOLT_COMMIT('-am', 'creating table t'));", @@ -3749,6 +3827,7 @@ var DiffSystemTableScriptTests = []queries.ScriptTest{ Name: "column drop and recreate with different type that can be coerced (int -> string)", SetUpScript: []string{ "create table t (pk int primary key, c int);", + "call dolt_add('.')", "insert into t values (1, 2), (3, 4);", "set @Commit1 = (select DOLT_COMMIT('-am', 'creating table t'));", @@ -3790,6 +3869,7 @@ var DiffSystemTableScriptTests = []queries.ScriptTest{ Name: "column drop and recreate with different type that can NOT be coerced (string -> int)", SetUpScript: []string{ "create table t (pk int primary key, c varchar(20));", + "call dolt_add('.')", "insert into t values (1, 'two'), (3, 'four');", "set @Commit1 = (select DOLT_COMMIT('-am', 'creating table t'));", @@ -3838,6 +3918,7 @@ var DiffSystemTableScriptTests = []queries.ScriptTest{ Name: "multiple column renames", SetUpScript: []string{ "create table t (pk int primary key, c1 int);", + "call dolt_add('.')", "insert into t values (1, 2);", "set @Commit1 = (select DOLT_COMMIT('-am', 'creating table t'));", @@ -3888,6 +3969,7 @@ var DiffSystemTableScriptTests = []queries.ScriptTest{ Name: "primary key change", SetUpScript: []string{ "create table t (pk int primary key, c1 int);", + "call dolt_add('.')", "insert into t values (1, 2), (3, 4);", "set @Commit1 = (select DOLT_COMMIT('-am', 'creating table t'));", @@ -3923,6 +4005,7 @@ var DiffSystemTableScriptTests = []queries.ScriptTest{ Name: "table with commit column should maintain its data in diff", SetUpScript: []string{ "CREATE TABLE t (pk int PRIMARY KEY, commit varchar(20));", + "CALL DOLT_ADD('.')", "CALL dolt_commit('-am', 'creating table t');", "INSERT INTO t VALUES (1, 'hi');", "CALL dolt_commit('-am', 'insert data');", @@ -3938,6 +4021,7 @@ var DiffSystemTableScriptTests = []queries.ScriptTest{ Name: "selecting to_pk columns", SetUpScript: []string{ "create table t (pk int primary key, c1 int, c2 int);", + "call dolt_add('.')", "insert into t values (1, 2, 3), (4, 5, 6);", "set @Commit1 = (select DOLT_COMMIT('-am', 'first commit'));", "insert into t values (7, 8, 9);", @@ -3970,6 +4054,7 @@ var DiffSystemTableScriptTests = []queries.ScriptTest{ Name: "selecting to_pk1 and to_pk2 columns", SetUpScript: []string{ "create table t (pk1 int, pk2 int, c1 int, primary key (pk1, pk2));", + "call dolt_add('.')", "insert into t values (1, 2, 3), (4, 5, 6);", "set @Commit1 = (select DOLT_COMMIT('-am', 'first commit'));", "insert into t values (7, 8, 9);", @@ -4036,6 +4121,7 @@ var Dolt1DiffSystemTableScripts = []queries.ScriptTest{ Name: "Diff table stops creating diff partitions when any primary key type has changed", SetUpScript: []string{ "CREATE TABLE t (pk1 VARCHAR(100), pk2 VARCHAR(100), PRIMARY KEY (pk1, pk2));", + "CALL DOLT_ADD('.')", "INSERT INTO t VALUES ('1', '1');", "CALL DOLT_COMMIT('-am', 'setup');", @@ -4059,6 +4145,7 @@ var DiffTableFunctionScriptTests = []queries.ScriptTest{ Name: "invalid arguments", SetUpScript: []string{ "create table t (pk int primary key, c1 varchar(20), c2 varchar(20));", + "call dolt_add('.')", "set @Commit1 = dolt_commit('-am', 'creating table t');", "insert into t values(1, 'one', 'two'), (2, 'two', 'three');", @@ -4125,12 +4212,14 @@ var DiffTableFunctionScriptTests = []queries.ScriptTest{ "set @Commit0 = HashOf('HEAD');", "create table t (pk int primary key, c1 varchar(20), c2 varchar(20));", + "call dolt_add('.')", "set @Commit1 = dolt_commit('-am', 'creating table t');", "insert into t values(1, 'one', 'two');", "set @Commit2 = dolt_commit('-am', 'inserting into table t');", "create table t2 (pk int primary key, c1 varchar(20), c2 varchar(20));", + "call dolt_add('.')", "insert into t2 values(100, 'hundred', 'hundert');", "set @Commit3 = dolt_commit('-am', 'inserting into table t2');", @@ -4193,6 +4282,7 @@ var DiffTableFunctionScriptTests = []queries.ScriptTest{ "set @Commit0 = HashOf('HEAD');", "create table t (pk int primary key, c1 text, c2 text);", + "call dolt_add('.')", "insert into t values (1, 'one', 'two'), (2, 'three', 'four');", "set @Commit1 = dolt_commit('-am', 'inserting two rows into table t');", @@ -4255,6 +4345,7 @@ var DiffTableFunctionScriptTests = []queries.ScriptTest{ Name: "diff with branch refs", SetUpScript: []string{ "create table t (pk int primary key, c1 varchar(20), c2 varchar(20));", + "call dolt_add('.')", "set @Commit1 = dolt_commit('-am', 'creating table t');", "insert into t values(1, 'one', 'two');", @@ -4302,6 +4393,7 @@ var DiffTableFunctionScriptTests = []queries.ScriptTest{ Name: "schema modification: drop and recreate column with same type", SetUpScript: []string{ "create table t (pk int primary key, c1 varchar(20), c2 varchar(20));", + "call dolt_add('.')", "set @Commit1 = dolt_commit('-am', 'creating table t');", "insert into t values(1, 'one', 'two'), (2, 'two', 'three');", @@ -4361,6 +4453,7 @@ var DiffTableFunctionScriptTests = []queries.ScriptTest{ Name: "schema modification: rename columns", SetUpScript: []string{ "create table t (pk int primary key, c1 varchar(20), c2 int);", + "call dolt_add('.')", "set @Commit1 = dolt_commit('-am', 'creating table t');", "insert into t values(1, 'one', -1), (2, 'two', -2);", @@ -4429,6 +4522,7 @@ var DiffTableFunctionScriptTests = []queries.ScriptTest{ Name: "schema modification: drop and rename columns with different types", SetUpScript: []string{ "create table t (pk int primary key, c1 varchar(20), c2 varchar(20));", + "call dolt_add('.')", "set @Commit1 = dolt_commit('-am', 'creating table t');", "insert into t values(1, 'one', 'asdf'), (2, 'two', '2');", @@ -4509,6 +4603,7 @@ var DiffTableFunctionScriptTests = []queries.ScriptTest{ Name: "dropped table", SetUpScript: []string{ "create table t1 (a int primary key, b int)", + "call dolt_add('.')", "insert into t1 values (1,2)", "call dolt_commit('-am', 'new table')", "drop table t1", @@ -4525,9 +4620,11 @@ var DiffTableFunctionScriptTests = []queries.ScriptTest{ Name: "renamed table", SetUpScript: []string{ "create table t1 (a int primary key, b int)", + "call dolt_add('.')", "insert into t1 values (1,2)", "call dolt_commit('-am', 'new table')", "alter table t1 rename to t2", + "call dolt_add('.')", "insert into t2 values (3,4)", "call dolt_commit('-am', 'renamed table')", }, @@ -4606,6 +4703,7 @@ var UnscopedDiffSystemTableScriptTests = []queries.ScriptTest{ "create table regularTable (a int primary key, b int, c int);", "create table droppedTable (a int primary key, b int, c int);", "create table renamedEmptyTable (a int primary key, b int, c int);", + "call dolt_add('.')", "insert into droppedTable values (1, 2, 3), (2, 3, 4);", "set @Commit1 = (select DOLT_COMMIT('-am', 'Creating tables x and y'));", @@ -4641,10 +4739,12 @@ var UnscopedDiffSystemTableScriptTests = []queries.ScriptTest{ SetUpScript: []string{ "create table x (a int primary key, b int, c int);", "create table y (a int primary key, b int, c int);", + "call dolt_add('.')", "insert into x values (1, 2, 3), (2, 3, 4);", "set @Commit1 = (select DOLT_COMMIT('-am', 'Creating tables x and y'));", "create table z (a int primary key, b int, c int);", + "call dolt_add('.')", "insert into z values (100, 101, 102);", "set @Commit2 = (select DOLT_COMMIT('-am', 'Creating tables z'));", @@ -4679,18 +4779,22 @@ var UnscopedDiffSystemTableScriptTests = []queries.ScriptTest{ SetUpScript: []string{ "create table x (a int primary key, b int, c int)", "create table y (a int primary key, b int, c int)", + "call dolt_add('.')", "insert into x values (1, 2, 3), (2, 3, 4)", "set @Commit1 = (select DOLT_COMMIT('-am', 'Creating tables x and y'))", "create table z (a int primary key, b int, c int)", + "call dolt_add('.')", "insert into z values (100, 101, 102)", "set @Commit2 = (select DOLT_COMMIT('-am', 'Creating tables z'))", "rename table x to x1", + "call dolt_add('.')", "insert into x1 values (1000, 1001, 1002);", "set @Commit3 = (select DOLT_COMMIT('-am', 'Renaming table x to x1 and inserting data'))", "rename table x1 to x2", + "call dolt_add('.')", "set @Commit4 = (select DOLT_COMMIT('-am', 'Renaming table x1 to x2'))", }, Assertions: []queries.ScriptTestAssertion{ @@ -4721,6 +4825,7 @@ var UnscopedDiffSystemTableScriptTests = []queries.ScriptTest{ SetUpScript: []string{ "create table x (a int primary key, b int, c int)", "create table y (a int primary key, b int, c int)", + "call dolt_add('.')", "insert into x values (1, 2, 3), (2, 3, 4)", "set @Commit1 = (select DOLT_COMMIT('-am', 'Creating tables x and y'))", @@ -4754,6 +4859,7 @@ var UnscopedDiffSystemTableScriptTests = []queries.ScriptTest{ SetUpScript: []string{ "create table x (a int primary key, b int, c int)", "create table y (a int primary key, b int, c int)", + "call dolt_add('.')", "insert into x values (1, 2, 3), (2, 3, 4)", "set @Commit1 = (select DOLT_COMMIT('-am', 'Creating tables x and y'))", @@ -4787,11 +4893,13 @@ var UnscopedDiffSystemTableScriptTests = []queries.ScriptTest{ "select dolt_checkout('-b', 'branch1')", "create table x (a int primary key, b int, c int)", "create table y (a int primary key, b int, c int)", + "call dolt_add('.')", "insert into x values (1, 2, 3), (2, 3, 4)", "set @Commit1 = (select DOLT_COMMIT('-am', 'Creating tables x and y'))", "select dolt_checkout('-b', 'branch2')", "create table z (a int primary key, b int, c int)", + "call dolt_add('.')", "insert into z values (100, 101, 102)", "set @Commit2 = (select DOLT_COMMIT('-am', 'Creating tables z'))", @@ -4827,11 +4935,13 @@ var UnscopedDiffSystemTableScriptTests = []queries.ScriptTest{ "select dolt_checkout('-b', 'branch1')", "create table x (a int primary key, b int, c int)", "create table y (a int primary key, b int, c int)", + "call dolt_add('.')", "insert into x values (1, 2, 3), (2, 3, 4)", "set @Commit1 = (select DOLT_COMMIT('-am', 'Creating tables x and y'))", "select dolt_checkout('-b', 'branch2')", "create table z (a int primary key, b int, c int)", + "call dolt_add('.')", "insert into z values (100, 101, 102)", "set @Commit2 = (select DOLT_COMMIT('-am', 'Creating tables z'))", @@ -4864,6 +4974,7 @@ var CommitDiffSystemTableScriptTests = []queries.ScriptTest{ Name: "error handling", SetUpScript: []string{ "create table t (pk int primary key, c1 int, c2 int);", + "call dolt_add('.')", "insert into t values (1, 2, 3), (4, 5, 6);", "set @Commit1 = (select DOLT_COMMIT('-am', 'creating table t'));", }, @@ -4887,6 +4998,7 @@ var CommitDiffSystemTableScriptTests = []queries.ScriptTest{ SetUpScript: []string{ "set @Commit0 = HASHOF('HEAD');", "create table t (pk int primary key, c1 int, c2 int);", + "call dolt_add('.')", "insert into t values (1, 2, 3), (4, 5, 6);", "set @Commit1 = (select DOLT_COMMIT('-am', 'creating table t'));", @@ -4942,6 +5054,7 @@ var CommitDiffSystemTableScriptTests = []queries.ScriptTest{ SetUpScript: []string{ "set @Commit0 = HASHOF('HEAD');", "create table t (pk int primary key, c1 int, c2 int);", + "call dolt_add('.')", "insert into t values (1, 2, 3), (4, 5, 6);", "set @Commit1 = (select DOLT_COMMIT('-am', 'creating table t'));", @@ -4971,6 +5084,7 @@ var CommitDiffSystemTableScriptTests = []queries.ScriptTest{ SetUpScript: []string{ "set @Commit0 = HASHOF('HEAD');", "create table t (pk int primary key, c int);", + "call dolt_add('.')", "insert into t values (1, 2), (3, 4);", "set @Commit1 = (select DOLT_COMMIT('-am', 'creating table t'));", @@ -5010,6 +5124,7 @@ var CommitDiffSystemTableScriptTests = []queries.ScriptTest{ SetUpScript: []string{ "set @Commit0 = HASHOF('HEAD');", "create table t (pk int primary key, c1 int, c2 int);", + "call dolt_add('.')", "insert into t values (1, 2, 3), (4, 5, 6);", "set @Commit1 = DOLT_COMMIT('-am', 'creating table t');", @@ -5052,6 +5167,7 @@ var CommitDiffSystemTableScriptTests = []queries.ScriptTest{ SetUpScript: []string{ "set @Commit0 = HASHOF('HEAD');", "create table t (pk int primary key, c int);", + "call dolt_add('.')", "insert into t values (1, 2), (3, 4);", "set @Commit1 = DOLT_COMMIT('-am', 'creating table t');", @@ -5090,6 +5206,7 @@ var CommitDiffSystemTableScriptTests = []queries.ScriptTest{ SetUpScript: []string{ "set @Commit0 = HASHOF('HEAD');", "create table t (pk int primary key, c varchar(20));", + "call dolt_add('.')", "insert into t values (1, 'two'), (3, 'four');", "set @Commit1 = (select DOLT_COMMIT('-am', 'creating table t'));", @@ -5134,6 +5251,7 @@ var CommitDiffSystemTableScriptTests = []queries.ScriptTest{ Name: "schema modification: primary key change", SetUpScript: []string{ "create table t (pk int primary key, c1 int);", + "call dolt_add('.')", "insert into t values (1, 2), (3, 4);", "set @Commit1 = DOLT_COMMIT('-am', 'creating table t');", @@ -5168,6 +5286,7 @@ var verifyConstraintsSetupScript = []string{ "CREATE TABLE child3 (pk BIGINT PRIMARY KEY, v1 BIGINT, CONSTRAINT fk_name1 FOREIGN KEY (v1) REFERENCES parent3 (v1));", "CREATE TABLE parent4 (pk BIGINT PRIMARY KEY, v1 BIGINT, INDEX (v1));", "CREATE TABLE child4 (pk BIGINT PRIMARY KEY, v1 BIGINT, CONSTRAINT fk_name2 FOREIGN KEY (v1) REFERENCES parent4 (v1));", + "CALL DOLT_ADD('.')", "INSERT INTO parent3 VALUES (1, 1);", "INSERT INTO parent4 VALUES (2, 2);", "SET foreign_key_checks=0;", @@ -5535,6 +5654,7 @@ var DoltTagTestScripts = []queries.ScriptTest{ Name: "dolt-tag: SQL create tags", SetUpScript: []string{ "CREATE TABLE test(pk int primary key);", + "CALL DOLT_ADD('.')", "INSERT INTO test VALUES (0),(1),(2);", "CALL DOLT_COMMIT('-am','created table test')", }, @@ -5561,6 +5681,7 @@ var DoltTagTestScripts = []queries.ScriptTest{ Name: "dolt-tag: SQL delete tags", SetUpScript: []string{ "CREATE TABLE test(pk int primary key);", + "CALL DOLT_ADD('.')", "INSERT INTO test VALUES (0),(1),(2);", "CALL DOLT_COMMIT('-am','created table test')", "CALL DOLT_TAG('v1', '-m', 'create tag v1')", @@ -5594,6 +5715,7 @@ var DoltTagTestScripts = []queries.ScriptTest{ Name: "dolt-tag: SQL use a tag as a ref for merge", SetUpScript: []string{ "CREATE TABLE test(pk int primary key);", + "CALL DOLT_ADD('.')", "INSERT INTO test VALUES (0),(1),(2);", "CALL DOLT_COMMIT('-am','created table test')", "DELETE FROM test WHERE pk = 0", @@ -5719,6 +5841,7 @@ var DoltAutoIncrementTests = []queries.ScriptTest{ Name: "insert on different branches", SetUpScript: []string{ "create table t (a int primary key auto_increment, b int)", + "call dolt_add('.')", "call dolt_commit('-am', 'empty table')", "call dolt_branch('branch1')", "call dolt_branch('branch2')", @@ -5772,6 +5895,7 @@ var DoltAutoIncrementTests = []queries.ScriptTest{ Name: "drop table", SetUpScript: []string{ "create table t (a int primary key auto_increment, b int)", + "call dolt_add('.')", "call dolt_commit('-am', 'empty table')", "call dolt_branch('branch1')", "call dolt_branch('branch2')", @@ -5861,6 +5985,7 @@ var BrokenAutoIncrementTests = []queries.ScriptTest{ Name: "truncate table", SetUpScript: []string{ "create table t (a int primary key auto_increment, b int)", + "call dolt_add('.')", "call dolt_commit('-am', 'empty table')", "call dolt_branch('branch1')", "call dolt_branch('branch2')", diff --git a/go/libraries/doltcore/sqle/enginetest/dolt_transaction_queries.go b/go/libraries/doltcore/sqle/enginetest/dolt_transaction_queries.go index 6183e51816..be7c54758c 100755 --- a/go/libraries/doltcore/sqle/enginetest/dolt_transaction_queries.go +++ b/go/libraries/doltcore/sqle/enginetest/dolt_transaction_queries.go @@ -761,6 +761,7 @@ var DoltConflictHandlingTests = []queries.TransactionTest{ Name: "default behavior (rollback on commit conflict)", SetUpScript: []string{ "CREATE TABLE test (pk int primary key, val int)", + "CALL DOLT_ADD('.')", "INSERT INTO test VALUES (0, 0)", "SELECT DOLT_COMMIT('-a', '-m', 'initial table');", }, @@ -811,6 +812,7 @@ var DoltConflictHandlingTests = []queries.TransactionTest{ Name: "allow commit conflicts on, conflict on transaction commit", SetUpScript: []string{ "CREATE TABLE test (pk int primary key, val int)", + "CALL DOLT_ADD('.')", "INSERT INTO test VALUES (0, 0)", "SELECT DOLT_COMMIT('-a', '-m', 'initial table');", }, @@ -861,6 +863,7 @@ var DoltConflictHandlingTests = []queries.TransactionTest{ Name: "force commit on, conflict on transaction commit (same as dolt_allow_commit_conflicts)", SetUpScript: []string{ "CREATE TABLE test (pk int primary key, val int)", + "CALL DOLT_ADD('.')", "INSERT INTO test VALUES (0, 0)", "SELECT DOLT_COMMIT('-a', '-m', 'initial table');", }, @@ -911,6 +914,7 @@ var DoltConflictHandlingTests = []queries.TransactionTest{ Name: "allow commit conflicts on, conflict on dolt_merge", SetUpScript: []string{ "CREATE TABLE test (pk int primary key, val int)", + "CALL DOLT_ADD('.')", "INSERT INTO test VALUES (0, 0)", "SELECT DOLT_COMMIT('-a', '-m', 'initial table');", }, @@ -1001,6 +1005,7 @@ var DoltConflictHandlingTests = []queries.TransactionTest{ Name: "force commit on, conflict on dolt_merge (same as dolt_allow_commit_conflicts)", SetUpScript: []string{ "CREATE TABLE test (pk int primary key, val int)", + "CALL DOLT_ADD('.')", "INSERT INTO test VALUES (0, 0)", "SELECT DOLT_COMMIT('-a', '-m', 'initial table');", }, @@ -1089,6 +1094,7 @@ var DoltConflictHandlingTests = []queries.TransactionTest{ Name: "allow commit conflicts off, conflict on dolt_merge", SetUpScript: []string{ "CREATE TABLE test (pk int primary key, val int)", + "CALL DOLT_ADD('.')", "INSERT INTO test VALUES (0, 0)", "SELECT DOLT_COMMIT('-a', '-m', 'initial table');", }, @@ -1159,6 +1165,7 @@ var DoltConflictHandlingTests = []queries.TransactionTest{ Name: "conflicts from a DOLT_MERGE return an initially unhelpful error in a concurrent write scenario", SetUpScript: []string{ "CREATE TABLE t (pk int PRIMARY KEY, col1 int);", + "CALL DOLT_ADD('.')", "CALL DOLT_COMMIT('-am', 'create table');", "CALL DOLT_CHECKOUT('-b', 'right');", @@ -1341,6 +1348,7 @@ var DoltSqlFuncTransactionTests = []queries.TransactionTest{ Name: "committed conflicts are seen by other sessions", SetUpScript: []string{ "CREATE TABLE test (pk int primary key, val int)", + "CALL DOLT_ADD('.')", "INSERT INTO test VALUES (0, 0)", "SELECT DOLT_COMMIT('-a', '-m', 'Step 1');", "SELECT DOLT_CHECKOUT('-b', 'feature-branch')", @@ -1482,6 +1490,7 @@ var DoltConstraintViolationTransactionTests = []queries.TransactionTest{ Name: "Constraint violations created by DOLT_MERGE should cause a roll back", SetUpScript: []string{ "CREATE TABLE t (pk int PRIMARY KEY, col1 int UNIQUE);", + "CALL DOLT_ADD('.')", "CALL DOLT_COMMIT('-am', 'create table');", "CALL DOLT_CHECKOUT('-b', 'right');", @@ -1515,6 +1524,7 @@ var DoltConstraintViolationTransactionTests = []queries.TransactionTest{ SetUpScript: []string{ "CREATE TABLE parent (pk BIGINT PRIMARY KEY, v1 BIGINT, INDEX(v1));", "CREATE TABLE child (pk BIGINT PRIMARY KEY, v1 BIGINT);", + "CALL DOLT_ADD('.')", "INSERT INTO parent VALUES (10, 1), (20, 2);", "INSERT INTO child VALUES (1, 1), (2, 2);", "ALTER TABLE child ADD CONSTRAINT fk_name FOREIGN KEY (v1) REFERENCES parent (v1);", @@ -1544,6 +1554,7 @@ var DoltConstraintViolationTransactionTests = []queries.TransactionTest{ SetUpScript: []string{ "CREATE TABLE parent (pk BIGINT PRIMARY KEY, v1 BIGINT, INDEX(v1));", "CREATE TABLE child (pk BIGINT PRIMARY KEY, v1 BIGINT);", + "CALL DOLT_ADD('.')", "INSERT INTO parent VALUES (10, 1), (20, 2);", "INSERT INTO child VALUES (1, 1), (2, 2);", "ALTER TABLE child ADD CONSTRAINT fk_name FOREIGN KEY (v1) REFERENCES parent (v1);",