Ensure NS KV is added when defining
This commit is contained in:
parent
f681b83ee7
commit
6075e4d1d7
1 changed files with 24 additions and 0 deletions
24
db/define.go
24
db/define.go
|
@ -37,6 +37,12 @@ func executeDefineTableStatement(txn kvs.TX, ast *sql.DefineTableStatement) (out
|
||||||
|
|
||||||
for _, TB := range ast.What {
|
for _, TB := range ast.What {
|
||||||
|
|
||||||
|
// Set the namespace definition
|
||||||
|
nkey := &keys.NS{KV: ast.KV, NS: ast.NS}
|
||||||
|
if err := txn.Put(nkey.Encode(), nil); err != nil {
|
||||||
|
return nil, err
|
||||||
|
}
|
||||||
|
|
||||||
// Set the database definition
|
// Set the database definition
|
||||||
dkey := &keys.DB{KV: ast.KV, NS: ast.NS, DB: ast.DB}
|
dkey := &keys.DB{KV: ast.KV, NS: ast.NS, DB: ast.DB}
|
||||||
if err := txn.Put(dkey.Encode(), nil); err != nil {
|
if err := txn.Put(dkey.Encode(), nil); err != nil {
|
||||||
|
@ -76,6 +82,12 @@ func executeDefineRulesStatement(txn kvs.TX, ast *sql.DefineRulesStatement) (out
|
||||||
|
|
||||||
for _, RU := range ast.When {
|
for _, RU := range ast.When {
|
||||||
|
|
||||||
|
// Set the namespace definition
|
||||||
|
nkey := &keys.NS{KV: ast.KV, NS: ast.NS}
|
||||||
|
if err := txn.Put(nkey.Encode(), nil); err != nil {
|
||||||
|
return nil, err
|
||||||
|
}
|
||||||
|
|
||||||
// Set the database definition
|
// Set the database definition
|
||||||
dkey := &keys.DB{KV: ast.KV, NS: ast.NS, DB: ast.DB}
|
dkey := &keys.DB{KV: ast.KV, NS: ast.NS, DB: ast.DB}
|
||||||
if err := txn.Put(dkey.Encode(), nil); err != nil {
|
if err := txn.Put(dkey.Encode(), nil); err != nil {
|
||||||
|
@ -121,6 +133,12 @@ func executeDefineFieldStatement(txn kvs.TX, ast *sql.DefineFieldStatement) (out
|
||||||
|
|
||||||
for _, TB := range ast.What {
|
for _, TB := range ast.What {
|
||||||
|
|
||||||
|
// Set the namespace definition
|
||||||
|
nkey := &keys.NS{KV: ast.KV, NS: ast.NS}
|
||||||
|
if err := txn.Put(nkey.Encode(), nil); err != nil {
|
||||||
|
return nil, err
|
||||||
|
}
|
||||||
|
|
||||||
// Set the database definition
|
// Set the database definition
|
||||||
dkey := &keys.DB{KV: ast.KV, NS: ast.NS, DB: ast.DB}
|
dkey := &keys.DB{KV: ast.KV, NS: ast.NS, DB: ast.DB}
|
||||||
if err := txn.Put(dkey.Encode(), nil); err != nil {
|
if err := txn.Put(dkey.Encode(), nil); err != nil {
|
||||||
|
@ -164,6 +182,12 @@ func executeDefineIndexStatement(txn kvs.TX, ast *sql.DefineIndexStatement) (out
|
||||||
|
|
||||||
for _, TB := range ast.What {
|
for _, TB := range ast.What {
|
||||||
|
|
||||||
|
// Set the namespace definition
|
||||||
|
nkey := &keys.NS{KV: ast.KV, NS: ast.NS}
|
||||||
|
if err := txn.Put(nkey.Encode(), nil); err != nil {
|
||||||
|
return nil, err
|
||||||
|
}
|
||||||
|
|
||||||
// Set the database definition
|
// Set the database definition
|
||||||
dkey := &keys.DB{KV: ast.KV, NS: ast.NS, DB: ast.DB}
|
dkey := &keys.DB{KV: ast.KV, NS: ast.NS, DB: ast.DB}
|
||||||
if err := txn.Put(dkey.Encode(), nil); err != nil {
|
if err := txn.Put(dkey.Encode(), nil); err != nil {
|
||||||
|
|
Loading…
Reference in a new issue