mirror of
https://github.com/phishingclub/phishingclub.git
synced 2026-12-06 01:53:42 +01:00
30 lines
887 B
Go
30 lines
887 B
Go
package testdb
|
|
|
|
import (
|
|
"strings"
|
|
"testing"
|
|
)
|
|
|
|
// TestRowOrderTriggerDDL checks the event trigger runs the seq column DDL
|
|
// and the DDL of every seq index
|
|
func TestRowOrderTriggerDDL(t *testing.T) {
|
|
for table, ddl := range RowOrderColumnDDL {
|
|
if !strings.Contains(rowOrderTriggerFunctionSQL, "'"+ddl+"'") {
|
|
t.Errorf("trigger function does not add the seq column of %s", table)
|
|
}
|
|
if len(RowOrderIndexDDL[table]) == 0 {
|
|
t.Errorf("no seq index ddl for %s", table)
|
|
}
|
|
}
|
|
if len(RowOrderIndexDDL) != len(RowOrderColumnDDL) {
|
|
t.Errorf("seq index ddl for %d tables, seq column ddl for %d", len(RowOrderIndexDDL), len(RowOrderColumnDDL))
|
|
}
|
|
for table, list := range RowOrderIndexDDL {
|
|
for _, ddl := range list {
|
|
if !strings.Contains(rowOrderTriggerFunctionSQL, "'"+ddl+"'") {
|
|
t.Errorf("trigger function does not make the index %q of %s", ddl, table)
|
|
}
|
|
}
|
|
}
|
|
}
|