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:
@@ -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
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user