mirror of
https://github.com/woodpecker-ci/woodpecker.git
synced 2025-01-10 17:45:36 +00:00
Fix index operation tests
This commit is contained in:
parent
489e38908a
commit
d61bb3ef6c
1 changed files with 6 additions and 6 deletions
|
@ -125,12 +125,12 @@ func (r *revision4) Revision() int64 {
|
|||
type revision5 struct{}
|
||||
|
||||
func (r *revision5) Up(mg *MigrationDriver) error {
|
||||
_, err := mg.Tx.Exec(`CREATE INDEX samples_url_name_ix ON samples (url, name)`)
|
||||
_, err := mg.AddIndex("samples", []string{"url", "name"}, "")
|
||||
return err
|
||||
}
|
||||
|
||||
func (r *revision5) Down(mg *MigrationDriver) error {
|
||||
_, err := mg.Tx.Exec(`DROP INDEX samples_url_name_ix`)
|
||||
_, err := mg.DropIndex("samples", []string{"url", "name"})
|
||||
return err
|
||||
}
|
||||
|
||||
|
@ -442,9 +442,9 @@ func TestIndexOperations(t *testing.T) {
|
|||
t.Errorf("Can not find index: %q", err)
|
||||
}
|
||||
|
||||
indexStatement := `CREATE INDEX samples_url_name_ix ON samples (url, name)`
|
||||
indexStatement := `CREATE INDEX idx_samples_on_url_and_name ON samples (url, name)`
|
||||
if string(esquel[1].Sql.([]byte)) != indexStatement {
|
||||
t.Errorf("Can not find index")
|
||||
t.Errorf("Can not find index, got: %q", esquel[1])
|
||||
}
|
||||
|
||||
// Migrate, rename indexed columns
|
||||
|
@ -457,9 +457,9 @@ func TestIndexOperations(t *testing.T) {
|
|||
t.Errorf("Can not find index: %q", err)
|
||||
}
|
||||
|
||||
indexStatement = `CREATE INDEX samples_host_name_ix ON samples (host, name)`
|
||||
indexStatement = `CREATE INDEX idx_samples_on_host_and_name ON samples (host, name)`
|
||||
if string(esquel1[1].Sql.([]byte)) != indexStatement {
|
||||
t.Errorf("Can not find index, got: %s", esquel[0])
|
||||
t.Errorf("Can not find index, got: %q", esquel1[1])
|
||||
}
|
||||
|
||||
if err := mgr.Add(&revision7{}).Migrate(); err != nil {
|
||||
|
|
Loading…
Reference in a new issue