-
Notifications
You must be signed in to change notification settings - Fork 17
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge branch 'BC-7703-bump-aws-sdk_lib-storage' of https://github.com…
…/hpi-schul-cloud/schulcloud-server into BC-7703-bump-aws-sdk_lib-storage
- Loading branch information
Showing
2 changed files
with
48 additions
and
0 deletions.
There are no files selected for viewing
39 changes: 39 additions & 0 deletions
39
apps/server/src/migrations/mikro-orm/Migration20240725143018.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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!`); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters