Skip to content

Commit 7b5b764

Browse files
committed
/go/libraries/doltcore/env/actions/dolt_ci/schema.go: export expected tables
1 parent 1785ef9 commit 7b5b764

File tree

1 file changed

+10
-8
lines changed
  • go/libraries/doltcore/env/actions/dolt_ci

1 file changed

+10
-8
lines changed

go/libraries/doltcore/env/actions/dolt_ci/schema.go

Lines changed: 10 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,9 @@ import (
2828
"github.com/dolthub/dolt/go/store/datas"
2929
)
3030

31-
var expectedDoltCITablesOrdered = []doltdb.TableName{
31+
// ExpectedDoltCITablesOrdered contains the tables names for the dolt ci workflow tables, in parent to child table order.
32+
// This is exported for use in DoltHub/DoltLab.
33+
var ExpectedDoltCITablesOrdered = []doltdb.TableName{
3234
{Name: doltdb.WorkflowsTableName},
3335
{Name: doltdb.WorkflowEventsTableName},
3436
{Name: doltdb.WorkflowEventTriggersTableName},
@@ -55,7 +57,7 @@ func HasDoltCITables(ctx *sql.Context) (bool, error) {
5557
exists := 0
5658
var hasSome bool
5759
var hasAll bool
58-
for _, tableName := range expectedDoltCITablesOrdered {
60+
for _, tableName := range ExpectedDoltCITablesOrdered {
5961
found, err := root.HasTable(ctx, tableName)
6062
if err != nil {
6163
return false, err
@@ -65,8 +67,8 @@ func HasDoltCITables(ctx *sql.Context) (bool, error) {
6567
}
6668
}
6769

68-
hasSome = exists > 0 && exists < len(expectedDoltCITablesOrdered)
69-
hasAll = exists == len(expectedDoltCITablesOrdered)
70+
hasSome = exists > 0 && exists < len(ExpectedDoltCITablesOrdered)
71+
hasAll = exists == len(ExpectedDoltCITablesOrdered)
7072
if !hasSome && !hasAll {
7173
return false, nil
7274
}
@@ -87,7 +89,7 @@ func getExistingDoltCITables(ctx *sql.Context) ([]doltdb.TableName, error) {
8789

8890
root := ws.WorkingRoot()
8991

90-
for _, tableName := range expectedDoltCITablesOrdered {
92+
for _, tableName := range ExpectedDoltCITablesOrdered {
9193
found, err := root.HasTable(ctx, tableName)
9294
if err != nil {
9395
return nil, err
@@ -112,8 +114,8 @@ func sqlWriteQuery(ctx *sql.Context, queryFunc queryFunc, query string) error {
112114
func commitCIDestroy(ctx *sql.Context, queryFunc queryFunc, commiterName, commiterEmail string) error {
113115
// stage table in reverse order so child tables
114116
// are staged before parent tables
115-
for i := len(expectedDoltCITablesOrdered) - 1; i >= 0; i-- {
116-
tableName := expectedDoltCITablesOrdered[i]
117+
for i := len(ExpectedDoltCITablesOrdered) - 1; i >= 0; i-- {
118+
tableName := ExpectedDoltCITablesOrdered[i]
117119
err := sqlWriteQuery(ctx, queryFunc, fmt.Sprintf("CALL DOLT_ADD('%s');", tableName))
118120
if err != nil {
119121
return err
@@ -177,7 +179,7 @@ func CreateDoltCITables(ctx *sql.Context, db sqle.Database, commiterName, commit
177179
return fmt.Errorf("roots not found in database %s", dbName)
178180
}
179181

180-
roots, err = actions.StageTables(ctx, roots, expectedDoltCITablesOrdered, true)
182+
roots, err = actions.StageTables(ctx, roots, ExpectedDoltCITablesOrdered, true)
181183
if err != nil {
182184
return err
183185
}

0 commit comments

Comments
 (0)