Skip to content
This repository has been archived by the owner on Oct 5, 2023. It is now read-only.

Commit

Permalink
chore: 様子見
Browse files Browse the repository at this point in the history
  • Loading branch information
yupix committed Sep 30, 2023
1 parent c067ff1 commit 31661bb
Showing 1 changed file with 6 additions and 4 deletions.
10 changes: 6 additions & 4 deletions src/migration/note.ts
Original file line number Diff line number Diff line change
Expand Up @@ -14,8 +14,13 @@ export async function migrateNote(noteId: string, useNote?: Note) {
const noteRepository = nextDb.getRepository(v13Note);
const originalNoteRepository = originalDb.getRepository(Note);

async function save(note: Note) {
async function save(note: Note, from: string = "") {
await createUser({userId: note.userId}); // ユーザー作る前にもしかするとノート作成が来る可能性があるから

const isExists = await noteRepository.findOne({where: {id: note.id}}) === undefined ? false : true

if (isExists) return;

await noteRepository.save({
id: note.id,
createdAt: note.createdAt,
Expand Down Expand Up @@ -99,9 +104,6 @@ export async function migrateNote(noteId: string, useNote?: Note) {
if (note.replyId) await checkReply(note.replyId); // リプライが既に登録されてるか確認し、無いなら再帰的に作成する
if (note.renoteId) await checkRenoteId(note.renoteId); // renoteが既に登録されてるか確認し、無いなら再帰的に作成する

const checkExists = await noteRepository.findOne({where: {id: note.id}}); // 既にノートが移行済みか確認
if (checkExists) return; // 移行済みならスキップする

await save(note);
}

Expand Down

0 comments on commit 31661bb

Please sign in to comment.