fix(assets): improve error reporting for asset failures
fix(embed): update embedDirectives to return result directly fix(executor): clean up import order and formatting fix(syntax_test): change file permission syntax to octal fix(mysql): update file permission syntax to octal fix(pgsql): update file permission syntax to octal fix(sqlex): simplify Walk function parameter handling fix(transform): adjust identifier comparison logic fix(template): clean up function formatting and error handling
This commit is contained in:
@@ -848,7 +848,7 @@ func adoptableUniqueIndex(table *models.Table, constraint *models.Constraint) st
|
||||
return ""
|
||||
}
|
||||
for i, col := range index.Columns {
|
||||
if !(col == constraint.Columns[i]) {
|
||||
if col != constraint.Columns[i] {
|
||||
return ""
|
||||
}
|
||||
}
|
||||
@@ -1239,21 +1239,21 @@ func constraintsEqual(c1, c2 *models.Constraint) bool {
|
||||
return false
|
||||
}
|
||||
for i, col := range c1.Columns {
|
||||
if !(col == c2.Columns[i]) {
|
||||
if col != c2.Columns[i] {
|
||||
return false
|
||||
}
|
||||
}
|
||||
|
||||
// For foreign keys, also compare referenced table and columns
|
||||
if c1.Type == models.ForeignKeyConstraint {
|
||||
if !(c1.ReferencedTable == c2.ReferencedTable) {
|
||||
if c1.ReferencedTable != c2.ReferencedTable {
|
||||
return false
|
||||
}
|
||||
if len(c1.ReferencedColumns) != len(c2.ReferencedColumns) {
|
||||
return false
|
||||
}
|
||||
for i, col := range c1.ReferencedColumns {
|
||||
if !(col == c2.ReferencedColumns[i]) {
|
||||
if col != c2.ReferencedColumns[i] {
|
||||
return false
|
||||
}
|
||||
}
|
||||
@@ -1283,7 +1283,7 @@ func indexesEqual(idx1, idx2 *models.Index) bool {
|
||||
return false
|
||||
}
|
||||
for i, col := range idx1.Columns {
|
||||
if !(col == idx2.Columns[i]) {
|
||||
if col != idx2.Columns[i] {
|
||||
return false
|
||||
}
|
||||
}
|
||||
@@ -1365,7 +1365,7 @@ func primaryKeyColumnsMatch(modelTable *models.Table, current *models.Constraint
|
||||
return false
|
||||
}
|
||||
for i, col := range modelCols {
|
||||
if !(col == current.Columns[i]) {
|
||||
if col != current.Columns[i] {
|
||||
return false
|
||||
}
|
||||
}
|
||||
|
||||
@@ -41,7 +41,7 @@ func TestQuotedNamesAndLowercaseOption(t *testing.T) {
|
||||
t.Fatal("input changed")
|
||||
}
|
||||
path := filepath.Join(t.TempDir(), "out.sql")
|
||||
if err := os.WriteFile(path, []byte("keep"), 0600); err != nil {
|
||||
if err := os.WriteFile(path, []byte("keep"), 0o600); err != nil {
|
||||
t.Fatal(err)
|
||||
}
|
||||
col.Name = "bad\x00name"
|
||||
|
||||
@@ -29,11 +29,13 @@ type Writer struct {
|
||||
}
|
||||
|
||||
// Shared execution results retain the PostgreSQL package's public type names.
|
||||
type ExecutionReport = writers.ExecutionReport
|
||||
type ExecutionFailure = writers.ExecutionFailure
|
||||
type SchemaReport = writers.SchemaReport
|
||||
type TableReport = writers.TableReport
|
||||
type ExecutionError = writers.ExecutionError
|
||||
type (
|
||||
ExecutionReport = writers.ExecutionReport
|
||||
ExecutionFailure = writers.ExecutionFailure
|
||||
SchemaReport = writers.SchemaReport
|
||||
TableReport = writers.TableReport
|
||||
ExecutionError = writers.ExecutionError
|
||||
)
|
||||
|
||||
// NewWriter creates a new PostgreSQL SQL writer
|
||||
func NewWriter(options *writers.WriterOptions) *Writer {
|
||||
@@ -2114,7 +2116,6 @@ func extractSequenceName(defaultExpr string) string {
|
||||
name.WriteByte(defaultExpr[i])
|
||||
}
|
||||
return ""
|
||||
|
||||
}
|
||||
|
||||
// executeDatabaseSQL applies db to a PostgreSQL database. By default it reads the live schema
|
||||
@@ -2497,7 +2498,6 @@ func parseQualifiedIdent(s string) (schema, name string) {
|
||||
}
|
||||
}
|
||||
return "", stripQuotes(token)
|
||||
|
||||
}
|
||||
|
||||
// firstBareIdent returns the first whitespace/delimiter-terminated token, stripping outer quotes.
|
||||
@@ -2520,7 +2520,6 @@ func firstBareIdent(s string) string {
|
||||
}
|
||||
}
|
||||
return s
|
||||
|
||||
}
|
||||
|
||||
// firstIdentAfterKeyword returns the first identifier token after keyword (matched case-insensitively via upperStmt).
|
||||
|
||||
Reference in New Issue
Block a user