-
-
Notifications
You must be signed in to change notification settings - Fork 798
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add sort tags and use them in search
- Loading branch information
Showing
10 changed files
with
177 additions
and
49 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,64 @@ | ||
package migration | ||
|
||
import ( | ||
"database/sql" | ||
"github.com/pressly/goose" | ||
) | ||
|
||
func init() { | ||
goose.AddMigration(Up20200423204116, Down20200423204116) | ||
} | ||
|
||
func Up20200423204116(tx *sql.Tx) error { | ||
_, err := tx.Exec(` | ||
alter table artist | ||
add order_artist_name varchar(255) collate nocase; | ||
alter table artist | ||
add sort_artist_name varchar(255) collate nocase; | ||
create index if not exists artist_order_artist_name | ||
on artist (order_artist_name); | ||
alter table album | ||
add order_album_name varchar(255) collate nocase; | ||
alter table album | ||
add order_album_artist_name varchar(255) collate nocase; | ||
alter table album | ||
add sort_album_name varchar(255) collate nocase; | ||
alter table album | ||
add sort_artist_name varchar(255) collate nocase; | ||
alter table album | ||
add sort_album_artist_name varchar(255) collate nocase; | ||
create index if not exists album_order_album_name | ||
on album (order_album_name); | ||
create index if not exists album_order_album_artist_name | ||
on album (order_album_artist_name); | ||
alter table media_file | ||
add order_album_name varchar(255) collate nocase; | ||
alter table media_file | ||
add order_album_artist_name varchar(255) collate nocase; | ||
alter table media_file | ||
add order_artist_name varchar(255) collate nocase; | ||
alter table media_file | ||
add sort_album_name varchar(255) collate nocase; | ||
alter table media_file | ||
add sort_artist_name varchar(255) collate nocase; | ||
alter table media_file | ||
add sort_album_artist_name varchar(255) collate nocase; | ||
alter table media_file | ||
add sort_title varchar(255) collate nocase; | ||
create index if not exists media_file_order_album_name | ||
on media_file (order_album_name); | ||
create index if not exists media_file_order_artist_name | ||
on media_file (order_artist_name); | ||
`) | ||
if err != nil { | ||
return err | ||
} | ||
notice(tx, "A full rescan will be performed to change the search behaviour") | ||
return forceFullRescan(tx) | ||
} | ||
|
||
func Down20200423204116(tx *sql.Tx) error { | ||
return nil | ||
} |
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
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
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
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
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