fix(migrate): reorder migrations so workspace ALTER runs after project CREATE

m20260411_000003_add_workspace_id_to_project was running before
m20250628_000013_create_project, causing "relation project does not exist".
Move all project table CREATEs before workspace migrations.
This commit is contained in:
ZhenYi 2026-04-15 11:19:01 +08:00
parent 3a8b8c9cf8
commit b6697258ab

View File

@ -53,15 +53,7 @@ impl MigratorTrait for Migrator {
Box::new(m20250628_000011_create_user_ssh_key::Migration),
Box::new(m20250628_000012_create_user_token::Migration),
Box::new(m20250628_000004_create_user_activity_log::Migration),
// Project tables
Box::new(m20260411_000001_create_workspace::Migration),
Box::new(m20260411_000002_create_workspace_membership::Migration),
Box::new(m20260411_000003_add_workspace_id_to_project::Migration),
Box::new(m20260411_000004_add_invite_token_to_workspace_membership::Migration),
Box::new(m20260412_000003_create_project_skill::Migration),
Box::new(m20260413_000001_add_skill_commit_blob::Migration),
Box::new(m20260414_000001_create_agent_task::Migration),
Box::new(m20260412_000002_create_workspace_billing_history::Migration),
// Project tables (CREATE first, then ALTER after workspace is created)
Box::new(m20250628_000013_create_project::Migration),
Box::new(m20250628_000014_create_project_access_log::Migration),
Box::new(m20250628_000015_create_project_audit_log::Migration),
@ -77,6 +69,16 @@ impl MigratorTrait for Migrator {
Box::new(m20250628_000025_create_project_member_join_settings::Migration),
Box::new(m20250628_000026_create_project_members::Migration),
Box::new(m20250628_000027_create_project_watch::Migration),
// Workspace tables (must come after project tables so ALTER project works)
Box::new(m20260411_000001_create_workspace::Migration),
Box::new(m20260411_000002_create_workspace_membership::Migration),
Box::new(m20260411_000003_add_workspace_id_to_project::Migration),
Box::new(m20260411_000004_add_invite_token_to_workspace_membership::Migration),
Box::new(m20260412_000001_create_workspace_billing::Migration),
Box::new(m20260412_000002_create_workspace_billing_history::Migration),
Box::new(m20260412_000003_create_project_skill::Migration),
Box::new(m20260413_000001_add_skill_commit_blob::Migration),
Box::new(m20260414_000001_create_agent_task::Migration),
// Repo tables
Box::new(m20250628_000028_create_repo::Migration),
Box::new(m20250628_000029_create_repo_branch::Migration),