From 5e00060421170076767dd446bd9183c5b50c107c Mon Sep 17 00:00:00 2001 From: juancwu Date: Sun, 3 May 2026 23:59:37 +0000 Subject: [PATCH] fix: sql syntax incompatibility with sqlite/postgresql --- .../db/migrations/00009_create_space_audit_logs_table.sql | 2 +- .../00010_create_transaction_audit_logs_table.sql | 2 +- internal/handler/home_test.go | 2 +- internal/routes/routes_test.go | 6 +++--- 4 files changed, 6 insertions(+), 6 deletions(-) diff --git a/internal/db/migrations/00009_create_space_audit_logs_table.sql b/internal/db/migrations/00009_create_space_audit_logs_table.sql index 028c19f..cef7887 100644 --- a/internal/db/migrations/00009_create_space_audit_logs_table.sql +++ b/internal/db/migrations/00009_create_space_audit_logs_table.sql @@ -7,7 +7,7 @@ CREATE TABLE space_audit_logs ( action TEXT NOT NULL, target_user_id TEXT REFERENCES users(id) ON DELETE SET NULL, target_email TEXT, - metadata JSONB NOT NULL DEFAULT '{}'::jsonb, + metadata JSONB NOT NULL DEFAULT '{}', created_at TIMESTAMP NOT NULL DEFAULT CURRENT_TIMESTAMP ); diff --git a/internal/db/migrations/00010_create_transaction_audit_logs_table.sql b/internal/db/migrations/00010_create_transaction_audit_logs_table.sql index 0387f95..670be17 100644 --- a/internal/db/migrations/00010_create_transaction_audit_logs_table.sql +++ b/internal/db/migrations/00010_create_transaction_audit_logs_table.sql @@ -5,7 +5,7 @@ CREATE TABLE transaction_audit_logs ( transaction_id TEXT NOT NULL, actor_id TEXT REFERENCES users(id) ON DELETE SET NULL, action TEXT NOT NULL, - metadata JSONB NOT NULL DEFAULT '{}'::jsonb, + metadata JSONB NOT NULL DEFAULT '{}', created_at TIMESTAMP NOT NULL DEFAULT CURRENT_TIMESTAMP ); diff --git a/internal/handler/home_test.go b/internal/handler/home_test.go index 6a7e78d..e73a523 100644 --- a/internal/handler/home_test.go +++ b/internal/handler/home_test.go @@ -38,5 +38,5 @@ func TestHomeHandler_HomePage_Authenticated(t *testing.T) { h.HomePage(w, req) assert.Equal(t, http.StatusSeeOther, w.Code) - assert.Equal(t, "/app/spaces", w.Header().Get("Location")) + assert.Equal(t, "/app/home", w.Header().Get("Location")) } diff --git a/internal/routes/routes_test.go b/internal/routes/routes_test.go index 445190b..ab56b08 100644 --- a/internal/routes/routes_test.go +++ b/internal/routes/routes_test.go @@ -85,7 +85,7 @@ func TestSetupRoutes_HomeRedirects(t *testing.T) { assert.Equal(t, http.StatusSeeOther, w.Code) assert.Equal(t, "/auth", w.Header().Get("Location")) - // Authenticated → redirect to /app/spaces + // Authenticated → redirect to /app/home name := "Test User" user := testutil.CreateTestUserWithName(t, dbi.DB, "home@example.com", &name) req = httptest.NewRequest(http.MethodGet, "/", nil) @@ -93,7 +93,7 @@ func TestSetupRoutes_HomeRedirects(t *testing.T) { w = httptest.NewRecorder() handler.ServeHTTP(w, req) assert.Equal(t, http.StatusSeeOther, w.Code) - assert.Equal(t, "/app/spaces", w.Header().Get("Location")) + assert.Equal(t, "/app/home", w.Header().Get("Location")) }) } @@ -202,7 +202,7 @@ func TestSetupRoutes_PermanentRedirect(t *testing.T) { handler.ServeHTTP(w, req) assert.Equal(t, http.StatusMovedPermanently, w.Code) - assert.Equal(t, "/app/spaces", w.Header().Get("Location")) + assert.Equal(t, "/app/home", w.Header().Get("Location")) }) }