refactor: remove user management tables and unused account/notification_preference tables

This commit is contained in:
2026-04-25 21:14:39 +02:00
parent 4285c6239c
commit 21da18831d
6 changed files with 6 additions and 111 deletions

View File

@@ -1,6 +1,6 @@
// Code generated by sqlc. DO NOT EDIT. // Code generated by sqlc. DO NOT EDIT.
// versions: // versions:
// sqlc v1.30.0 // sqlc v1.31.1
package database package database

View File

@@ -1,6 +1,6 @@
// Code generated by sqlc. DO NOT EDIT. // Code generated by sqlc. DO NOT EDIT.
// versions: // versions:
// sqlc v1.30.0 // sqlc v1.31.1
package database package database
@@ -9,14 +9,6 @@ import (
"time" "time"
) )
type Account struct {
ID string `json:"id"`
UserID string `json:"user_id"`
Provider string `json:"provider"`
ProviderAccountID string `json:"provider_account_id"`
CreatedAt time.Time `json:"created_at"`
}
type Anime struct { type Anime struct {
ID int64 `json:"id"` ID int64 `json:"id"`
TitleOriginal string `json:"title_original"` TitleOriginal string `json:"title_original"`
@@ -61,13 +53,6 @@ type JikanCache struct {
CreatedAt time.Time `json:"created_at"` CreatedAt time.Time `json:"created_at"`
} }
type NotificationPreference struct {
ID string `json:"id"`
UserID string `json:"user_id"`
NotifyNewEpisodes bool `json:"notify_new_episodes"`
CreatedAt time.Time `json:"created_at"`
}
type Session struct { type Session struct {
ID string `json:"id"` ID string `json:"id"`
UserID string `json:"user_id"` UserID string `json:"user_id"`

View File

@@ -1,6 +1,6 @@
// Code generated by sqlc. DO NOT EDIT. // Code generated by sqlc. DO NOT EDIT.
// versions: // versions:
// sqlc v1.30.0 // sqlc v1.31.1
package database package database
@@ -11,13 +11,10 @@ import (
type Querier interface { type Querier interface {
CountPendingAnimeFetchRetries(ctx context.Context) (int64, error) CountPendingAnimeFetchRetries(ctx context.Context) (int64, error)
CreateSession(ctx context.Context, arg CreateSessionParams) (Session, error) CreateSession(ctx context.Context, arg CreateSessionParams) (Session, error)
CreateUser(ctx context.Context, arg CreateUserParams) (User, error)
DeleteAnimeFetchRetry(ctx context.Context, animeID int64) error DeleteAnimeFetchRetry(ctx context.Context, animeID int64) error
DeleteContinueWatchingEntry(ctx context.Context, arg DeleteContinueWatchingEntryParams) error DeleteContinueWatchingEntry(ctx context.Context, arg DeleteContinueWatchingEntryParams) error
DeleteExpiredJikanCache(ctx context.Context) error DeleteExpiredJikanCache(ctx context.Context) error
DeleteSession(ctx context.Context, id string) error DeleteSession(ctx context.Context, id string) error
DeleteUser(ctx context.Context, id string) error
DeleteUserSessions(ctx context.Context, userID string) error
DeleteWatchListEntry(ctx context.Context, arg DeleteWatchListEntryParams) error DeleteWatchListEntry(ctx context.Context, arg DeleteWatchListEntryParams) error
EnqueueAnimeFetchRetry(ctx context.Context, arg EnqueueAnimeFetchRetryParams) error EnqueueAnimeFetchRetry(ctx context.Context, arg EnqueueAnimeFetchRetryParams) error
GetAnime(ctx context.Context, id int64) (Anime, error) GetAnime(ctx context.Context, id int64) (Anime, error)
@@ -34,7 +31,6 @@ type Querier interface {
GetUserWatchList(ctx context.Context, userID string) ([]GetUserWatchListRow, error) GetUserWatchList(ctx context.Context, userID string) ([]GetUserWatchListRow, error)
GetWatchListEntry(ctx context.Context, arg GetWatchListEntryParams) (WatchListEntry, error) GetWatchListEntry(ctx context.Context, arg GetWatchListEntryParams) (WatchListEntry, error)
GetWatchingAnime(ctx context.Context, userID string) ([]GetWatchingAnimeRow, error) GetWatchingAnime(ctx context.Context, userID string) ([]GetWatchingAnimeRow, error)
ListUsers(ctx context.Context) ([]User, error)
MarkAnimeFetchRetryFailed(ctx context.Context, arg MarkAnimeFetchRetryFailedParams) error MarkAnimeFetchRetryFailed(ctx context.Context, arg MarkAnimeFetchRetryFailedParams) error
MarkRelationsSynced(ctx context.Context, id int64) error MarkRelationsSynced(ctx context.Context, id int64) error
SaveWatchProgress(ctx context.Context, arg SaveWatchProgressParams) error SaveWatchProgress(ctx context.Context, arg SaveWatchProgressParams) error

View File

@@ -4,17 +4,6 @@ SELECT * FROM user WHERE id = ? LIMIT 1;
-- name: GetUserByUsername :one -- name: GetUserByUsername :one
SELECT * FROM user WHERE username = ? LIMIT 1; SELECT * FROM user WHERE username = ? LIMIT 1;
-- name: ListUsers :many
SELECT * FROM user ORDER BY created_at DESC;
-- name: DeleteUser :exec
DELETE FROM user WHERE id = ?;
-- name: CreateUser :one
INSERT INTO user (id, username, password_hash)
VALUES (?, ?, ?)
RETURNING *;
-- name: CreateSession :one -- name: CreateSession :one
INSERT INTO session (id, user_id, expires_at) INSERT INTO session (id, user_id, expires_at)
VALUES (?, ?, ?) VALUES (?, ?, ?)
@@ -26,9 +15,6 @@ SELECT * FROM session WHERE id = ? LIMIT 1;
-- name: DeleteSession :exec -- name: DeleteSession :exec
DELETE FROM session WHERE id = ?; DELETE FROM session WHERE id = ?;
-- name: DeleteUserSessions :exec
DELETE FROM session WHERE user_id = ?;
-- name: UpsertAnime :one -- name: UpsertAnime :one
INSERT INTO anime (id, title_original, title_english, title_japanese, image_url, airing) INSERT INTO anime (id, title_original, title_english, title_japanese, image_url, airing)
VALUES (?, ?, ?, ?, ?, ?) VALUES (?, ?, ?, ?, ?, ?)

View File

@@ -1,6 +1,6 @@
// Code generated by sqlc. DO NOT EDIT. // Code generated by sqlc. DO NOT EDIT.
// versions: // versions:
// sqlc v1.30.0 // sqlc v1.31.1
// source: queries.sql // source: queries.sql
package database package database
@@ -48,30 +48,6 @@ func (q *Queries) CreateSession(ctx context.Context, arg CreateSessionParams) (S
return i, err return i, err
} }
const createUser = `-- name: CreateUser :one
INSERT INTO user (id, username, password_hash)
VALUES (?, ?, ?)
RETURNING id, username, password_hash, created_at
`
type CreateUserParams struct {
ID string `json:"id"`
Username string `json:"username"`
PasswordHash string `json:"password_hash"`
}
func (q *Queries) CreateUser(ctx context.Context, arg CreateUserParams) (User, error) {
row := q.db.QueryRowContext(ctx, createUser, arg.ID, arg.Username, arg.PasswordHash)
var i User
err := row.Scan(
&i.ID,
&i.Username,
&i.PasswordHash,
&i.CreatedAt,
)
return i, err
}
const deleteAnimeFetchRetry = `-- name: DeleteAnimeFetchRetry :exec const deleteAnimeFetchRetry = `-- name: DeleteAnimeFetchRetry :exec
DELETE FROM anime_fetch_retry DELETE FROM anime_fetch_retry
WHERE anime_id = ? WHERE anime_id = ?
@@ -115,24 +91,6 @@ func (q *Queries) DeleteSession(ctx context.Context, id string) error {
return err return err
} }
const deleteUser = `-- name: DeleteUser :exec
DELETE FROM user WHERE id = ?
`
func (q *Queries) DeleteUser(ctx context.Context, id string) error {
_, err := q.db.ExecContext(ctx, deleteUser, id)
return err
}
const deleteUserSessions = `-- name: DeleteUserSessions :exec
DELETE FROM session WHERE user_id = ?
`
func (q *Queries) DeleteUserSessions(ctx context.Context, userID string) error {
_, err := q.db.ExecContext(ctx, deleteUserSessions, userID)
return err
}
const deleteWatchListEntry = `-- name: DeleteWatchListEntry :exec const deleteWatchListEntry = `-- name: DeleteWatchListEntry :exec
DELETE FROM watch_list_entry DELETE FROM watch_list_entry
WHERE user_id = ? AND anime_id = ? WHERE user_id = ? AND anime_id = ?
@@ -697,38 +655,6 @@ func (q *Queries) GetWatchingAnime(ctx context.Context, userID string) ([]GetWat
return items, nil return items, nil
} }
const listUsers = `-- name: ListUsers :many
SELECT id, username, password_hash, created_at FROM user ORDER BY created_at DESC
`
func (q *Queries) ListUsers(ctx context.Context) ([]User, error) {
rows, err := q.db.QueryContext(ctx, listUsers)
if err != nil {
return nil, err
}
defer rows.Close()
var items []User
for rows.Next() {
var i User
if err := rows.Scan(
&i.ID,
&i.Username,
&i.PasswordHash,
&i.CreatedAt,
); err != nil {
return nil, err
}
items = append(items, i)
}
if err := rows.Close(); err != nil {
return nil, err
}
if err := rows.Err(); err != nil {
return nil, err
}
return items, nil
}
const markAnimeFetchRetryFailed = `-- name: MarkAnimeFetchRetryFailed :exec const markAnimeFetchRetryFailed = `-- name: MarkAnimeFetchRetryFailed :exec
UPDATE anime_fetch_retry UPDATE anime_fetch_retry
SET attempts = attempts + 1, SET attempts = attempts + 1,

View File

@@ -0,0 +1,2 @@
DROP TABLE IF EXISTS account;
DROP TABLE IF EXISTS notification_preference;