From eadee5104e7f180a5be7e9a9c7ebdfaf59e5e0f0 Mon Sep 17 00:00:00 2001 From: virgilchiriac Date: Fri, 5 Jan 2024 18:28:03 +0100 Subject: [PATCH] BC-5962 - fixes --- .github/workflows/migrations.yml | 6 ++---- Dockerfile | 1 - .../schulcloud-server-core/templates/migration-job.yml.j2 | 4 ++-- .../management/console/database-management.console.ts | 2 +- package.json | 2 +- 5 files changed, 6 insertions(+), 9 deletions(-) diff --git a/.github/workflows/migrations.yml b/.github/workflows/migrations.yml index 22aa7562e3c..e736c30ee1d 100644 --- a/.github/workflows/migrations.yml +++ b/.github/workflows/migrations.yml @@ -26,9 +26,7 @@ jobs: - run: npm run setup:db:seed - name: check migrations.json formatting run: | - npm run migration-persist + npm run migration:persisted git diff --exit-code backup/** - name: check filesystem migrations have been added to database - run: npm run migration-list - - name: check migrations in database exist in filesystem - run: npm run migration-prune + run: npm run migration:list diff --git a/Dockerfile b/Dockerfile index 77ed4a1088b..036bd9734d3 100644 --- a/Dockerfile +++ b/Dockerfile @@ -16,7 +16,6 @@ COPY esbuild ./esbuild RUN npm ci && npm cache clean --force COPY config /schulcloud-server/config COPY backup /schulcloud-server/backup -COPY migrations /schulcloud-server/migrations COPY src /schulcloud-server/src COPY apps /schulcloud-server/apps COPY --from=git /app/serverversion /schulcloud-server/apps/server/static-assets diff --git a/ansible/roles/schulcloud-server-core/templates/migration-job.yml.j2 b/ansible/roles/schulcloud-server-core/templates/migration-job.yml.j2 index cff6e0d7ac2..c83c512d0d7 100644 --- a/ansible/roles/schulcloud-server-core/templates/migration-job.yml.j2 +++ b/ansible/roles/schulcloud-server-core/templates/migration-job.yml.j2 @@ -20,8 +20,8 @@ spec: name: api-configmap - secretRef: name: api-secret - command: ['/bin/sh','-c']vi - args: ['npm run ensureIndexes && npm run migration up'] + command: ['/bin/sh','-c'] + args: ['npm run ensureIndexes && npm run migration:up'] resources: limits: cpu: {{ API_CPU_LIMITS|default("2000m", true) }} diff --git a/apps/server/src/modules/management/console/database-management.console.ts b/apps/server/src/modules/management/console/database-management.console.ts index d0a22d8a846..383f8461a3c 100644 --- a/apps/server/src/modules/management/console/database-management.console.ts +++ b/apps/server/src/modules/management/console/database-management.console.ts @@ -89,7 +89,7 @@ export class DatabaseManagementConsole { options: [ { flags: '--up', - required: true, + required: false, description: 'execute migration up', }, { diff --git a/package.json b/package.json index 919a07cd420..fd240d8733f 100644 --- a/package.json +++ b/package.json @@ -52,7 +52,7 @@ "mocha-metrics": "cross-env NODE_ENV=test mocha \"test/routes/*.metrics.js\" --exclude \"{test,src}/**/*.test.{js,ts}\" --no-timeout --exit", "migration:up": "npm run nest:start:console -- database migration --up", "migration:down": "npm run nest:start:console -- database migration --down", - "migration:list": "npx mikro-orm migration:list --config ./config/mikro-orm.config.ts", + "migration:list": "npx mikro-orm migration:list", "migration:persisted": "npm run nest:start:console -- database export --collection migrations --override", "nest:prebuild": "rimraf dist", "nest:build": "nest build",