-
-
Notifications
You must be signed in to change notification settings - Fork 805
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
5 changed files
with
85 additions
and
50 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,29 @@ | ||
package migrations | ||
|
||
import ( | ||
"context" | ||
"database/sql" | ||
|
||
"github.com/pressly/goose/v3" | ||
) | ||
|
||
func init() { | ||
goose.AddMigrationContext(upAddSampleRate, downAddSampleRate) | ||
} | ||
|
||
func upAddSampleRate(ctx context.Context, tx *sql.Tx) error { | ||
_, err := tx.ExecContext(ctx, ` | ||
alter table media_file | ||
add sample_rate integer not null default 0; | ||
create index if not exists media_file_sample_rate | ||
on media_file (sample_rate); | ||
`) | ||
notice(tx, "A full rescan should be performed to pick up additional tags") | ||
return err | ||
} | ||
|
||
func downAddSampleRate(ctx context.Context, tx *sql.Tx) error { | ||
_, err := tx.ExecContext(ctx, `alter table media_file drop sample_rate;`) | ||
return err | ||
} |
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