()
| 21 | } |
| 22 | |
| 23 | export async function migrateDb() { |
| 24 | try { |
| 25 | await runMigrate(); |
| 26 | } catch (e) { |
| 27 | if (!errorIsOrgIdMigration(e)) throw e; |
| 28 | |
| 29 | console.log("non-null videos.orgId migration failed, running backfill"); |
| 30 | |
| 31 | await runOrgIdBackfill(); |
| 32 | |
| 33 | try { |
| 34 | await runMigrate(); |
| 35 | } catch (retryError) { |
| 36 | if (errorIsOrgIdMigration(retryError)) { |
| 37 | throw new Error( |
| 38 | "videos.orgId backfill failed, you will need to manually update the videos.orgId column before attempting to migrate again.", |
| 39 | ); |
| 40 | } |
| 41 | throw retryError; |
| 42 | } |
| 43 | } |
| 44 | |
| 45 | await runSpaceMemberRoleBackfill(); |
| 46 | } |
no test coverage detected