Skip to content

Commit

Permalink
fix #4
Browse files Browse the repository at this point in the history
  • Loading branch information
covrom committed Oct 18, 2023
1 parent a445386 commit 26bf668
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 7 deletions.
2 changes: 1 addition & 1 deletion schema/diff_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -367,7 +367,7 @@ func TestPatchSchema_BuildChangeIdx(t *testing.T) {
qss := strings.Join(qs, "\n")
if qss != `ALTER TABLE table1 ADD COLUMN column3 uuid NOT NULL
DROP INDEX IF EXISTS table1_col2
CREATE INDEX table1_col2 ON table1(column2,column3)` {
CREATE INDEX table1_col2 ON table1 USING btree(column2,column3)` {
t.Error(qss)
}
})
Expand Down
12 changes: 6 additions & 6 deletions schema/schema.go
Original file line number Diff line number Diff line change
Expand Up @@ -73,9 +73,9 @@ func (idx *Index) Validate() error {
if idx.Name == "" {
return fmt.Errorf("index name not defined")
}
if idx.Table == nil {
return fmt.Errorf("index table not defined")
}
// if idx.Table == nil {
// return fmt.Errorf("index table not defined")
// }
if idx.ColDef == "" && len(idx.Columns) == 0 {
return fmt.Errorf("index columns not defined")
}
Expand All @@ -100,9 +100,9 @@ func (c *Constraint) Validate() error {
if c.Name == "" {
return fmt.Errorf("constraint name not defined")
}
if c.Table == nil {
return fmt.Errorf("constraint table not defined")
}
// if c.Table == nil {
// return fmt.Errorf("constraint table not defined")
// }
if len(c.Check) > 0 {
return nil
}
Expand Down

0 comments on commit 26bf668

Please sign in to comment.