Skip to content

Commit 04edb1e

Browse files
committed
fix(migrations): correctly create spotify table
1 parent 2f35245 commit 04edb1e

File tree

1 file changed

+3
-9
lines changed

1 file changed

+3
-9
lines changed

libs/migrations/migrations/20250227132205_separate_spotify.go

+3-9
Original file line numberDiff line numberDiff line change
@@ -39,10 +39,7 @@ func upSeparateSpotify(ctx context.Context, tx *sql.Tx) error {
3939
ctx,
4040
"SELECT id FROM integrations WHERE service = 'SPOTIFY'",
4141
).Scan(&spotifyIntegration.ID)
42-
if err != nil {
43-
if errors.Is(err, sql.ErrNoRows) {
44-
return nil
45-
}
42+
if err != nil && !errors.Is(err, sql.ErrNoRows) {
4643
return err
4744
}
4845

@@ -51,10 +48,7 @@ func upSeparateSpotify(ctx context.Context, tx *sql.Tx) error {
5148
`SELECT id, "accessToken", "refreshToken", enabled, "channelId", data FROM channels_integrations WHERE "integrationId" = $1`,
5249
spotifyIntegration.ID,
5350
)
54-
if err != nil {
55-
if errors.Is(err, sql.ErrNoRows) {
56-
return nil
57-
}
51+
if err != nil && !errors.Is(err, sql.ErrNoRows) {
5852
return err
5953
}
6054
channelsIntegrations := []channelsIntegrationsSpotify20250227132205{}
@@ -75,7 +69,7 @@ func upSeparateSpotify(ctx context.Context, tx *sql.Tx) error {
7569
}
7670
channelsIntegrations = append(channelsIntegrations, channelIntegration)
7771
}
78-
if rows.Err() != nil {
72+
if rows.Err() != nil && !errors.Is(err, sql.ErrNoRows) {
7973
return err
8074
}
8175

0 commit comments

Comments
 (0)