Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
30 commits
Select commit Hold shift + click to select a range
69d39d1
Implemented dolt_history_dolt_schemas and dolt_diff_dolt_schemas
timsehn Jun 16, 2025
db42c63
Fix tests
timsehn Jun 16, 2025
c5d5f19
Added schema tests
timsehn Jun 16, 2025
16eb582
More test fixes
timsehn Jun 16, 2025
6f62dea
Another set of test changes
timsehn Jun 16, 2025
7b13095
Another pass this time with a better approach
timsehn Jun 16, 2025
b4722d8
Better tests
timsehn Jun 16, 2025
830cb58
Improve bats tests
timsehn Jun 17, 2025
c0d1de8
Fix copyright headers
timsehn Jun 17, 2025
0775c17
Fixed comparison logic in diff
timsehn Jun 17, 2025
448aeaa
fix skipped bats test
timsehn Jun 17, 2025
54a40ee
Another pas. This time beter i think
timsehn Jun 17, 2025
a717f4b
Fix bug with working and staged
timsehn Jun 17, 2025
053ada5
[ga-format-pr] Run go/utils/repofmt/format_repo.sh and go/Godeps/upda…
timsehn Jun 17, 2025
6917d57
This seems like a working implementation finally. Will manually test
timsehn Jun 17, 2025
e1c32aa
Merged github branch
timsehn Jun 17, 2025
9bcadfe
Made bats tests a bit more robust
timsehn Jun 17, 2025
ba7b937
Working build
timsehn Jun 17, 2025
1507143
Rename tables to not say new
timsehn Jun 17, 2025
40d488b
Remove giant unused commented code
timsehn Jun 17, 2025
255c488
[ga-format-pr] Run go/utils/repofmt/format_repo.sh and go/Godeps/upda…
timsehn Jun 17, 2025
8068ece
Remove dead code in dolt_schemas_diff_table.go
timsehn Jun 24, 2025
dfc3ea3
Remove dead code in dolt_schemas_history_table.go
timsehn Jun 24, 2025
a7f7f27
[ga-format-pr] Run go/utils/repofmt/format_repo.sh and go/Godeps/upda…
timsehn Jun 24, 2025
a61b51c
Addressed the rest of Brian's feedback
timsehn Jun 24, 2025
190a5f4
Merged and resolved conflict
timsehn Jun 24, 2025
c73d6ad
[ga-format-pr] Run go/utils/repofmt/format_repo.sh and go/Godeps/upda…
timsehn Jun 24, 2025
186dc75
Addressed constants feedback. Made a number of new constants and used…
timsehn Jun 25, 2025
6cae5ef
Merge branch 'tim/history-tables-dolt-schemas' of github.com:dolthub/…
timsehn Jun 25, 2025
2510316
[ga-format-pr] Run go/utils/repofmt/format_repo.sh and go/Godeps/upda…
timsehn Jun 25, 2025
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
36 changes: 36 additions & 0 deletions go/libraries/doltcore/doltdb/system_table.go
Original file line number Diff line number Diff line change
Expand Up @@ -291,6 +291,42 @@ const (
// SchemasTablesSqlModeCol is the name of the column that stores the SQL_MODE string used when this fragment
// was originally defined. Mode settings, such as ANSI_QUOTES, are needed to correctly parse the fragment.
SchemasTablesSqlModeCol = "sql_mode"

// DiffTypeCol is the column name for the type of change (added, modified, removed) in diff tables
DiffTypeCol = "diff_type"

// ToCommitCol is the column name for the "to" commit in diff tables
ToCommitCol = "to_commit"

// FromCommitCol is the column name for the "from" commit in diff tables
FromCommitCol = "from_commit"

// ToCommitDateCol is the column name for the "to" commit date in diff tables
ToCommitDateCol = "to_commit_date"

// FromCommitDateCol is the column name for the "from" commit date in diff tables
FromCommitDateCol = "from_commit_date"

// WorkingCommitRef is the special commit reference for working changes
WorkingCommitRef = "WORKING"

// EmptyCommitRef is the special commit reference for empty/initial state
EmptyCommitRef = "EMPTY"

// DiffTypeAdded represents a row that was added in a diff
DiffTypeAdded = "added"

// DiffTypeModified represents a row that was modified in a diff
DiffTypeModified = "modified"

// DiffTypeRemoved represents a row that was removed in a diff
DiffTypeRemoved = "removed"

// DiffToPrefix is the prefix for "to" columns in diff tables
DiffToPrefix = "to_"

// DiffFromPrefix is the prefix for "from" columns in diff tables
DiffFromPrefix = "from_"
)

const (
Expand Down
25 changes: 25 additions & 0 deletions go/libraries/doltcore/sqle/database.go
Original file line number Diff line number Diff line change
Expand Up @@ -332,6 +332,20 @@ func (db Database) getTableInsensitive(ctx *sql.Context, head *doltdb.Commit, ds
// TODO: these tables that cache a root value at construction time should not, they need to get it from the session
// at runtime
switch {
case lwrName == doltdb.DoltDiffTablePrefix+doltdb.SchemasTableName:
// Special handling for dolt_diff_dolt_schemas
// Get the HEAD commit
if head == nil {
var err error
head, err = ds.GetHeadCommit(ctx, db.RevisionQualifiedName())
if err != nil {
return nil, false, err
}
}

// Use the same pattern as regular diff tables - this will show complete history
return DoltSchemasDiffTable(ctx, db.ddb, head, root, db), true, nil

case strings.HasPrefix(lwrName, doltdb.DoltDiffTablePrefix):
if head == nil {
var err error
Expand Down Expand Up @@ -384,6 +398,17 @@ func (db Database) getTableInsensitive(ctx *sql.Context, head *doltdb.Commit, ds
}
return dt, true, nil

case lwrName == doltdb.DoltHistoryTablePrefix+doltdb.SchemasTableName:
// Special handling for dolt_history_dolt_schemas
if head == nil {
var err error
head, err = ds.GetHeadCommit(ctx, db.RevisionQualifiedName())
if err != nil {
return nil, false, err
}
}
return DoltSchemasHistoryTable(db.ddb, head, db), true, nil

case strings.HasPrefix(lwrName, doltdb.DoltHistoryTablePrefix):
baseTableName := tblName[len(doltdb.DoltHistoryTablePrefix):]
baseTable, ok, err := db.getTable(ctx, root, baseTableName)
Expand Down
Loading
Loading