RocketChat / RocketChat/Rocket.Chat

Perform migration

Open
#14,598 7 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

stale
Dominant language
TypeScript
Stars
46.1k
Forks
13.9k
Avg merge
3d 3h
Merged PRs (30d)
130

Description

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.

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start by reviewing the referenced v122.js migration and the reported v12222.js execution error, then trace how RocketChat.Migrations is made available when migrations run. Document the correct way to execute this migration and verify that the instructions address the missing Migrations reference.

Written by the indexing model from the issue text.

Assessment

Tech stack
javascript
Domain
databases
Issue type
Documentation
Difficulty
3/5
Estimated time
1-2 days
Activity status
Stale
Clarity
Needs clarification
Newbie friendliness
25/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.