feat(db): drop the acquisition and Discover tables
release / web (push) Successful in 1m22s
release / go (push) Successful in 1m49s
release / govulncheck (push) Successful in 18s
release / integration (push) Successful in 4m10s
release / android (push) Successful in 4m27s
release / Build signed APK (push) Successful in 4m56s
release / Attach APK to the Release (tag releases only) (push) Skipped
release / Build + push container image (push) Successful in 22s
release / Verify release artifacts (tag releases only) (push) Skipped
release / web (push) Successful in 1m22s
release / go (push) Successful in 1m49s
release / govulncheck (push) Successful in 18s
release / integration (push) Successful in 4m10s
release / android (push) Successful in 4m27s
release / Build signed APK (push) Successful in 4m56s
release / Attach APK to the Release (tag releases only) (push) Skipped
release / Build + push container image (push) Successful in 22s
release / Verify release artifacts (tag releases only) (push) Skipped
Migration 105 removes the tables the acquisition and Discover features kept, and users.auto_approve_requests. Before library_album_matches goes, an album with no release-group MBID takes the one its match listed. Tables drop without CASCADE, in reference order, so a reference from a table that stays stops the migration. The down migration refuses: the data is gone, and a backup from before it is the way back. The backup table list, the test reset list and the duplicate and user queries follow. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
@@ -316,7 +316,7 @@ SELECT g.id AS group_id,
|
||||
AND t.track_number IS NOT NULL
|
||||
AND o.disc_number IS NOT DISTINCT FROM t.disc_number
|
||||
AND o.track_number = t.track_number)::boolean AS position_clash,
|
||||
COALESCE(NULLIF(al.release_group_mbid, ''), lam.release_group_mbid, '')::text AS release_group_mbid,
|
||||
COALESCE(al.release_group_mbid, '')::text AS release_group_mbid,
|
||||
l.state AS acoustid_state,
|
||||
l.recording_mbid AS acoustid_recording
|
||||
FROM duplicate_groups g
|
||||
@@ -324,7 +324,6 @@ SELECT g.id AS group_id,
|
||||
JOIN tracks t ON t.id = m.track_id
|
||||
JOIN artists ON artists.id = t.artist_id
|
||||
JOIN albums al ON al.id = t.album_id
|
||||
LEFT JOIN library_album_matches lam ON lam.album_id = t.album_id AND lam.outcome = 'listed'
|
||||
LEFT JOIN track_acoustid_lookups l ON l.track_id = t.id
|
||||
WHERE g.status = 'pending'
|
||||
AND t.missing_since IS NULL
|
||||
|
||||
@@ -196,46 +196,6 @@ type AcoustidSetting struct {
|
||||
UpdatedAt pgtype.Timestamptz
|
||||
}
|
||||
|
||||
type AcquisitionService struct {
|
||||
Code string
|
||||
Kind string
|
||||
Protocol string
|
||||
Label string
|
||||
Enabled bool
|
||||
BaseUrl string
|
||||
ApiKey string
|
||||
Username string
|
||||
Password string
|
||||
Category string
|
||||
TimeoutMs int32
|
||||
ServesSearch bool
|
||||
ServesDownloads bool
|
||||
ServesEnrichment bool
|
||||
LocalPath string
|
||||
RemotePath string
|
||||
SearchesPerHour int32
|
||||
CreatedAt pgtype.Timestamptz
|
||||
UpdatedAt pgtype.Timestamptz
|
||||
}
|
||||
|
||||
type AcquisitionSetting struct {
|
||||
ID bool
|
||||
AutoGrab bool
|
||||
SearchIntervalHours int32
|
||||
AllowedQualities []string
|
||||
LastPassAt pgtype.Timestamptz
|
||||
LastPass []byte
|
||||
UpdatedAt pgtype.Timestamptz
|
||||
ImportRoot string
|
||||
SeedRatio float32
|
||||
SeedDays int32
|
||||
StallHours int32
|
||||
LibraryListingStartedAt pgtype.Timestamptz
|
||||
LibraryListedAt pgtype.Timestamptz
|
||||
LibraryUnlisted int32
|
||||
UpgradeUntil string
|
||||
}
|
||||
|
||||
type Album struct {
|
||||
ID pgtype.UUID
|
||||
Title string
|
||||
@@ -289,15 +249,6 @@ type ArtistSimilarityFetch struct {
|
||||
Returned int32
|
||||
}
|
||||
|
||||
type ArtistSimilarityUnmatched struct {
|
||||
SeedArtistID pgtype.UUID
|
||||
CandidateMbid string
|
||||
CandidateName string
|
||||
Score float64
|
||||
Source string
|
||||
FetchedAt pgtype.Timestamptz
|
||||
}
|
||||
|
||||
type AuditLog struct {
|
||||
ID pgtype.UUID
|
||||
ActorID pgtype.UUID
|
||||
@@ -345,19 +296,6 @@ type BackupSetting struct {
|
||||
IncludeMusic bool
|
||||
}
|
||||
|
||||
type CandidateArtistTag struct {
|
||||
CandidateMbid string
|
||||
Tag string
|
||||
Weight float64
|
||||
}
|
||||
|
||||
type CandidateArtistTagState struct {
|
||||
CandidateMbid string
|
||||
TagSource string
|
||||
TagSourcesVersion int32
|
||||
UpdatedAt pgtype.Timestamptz
|
||||
}
|
||||
|
||||
type ContextualLike struct {
|
||||
ID pgtype.UUID
|
||||
UserID pgtype.UUID
|
||||
@@ -395,30 +333,6 @@ type DiagnosticEvent struct {
|
||||
ReceivedAt pgtype.Timestamptz
|
||||
}
|
||||
|
||||
type DiscoverTuning struct {
|
||||
Singleton bool
|
||||
TagOverlapWeight float64
|
||||
SnoozeDays float64
|
||||
UpdatedAt pgtype.Timestamptz
|
||||
}
|
||||
|
||||
type DownloadIntervention struct {
|
||||
ID pgtype.UUID
|
||||
Client string
|
||||
InfoHash string
|
||||
GrabID pgtype.UUID
|
||||
Name string
|
||||
Trigger string
|
||||
Action string
|
||||
Outcome string
|
||||
Detail string
|
||||
Observations int32
|
||||
Remediations int32
|
||||
FirstSeen pgtype.Timestamptz
|
||||
LastSeen pgtype.Timestamptz
|
||||
SettledAt pgtype.Timestamptz
|
||||
}
|
||||
|
||||
type DuplicateGroup struct {
|
||||
ID pgtype.UUID
|
||||
MemberKey string
|
||||
@@ -459,24 +373,6 @@ type FingerprintSetting struct {
|
||||
AutoResolve bool
|
||||
}
|
||||
|
||||
type Follow struct {
|
||||
ArtistMbid string
|
||||
ArtistName string
|
||||
ProfileID pgtype.UUID
|
||||
FollowedBy pgtype.UUID
|
||||
FollowedAt pgtype.Timestamptz
|
||||
BaselineAt pgtype.Timestamptz
|
||||
WantExisting bool
|
||||
CheckedAt pgtype.Timestamptz
|
||||
UpdatedAt pgtype.Timestamptz
|
||||
}
|
||||
|
||||
type FollowSeenGroup struct {
|
||||
ArtistMbid string
|
||||
ReleaseGroupMbid string
|
||||
SeenAt pgtype.Timestamptz
|
||||
}
|
||||
|
||||
type GeneralLike struct {
|
||||
UserID pgtype.UUID
|
||||
TrackID pgtype.UUID
|
||||
@@ -495,49 +391,6 @@ type GeneralLikesArtist struct {
|
||||
LikedAt pgtype.Timestamptz
|
||||
}
|
||||
|
||||
type Grab struct {
|
||||
ID pgtype.UUID
|
||||
WantID pgtype.UUID
|
||||
InfoHash string
|
||||
Name string
|
||||
Key string
|
||||
Indexer string
|
||||
Source string
|
||||
Client string
|
||||
SavePath string
|
||||
Quality string
|
||||
Origin string
|
||||
Forced bool
|
||||
GrabbedBy pgtype.UUID
|
||||
GrabbedAt pgtype.Timestamptz
|
||||
EndedAt pgtype.Timestamptz
|
||||
EndReason string
|
||||
EndDetail string
|
||||
Progress float32
|
||||
ImportState string
|
||||
ImportReason string
|
||||
ImportDetail []byte
|
||||
ImportForced bool
|
||||
ImportAttempts int32
|
||||
ImportUpdatedAt pgtype.Timestamptz
|
||||
ImportedAt pgtype.Timestamptz
|
||||
ImportedFiles int32
|
||||
Destination string
|
||||
Seeding bool
|
||||
Ratio float32
|
||||
SeedReleasedAt pgtype.Timestamptz
|
||||
}
|
||||
|
||||
type LibraryAlbumMatch struct {
|
||||
AlbumID pgtype.UUID
|
||||
Outcome string
|
||||
Method string
|
||||
ReleaseGroupMbid string
|
||||
Detail string
|
||||
DecidedAt pgtype.Timestamptz
|
||||
Matcher int32
|
||||
}
|
||||
|
||||
type LibraryChange struct {
|
||||
ID int64
|
||||
EntityType string
|
||||
@@ -571,23 +424,6 @@ type LoudnessSetting struct {
|
||||
LeveledCacheMb int32
|
||||
}
|
||||
|
||||
type MbArtist struct {
|
||||
Mbid string
|
||||
Name string
|
||||
SortName string
|
||||
Disambiguation string
|
||||
ArtistType string
|
||||
Country string
|
||||
DiscographyRefreshedAt pgtype.Timestamptz
|
||||
CreatedAt pgtype.Timestamptz
|
||||
UpdatedAt pgtype.Timestamptz
|
||||
}
|
||||
|
||||
type MbArtistReleaseGroup struct {
|
||||
ArtistMbid string
|
||||
ReleaseGroupMbid string
|
||||
}
|
||||
|
||||
type MbRelease struct {
|
||||
Mbid string
|
||||
ReleaseGroupMbid string
|
||||
@@ -735,13 +571,6 @@ type QuarantineAction struct {
|
||||
CreatedAt pgtype.Timestamptz
|
||||
}
|
||||
|
||||
type ReacquisitionSetting struct {
|
||||
ID bool
|
||||
Enabled bool
|
||||
GraceHours int32
|
||||
MaxPerPass int32
|
||||
}
|
||||
|
||||
type RecommendationTuningAudit struct {
|
||||
ID int64
|
||||
ChangedAt pgtype.Timestamptz
|
||||
@@ -769,49 +598,6 @@ type RegistrationSetting struct {
|
||||
Mode string
|
||||
}
|
||||
|
||||
type ReleaseBlock struct {
|
||||
InfoHash string
|
||||
Name string
|
||||
Reason string
|
||||
Detail string
|
||||
WantID pgtype.UUID
|
||||
BlockedBy pgtype.UUID
|
||||
BlockedAt pgtype.Timestamptz
|
||||
ExpiresAt pgtype.Timestamptz
|
||||
}
|
||||
|
||||
type ReleaseTypeProfile struct {
|
||||
ID pgtype.UUID
|
||||
Name string
|
||||
PrimaryTypes []string
|
||||
SecondaryTypes []string
|
||||
IsDefault bool
|
||||
CreatedAt pgtype.Timestamptz
|
||||
UpdatedAt pgtype.Timestamptz
|
||||
}
|
||||
|
||||
type Request struct {
|
||||
ID pgtype.UUID
|
||||
UserID pgtype.UUID
|
||||
Status RequestStatus
|
||||
Kind RequestKind
|
||||
ArtistMbid string
|
||||
AlbumMbid *string
|
||||
TrackMbid *string
|
||||
ArtistName string
|
||||
AlbumTitle *string
|
||||
TrackTitle *string
|
||||
DecidedAt pgtype.Timestamptz
|
||||
DecidedBy pgtype.UUID
|
||||
Notes *string
|
||||
CompletedAt pgtype.Timestamptz
|
||||
MatchedTrackID pgtype.UUID
|
||||
MatchedAlbumID pgtype.UUID
|
||||
MatchedArtistID pgtype.UUID
|
||||
RequestedAt pgtype.Timestamptz
|
||||
UpdatedAt pgtype.Timestamptz
|
||||
}
|
||||
|
||||
type ScanRun struct {
|
||||
ID pgtype.UUID
|
||||
StartedAt pgtype.Timestamptz
|
||||
@@ -867,14 +653,6 @@ type SmtpConfig struct {
|
||||
UpdatedAt pgtype.Timestamptz
|
||||
}
|
||||
|
||||
type SuggestionSnooze struct {
|
||||
UserID pgtype.UUID
|
||||
CandidateMbid string
|
||||
CandidateName string
|
||||
SnoozedUntil pgtype.Timestamptz
|
||||
CreatedAt pgtype.Timestamptz
|
||||
}
|
||||
|
||||
type SystemPlaylistRotationState struct {
|
||||
UserID pgtype.UUID
|
||||
PlaylistKind string
|
||||
@@ -1037,7 +815,6 @@ type User struct {
|
||||
ListenbrainzToken *string
|
||||
ListenbrainzEnabled bool
|
||||
DisplayName *string
|
||||
AutoApproveRequests bool
|
||||
Email *string
|
||||
Timezone string
|
||||
TimezoneUpdatedAt pgtype.Timestamptz
|
||||
@@ -1092,54 +869,6 @@ type UserNotificationPref struct {
|
||||
UpdatedAt pgtype.Timestamptz
|
||||
}
|
||||
|
||||
type Want struct {
|
||||
ID pgtype.UUID
|
||||
ReleaseGroupMbid string
|
||||
ArtistMbid string
|
||||
ArtistName string
|
||||
Title string
|
||||
PrimaryType string
|
||||
FirstReleaseDate string
|
||||
Reason string
|
||||
AlbumID pgtype.UUID
|
||||
CreatedBy pgtype.UUID
|
||||
WantedAt pgtype.Timestamptz
|
||||
FulfilledAt pgtype.Timestamptz
|
||||
CreatedAt pgtype.Timestamptz
|
||||
UpdatedAt pgtype.Timestamptz
|
||||
SearchedAt pgtype.Timestamptz
|
||||
SearchOutcome string
|
||||
SearchConsidered int32
|
||||
BestRelease string
|
||||
BestVerdict string
|
||||
SearchError string
|
||||
Upgrade string
|
||||
HeldTier string
|
||||
HeldQuality string
|
||||
UpgradeCheckedAt pgtype.Timestamptz
|
||||
}
|
||||
|
||||
type WantCandidate struct {
|
||||
WantID pgtype.UUID
|
||||
Key string
|
||||
Name string
|
||||
InfoHash string
|
||||
Indexer string
|
||||
Source string
|
||||
SizeBytes int64
|
||||
Seeders int32
|
||||
FilesCount int32
|
||||
Format string
|
||||
Quality string
|
||||
Year int32
|
||||
Verdict string
|
||||
Reason string
|
||||
Reasons []byte
|
||||
FoldedFrom []string
|
||||
Rank int32
|
||||
SearchedAt pgtype.Timestamptz
|
||||
}
|
||||
|
||||
type YouMightLikeAlbum struct {
|
||||
UserID pgtype.UUID
|
||||
AlbumID pgtype.UUID
|
||||
|
||||
@@ -54,7 +54,7 @@ func (q *Queries) CountUsers(ctx context.Context) (int64, error) {
|
||||
const createUser = `-- name: CreateUser :one
|
||||
INSERT INTO users (username, password_hash, api_token_hash, is_admin, display_name)
|
||||
VALUES ($1, $2, $3, $4, $5)
|
||||
RETURNING id, username, password_hash, is_admin, created_at, subsonic_password, listenbrainz_token, listenbrainz_enabled, display_name, auto_approve_requests, email, timezone, timezone_updated_at, debug_mode_enabled, api_token_hash
|
||||
RETURNING id, username, password_hash, is_admin, created_at, subsonic_password, listenbrainz_token, listenbrainz_enabled, display_name, email, timezone, timezone_updated_at, debug_mode_enabled, api_token_hash
|
||||
`
|
||||
|
||||
type CreateUserParams struct {
|
||||
@@ -84,7 +84,6 @@ func (q *Queries) CreateUser(ctx context.Context, arg CreateUserParams) (User, e
|
||||
&i.ListenbrainzToken,
|
||||
&i.ListenbrainzEnabled,
|
||||
&i.DisplayName,
|
||||
&i.AutoApproveRequests,
|
||||
&i.Email,
|
||||
&i.Timezone,
|
||||
&i.TimezoneUpdatedAt,
|
||||
@@ -97,7 +96,7 @@ func (q *Queries) CreateUser(ctx context.Context, arg CreateUserParams) (User, e
|
||||
const createUserAdmin = `-- name: CreateUserAdmin :one
|
||||
INSERT INTO users (username, password_hash, api_token_hash, is_admin, display_name)
|
||||
VALUES ($1, $2, $3, $4, $5)
|
||||
RETURNING id, username, password_hash, is_admin, created_at, subsonic_password, listenbrainz_token, listenbrainz_enabled, display_name, auto_approve_requests, email, timezone, timezone_updated_at, debug_mode_enabled, api_token_hash
|
||||
RETURNING id, username, password_hash, is_admin, created_at, subsonic_password, listenbrainz_token, listenbrainz_enabled, display_name, email, timezone, timezone_updated_at, debug_mode_enabled, api_token_hash
|
||||
`
|
||||
|
||||
type CreateUserAdminParams struct {
|
||||
@@ -130,7 +129,6 @@ func (q *Queries) CreateUserAdmin(ctx context.Context, arg CreateUserAdminParams
|
||||
&i.ListenbrainzToken,
|
||||
&i.ListenbrainzEnabled,
|
||||
&i.DisplayName,
|
||||
&i.AutoApproveRequests,
|
||||
&i.Email,
|
||||
&i.Timezone,
|
||||
&i.TimezoneUpdatedAt,
|
||||
@@ -147,7 +145,7 @@ VALUES (
|
||||
(SELECT NOT EXISTS (SELECT 1 FROM users)),
|
||||
$4
|
||||
)
|
||||
RETURNING id, username, password_hash, is_admin, created_at, subsonic_password, listenbrainz_token, listenbrainz_enabled, display_name, auto_approve_requests, email, timezone, timezone_updated_at, debug_mode_enabled, api_token_hash
|
||||
RETURNING id, username, password_hash, is_admin, created_at, subsonic_password, listenbrainz_token, listenbrainz_enabled, display_name, email, timezone, timezone_updated_at, debug_mode_enabled, api_token_hash
|
||||
`
|
||||
|
||||
type CreateUserFirstAdminRaceParams struct {
|
||||
@@ -188,7 +186,6 @@ func (q *Queries) CreateUserFirstAdminRace(ctx context.Context, arg CreateUserFi
|
||||
&i.ListenbrainzToken,
|
||||
&i.ListenbrainzEnabled,
|
||||
&i.DisplayName,
|
||||
&i.AutoApproveRequests,
|
||||
&i.Email,
|
||||
&i.Timezone,
|
||||
&i.TimezoneUpdatedAt,
|
||||
@@ -240,7 +237,7 @@ func (q *Queries) GetListenBrainzConfig(ctx context.Context, id pgtype.UUID) (Ge
|
||||
}
|
||||
|
||||
const getUserByAPITokenHash = `-- name: GetUserByAPITokenHash :one
|
||||
SELECT id, username, password_hash, is_admin, created_at, subsonic_password, listenbrainz_token, listenbrainz_enabled, display_name, auto_approve_requests, email, timezone, timezone_updated_at, debug_mode_enabled, api_token_hash FROM users WHERE api_token_hash = $1
|
||||
SELECT id, username, password_hash, is_admin, created_at, subsonic_password, listenbrainz_token, listenbrainz_enabled, display_name, email, timezone, timezone_updated_at, debug_mode_enabled, api_token_hash FROM users WHERE api_token_hash = $1
|
||||
`
|
||||
|
||||
func (q *Queries) GetUserByAPITokenHash(ctx context.Context, apiTokenHash string) (User, error) {
|
||||
@@ -256,7 +253,6 @@ func (q *Queries) GetUserByAPITokenHash(ctx context.Context, apiTokenHash string
|
||||
&i.ListenbrainzToken,
|
||||
&i.ListenbrainzEnabled,
|
||||
&i.DisplayName,
|
||||
&i.AutoApproveRequests,
|
||||
&i.Email,
|
||||
&i.Timezone,
|
||||
&i.TimezoneUpdatedAt,
|
||||
@@ -267,7 +263,7 @@ func (q *Queries) GetUserByAPITokenHash(ctx context.Context, apiTokenHash string
|
||||
}
|
||||
|
||||
const getUserByEmail = `-- name: GetUserByEmail :one
|
||||
SELECT id, username, password_hash, is_admin, created_at, subsonic_password, listenbrainz_token, listenbrainz_enabled, display_name, auto_approve_requests, email, timezone, timezone_updated_at, debug_mode_enabled, api_token_hash FROM users WHERE lower(email) = lower($1)
|
||||
SELECT id, username, password_hash, is_admin, created_at, subsonic_password, listenbrainz_token, listenbrainz_enabled, display_name, email, timezone, timezone_updated_at, debug_mode_enabled, api_token_hash FROM users WHERE lower(email) = lower($1)
|
||||
`
|
||||
|
||||
// Used by forgot-password lookup. Lowercase comparison both sides
|
||||
@@ -286,7 +282,6 @@ func (q *Queries) GetUserByEmail(ctx context.Context, lower string) (User, error
|
||||
&i.ListenbrainzToken,
|
||||
&i.ListenbrainzEnabled,
|
||||
&i.DisplayName,
|
||||
&i.AutoApproveRequests,
|
||||
&i.Email,
|
||||
&i.Timezone,
|
||||
&i.TimezoneUpdatedAt,
|
||||
@@ -297,7 +292,7 @@ func (q *Queries) GetUserByEmail(ctx context.Context, lower string) (User, error
|
||||
}
|
||||
|
||||
const getUserByID = `-- name: GetUserByID :one
|
||||
SELECT id, username, password_hash, is_admin, created_at, subsonic_password, listenbrainz_token, listenbrainz_enabled, display_name, auto_approve_requests, email, timezone, timezone_updated_at, debug_mode_enabled, api_token_hash FROM users WHERE id = $1
|
||||
SELECT id, username, password_hash, is_admin, created_at, subsonic_password, listenbrainz_token, listenbrainz_enabled, display_name, email, timezone, timezone_updated_at, debug_mode_enabled, api_token_hash FROM users WHERE id = $1
|
||||
`
|
||||
|
||||
func (q *Queries) GetUserByID(ctx context.Context, id pgtype.UUID) (User, error) {
|
||||
@@ -313,7 +308,6 @@ func (q *Queries) GetUserByID(ctx context.Context, id pgtype.UUID) (User, error)
|
||||
&i.ListenbrainzToken,
|
||||
&i.ListenbrainzEnabled,
|
||||
&i.DisplayName,
|
||||
&i.AutoApproveRequests,
|
||||
&i.Email,
|
||||
&i.Timezone,
|
||||
&i.TimezoneUpdatedAt,
|
||||
@@ -324,7 +318,7 @@ func (q *Queries) GetUserByID(ctx context.Context, id pgtype.UUID) (User, error)
|
||||
}
|
||||
|
||||
const getUserByUsername = `-- name: GetUserByUsername :one
|
||||
SELECT id, username, password_hash, is_admin, created_at, subsonic_password, listenbrainz_token, listenbrainz_enabled, display_name, auto_approve_requests, email, timezone, timezone_updated_at, debug_mode_enabled, api_token_hash FROM users WHERE username = $1
|
||||
SELECT id, username, password_hash, is_admin, created_at, subsonic_password, listenbrainz_token, listenbrainz_enabled, display_name, email, timezone, timezone_updated_at, debug_mode_enabled, api_token_hash FROM users WHERE username = $1
|
||||
`
|
||||
|
||||
func (q *Queries) GetUserByUsername(ctx context.Context, username string) (User, error) {
|
||||
@@ -340,7 +334,6 @@ func (q *Queries) GetUserByUsername(ctx context.Context, username string) (User,
|
||||
&i.ListenbrainzToken,
|
||||
&i.ListenbrainzEnabled,
|
||||
&i.DisplayName,
|
||||
&i.AutoApproveRequests,
|
||||
&i.Email,
|
||||
&i.Timezone,
|
||||
&i.TimezoneUpdatedAt,
|
||||
@@ -419,20 +412,19 @@ func (q *Queries) ListUsernamesByIDs(ctx context.Context, dollar_1 []pgtype.UUID
|
||||
}
|
||||
|
||||
const listUsers = `-- name: ListUsers :many
|
||||
SELECT id, username, display_name, is_admin, auto_approve_requests,
|
||||
SELECT id, username, display_name, is_admin,
|
||||
debug_mode_enabled, created_at
|
||||
FROM users
|
||||
ORDER BY created_at DESC
|
||||
`
|
||||
|
||||
type ListUsersRow struct {
|
||||
ID pgtype.UUID
|
||||
Username string
|
||||
DisplayName *string
|
||||
IsAdmin bool
|
||||
AutoApproveRequests bool
|
||||
DebugModeEnabled bool
|
||||
CreatedAt pgtype.Timestamptz
|
||||
ID pgtype.UUID
|
||||
Username string
|
||||
DisplayName *string
|
||||
IsAdmin bool
|
||||
DebugModeEnabled bool
|
||||
CreatedAt pgtype.Timestamptz
|
||||
}
|
||||
|
||||
// Admin user-management list. Sort newest-first.
|
||||
@@ -450,7 +442,6 @@ func (q *Queries) ListUsers(ctx context.Context) ([]ListUsersRow, error) {
|
||||
&i.Username,
|
||||
&i.DisplayName,
|
||||
&i.IsAdmin,
|
||||
&i.AutoApproveRequests,
|
||||
&i.DebugModeEnabled,
|
||||
&i.CreatedAt,
|
||||
); err != nil {
|
||||
@@ -505,7 +496,7 @@ const setDebugMode = `-- name: SetDebugMode :one
|
||||
UPDATE users
|
||||
SET debug_mode_enabled = $2
|
||||
WHERE id = $1
|
||||
RETURNING id, username, password_hash, is_admin, created_at, subsonic_password, listenbrainz_token, listenbrainz_enabled, display_name, auto_approve_requests, email, timezone, timezone_updated_at, debug_mode_enabled, api_token_hash
|
||||
RETURNING id, username, password_hash, is_admin, created_at, subsonic_password, listenbrainz_token, listenbrainz_enabled, display_name, email, timezone, timezone_updated_at, debug_mode_enabled, api_token_hash
|
||||
`
|
||||
|
||||
type SetDebugModeParams struct {
|
||||
@@ -529,7 +520,6 @@ func (q *Queries) SetDebugMode(ctx context.Context, arg SetDebugModeParams) (Use
|
||||
&i.ListenbrainzToken,
|
||||
&i.ListenbrainzEnabled,
|
||||
&i.DisplayName,
|
||||
&i.AutoApproveRequests,
|
||||
&i.Email,
|
||||
&i.Timezone,
|
||||
&i.TimezoneUpdatedAt,
|
||||
@@ -593,7 +583,7 @@ const updateUserAdmin = `-- name: UpdateUserAdmin :one
|
||||
UPDATE users
|
||||
SET is_admin = $2
|
||||
WHERE id = $1
|
||||
RETURNING id, username, password_hash, is_admin, created_at, subsonic_password, listenbrainz_token, listenbrainz_enabled, display_name, auto_approve_requests, email, timezone, timezone_updated_at, debug_mode_enabled, api_token_hash
|
||||
RETURNING id, username, password_hash, is_admin, created_at, subsonic_password, listenbrainz_token, listenbrainz_enabled, display_name, email, timezone, timezone_updated_at, debug_mode_enabled, api_token_hash
|
||||
`
|
||||
|
||||
type UpdateUserAdminParams struct {
|
||||
@@ -616,7 +606,6 @@ func (q *Queries) UpdateUserAdmin(ctx context.Context, arg UpdateUserAdminParams
|
||||
&i.ListenbrainzToken,
|
||||
&i.ListenbrainzEnabled,
|
||||
&i.DisplayName,
|
||||
&i.AutoApproveRequests,
|
||||
&i.Email,
|
||||
&i.Timezone,
|
||||
&i.TimezoneUpdatedAt,
|
||||
@@ -631,7 +620,7 @@ UPDATE users
|
||||
SET display_name = $2,
|
||||
email = $3
|
||||
WHERE id = $1
|
||||
RETURNING id, username, password_hash, is_admin, created_at, subsonic_password, listenbrainz_token, listenbrainz_enabled, display_name, auto_approve_requests, email, timezone, timezone_updated_at, debug_mode_enabled, api_token_hash
|
||||
RETURNING id, username, password_hash, is_admin, created_at, subsonic_password, listenbrainz_token, listenbrainz_enabled, display_name, email, timezone, timezone_updated_at, debug_mode_enabled, api_token_hash
|
||||
`
|
||||
|
||||
type UpdateUserProfileParams struct {
|
||||
@@ -655,7 +644,6 @@ func (q *Queries) UpdateUserProfile(ctx context.Context, arg UpdateUserProfilePa
|
||||
&i.ListenbrainzToken,
|
||||
&i.ListenbrainzEnabled,
|
||||
&i.DisplayName,
|
||||
&i.AutoApproveRequests,
|
||||
&i.Email,
|
||||
&i.Timezone,
|
||||
&i.TimezoneUpdatedAt,
|
||||
|
||||
@@ -0,0 +1,5 @@
|
||||
-- The dropped tables held data this migration deleted, so there is nothing
|
||||
-- to restore them from. Restore a backup taken before it instead.
|
||||
DO $$ BEGIN
|
||||
RAISE EXCEPTION 'migration 105 dropped data and cannot be undone; restore a backup taken before it';
|
||||
END $$;
|
||||
@@ -0,0 +1,44 @@
|
||||
-- Minstrel plays and keeps the library it is given; it no longer finds
|
||||
-- music. This drops the tables that served finding it (follows, wants,
|
||||
-- searches, downloads, requests and their settings), the Discover tables,
|
||||
-- the MusicBrainz artist catalogue only those used, and the per-user
|
||||
-- auto-approve switch.
|
||||
--
|
||||
-- An album matched to a release group only through its wanted-listing
|
||||
-- match keeps that release group: it is copied onto the album first, where
|
||||
-- the duplicate resolver reads it.
|
||||
UPDATE albums al
|
||||
SET release_group_mbid = lam.release_group_mbid
|
||||
FROM library_album_matches lam
|
||||
WHERE lam.album_id = al.id
|
||||
AND lam.outcome = 'listed'
|
||||
AND COALESCE(lam.release_group_mbid, '') <> ''
|
||||
AND COALESCE(al.release_group_mbid, '') = '';
|
||||
|
||||
-- Each table goes after the tables that reference it, without CASCADE, so
|
||||
-- a reference from a table that stays stops the migration instead of being
|
||||
-- dropped quietly.
|
||||
DROP TABLE download_interventions;
|
||||
DROP TABLE want_candidates;
|
||||
DROP TABLE release_blocks;
|
||||
DROP TABLE grabs;
|
||||
DROP TABLE wants;
|
||||
DROP TABLE follow_seen_groups;
|
||||
DROP TABLE follows;
|
||||
DROP TABLE release_type_profiles;
|
||||
DROP TABLE requests;
|
||||
DROP TABLE acquisition_services;
|
||||
DROP TABLE acquisition_settings;
|
||||
DROP TABLE reacquisition_settings;
|
||||
DROP TABLE library_album_matches;
|
||||
|
||||
DROP TABLE suggestion_snoozes;
|
||||
DROP TABLE discover_tuning;
|
||||
DROP TABLE candidate_artist_tag_state;
|
||||
DROP TABLE candidate_artist_tags;
|
||||
DROP TABLE artist_similarity_unmatched;
|
||||
|
||||
DROP TABLE mb_artist_release_groups;
|
||||
DROP TABLE mb_artists;
|
||||
|
||||
ALTER TABLE users DROP COLUMN auto_approve_requests;
|
||||
@@ -221,7 +221,7 @@ SELECT g.id AS group_id,
|
||||
AND t.track_number IS NOT NULL
|
||||
AND o.disc_number IS NOT DISTINCT FROM t.disc_number
|
||||
AND o.track_number = t.track_number)::boolean AS position_clash,
|
||||
COALESCE(NULLIF(al.release_group_mbid, ''), lam.release_group_mbid, '')::text AS release_group_mbid,
|
||||
COALESCE(al.release_group_mbid, '')::text AS release_group_mbid,
|
||||
l.state AS acoustid_state,
|
||||
l.recording_mbid AS acoustid_recording
|
||||
FROM duplicate_groups g
|
||||
@@ -229,7 +229,6 @@ SELECT g.id AS group_id,
|
||||
JOIN tracks t ON t.id = m.track_id
|
||||
JOIN artists ON artists.id = t.artist_id
|
||||
JOIN albums al ON al.id = t.album_id
|
||||
LEFT JOIN library_album_matches lam ON lam.album_id = t.album_id AND lam.outcome = 'listed'
|
||||
LEFT JOIN track_acoustid_lookups l ON l.track_id = t.id
|
||||
WHERE g.status = 'pending'
|
||||
AND t.missing_since IS NULL
|
||||
|
||||
@@ -60,7 +60,7 @@ WHERE id = $1;
|
||||
|
||||
-- name: ListUsers :many
|
||||
-- Admin user-management list. Sort newest-first.
|
||||
SELECT id, username, display_name, is_admin, auto_approve_requests,
|
||||
SELECT id, username, display_name, is_admin,
|
||||
debug_mode_enabled, created_at
|
||||
FROM users
|
||||
ORDER BY created_at DESC;
|
||||
|
||||
Reference in New Issue
Block a user