mirror of
https://github.com/pomerium/pomerium.git
synced 2025-04-30 10:56:28 +02:00
storage: add indexes for postgres (#4479)
* storage: add indexes for postgres * add type, version index
This commit is contained in:
parent
379abecab1
commit
3e330bb76a
1 changed files with 17 additions and 0 deletions
|
@ -139,6 +139,23 @@ var migrations = []func(context.Context, pgx.Tx) error{
|
||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
|
|
||||||
|
return nil
|
||||||
|
},
|
||||||
|
5: func(ctx context.Context, tx pgx.Tx) error {
|
||||||
|
for _, q := range []string{
|
||||||
|
`CREATE INDEX ON ` + schemaName + `.` + recordsTableName + ` (type)`,
|
||||||
|
`CREATE INDEX ON ` + schemaName + `.` + recordsTableName + ` (type, version)`,
|
||||||
|
`CREATE INDEX ON ` + schemaName + `.` + recordChangesTableName + ` (modified_at)`,
|
||||||
|
`CREATE INDEX ON ` + schemaName + `.` + recordChangesTableName + ` (version)`,
|
||||||
|
`CREATE INDEX ON ` + schemaName + `.` + recordChangesTableName + ` (type)`,
|
||||||
|
`CREATE INDEX ON ` + schemaName + `.` + recordChangesTableName + ` (type, version)`,
|
||||||
|
} {
|
||||||
|
_, err := tx.Exec(ctx, q)
|
||||||
|
if err != nil {
|
||||||
|
return err
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
return nil
|
return nil
|
||||||
},
|
},
|
||||||
}
|
}
|
||||||
|
|
Loading…
Add table
Reference in a new issue