Skip to content

Commit

Permalink
fix(parsing): Removing external tags for system versioning when parsi…
Browse files Browse the repository at this point in the history
…ng (#18)

* Fixing templates and debug code for keys

* vendor

* Using sql.NullTime

* Using sql.NullTime

* removing the with system versioning calls for parsing

* merging

* merge complete
  • Loading branch information
Jacobbrewer1 authored Jun 24, 2024
1 parent 342e4cd commit f59ec2b
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 6 deletions.
8 changes: 2 additions & 6 deletions .github/workflows/ci-lint-pr-title.yml
Original file line number Diff line number Diff line change
Expand Up @@ -18,12 +18,8 @@ jobs:
name: "Lint title"
permissions:
statuses: write
pull-requests: read
steps:
- uses: aslafy-z/conventional-pr-title-action@v3
with:
success-state: Title follows conventional commits.
failure-state: Title does not follow conventional commits.
context-name: conventional-pr-title
preset: conventional-changelog-angular@latest
- uses: amannn/action-semantic-pull-request@v5
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
14 changes: 14 additions & 0 deletions pkg/services/generation/load.go
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ import (
"fmt"
"os"
"path/filepath"
"strings"

"github.com/Jacobbrewer1/goschema/pkg/models"
"github.com/pingcap/tidb/ast"
Expand Down Expand Up @@ -53,6 +54,19 @@ func parseSQL(p *parser.Parser, path string) ([]*models.Table, error) {
return nil, err
}

// Loop through each line and remove any `with system versioning` clauses
lines := strings.Split(string(sql), "\n")
newSql := ""
for i, line := range lines {
if strings.Contains(line, "with system versioning") {
newSql = strings.ReplaceAll(line, "with system versioning", "")
} else {
newSql = line
}
lines[i] = newSql
}
sql = []byte(strings.Join(lines, "\n"))

stmts, err := p.Parse(string(sql), "", "")
if err != nil {
return nil, fmt.Errorf("error parsing SQL: %w", err)
Expand Down

0 comments on commit f59ec2b

Please sign in to comment.