Skip to content

Commit

Permalink
Merge branch 'BC-7703-bump-aws-sdk_lib-storage' of https://github.com…
Browse files Browse the repository at this point in the history
…/hpi-schul-cloud/schulcloud-server into BC-7703-bump-aws-sdk_lib-storage
  • Loading branch information
CeEv committed Jul 26, 2024
2 parents a2ae505 + fcde94a commit cd3b4c9
Show file tree
Hide file tree
Showing 2 changed files with 48 additions and 0 deletions.
39 changes: 39 additions & 0 deletions apps/server/src/migrations/mikro-orm/Migration20240725143018.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,39 @@
import { Migration } from '@mikro-orm/migrations-mongodb';

export class Migration20240725143018 extends Migration {
async up(): Promise<void> {
// eslint-disable-next-line no-process-env
if (process.env.SC_THEME !== 'n21') {
return;
}

console.info(`Adding 'oauthProvisioningEnabled' school feature to schools with moin.schule system`);

const moinSchuleSystem = await this.getCollection('systems').findOne({ alias: 'SANIS' });

if (!moinSchuleSystem) {
console.error('moin.schule system not found');
return;
}
console.info(`moin.schule system ${moinSchuleSystem._id.toHexString()} found`);

const addOauthFeatureToSchools = await this.driver.nativeUpdate(
'schools',
{ systems: moinSchuleSystem._id },
{
$addToSet: {
features: {
$each: ['oauthProvisioningEnabled'],
},
},
}
);

console.info(`Added 'oauthProvisioningEnabled' school feature to ${addOauthFeatureToSchools.affectedRows} schools`);
}

// eslint-disable-next-line @typescript-eslint/require-await
async down(): Promise<void> {
console.error(`Migration down not implemented. You might need to restore database from backup!`);
}
}
9 changes: 9 additions & 0 deletions backup/setup/migrations.json
Original file line number Diff line number Diff line change
Expand Up @@ -187,5 +187,14 @@
"created_at": {
"$date": "2024-07-24T09:11:11.359Z"
}
},
{
"_id": {
"$oid": "66a267da6d71e4510a572d08"
},
"name": "Migration20240725143018",
"created_at": {
"$date": "2024-07-25T14:57:30.752Z"
}
}
]

0 comments on commit cd3b4c9

Please sign in to comment.