fix: sql syntax incompatibility with sqlite/postgresql

This commit is contained in:
juancwu 2026-05-03 23:59:37 +00:00
commit 5e00060421
4 changed files with 6 additions and 6 deletions

View file

@ -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
);

View file

@ -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
);

View file

@ -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"))
}

View file

@ -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"))
})
}