Skip to content

Commit

Permalink
[feat] nocase indices
Browse files Browse the repository at this point in the history
  • Loading branch information
zenlor committed Feb 4, 2024
1 parent db28fe3 commit 6513fe5
Show file tree
Hide file tree
Showing 4 changed files with 10 additions and 2 deletions.
2 changes: 1 addition & 1 deletion internal/db/abraxoides.go
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ func (a *Abraxas) Clone() *Abraxas {
func SelectOneAbraxasByAbraxas(ctx context.Context, a *Abraxas) error {
q, err := prepareStmt(
`SELECT gid,abraxas,kind FROM ` + abraxoidesTable + `
WHERE gid=? AND abraxas=? LIMIT 1`,
WHERE gid=? AND abraxas LIKE ? LIMIT 1`,
)
if err != nil {
return err
Expand Down
2 changes: 1 addition & 1 deletion internal/db/callouts.go
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,7 @@ func InsertCallout(ctx context.Context, c *Callout) error {
func SelectOneCallout(ctx context.Context, c *Callout) error {
q, err := prepareStmt(
`SELECT gid,callout,text FROM ` + calloutsTable + `
WHERE callout=? AND gid=? LIMIT 1`,
WHERE callout LIKE ? AND gid=? LIMIT 1`,
)
if err != nil {
return err
Expand Down
3 changes: 3 additions & 0 deletions internal/db/migrations/08_nocase_indices.down.sql
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
DROP INDEX 'idx_callouts_callout';

DROP INDEX 'idx_abraxoides_abraxas';
5 changes: 5 additions & 0 deletions internal/db/migrations/08_nocase_indices.up.sql
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
CREATE INDEX 'idx_callouts_callout'
ON callouts (callout COLLATE NOCASE);

CREATE INDEX 'idx_abraxoides_abraxas'
ON abraxoides (abraxas COLLATE NOCASE);

0 comments on commit 6513fe5

Please sign in to comment.