Files
multica/server/migrations/131_workspace_space.down.sql
Naiyuan Qing 05ad0d292f fix(server): backfill space_id in raw-SQL test fixtures + generator/mobile CI fixes
CI was red across backend/frontend/mobile:

- backend: migration 132 made issue.space_id/autopilot.space_id NOT NULL,
  but ~28 test files across internal/handler, cmd/server, and cmd/migrate
  still raw-SQL-inserted issue/autopilot rows without space_id. Backfilled
  every one via (SELECT id FROM workspace_space WHERE workspace_id = $N
  LIMIT 1), reusing the existing workspace_id positional param — matches
  the convention already established in daemon_test.go/comment_resolve_test.go.
  Seeded a workspace_space row for every test that creates its own local
  workspace (cross-workspace fixtures), mirroring setupHandlerTestFixture.
- frontend: scripts/generate-reserved-slugs.mjs had a stale hardcoded
  `/create-team` example in its generated doc comment (never updated in
  the team→space rename), so `pnpm generate:reserved-slugs`'s output
  diverged from the committed reserved-slugs.ts and CI's drift-check failed.
- mobile: agent-schema.test.ts asserted the unknown-target_type fallback
  was "team"; the schema's actual .catch() fallback is "space" — stale
  assertion, not a schema bug.

go test ./... and go vet ./... are clean; pnpm generate:reserved-slugs
produces no diff; mobile's agent-schema test passes.

Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
2026-07-08 18:53:18 +08:00

19 lines
777 B
SQL

DROP INDEX IF EXISTS idx_autopilot_workspace_space;
ALTER TABLE autopilot DROP CONSTRAINT IF EXISTS fk_autopilot_workspace_space;
ALTER TABLE autopilot DROP COLUMN IF EXISTS space_id;
DROP INDEX IF EXISTS idx_issue_project_space;
DROP INDEX IF EXISTS idx_issue_workspace_space_created_at;
DROP INDEX IF EXISTS idx_issue_workspace_space_status_position;
ALTER TABLE issue DROP CONSTRAINT IF EXISTS fk_issue_workspace_space;
ALTER TABLE issue DROP COLUMN IF EXISTS space_id;
DROP TABLE IF EXISTS project_space;
ALTER TABLE project DROP CONSTRAINT IF EXISTS uq_project_workspace_id;
DROP TABLE IF EXISTS workspace_space_member;
DROP INDEX IF EXISTS idx_workspace_space_active;
DROP INDEX IF EXISTS uq_workspace_space_workspace_key_lower;
DROP TABLE IF EXISTS workspace_space;