feat(03-02): wire DATABASE_URL branching in main.go and fix cross-dialect UNIQUE detection

- Add DATABASE_URL env var branching: pgx/PostgreSQL when set, SQLite when absent
- Blank-import github.com/jackc/pgx/v5/stdlib to register 'pgx' driver
- Log 'Using PostgreSQL database' or 'Using SQLite database at {path}' on startup
- Replace RunMigrations with RunSQLiteMigrations (rename from Plan 01)
- Fix TagsHandler UNIQUE detection to use strings.ToLower for cross-dialect compat
This commit is contained in:
2026-03-24 09:12:31 +01:00
parent cf788930e0
commit 4f60f1c9a0
2 changed files with 28 additions and 15 deletions

View File

@@ -169,7 +169,7 @@ func (s *Server) TagsHandler(w http.ResponseWriter, r *http.Request) {
}
tag, err := s.store.CreateTag(req.Name)
if err != nil {
if strings.Contains(err.Error(), "UNIQUE") {
if strings.Contains(strings.ToLower(err.Error()), "unique") {
http.Error(w, "conflict: tag name already exists", http.StatusConflict)
return
}