-
Notifications
You must be signed in to change notification settings - Fork 1.2k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
pgsql: Add detector to database schema
'detector' table is added to store the metadata of detectors. 'layer_feature', 'layer_namespace', and 'ancestry_feature' tables are modified to store the detection relationship between the feature/namespace with the detector.
- Loading branch information
1 parent
db2db8b
commit dca2d4e
Showing
2 changed files
with
141 additions
and
67 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,30 @@ | ||
package migrations | ||
|
||
import "github.com/remind101/migrate" | ||
|
||
// MigrationQuery contains the Up migration and Down migration in Plain strings. | ||
type MigrationQuery struct { | ||
Up []string | ||
Down []string | ||
} | ||
|
||
// ConcatMigrationQueries concats migration queries in the give order. | ||
func ConcatMigrationQueries(qs []MigrationQuery) MigrationQuery { | ||
r := MigrationQuery{} | ||
for _, q := range qs { | ||
r.Up = append(r.Up, q.Up...) | ||
r.Down = append(r.Down, q.Down...) | ||
} | ||
return r | ||
} | ||
|
||
// NewSimpleMigration returns a simple migration plan with all provided | ||
// migration queries concatted in order. | ||
func NewSimpleMigration(id int, qs []MigrationQuery) migrate.Migration { | ||
q := ConcatMigrationQueries(qs) | ||
return migrate.Migration{ | ||
ID: id, | ||
Up: migrate.Queries(q.Up), | ||
Down: migrate.Queries(q.Down), | ||
} | ||
} |