Open CH1PSET1 opened 5 years ago
@CH1PSET1 The migrations runs automatically when the server startup. Which version of Rocket are you using? It seems very old, these files had a lot of changes. Maybe you should update to the latest version.
@MarcosSpessatto Good day. Thanks for the answer. I use one of the latest versions 1.0.2, but in my problem for some reason I was told to perform a migration to fix it.
Got it, If you need run this Migration, you must follow the order, see the last file on server -> startup -> migrations -> your-migration.js
, then you must create a file named in order, if the last file is v146.js, the next should be v147.js. Also you can't simply copy and paste the content of the v122.js migration, because it won't work, the RocketChat
variable has been removed. You need import
the Migrations
and the Subscriptions
to be able to make it work. https://github.com/RocketChat/Rocket.Chat/blob/develop/server/startup/migrations/v122.js#L1
@MarcosSpessatto I understand that v122.js is present and correct in my case?
Then why do I have an error that I showed above in the logs?
This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions.
Please tell me, you need to run this script, but not enough experience. How to do it correctly? The initial topic here is https://github.com/RocketChat/Rocket.Chat/issues/14504#issuecomment-493446375, but no one answers. I tried to write this script in a single v12222.js file and run it, got an error
ReferenceError: Migrations is not defined at Object. (/root/v12222.js:1:63)
at Module._compile (module.js:652:30)
at Object.Module._extensions..js (module.js:663:10)
at Module.load (module.js:565:32)
at tryModuleLoad (module.js:505:12)
at Function.Module._load (module.js:497:3)
at Function.Module.runMain (module.js:693:10)
at startup (bootstrap_node.js:191:16)
at bootstrap_node.js:612:3
`
Script v122.js that I need to run. RocketChat.Migrations.add({ version: 122, up() { RocketChat.models.Subscriptions.tryDropIndex('u._id_1_name_1_t_1_code_1'); console.log('Fixing ChatSubscription u._id_1_name_1_t_1_code_1'); } });`
Tell me what I'm doing wrong and how it should be. Thank.