3
0

Support SQLite table & index creation

This commit is contained in:
Denis Arh
2022-09-10 10:00:33 +02:00
parent 1f85b1be2b
commit d1dd4d1a0c
3 changed files with 20 additions and 5 deletions

View File

@@ -1,5 +1,7 @@
package dal
import "go.uber.org/zap"
type (
issue struct {
kind issueKind
@@ -118,6 +120,13 @@ func (a *issueHelper) mergeWith(b *issueHelper) {
// Op check utils
func (svc *service) canOpData(ref ModelRef) (err error) {
if svc.hasConnectionIssues(ref.ConnectionID) {
for _, i := range svc.connectionIssues[ref.ConnectionID] {
svc.logger.Debug(
"can not perform data operation due to connection issue: "+i.err.Error(),
zap.Any("ref", ref.ResourceID),
)
}
return errRecordOpProblematicConnection(ref.ConnectionID)
}
@@ -127,6 +136,13 @@ func (svc *service) canOpData(ref ModelRef) (err error) {
}
if svc.hasModelIssues(mod.ResourceID) {
for _, i := range svc.modelIssues[mod.ResourceID] {
svc.logger.Debug(
"can not perform data operation due to model issue: "+i.err.Error(),
zap.Any("ref", ref.ResourceID),
)
}
return errRecordOpProblematicModel(mod.ResourceID)
}

View File

@@ -76,9 +76,7 @@ func Connect(ctx context.Context, dsn string) (_ store.Storer, err error) {
ErrorHandler: errorHandler,
TxRetryLimit: -1,
//TxRetryErrHandler: txRetryErrHandler,
//SchemaAPI: &schema{},
DataDefiner: DataDefiner(cfg.DBName, db),
}
s.SetDefaults()

View File

@@ -2,8 +2,8 @@ package sqlite
import (
"context"
"fmt"
"github.com/cortezaproject/corteza-server/pkg/dal"
"github.com/cortezaproject/corteza-server/pkg/errors"
"github.com/cortezaproject/corteza-server/store/adapters/rdbms/ddl"
"github.com/doug-martin/goqu/v9/exp"
"github.com/jmoiron/sqlx"
@@ -44,7 +44,8 @@ func (dd *dataDefiner) TableCreate(ctx context.Context, t *ddl.Table) error {
}
func (dd *dataDefiner) TableLookup(ctx context.Context, t string) (*ddl.Table, error) {
return nil, fmt.Errorf("not implemented")
// for now, assume tables never exist
return nil, errors.NotFound("table does not exist")
}
func (dd *dataDefiner) ColumnAdd(ctx context.Context, t string, c *ddl.Column) error {