Backfill package json for custom and standard app (#17681)
# Backfill application package files for custom and standard apps - Backfill `package.json` / `yarn.lock` (and related fields) for existing workspaces; new standard/custom apps get default dependency files. - Default package files under `application/constants/default-package-files/`; util with hardcoded checksums (comment on how to regenerate). - New **FileFolder.Dependencies** for app dependency files; **writeFile_v2** accepts optional `queryRunner` for transactional writes. Usages: - **Upgrade command** `upgrade:1-17:backfill-application-package-files`: standard/custom apps → default files; other apps → from logic function layer. - **Workspace creation**: create workspace with `workspaceCustomApplicationId` first, then create application (enables same-transaction insert). Migration makes workspace/application/file FKs deferrable. - dev seeder
This commit is contained in:
+12
-9
@@ -1,4 +1,5 @@
|
||||
import { type DataSource } from 'typeorm';
|
||||
import { v4 } from 'uuid';
|
||||
|
||||
import { type ApplicationService } from 'src/engine/core-modules/application/services/application.service';
|
||||
import { seedBillingCustomers } from 'src/engine/workspace-manager/dev-seeder/core/billing/utils/seed-billing-customers.util';
|
||||
@@ -42,14 +43,7 @@ export const seedCoreSchema = async ({
|
||||
await queryRunner.startTransaction();
|
||||
|
||||
try {
|
||||
const customWorkspaceApplication =
|
||||
await applicationService.createWorkspaceCustomApplication(
|
||||
{
|
||||
workspaceId,
|
||||
workspaceDisplayName: createWorkspaceStaticInput.displayName,
|
||||
},
|
||||
queryRunner,
|
||||
);
|
||||
const workspaceCustomApplicationId = v4();
|
||||
|
||||
await createWorkspace({
|
||||
queryRunner,
|
||||
@@ -57,10 +51,19 @@ export const seedCoreSchema = async ({
|
||||
createWorkspaceInput: {
|
||||
...createWorkspaceStaticInput,
|
||||
version,
|
||||
workspaceCustomApplicationId: customWorkspaceApplication.id,
|
||||
workspaceCustomApplicationId,
|
||||
},
|
||||
});
|
||||
|
||||
await applicationService.createWorkspaceCustomApplication(
|
||||
{
|
||||
workspaceId,
|
||||
applicationId: workspaceCustomApplicationId,
|
||||
workspaceDisplayName: createWorkspaceStaticInput.displayName,
|
||||
},
|
||||
queryRunner,
|
||||
);
|
||||
|
||||
await seedUsers({ queryRunner, schemaName });
|
||||
|
||||
await seedUserWorkspaces({ queryRunner, schemaName, workspaceId });
|
||||
|
||||
Reference in New Issue
Block a user