mirror of
https://github.com/dolthub/dolt.git
synced 2026-05-02 11:30:13 -05:00
write feature version on TableEditSession.flush()
This commit is contained in:
@@ -44,13 +44,9 @@ const (
|
||||
MasterBranch = "master"
|
||||
CommitStructName = "Commit"
|
||||
|
||||
FeatureVersion featureVersion = 0
|
||||
|
||||
defaultChunksPerTF = 256 * 1024
|
||||
)
|
||||
|
||||
type featureVersion int64
|
||||
|
||||
// LocalDirDoltDB stores the db in the current directory
|
||||
var LocalDirDoltDB = "file://./" + dbfactory.DoltDataDir
|
||||
|
||||
|
||||
@@ -34,8 +34,12 @@ const (
|
||||
superSchemasKey = "super_schemas"
|
||||
foreignKeyKey = "foreign_key"
|
||||
featureVersKey = "feature_ver"
|
||||
|
||||
FeatureVersion featureVersion = 0
|
||||
)
|
||||
|
||||
type featureVersion int64
|
||||
|
||||
// RootValue defines the structure used inside all Dolthub noms dbs
|
||||
type RootValue struct {
|
||||
vrw types.ValueReadWriter
|
||||
@@ -133,6 +137,16 @@ func (root *RootValue) GetFeatureVersion(ctx context.Context) (ver int64, ok boo
|
||||
return ver, ok, err
|
||||
}
|
||||
|
||||
func (root *RootValue) SetFeatureVersion(ctx context.Context) (*RootValue, error) {
|
||||
st, err := root.valueSt.Set(featureVersKey, types.Int(FeatureVersion))
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
|
||||
return newRootValue(root.vrw, st), nil
|
||||
}
|
||||
|
||||
|
||||
func (root *RootValue) HasTable(ctx context.Context, tName string) (bool, error) {
|
||||
val, found, err := root.valueSt.MaybeGet(tablesKey)
|
||||
|
||||
|
||||
@@ -192,6 +192,11 @@ func (tes *TableEditSession) flush(ctx context.Context) (*doltdb.RootValue, erro
|
||||
return nil, rootErr
|
||||
}
|
||||
|
||||
newRoot, rootErr = newRoot.SetFeatureVersion(ctx)
|
||||
if rootErr != nil {
|
||||
return nil, rootErr
|
||||
}
|
||||
|
||||
tes.root = newRoot
|
||||
return newRoot, nil
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user