Upgrade to Goose 3.15.1

This commit is contained in:
Deluan 2023-11-27 14:46:44 -05:00
parent 1b4483d32b
commit abde399e7b
69 changed files with 290 additions and 225 deletions

View file

@ -1,6 +1,7 @@
package migrations
import (
"context"
"database/sql"
"github.com/navidrome/navidrome/log"
@ -8,10 +9,10 @@ import (
)
func init() {
goose.AddMigration(Up20200130083147, Down20200130083147)
goose.AddMigrationContext(Up20200130083147, Down20200130083147)
}
func Up20200130083147(tx *sql.Tx) error {
func Up20200130083147(_ context.Context, tx *sql.Tx) error {
log.Info("Creating DB Schema")
_, err := tx.Exec(`
create table if not exists album
@ -178,6 +179,6 @@ create table if not exists user
return err
}
func Down20200130083147(tx *sql.Tx) error {
func Down20200130083147(_ context.Context, tx *sql.Tx) error {
return nil
}

View file

@ -1,16 +1,17 @@
package migrations
import (
"context"
"database/sql"
"github.com/pressly/goose/v3"
)
func init() {
goose.AddMigration(Up20200131183653, Down20200131183653)
goose.AddMigrationContext(Up20200131183653, Down20200131183653)
}
func Up20200131183653(tx *sql.Tx) error {
func Up20200131183653(_ context.Context, tx *sql.Tx) error {
_, err := tx.Exec(`
create table search_dg_tmp
(
@ -36,7 +37,7 @@ update annotation set item_type = 'media_file' where item_type = 'mediaFile';
return err
}
func Down20200131183653(tx *sql.Tx) error {
func Down20200131183653(_ context.Context, tx *sql.Tx) error {
_, err := tx.Exec(`
create table search_dg_tmp
(

View file

@ -1,16 +1,17 @@
package migrations
import (
"context"
"database/sql"
"github.com/pressly/goose/v3"
)
func init() {
goose.AddMigration(Up20200208222418, Down20200208222418)
goose.AddMigrationContext(Up20200208222418, Down20200208222418)
}
func Up20200208222418(tx *sql.Tx) error {
func Up20200208222418(_ context.Context, tx *sql.Tx) error {
_, err := tx.Exec(`
update annotation set play_count = 0 where play_count is null;
update annotation set rating = 0 where rating is null;
@ -50,6 +51,6 @@ create index annotation_starred
return err
}
func Down20200208222418(tx *sql.Tx) error {
func Down20200208222418(_ context.Context, tx *sql.Tx) error {
return nil
}

View file

@ -1,16 +1,17 @@
package migrations
import (
"context"
"database/sql"
"github.com/pressly/goose/v3"
)
func init() {
goose.AddMigration(Up20200220143731, Down20200220143731)
goose.AddMigrationContext(Up20200220143731, Down20200220143731)
}
func Up20200220143731(tx *sql.Tx) error {
func Up20200220143731(_ context.Context, tx *sql.Tx) error {
notice(tx, "This migration will force the next scan to be a full rescan!")
_, err := tx.Exec(`
create table media_file_dg_tmp
@ -124,6 +125,6 @@ update media_file set updated_at = '0001-01-01';
return err
}
func Down20200220143731(tx *sql.Tx) error {
func Down20200220143731(_ context.Context, tx *sql.Tx) error {
return nil
}

View file

@ -1,20 +1,21 @@
package migrations
import (
"context"
"database/sql"
"github.com/pressly/goose/v3"
)
func init() {
goose.AddMigration(Up20200310171621, Down20200310171621)
goose.AddMigrationContext(Up20200310171621, Down20200310171621)
}
func Up20200310171621(tx *sql.Tx) error {
func Up20200310171621(_ context.Context, tx *sql.Tx) error {
notice(tx, "A full rescan will be performed to enable search by Album Artist!")
return forceFullRescan(tx)
}
func Down20200310171621(tx *sql.Tx) error {
func Down20200310171621(_ context.Context, tx *sql.Tx) error {
return nil
}

View file

@ -1,16 +1,17 @@
package migrations
import (
"context"
"database/sql"
"github.com/pressly/goose/v3"
)
func init() {
goose.AddMigration(Up20200310181627, Down20200310181627)
goose.AddMigrationContext(Up20200310181627, Down20200310181627)
}
func Up20200310181627(tx *sql.Tx) error {
func Up20200310181627(_ context.Context, tx *sql.Tx) error {
_, err := tx.Exec(`
create table transcoding
(
@ -44,7 +45,7 @@ create table player
return err
}
func Down20200310181627(tx *sql.Tx) error {
func Down20200310181627(_ context.Context, tx *sql.Tx) error {
_, err := tx.Exec(`
drop table transcoding;
drop table player;

View file

@ -1,16 +1,17 @@
package migrations
import (
"context"
"database/sql"
"github.com/pressly/goose/v3"
)
func init() {
goose.AddMigration(Up20200319211049, Down20200319211049)
goose.AddMigrationContext(Up20200319211049, Down20200319211049)
}
func Up20200319211049(tx *sql.Tx) error {
func Up20200319211049(_ context.Context, tx *sql.Tx) error {
_, err := tx.Exec(`
alter table media_file
add full_text varchar(255) default '';
@ -36,6 +37,6 @@ drop table if exists search;
return forceFullRescan(tx)
}
func Down20200319211049(tx *sql.Tx) error {
func Down20200319211049(_ context.Context, tx *sql.Tx) error {
return nil
}

View file

@ -1,16 +1,17 @@
package migrations
import (
"context"
"database/sql"
"github.com/pressly/goose/v3"
)
func init() {
goose.AddMigration(Up20200325185135, Down20200325185135)
goose.AddMigrationContext(Up20200325185135, Down20200325185135)
}
func Up20200325185135(tx *sql.Tx) error {
func Up20200325185135(_ context.Context, tx *sql.Tx) error {
_, err := tx.Exec(`
alter table album
add album_artist_id varchar(255) default '';
@ -29,6 +30,6 @@ create index media_file_artist_album_id
return forceFullRescan(tx)
}
func Down20200325185135(tx *sql.Tx) error {
func Down20200325185135(_ context.Context, tx *sql.Tx) error {
return nil
}

View file

@ -1,20 +1,21 @@
package migrations
import (
"context"
"database/sql"
"github.com/pressly/goose/v3"
)
func init() {
goose.AddMigration(Up20200326090707, Down20200326090707)
goose.AddMigrationContext(Up20200326090707, Down20200326090707)
}
func Up20200326090707(tx *sql.Tx) error {
func Up20200326090707(_ context.Context, tx *sql.Tx) error {
notice(tx, "A full rescan will be performed!")
return forceFullRescan(tx)
}
func Down20200326090707(tx *sql.Tx) error {
func Down20200326090707(_ context.Context, tx *sql.Tx) error {
return nil
}

View file

@ -1,16 +1,17 @@
package migrations
import (
"context"
"database/sql"
"github.com/pressly/goose/v3"
)
func init() {
goose.AddMigration(Up20200327193744, Down20200327193744)
goose.AddMigrationContext(Up20200327193744, Down20200327193744)
}
func Up20200327193744(tx *sql.Tx) error {
func Up20200327193744(_ context.Context, tx *sql.Tx) error {
_, err := tx.Exec(`
create table album_dg_tmp
(
@ -75,6 +76,6 @@ create index album_max_year
return forceFullRescan(tx)
}
func Down20200327193744(tx *sql.Tx) error {
func Down20200327193744(_ context.Context, tx *sql.Tx) error {
return nil
}

View file

@ -1,16 +1,17 @@
package migrations
import (
"context"
"database/sql"
"github.com/pressly/goose/v3"
)
func init() {
goose.AddMigration(Up20200404214704, Down20200404214704)
goose.AddMigrationContext(Up20200404214704, Down20200404214704)
}
func Up20200404214704(tx *sql.Tx) error {
func Up20200404214704(_ context.Context, tx *sql.Tx) error {
_, err := tx.Exec(`
create index if not exists media_file_year
on media_file (year);
@ -24,6 +25,6 @@ create index if not exists media_file_track_number
return err
}
func Down20200404214704(tx *sql.Tx) error {
func Down20200404214704(_ context.Context, tx *sql.Tx) error {
return nil
}

View file

@ -1,20 +1,21 @@
package migrations
import (
"context"
"database/sql"
"github.com/pressly/goose/v3"
)
func init() {
goose.AddMigration(Up20200409002249, Down20200409002249)
goose.AddMigrationContext(Up20200409002249, Down20200409002249)
}
func Up20200409002249(tx *sql.Tx) error {
func Up20200409002249(_ context.Context, tx *sql.Tx) error {
notice(tx, "A full rescan will be performed to enable search by individual Artist in an Album!")
return forceFullRescan(tx)
}
func Down20200409002249(tx *sql.Tx) error {
func Down20200409002249(_ context.Context, tx *sql.Tx) error {
return nil
}

View file

@ -1,16 +1,17 @@
package migrations
import (
"context"
"database/sql"
"github.com/pressly/goose/v3"
)
func init() {
goose.AddMigration(Up20200411164603, Down20200411164603)
goose.AddMigrationContext(Up20200411164603, Down20200411164603)
}
func Up20200411164603(tx *sql.Tx) error {
func Up20200411164603(_ context.Context, tx *sql.Tx) error {
_, err := tx.Exec(`
alter table playlist
add created_at datetime;
@ -22,6 +23,6 @@ update playlist
return err
}
func Down20200411164603(tx *sql.Tx) error {
func Down20200411164603(_ context.Context, tx *sql.Tx) error {
return nil
}

View file

@ -1,20 +1,21 @@
package migrations
import (
"context"
"database/sql"
"github.com/pressly/goose/v3"
)
func init() {
goose.AddMigration(Up20200418110522, Down20200418110522)
goose.AddMigrationContext(Up20200418110522, Down20200418110522)
}
func Up20200418110522(tx *sql.Tx) error {
func Up20200418110522(_ context.Context, tx *sql.Tx) error {
notice(tx, "A full rescan will be performed to fix search Albums by year")
return forceFullRescan(tx)
}
func Down20200418110522(tx *sql.Tx) error {
func Down20200418110522(_ context.Context, tx *sql.Tx) error {
return nil
}

View file

@ -1,20 +1,21 @@
package migrations
import (
"context"
"database/sql"
"github.com/pressly/goose/v3"
)
func init() {
goose.AddMigration(Up20200419222708, Down20200419222708)
goose.AddMigrationContext(Up20200419222708, Down20200419222708)
}
func Up20200419222708(tx *sql.Tx) error {
func Up20200419222708(_ context.Context, tx *sql.Tx) error {
notice(tx, "A full rescan will be performed to change the search behaviour")
return forceFullRescan(tx)
}
func Down20200419222708(tx *sql.Tx) error {
func Down20200419222708(_ context.Context, tx *sql.Tx) error {
return nil
}

View file

@ -1,16 +1,17 @@
package migrations
import (
"context"
"database/sql"
"github.com/pressly/goose/v3"
)
func init() {
goose.AddMigration(Up20200423204116, Down20200423204116)
goose.AddMigrationContext(Up20200423204116, Down20200423204116)
}
func Up20200423204116(tx *sql.Tx) error {
func Up20200423204116(_ context.Context, tx *sql.Tx) error {
_, err := tx.Exec(`
alter table artist
add order_artist_name varchar(255) collate nocase;
@ -60,6 +61,6 @@ create index if not exists media_file_order_artist_name
return forceFullRescan(tx)
}
func Down20200423204116(tx *sql.Tx) error {
func Down20200423204116(_ context.Context, tx *sql.Tx) error {
return nil
}

View file

@ -1,16 +1,17 @@
package migrations
import (
"context"
"database/sql"
"github.com/pressly/goose/v3"
)
func init() {
goose.AddMigration(Up20200508093059, Down20200508093059)
goose.AddMigrationContext(Up20200508093059, Down20200508093059)
}
func Up20200508093059(tx *sql.Tx) error {
func Up20200508093059(_ context.Context, tx *sql.Tx) error {
_, err := tx.Exec(`
alter table artist
add song_count integer default 0 not null;
@ -22,6 +23,6 @@ alter table artist
return forceFullRescan(tx)
}
func Down20200508093059(tx *sql.Tx) error {
func Down20200508093059(_ context.Context, tx *sql.Tx) error {
return nil
}

View file

@ -1,16 +1,17 @@
package migrations
import (
"context"
"database/sql"
"github.com/pressly/goose/v3"
)
func init() {
goose.AddMigration(Up20200512104202, Down20200512104202)
goose.AddMigrationContext(Up20200512104202, Down20200512104202)
}
func Up20200512104202(tx *sql.Tx) error {
func Up20200512104202(_ context.Context, tx *sql.Tx) error {
_, err := tx.Exec(`
alter table media_file
add disc_subtitle varchar(255);
@ -22,6 +23,6 @@ alter table media_file
return forceFullRescan(tx)
}
func Down20200512104202(tx *sql.Tx) error {
func Down20200512104202(_ context.Context, tx *sql.Tx) error {
return nil
}

View file

@ -1,6 +1,7 @@
package migrations
import (
"context"
"database/sql"
"strings"
@ -9,10 +10,10 @@ import (
)
func init() {
goose.AddMigration(Up20200516140647, Down20200516140647)
goose.AddMigrationContext(Up20200516140647, Down20200516140647)
}
func Up20200516140647(tx *sql.Tx) error {
func Up20200516140647(_ context.Context, tx *sql.Tx) error {
_, err := tx.Exec(`
create table if not exists playlist_tracks
(
@ -95,6 +96,6 @@ func Up20200516140647UpdatePlaylistTracks(tx *sql.Tx, id string, tracks string)
return nil
}
func Down20200516140647(tx *sql.Tx) error {
func Down20200516140647(_ context.Context, tx *sql.Tx) error {
return nil
}

View file

@ -1,16 +1,17 @@
package migrations
import (
"context"
"database/sql"
"github.com/pressly/goose/v3"
)
func init() {
goose.AddMigration(Up20200608153717, Down20200608153717)
goose.AddMigrationContext(Up20200608153717, Down20200608153717)
}
func Up20200608153717(tx *sql.Tx) error {
func Up20200608153717(_ context.Context, tx *sql.Tx) error {
// First delete dangling players
_, err := tx.Exec(`
delete from player where user_name not in (select user_name from user)`)
@ -132,6 +133,6 @@ create unique index playlist_tracks_pos
return err
}
func Down20200608153717(tx *sql.Tx) error {
func Down20200608153717(_ context.Context, tx *sql.Tx) error {
return nil
}

View file

@ -1,6 +1,7 @@
package migrations
import (
"context"
"database/sql"
"github.com/google/uuid"
@ -9,10 +10,10 @@ import (
)
func init() {
goose.AddMigration(upAddDefaultTranscodings, downAddDefaultTranscodings)
goose.AddMigrationContext(upAddDefaultTranscodings, downAddDefaultTranscodings)
}
func upAddDefaultTranscodings(tx *sql.Tx) error {
func upAddDefaultTranscodings(_ context.Context, tx *sql.Tx) error {
row := tx.QueryRow("SELECT COUNT(*) FROM transcoding")
var count int
err := row.Scan(&count)
@ -37,6 +38,6 @@ func upAddDefaultTranscodings(tx *sql.Tx) error {
return nil
}
func downAddDefaultTranscodings(tx *sql.Tx) error {
func downAddDefaultTranscodings(_ context.Context, tx *sql.Tx) error {
return nil
}

View file

@ -1,16 +1,17 @@
package migrations
import (
"context"
"database/sql"
"github.com/pressly/goose/v3"
)
func init() {
goose.AddMigration(upAddPlaylistPath, downAddPlaylistPath)
goose.AddMigrationContext(upAddPlaylistPath, downAddPlaylistPath)
}
func upAddPlaylistPath(tx *sql.Tx) error {
func upAddPlaylistPath(_ context.Context, tx *sql.Tx) error {
_, err := tx.Exec(`
alter table playlist
add path string default '' not null;
@ -22,6 +23,6 @@ alter table playlist
return err
}
func downAddPlaylistPath(tx *sql.Tx) error {
func downAddPlaylistPath(_ context.Context, tx *sql.Tx) error {
return nil
}

View file

@ -1,16 +1,17 @@
package migrations
import (
"context"
"database/sql"
"github.com/pressly/goose/v3"
)
func init() {
goose.AddMigration(upCreatePlayQueuesTable, downCreatePlayQueuesTable)
goose.AddMigrationContext(upCreatePlayQueuesTable, downCreatePlayQueuesTable)
}
func upCreatePlayQueuesTable(tx *sql.Tx) error {
func upCreatePlayQueuesTable(_ context.Context, tx *sql.Tx) error {
_, err := tx.Exec(`
create table playqueue
(
@ -31,6 +32,6 @@ create table playqueue
return err
}
func downCreatePlayQueuesTable(tx *sql.Tx) error {
func downCreatePlayQueuesTable(_ context.Context, tx *sql.Tx) error {
return nil
}

View file

@ -1,16 +1,17 @@
package migrations
import (
"context"
"database/sql"
"github.com/pressly/goose/v3"
)
func init() {
goose.AddMigration(upCreateBookmarkTable, downCreateBookmarkTable)
goose.AddMigrationContext(upCreateBookmarkTable, downCreateBookmarkTable)
}
func upCreateBookmarkTable(tx *sql.Tx) error {
func upCreateBookmarkTable(_ context.Context, tx *sql.Tx) error {
_, err := tx.Exec(`
create table bookmark
(
@ -48,6 +49,6 @@ alter table playqueue_dg_tmp rename to playqueue;
return err
}
func downCreateBookmarkTable(tx *sql.Tx) error {
func downCreateBookmarkTable(_ context.Context, tx *sql.Tx) error {
return nil
}

View file

@ -1,16 +1,17 @@
package migrations
import (
"context"
"database/sql"
"github.com/pressly/goose/v3"
)
func init() {
goose.AddMigration(upDropEmailUniqueConstraint, downDropEmailUniqueConstraint)
goose.AddMigrationContext(upDropEmailUniqueConstraint, downDropEmailUniqueConstraint)
}
func upDropEmailUniqueConstraint(tx *sql.Tx) error {
func upDropEmailUniqueConstraint(_ context.Context, tx *sql.Tx) error {
_, err := tx.Exec(`
create table user_dg_tmp
(
@ -37,6 +38,6 @@ alter table user_dg_tmp rename to user;
return err
}
func downDropEmailUniqueConstraint(tx *sql.Tx) error {
func downDropEmailUniqueConstraint(_ context.Context, tx *sql.Tx) error {
return nil
}

View file

@ -1,16 +1,17 @@
package migrations
import (
"context"
"database/sql"
"github.com/pressly/goose/v3"
)
func init() {
goose.AddMigration(Up20201003111749, Down20201003111749)
goose.AddMigrationContext(Up20201003111749, Down20201003111749)
}
func Up20201003111749(tx *sql.Tx) error {
func Up20201003111749(_ context.Context, tx *sql.Tx) error {
_, err := tx.Exec(`
create index if not exists annotation_starred_at
on annotation (starred_at);
@ -18,6 +19,6 @@ create index if not exists annotation_starred_at
return err
}
func Down20201003111749(tx *sql.Tx) error {
func Down20201003111749(_ context.Context, tx *sql.Tx) error {
return nil
}

View file

@ -1,16 +1,17 @@
package migrations
import (
"context"
"database/sql"
"github.com/pressly/goose/v3"
)
func init() {
goose.AddMigration(Up20201010162350, Down20201010162350)
goose.AddMigrationContext(Up20201010162350, Down20201010162350)
}
func Up20201010162350(tx *sql.Tx) error {
func Up20201010162350(_ context.Context, tx *sql.Tx) error {
_, err := tx.Exec(`
alter table album
add size integer default 0 not null;
@ -27,7 +28,7 @@ where id not null;`)
return err
}
func Down20201010162350(tx *sql.Tx) error {
func Down20201010162350(_ context.Context, tx *sql.Tx) error {
// This code is executed when the migration is rolled back.
return nil
}

View file

@ -1,16 +1,17 @@
package migrations
import (
"context"
"database/sql"
"github.com/pressly/goose/v3"
)
func init() {
goose.AddMigration(Up20201012210022, Down20201012210022)
goose.AddMigrationContext(Up20201012210022, Down20201012210022)
}
func Up20201012210022(tx *sql.Tx) error {
func Up20201012210022(_ context.Context, tx *sql.Tx) error {
_, err := tx.Exec(`
alter table artist
add size integer default 0 not null;
@ -39,6 +40,6 @@ update playlist set size = ifnull((
return err
}
func Down20201012210022(tx *sql.Tx) error {
func Down20201012210022(_ context.Context, tx *sql.Tx) error {
return nil
}

View file

@ -1,16 +1,17 @@
package migrations
import (
"context"
"database/sql"
"github.com/pressly/goose/v3"
)
func init() {
goose.AddMigration(Up20201021085410, Down20201021085410)
goose.AddMigrationContext(Up20201021085410, Down20201021085410)
}
func Up20201021085410(tx *sql.Tx) error {
func Up20201021085410(_ context.Context, tx *sql.Tx) error {
_, err := tx.Exec(`
alter table media_file
add mbz_track_id varchar(255);
@ -52,7 +53,7 @@ alter table artist
return forceFullRescan(tx)
}
func Down20201021085410(tx *sql.Tx) error {
func Down20201021085410(_ context.Context, tx *sql.Tx) error {
// This code is executed when the migration is rolled back.
return nil
}

View file

@ -1,16 +1,17 @@
package migrations
import (
"context"
"database/sql"
"github.com/pressly/goose/v3"
)
func init() {
goose.AddMigration(Up20201021093209, Down20201021093209)
goose.AddMigrationContext(Up20201021093209, Down20201021093209)
}
func Up20201021093209(tx *sql.Tx) error {
func Up20201021093209(_ context.Context, tx *sql.Tx) error {
_, err := tx.Exec(`
create index if not exists media_file_artist
on media_file (artist);
@ -22,6 +23,6 @@ create index if not exists media_file_mbz_track_id
return err
}
func Down20201021093209(tx *sql.Tx) error {
func Down20201021093209(_ context.Context, tx *sql.Tx) error {
return nil
}

View file

@ -1,16 +1,17 @@
package migrations
import (
"context"
"database/sql"
"github.com/pressly/goose/v3"
)
func init() {
goose.AddMigration(Up20201021135455, Down20201021135455)
goose.AddMigrationContext(Up20201021135455, Down20201021135455)
}
func Up20201021135455(tx *sql.Tx) error {
func Up20201021135455(_ context.Context, tx *sql.Tx) error {
_, err := tx.Exec(`
create index if not exists media_file_artist_id
on media_file (artist_id);
@ -18,6 +19,6 @@ create index if not exists media_file_artist_id
return err
}
func Down20201021135455(tx *sql.Tx) error {
func Down20201021135455(_ context.Context, tx *sql.Tx) error {
return nil
}

View file

@ -1,16 +1,17 @@
package migrations
import (
"context"
"database/sql"
"github.com/pressly/goose/v3"
)
func init() {
goose.AddMigration(upAddArtistImageUrl, downAddArtistImageUrl)
goose.AddMigrationContext(upAddArtistImageUrl, downAddArtistImageUrl)
}
func upAddArtistImageUrl(tx *sql.Tx) error {
func upAddArtistImageUrl(_ context.Context, tx *sql.Tx) error {
_, err := tx.Exec(`
alter table artist
add biography varchar(255) default '' not null;
@ -30,6 +31,6 @@ alter table artist
return err
}
func downAddArtistImageUrl(tx *sql.Tx) error {
func downAddArtistImageUrl(_ context.Context, tx *sql.Tx) error {
return nil
}

View file

@ -1,16 +1,17 @@
package migrations
import (
"context"
"database/sql"
"github.com/pressly/goose/v3"
)
func init() {
goose.AddMigration(Up20201110205344, Down20201110205344)
goose.AddMigrationContext(Up20201110205344, Down20201110205344)
}
func Up20201110205344(tx *sql.Tx) error {
func Up20201110205344(_ context.Context, tx *sql.Tx) error {
_, err := tx.Exec(`
alter table media_file
add comment varchar;
@ -27,6 +28,6 @@ alter table album
return forceFullRescan(tx)
}
func Down20201110205344(tx *sql.Tx) error {
func Down20201110205344(_ context.Context, tx *sql.Tx) error {
return nil
}

View file

@ -1,16 +1,17 @@
package migrations
import (
"context"
"database/sql"
"github.com/pressly/goose/v3"
)
func init() {
goose.AddMigration(Up20201128100726, Down20201128100726)
goose.AddMigrationContext(Up20201128100726, Down20201128100726)
}
func Up20201128100726(tx *sql.Tx) error {
func Up20201128100726(_ context.Context, tx *sql.Tx) error {
_, err := tx.Exec(`
alter table player
add report_real_path bool default FALSE not null;
@ -18,6 +19,6 @@ alter table player
return err
}
func Down20201128100726(tx *sql.Tx) error {
func Down20201128100726(_ context.Context, tx *sql.Tx) error {
return nil
}

View file

@ -1,6 +1,7 @@
package migrations
import (
"context"
"database/sql"
"github.com/navidrome/navidrome/log"
@ -9,10 +10,10 @@ import (
)
func init() {
goose.AddMigration(Up20201213124814, Down20201213124814)
goose.AddMigrationContext(Up20201213124814, Down20201213124814)
}
func Up20201213124814(tx *sql.Tx) error {
func Up20201213124814(_ context.Context, tx *sql.Tx) error {
_, err := tx.Exec(`
alter table album
add all_artist_ids varchar;
@ -58,6 +59,6 @@ select a.id, a.name, a.artist_id, a.album_artist_id, group_concat(mf.artist_id,
return rows.Err()
}
func Down20201213124814(tx *sql.Tx) error {
func Down20201213124814(_ context.Context, tx *sql.Tx) error {
return nil
}

View file

@ -1,16 +1,17 @@
package migrations
import (
"context"
"database/sql"
"github.com/pressly/goose/v3"
)
func init() {
goose.AddMigration(upAddTimestampIndexesGo, downAddTimestampIndexesGo)
goose.AddMigrationContext(upAddTimestampIndexesGo, downAddTimestampIndexesGo)
}
func upAddTimestampIndexesGo(tx *sql.Tx) error {
func upAddTimestampIndexesGo(_ context.Context, tx *sql.Tx) error {
_, err := tx.Exec(`
create index if not exists album_updated_at
on album (updated_at);
@ -28,6 +29,6 @@ create index if not exists media_file_updated_at
return err
}
func downAddTimestampIndexesGo(tx *sql.Tx) error {
func downAddTimestampIndexesGo(_ context.Context, tx *sql.Tx) error {
return nil
}

View file

@ -1,6 +1,7 @@
package migrations
import (
"context"
"database/sql"
"strings"
@ -10,10 +11,10 @@ import (
)
func init() {
goose.AddMigration(upFixAlbumComments, downFixAlbumComments)
goose.AddMigrationContext(upFixAlbumComments, downFixAlbumComments)
}
func upFixAlbumComments(tx *sql.Tx) error {
func upFixAlbumComments(_ context.Context, tx *sql.Tx) error {
//nolint:gosec
rows, err := tx.Query(`
SELECT album.id, group_concat(media_file.comment, '` + consts.Zwsp + `') FROM album, media_file WHERE media_file.album_id = album.id GROUP BY album.id;
@ -48,7 +49,7 @@ func upFixAlbumComments(tx *sql.Tx) error {
return rows.Err()
}
func downFixAlbumComments(tx *sql.Tx) error {
func downFixAlbumComments(_ context.Context, tx *sql.Tx) error {
return nil
}

View file

@ -1,16 +1,17 @@
package migrations
import (
"context"
"database/sql"
"github.com/pressly/goose/v3"
)
func init() {
goose.AddMigration(upAddBpmMetadata, downAddBpmMetadata)
goose.AddMigrationContext(upAddBpmMetadata, downAddBpmMetadata)
}
func upAddBpmMetadata(tx *sql.Tx) error {
func upAddBpmMetadata(_ context.Context, tx *sql.Tx) error {
_, err := tx.Exec(`
alter table media_file
add bpm integer;
@ -25,6 +26,6 @@ create index if not exists media_file_bpm
return forceFullRescan(tx)
}
func downAddBpmMetadata(tx *sql.Tx) error {
func downAddBpmMetadata(_ context.Context, tx *sql.Tx) error {
return nil
}

View file

@ -1,16 +1,17 @@
package migrations
import (
"context"
"database/sql"
"github.com/pressly/goose/v3"
)
func init() {
goose.AddMigration(upCreateSharesTable, downCreateSharesTable)
goose.AddMigrationContext(upCreateSharesTable, downCreateSharesTable)
}
func upCreateSharesTable(tx *sql.Tx) error {
func upCreateSharesTable(_ context.Context, tx *sql.Tx) error {
_, err := tx.Exec(`
create table share
(
@ -29,6 +30,6 @@ create table share
return err
}
func downCreateSharesTable(tx *sql.Tx) error {
func downCreateSharesTable(_ context.Context, tx *sql.Tx) error {
return nil
}

View file

@ -1,16 +1,17 @@
package migrations
import (
"context"
"database/sql"
"github.com/pressly/goose/v3"
)
func init() {
goose.AddMigration(upUpdateShareFieldNames, downUpdateShareFieldNames)
goose.AddMigrationContext(upUpdateShareFieldNames, downUpdateShareFieldNames)
}
func upUpdateShareFieldNames(tx *sql.Tx) error {
func upUpdateShareFieldNames(_ context.Context, tx *sql.Tx) error {
_, err := tx.Exec(`
alter table share rename column expires to expires_at;
alter table share rename column created to created_at;
@ -20,6 +21,6 @@ alter table share rename column last_visited to last_visited_at;
return err
}
func downUpdateShareFieldNames(tx *sql.Tx) error {
func downUpdateShareFieldNames(_ context.Context, tx *sql.Tx) error {
return nil
}

View file

@ -12,10 +12,10 @@ import (
)
func init() {
goose.AddMigration(upEncodeAllPasswords, downEncodeAllPasswords)
goose.AddMigrationContext(upEncodeAllPasswords, downEncodeAllPasswords)
}
func upEncodeAllPasswords(tx *sql.Tx) error {
func upEncodeAllPasswords(ctx context.Context, tx *sql.Tx) error {
rows, err := tx.Query(`SELECT id, user_name, password from user;`)
if err != nil {
return err
@ -38,7 +38,7 @@ func upEncodeAllPasswords(tx *sql.Tx) error {
return err
}
password, err = utils.Encrypt(context.Background(), encKey, password)
password, err = utils.Encrypt(ctx, encKey, password)
if err != nil {
log.Error("Error encrypting user's password", "id", id, "username", username, err)
}
@ -51,6 +51,6 @@ func upEncodeAllPasswords(tx *sql.Tx) error {
return rows.Err()
}
func downEncodeAllPasswords(tx *sql.Tx) error {
func downEncodeAllPasswords(_ context.Context, tx *sql.Tx) error {
return nil
}

View file

@ -1,16 +1,17 @@
package migrations
import (
"context"
"database/sql"
"github.com/pressly/goose/v3"
)
func init() {
goose.AddMigration(upDropPlayerNameUniqueConstraint, downDropPlayerNameUniqueConstraint)
goose.AddMigrationContext(upDropPlayerNameUniqueConstraint, downDropPlayerNameUniqueConstraint)
}
func upDropPlayerNameUniqueConstraint(tx *sql.Tx) error {
func upDropPlayerNameUniqueConstraint(_ context.Context, tx *sql.Tx) error {
_, err := tx.Exec(`
create table player_dg_tmp
(
@ -42,6 +43,6 @@ create index if not exists player_name
return err
}
func downDropPlayerNameUniqueConstraint(tx *sql.Tx) error {
func downDropPlayerNameUniqueConstraint(_ context.Context, tx *sql.Tx) error {
return nil
}

View file

@ -1,16 +1,17 @@
package migrations
import (
"context"
"database/sql"
"github.com/pressly/goose/v3"
)
func init() {
goose.AddMigration(upAddUserPrefsPlayerScrobblerEnabled, downAddUserPrefsPlayerScrobblerEnabled)
goose.AddMigrationContext(upAddUserPrefsPlayerScrobblerEnabled, downAddUserPrefsPlayerScrobblerEnabled)
}
func upAddUserPrefsPlayerScrobblerEnabled(tx *sql.Tx) error {
func upAddUserPrefsPlayerScrobblerEnabled(_ context.Context, tx *sql.Tx) error {
err := upAddUserPrefs(tx)
if err != nil {
return err
@ -39,6 +40,6 @@ alter table player add scrobble_enabled bool default true;
return err
}
func downAddUserPrefsPlayerScrobblerEnabled(tx *sql.Tx) error {
func downAddUserPrefsPlayerScrobblerEnabled(_ context.Context, tx *sql.Tx) error {
return nil
}

View file

@ -1,16 +1,17 @@
package migrations
import (
"context"
"database/sql"
"github.com/pressly/goose/v3"
)
func init() {
goose.AddMigration(upAddReferentialIntegrityToUserProps, downAddReferentialIntegrityToUserProps)
goose.AddMigrationContext(upAddReferentialIntegrityToUserProps, downAddReferentialIntegrityToUserProps)
}
func upAddReferentialIntegrityToUserProps(tx *sql.Tx) error {
func upAddReferentialIntegrityToUserProps(_ context.Context, tx *sql.Tx) error {
_, err := tx.Exec(`
create table user_props_dg_tmp
(
@ -33,6 +34,6 @@ alter table user_props_dg_tmp rename to user_props;
return err
}
func downAddReferentialIntegrityToUserProps(tx *sql.Tx) error {
func downAddReferentialIntegrityToUserProps(_ context.Context, tx *sql.Tx) error {
return nil
}

View file

@ -1,16 +1,17 @@
package migrations
import (
"context"
"database/sql"
"github.com/pressly/goose/v3"
)
func init() {
goose.AddMigration(upAddScrobbleBuffer, downAddScrobbleBuffer)
goose.AddMigrationContext(upAddScrobbleBuffer, downAddScrobbleBuffer)
}
func upAddScrobbleBuffer(tx *sql.Tx) error {
func upAddScrobbleBuffer(_ context.Context, tx *sql.Tx) error {
_, err := tx.Exec(`
create table if not exists scrobble_buffer
(
@ -33,6 +34,6 @@ create table if not exists scrobble_buffer
return err
}
func downAddScrobbleBuffer(tx *sql.Tx) error {
func downAddScrobbleBuffer(_ context.Context, tx *sql.Tx) error {
return nil
}

View file

@ -1,16 +1,17 @@
package migrations
import (
"context"
"database/sql"
"github.com/pressly/goose/v3"
)
func init() {
goose.AddMigration(upAddGenreTables, downAddGenreTables)
goose.AddMigrationContext(upAddGenreTables, downAddGenreTables)
}
func upAddGenreTables(tx *sql.Tx) error {
func upAddGenreTables(_ context.Context, tx *sql.Tx) error {
notice(tx, "A full rescan will be performed to import multiple genres!")
_, err := tx.Exec(`
create table if not exists genre
@ -63,6 +64,6 @@ create table if not exists artist_genres
return forceFullRescan(tx)
}
func downAddGenreTables(tx *sql.Tx) error {
func downAddGenreTables(_ context.Context, tx *sql.Tx) error {
return nil
}

View file

@ -1,16 +1,17 @@
package migrations
import (
"context"
"database/sql"
"github.com/pressly/goose/v3"
)
func init() {
goose.AddMigration(upAddMediafileChannels, downAddMediafileChannels)
goose.AddMigrationContext(upAddMediafileChannels, downAddMediafileChannels)
}
func upAddMediafileChannels(tx *sql.Tx) error {
func upAddMediafileChannels(_ context.Context, tx *sql.Tx) error {
_, err := tx.Exec(`
alter table media_file
add channels integer;
@ -25,6 +26,6 @@ create index if not exists media_file_channels
return forceFullRescan(tx)
}
func downAddMediafileChannels(tx *sql.Tx) error {
func downAddMediafileChannels(_ context.Context, tx *sql.Tx) error {
return nil
}

View file

@ -1,16 +1,17 @@
package migrations
import (
"context"
"database/sql"
"github.com/pressly/goose/v3"
)
func init() {
goose.AddMigration(upAddSmartPlaylist, downAddSmartPlaylist)
goose.AddMigrationContext(upAddSmartPlaylist, downAddSmartPlaylist)
}
func upAddSmartPlaylist(tx *sql.Tx) error {
func upAddSmartPlaylist(_ context.Context, tx *sql.Tx) error {
_, err := tx.Exec(`
alter table playlist
add column rules varchar null;
@ -32,6 +33,6 @@ create unique index playlist_fields_idx
return err
}
func downAddSmartPlaylist(tx *sql.Tx) error {
func downAddSmartPlaylist(_ context.Context, tx *sql.Tx) error {
return nil
}

View file

@ -1,6 +1,7 @@
package migrations
import (
"context"
"database/sql"
"strings"
@ -10,10 +11,10 @@ import (
)
func init() {
goose.AddMigration(upAddOrderTitleToMediaFile, downAddOrderTitleToMediaFile)
goose.AddMigrationContext(upAddOrderTitleToMediaFile, downAddOrderTitleToMediaFile)
}
func upAddOrderTitleToMediaFile(tx *sql.Tx) error {
func upAddOrderTitleToMediaFile(_ context.Context, tx *sql.Tx) error {
_, err := tx.Exec(`
alter table main.media_file
add order_title varchar null collate NOCASE;
@ -56,6 +57,6 @@ func upAddOrderTitleToMediaFile_populateOrderTitle(tx *sql.Tx) error {
return rows.Err()
}
func downAddOrderTitleToMediaFile(tx *sql.Tx) error {
func downAddOrderTitleToMediaFile(_ context.Context, tx *sql.Tx) error {
return nil
}

View file

@ -1,6 +1,7 @@
package migrations
import (
"context"
"database/sql"
"github.com/navidrome/navidrome/log"
@ -9,10 +10,10 @@ import (
)
func init() {
goose.AddMigration(upUnescapeLyricsAndComments, downUnescapeLyricsAndComments)
goose.AddMigrationContext(upUnescapeLyricsAndComments, downUnescapeLyricsAndComments)
}
func upUnescapeLyricsAndComments(tx *sql.Tx) error {
func upUnescapeLyricsAndComments(_ context.Context, tx *sql.Tx) error {
rows, err := tx.Query(`select id, comment, lyrics, title from media_file`)
if err != nil {
return err
@ -42,6 +43,6 @@ func upUnescapeLyricsAndComments(tx *sql.Tx) error {
return rows.Err()
}
func downUnescapeLyricsAndComments(tx *sql.Tx) error {
func downUnescapeLyricsAndComments(_ context.Context, tx *sql.Tx) error {
return nil
}

View file

@ -1,16 +1,17 @@
package migrations
import (
"context"
"database/sql"
"github.com/pressly/goose/v3"
)
func init() {
goose.AddMigration(upAddUseridToPlaylist, downAddUseridToPlaylist)
goose.AddMigrationContext(upAddUseridToPlaylist, downAddUseridToPlaylist)
}
func upAddUseridToPlaylist(tx *sql.Tx) error {
func upAddUseridToPlaylist(_ context.Context, tx *sql.Tx) error {
_, err := tx.Exec(`
create table playlist_dg_tmp
(
@ -55,6 +56,6 @@ create index playlist_updated_at
return err
}
func downAddUseridToPlaylist(tx *sql.Tx) error {
func downAddUseridToPlaylist(_ context.Context, tx *sql.Tx) error {
return nil
}

View file

@ -1,16 +1,17 @@
package migrations
import (
"context"
"database/sql"
"github.com/pressly/goose/v3"
)
func init() {
goose.AddMigration(upAddAlphabeticalByArtistIndex, downAddAlphabeticalByArtistIndex)
goose.AddMigrationContext(upAddAlphabeticalByArtistIndex, downAddAlphabeticalByArtistIndex)
}
func upAddAlphabeticalByArtistIndex(tx *sql.Tx) error {
func upAddAlphabeticalByArtistIndex(_ context.Context, tx *sql.Tx) error {
_, err := tx.Exec(`
create index album_alphabetical_by_artist
ON album(compilation, order_album_artist_name, order_album_name)
@ -18,6 +19,6 @@ create index album_alphabetical_by_artist
return err
}
func downAddAlphabeticalByArtistIndex(tx *sql.Tx) error {
func downAddAlphabeticalByArtistIndex(_ context.Context, tx *sql.Tx) error {
return nil
}

View file

@ -1,22 +1,23 @@
package migrations
import (
"context"
"database/sql"
"github.com/pressly/goose/v3"
)
func init() {
goose.AddMigration(upRemoveInvalidArtistIds, downRemoveInvalidArtistIds)
goose.AddMigrationContext(upRemoveInvalidArtistIds, downRemoveInvalidArtistIds)
}
func upRemoveInvalidArtistIds(tx *sql.Tx) error {
func upRemoveInvalidArtistIds(_ context.Context, tx *sql.Tx) error {
_, err := tx.Exec(`
update media_file set artist_id = '' where not exists(select 1 from artist where id = artist_id)
`)
return err
}
func downRemoveInvalidArtistIds(tx *sql.Tx) error {
func downRemoveInvalidArtistIds(_ context.Context, tx *sql.Tx) error {
return nil
}

View file

@ -1,16 +1,17 @@
package migrations
import (
"context"
"database/sql"
"github.com/pressly/goose/v3"
)
func init() {
goose.AddMigration(upAddMusicbrainzReleaseTrackId, downAddMusicbrainzReleaseTrackId)
goose.AddMigrationContext(upAddMusicbrainzReleaseTrackId, downAddMusicbrainzReleaseTrackId)
}
func upAddMusicbrainzReleaseTrackId(tx *sql.Tx) error {
func upAddMusicbrainzReleaseTrackId(_ context.Context, tx *sql.Tx) error {
_, err := tx.Exec(`
alter table media_file
add mbz_release_track_id varchar(255);
@ -22,7 +23,7 @@ alter table media_file
return forceFullRescan(tx)
}
func downAddMusicbrainzReleaseTrackId(tx *sql.Tx) error {
func downAddMusicbrainzReleaseTrackId(_ context.Context, tx *sql.Tx) error {
// This code is executed when the migration is rolled back.
return nil
}

View file

@ -1,16 +1,17 @@
package migrations
import (
"context"
"database/sql"
"github.com/pressly/goose/v3"
)
func init() {
goose.AddMigration(upAddAlbumImagePaths, downAddAlbumImagePaths)
goose.AddMigrationContext(upAddAlbumImagePaths, downAddAlbumImagePaths)
}
func upAddAlbumImagePaths(tx *sql.Tx) error {
func upAddAlbumImagePaths(_ context.Context, tx *sql.Tx) error {
_, err := tx.Exec(`
alter table main.album add image_files varchar;
`)
@ -21,6 +22,6 @@ alter table main.album add image_files varchar;
return forceFullRescan(tx)
}
func downAddAlbumImagePaths(tx *sql.Tx) error {
func downAddAlbumImagePaths(_ context.Context, tx *sql.Tx) error {
return nil
}

View file

@ -1,16 +1,17 @@
package migrations
import (
"context"
"database/sql"
"github.com/pressly/goose/v3"
)
func init() {
goose.AddMigration(upRemoveCoverArtId, downRemoveCoverArtId)
goose.AddMigrationContext(upRemoveCoverArtId, downRemoveCoverArtId)
}
func upRemoveCoverArtId(tx *sql.Tx) error {
func upRemoveCoverArtId(_ context.Context, tx *sql.Tx) error {
_, err := tx.Exec(`
alter table album drop column cover_art_id;
alter table album rename column cover_art_path to embed_art_path
@ -22,6 +23,6 @@ alter table album rename column cover_art_path to embed_art_path
return forceFullRescan(tx)
}
func downRemoveCoverArtId(tx *sql.Tx) error {
func downRemoveCoverArtId(_ context.Context, tx *sql.Tx) error {
return nil
}

View file

@ -1,6 +1,7 @@
package migrations
import (
"context"
"database/sql"
"path/filepath"
"strings"
@ -12,10 +13,10 @@ import (
)
func init() {
goose.AddMigration(upAddAlbumPaths, downAddAlbumPaths)
goose.AddMigrationContext(upAddAlbumPaths, downAddAlbumPaths)
}
func upAddAlbumPaths(tx *sql.Tx) error {
func upAddAlbumPaths(_ context.Context, tx *sql.Tx) error {
_, err := tx.Exec(`alter table album add paths varchar;`)
if err != nil {
return err
@ -62,6 +63,6 @@ func upAddAlbumPathsDirs(filePaths string) string {
return strings.Join(dirs, string(filepath.ListSeparator))
}
func downAddAlbumPaths(tx *sql.Tx) error {
func downAddAlbumPaths(_ context.Context, tx *sql.Tx) error {
return nil
}

View file

@ -1,20 +1,21 @@
package migrations
import (
"context"
"database/sql"
"github.com/pressly/goose/v3"
)
func init() {
goose.AddMigration(upTouchPlaylists, downTouchPlaylists)
goose.AddMigrationContext(upTouchPlaylists, downTouchPlaylists)
}
func upTouchPlaylists(tx *sql.Tx) error {
func upTouchPlaylists(_ context.Context, tx *sql.Tx) error {
_, err := tx.Exec(`update playlist set updated_at = datetime('now');`)
return err
}
func downTouchPlaylists(tx *sql.Tx) error {
func downTouchPlaylists(_ context.Context, tx *sql.Tx) error {
return nil
}

View file

@ -1,16 +1,17 @@
package migrations
import (
"context"
"database/sql"
"github.com/pressly/goose/v3"
)
func init() {
goose.AddMigration(upCreateInternetRadio, downCreateInternetRadio)
goose.AddMigrationContext(upCreateInternetRadio, downCreateInternetRadio)
}
func upCreateInternetRadio(tx *sql.Tx) error {
func upCreateInternetRadio(_ context.Context, tx *sql.Tx) error {
_, err := tx.Exec(`
create table if not exists radio
(
@ -25,6 +26,6 @@ create table if not exists radio
return err
}
func downCreateInternetRadio(tx *sql.Tx) error {
func downCreateInternetRadio(_ context.Context, tx *sql.Tx) error {
return nil
}

View file

@ -1,16 +1,17 @@
package migrations
import (
"context"
"database/sql"
"github.com/pressly/goose/v3"
)
func init() {
goose.AddMigration(upAddReplaygainMetadata, downAddReplaygainMetadata)
goose.AddMigrationContext(upAddReplaygainMetadata, downAddReplaygainMetadata)
}
func upAddReplaygainMetadata(tx *sql.Tx) error {
func upAddReplaygainMetadata(_ context.Context, tx *sql.Tx) error {
_, err := tx.Exec(`
alter table media_file add
rg_album_gain real;
@ -29,6 +30,6 @@ alter table media_file add
return forceFullRescan(tx)
}
func downAddReplaygainMetadata(tx *sql.Tx) error {
func downAddReplaygainMetadata(_ context.Context, tx *sql.Tx) error {
return nil
}

View file

@ -1,16 +1,17 @@
package migrations
import (
"context"
"database/sql"
"github.com/pressly/goose/v3"
)
func init() {
goose.AddMigration(upAddAlbumInfo, downAddAlbumInfo)
goose.AddMigrationContext(upAddAlbumInfo, downAddAlbumInfo)
}
func upAddAlbumInfo(tx *sql.Tx) error {
func upAddAlbumInfo(_ context.Context, tx *sql.Tx) error {
_, err := tx.Exec(`
alter table album
add description varchar(255) default '' not null;
@ -28,6 +29,6 @@ alter table album
return err
}
func downAddAlbumInfo(tx *sql.Tx) error {
func downAddAlbumInfo(_ context.Context, tx *sql.Tx) error {
return nil
}

View file

@ -1,16 +1,17 @@
package migrations
import (
"context"
"database/sql"
"github.com/pressly/goose/v3"
)
func init() {
goose.AddMigration(upAddMissingShareInfo, downAddMissingShareInfo)
goose.AddMigrationContext(upAddMissingShareInfo, downAddMissingShareInfo)
}
func upAddMissingShareInfo(tx *sql.Tx) error {
func upAddMissingShareInfo(_ context.Context, tx *sql.Tx) error {
_, err := tx.Exec(`
drop table if exists share;
create table share
@ -36,6 +37,6 @@ create table share
return err
}
func downAddMissingShareInfo(tx *sql.Tx) error {
func downAddMissingShareInfo(_ context.Context, tx *sql.Tx) error {
return nil
}

View file

@ -1,6 +1,7 @@
package migrations
import (
"context"
"database/sql"
"path/filepath"
"strings"
@ -12,10 +13,10 @@ import (
)
func init() {
goose.AddMigration(upChangePathListSeparator, downChangePathListSeparator)
goose.AddMigrationContext(upChangePathListSeparator, downChangePathListSeparator)
}
func upChangePathListSeparator(tx *sql.Tx) error {
func upChangePathListSeparator(_ context.Context, tx *sql.Tx) error {
//nolint:gosec
rows, err := tx.Query(`
select album_id, group_concat(path, '` + consts.Zwsp + `') from media_file group by album_id
@ -57,6 +58,6 @@ func upChangePathListSeparatorDirs(filePaths string) string {
return strings.Join(dirs, consts.Zwsp)
}
func downChangePathListSeparator(tx *sql.Tx) error {
func downChangePathListSeparator(_ context.Context, tx *sql.Tx) error {
return nil
}

View file

@ -1,6 +1,7 @@
package migrations
import (
"context"
"database/sql"
"path/filepath"
"strings"
@ -12,11 +13,10 @@ import (
)
func init() {
goose.AddMigration(upChangeImageFilesListSeparator, downChangeImageFilesListSeparator)
goose.AddMigrationContext(upChangeImageFilesListSeparator, downChangeImageFilesListSeparator)
}
func upChangeImageFilesListSeparator(tx *sql.Tx) error {
//nolint:gosec
func upChangeImageFilesListSeparator(_ context.Context, tx *sql.Tx) error {
rows, err := tx.Query(`select id, image_files from album`)
if err != nil {
return err
@ -54,7 +54,7 @@ func upChangeImageFilesListSeparatorDirs(filePaths string) string {
return strings.Join(allPaths, consts.Zwsp)
}
func downChangeImageFilesListSeparator(tx *sql.Tx) error {
func downChangeImageFilesListSeparator(_ context.Context, tx *sql.Tx) error {
// This code is executed when the migration is rolled back.
return nil
}

View file

@ -1,16 +1,17 @@
package migrations
import (
"context"
"database/sql"
"github.com/pressly/goose/v3"
)
func init() {
goose.AddMigration(upAddDownloadToShare, downAddDownloadToShare)
goose.AddMigrationContext(upAddDownloadToShare, downAddDownloadToShare)
}
func upAddDownloadToShare(tx *sql.Tx) error {
func upAddDownloadToShare(_ context.Context, tx *sql.Tx) error {
_, err := tx.Exec(`
alter table share
add downloadable bool not null default false;
@ -18,6 +19,6 @@ alter table share
return err
}
func downAddDownloadToShare(tx *sql.Tx) error {
func downAddDownloadToShare(_ context.Context, tx *sql.Tx) error {
return nil
}

View file

@ -1,16 +1,17 @@
package migrations
import (
"context"
"database/sql"
"github.com/pressly/goose/v3"
)
func init() {
goose.AddMigration(upAddRelRecYear, downAddRelRecYear)
goose.AddMigrationContext(upAddRelRecYear, downAddRelRecYear)
}
func upAddRelRecYear(tx *sql.Tx) error {
func upAddRelRecYear(_ context.Context, tx *sql.Tx) error {
_, err := tx.Exec(`
alter table media_file
add date varchar(255) default '' not null;
@ -44,6 +45,6 @@ alter table album
return forceFullRescan(tx)
}
func downAddRelRecYear(tx *sql.Tx) error {
func downAddRelRecYear(_ context.Context, tx *sql.Tx) error {
return nil
}

View file

@ -1,16 +1,17 @@
package migrations
import (
"context"
"database/sql"
"github.com/pressly/goose/v3"
)
func init() {
goose.AddMigration(upRenameMusicbrainzRecordingId, downRenameMusicbrainzRecordingId)
goose.AddMigrationContext(upRenameMusicbrainzRecordingId, downRenameMusicbrainzRecordingId)
}
func upRenameMusicbrainzRecordingId(tx *sql.Tx) error {
func upRenameMusicbrainzRecordingId(_ context.Context, tx *sql.Tx) error {
_, err := tx.Exec(`
alter table media_file
rename column mbz_track_id to mbz_recording_id;
@ -18,7 +19,7 @@ alter table media_file
return err
}
func downRenameMusicbrainzRecordingId(tx *sql.Tx) error {
func downRenameMusicbrainzRecordingId(_ context.Context, tx *sql.Tx) error {
_, err := tx.Exec(`
alter table media_file
rename column mbz_recording_id to mbz_track_id;