diff --git a/deploy/postgres/goose/00046_2026-09-16-retire-demo-ten-projects.sql b/deploy/postgres/goose/00046_2026-09-16-retire-demo-ten-projects.sql new file mode 100644 index 00000000..b1914804 --- /dev/null +++ b/deploy/postgres/goose/00046_2026-09-16-retire-demo-ten-projects.sql @@ -0,0 +1,23 @@ +-- +goose Up +-- Retire goose-seeded demo projects (6001–6010) so they no longer appear in default lists. +-- Data is retained for audit; status flips to demo_retired (reversible with UPDATE). +BEGIN; + +UPDATE projects +SET status = 'demo_retired', + updated_at = now() +WHERE id BETWEEN 6001 AND 6010 + AND status <> 'demo_retired'; + +COMMIT; + +-- +goose Down +BEGIN; + +UPDATE projects +SET status = 'active', + updated_at = now() +WHERE id BETWEEN 6001 AND 6010 + AND status = 'demo_retired'; + +COMMIT; diff --git a/deploy/postgres/migrations/2026-09-16-retire-demo-ten-projects.sql b/deploy/postgres/migrations/2026-09-16-retire-demo-ten-projects.sql new file mode 100644 index 00000000..b1914804 --- /dev/null +++ b/deploy/postgres/migrations/2026-09-16-retire-demo-ten-projects.sql @@ -0,0 +1,23 @@ +-- +goose Up +-- Retire goose-seeded demo projects (6001–6010) so they no longer appear in default lists. +-- Data is retained for audit; status flips to demo_retired (reversible with UPDATE). +BEGIN; + +UPDATE projects +SET status = 'demo_retired', + updated_at = now() +WHERE id BETWEEN 6001 AND 6010 + AND status <> 'demo_retired'; + +COMMIT; + +-- +goose Down +BEGIN; + +UPDATE projects +SET status = 'active', + updated_at = now() +WHERE id BETWEEN 6001 AND 6010 + AND status = 'demo_retired'; + +COMMIT; diff --git a/internal/projectworkflow/store.go b/internal/projectworkflow/store.go index 41aee3a2..81f6731f 100644 --- a/internal/projectworkflow/store.go +++ b/internal/projectworkflow/store.go @@ -155,7 +155,8 @@ func (s *pgStore) ListProjectsForUser(ctx context.Context, userID int64) ([]*Pro p.active_workflow_changed_at, p.active_workflow_changed_by, p.created_at, p.updated_at FROM projects p LEFT JOIN project_members pm ON pm.project_id = p.id AND pm.user_id = $1 AND pm.status = 'active' - WHERE p.creator_user_id = $1 OR pm.user_id IS NOT NULL + WHERE (p.creator_user_id = $1 OR pm.user_id IS NOT NULL) + AND COALESCE(p.status, 'active') <> 'demo_retired' ORDER BY p.id DESC ` rows, err := s.pool.Query(ctx, query, userID) @@ -188,6 +189,7 @@ func (s *pgStore) ListAllProjects(ctx context.Context) ([]*Project, error) { COALESCE(p.workflow_selection_version, 1), COALESCE(p.workflow_plan_revision, 0), p.active_workflow_changed_at, p.active_workflow_changed_by, p.created_at, p.updated_at FROM projects p + WHERE COALESCE(p.status, 'active') <> 'demo_retired' ORDER BY p.id DESC ` rows, err := s.pool.Query(ctx, query)