fix(db): retire goose-seeded demo projects from lists
Mark projects 6001–6010 as demo_retired and exclude them from default project list queries so demo seeds no longer pollute real workspaces. Co-authored-by: Cursor <cursoragent@cursor.com>
This commit is contained in:
@@ -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;
|
||||
@@ -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;
|
||||
@@ -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)
|
||||
|
||||
Reference in New Issue
Block a user