diff options
| author | Paul Buetow <paul@buetow.org> | 2026-05-05 22:08:33 +0300 |
|---|---|---|
| committer | Paul Buetow <paul@buetow.org> | 2026-05-05 22:08:33 +0300 |
| commit | f96c13de4828a3d531f4dc62f63ba571542c3ece (patch) | |
| tree | bff84878260815f5304b4b85ccfe6982bec44c55 | |
| parent | 83ffe8544aa7845810049083d1376f7c7d01cd2c (diff) | |
Fix podcast migration backward compatibility and login logo width
| -rw-r--r-- | internal/repository/migrate.go | 20 | ||||
| -rw-r--r-- | web/css/login.css | 2 |
2 files changed, 21 insertions, 1 deletions
diff --git a/internal/repository/migrate.go b/internal/repository/migrate.go index 2896906..d64732d 100644 --- a/internal/repository/migrate.go +++ b/internal/repository/migrate.go @@ -196,6 +196,21 @@ func enableForeignKeys(db *sql.DB) error { return nil } +// addPodcastColumn ensures the sets table has the is_podcast column. +// It safely ignores the error if the column already exists. +func addPodcastColumn(db *sql.DB) error { + _, err := db.Exec(`ALTER TABLE sets ADD COLUMN is_podcast INTEGER NOT NULL DEFAULT 0;`) + if err != nil { + // SQLite returns a generic error message for duplicate columns. + if err.Error() == "duplicate column name: is_podcast" || + err.Error() == "SQL logic error: duplicate column name: is_podcast (1)" { + return nil + } + return fmt.Errorf("add is_podcast column: %w", err) + } + return nil +} + // Migrate creates the database schema if it does not exist. func Migrate(db *sql.DB) error { if err := enableForeignKeys(db); err != nil { @@ -204,6 +219,11 @@ func Migrate(db *sql.DB) error { if err := execSchema(db, "tables", tablesSchema); err != nil { return err } + // Backward-compatibility: older databases may have a sets table + // without the is_podcast column. Add it before creating the index. + if err := addPodcastColumn(db); err != nil { + return err + } if err := execSchema(db, "indexes", indexesSchema); err != nil { return err } diff --git a/web/css/login.css b/web/css/login.css index 086e54c..a69c9a9 100644 --- a/web/css/login.css +++ b/web/css/login.css @@ -27,7 +27,7 @@ .login-form .btn { width: 100%; margin-top: 0.5rem; } .login-logo { - width: 4rem; + width: 10rem; height: auto; margin-bottom: 0.5rem; } |
