-
Notifications
You must be signed in to change notification settings - Fork 218
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
support: add migration file #7266
support: add migration file #7266
Conversation
const tsvReplaced = plantUmlReplaced.replace(oldTsvTableRegExp, '``` tsv$1\n$2\n```'); | ||
const csvReplaced = tsvReplaced.replace(oldCsvTableRegExp, '``` csv$1\n$2\n```'); | ||
return csvReplaced; | ||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
こういうことではないなあ
理想
TypeScript 風に書くと、
replaceLatestRevisions(processor: Processor[]) {
// replacer の数だけ body.replace する
}
Processor は (markdown: string) => string
利点
- グループ別に「これは差し替えたい」「これはスキップしたい」といったユーザー要望があるはず
- グループ1: drawio, plantuml 等
- グループ2: GROWI 独自 syntax の linker
- 将来的に、ユーザーが入れられると一番強い
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
修正済み
packages/app/migration.sh
Outdated
var oldCsvTableRegExp = /::: csv(-h)?\n([\s\S]*?)\n:::/g; // CSVによるテーブル描画の旧記法 | ||
|
||
function replaceBody(body) { | ||
const drawioReplaced = body.replace(oldDrawioRegExp, '```drawio\n$1\n```'); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
細かいけど drawio の前にスペース一つ入れよう
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
修正済み
packages/app/migration.sh
Outdated
var pagesCollection = db.getCollection("pages"); | ||
var revisionIds = []; | ||
|
||
// 各ページの最新のrevisionを取得(最新revisionしか記法のマイグレーションをしない) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
最終的には日本語禁止
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
修正済み
packages/app/migration.sh
Outdated
if (doc.revision != undefined) { | ||
revisionIds.push(doc.revision); | ||
} | ||
}); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
パフォーマンス的に NG。ページが10万とかあったらどうするのだ。
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
100ページごと、最新のrevisionを置き換える形にしました
https://redmine.weseek.co.jp/issues/112439
GROWIv6へのリリースガイド
v6へのアップグレードに際する上記の3つの記法変更に対応するためのマイグレーションの
mongoshell
のスクリプトを書きました動作確認
上記のすべてにおいてマイグレーション後、v6で正常に表示できることを確認しました。