mirror of
https://gitlab.com/soapbox-pub/ditto.git
synced 2025-12-06 11:29:46 +00:00
Clear timeouts in tag queries migration
This commit is contained in:
parent
48a4e30e38
commit
31f5254fb3
1 changed files with 6 additions and 2 deletions
|
|
@ -11,12 +11,13 @@ export async function up(db: Kysely<any>): Promise<void> {
|
||||||
.addColumn('created_at', 'integer', (col) => col.notNull())
|
.addColumn('created_at', 'integer', (col) => col.notNull())
|
||||||
.execute();
|
.execute();
|
||||||
|
|
||||||
setTimeout(() => {
|
let iid: number | undefined;
|
||||||
|
const tid = setTimeout(() => {
|
||||||
console.warn(
|
console.warn(
|
||||||
'Recreating the tags table to boost performance. Depending on the size of your database, this could take a very long time, even as long as 2 days!',
|
'Recreating the tags table to boost performance. Depending on the size of your database, this could take a very long time, even as long as 2 days!',
|
||||||
);
|
);
|
||||||
const emojis = ['⚡', '🐛', '🔎', '😂', '😅', '😬', '😭', '🙃', '🤔', '🧐', '🧐', '🫠'];
|
const emojis = ['⚡', '🐛', '🔎', '😂', '😅', '😬', '😭', '🙃', '🤔', '🧐', '🧐', '🫠'];
|
||||||
setInterval(() => {
|
iid = setInterval(() => {
|
||||||
const emoji = emojis[Math.floor(Math.random() * emojis.length)];
|
const emoji = emojis[Math.floor(Math.random() * emojis.length)];
|
||||||
console.info(`Recreating tags table... ${emoji}`);
|
console.info(`Recreating tags table... ${emoji}`);
|
||||||
}, 60_000);
|
}, 60_000);
|
||||||
|
|
@ -32,6 +33,9 @@ export async function up(db: Kysely<any>): Promise<void> {
|
||||||
nostr_tags as t LEFT JOIN nostr_events e on t.event_id = e.id;
|
nostr_tags as t LEFT JOIN nostr_events e on t.event_id = e.id;
|
||||||
`.execute(db);
|
`.execute(db);
|
||||||
|
|
||||||
|
clearTimeout(tid);
|
||||||
|
if (iid) clearInterval(iid);
|
||||||
|
|
||||||
// Drop the old table and rename it.
|
// Drop the old table and rename it.
|
||||||
await db.schema.dropTable('nostr_tags').execute();
|
await db.schema.dropTable('nostr_tags').execute();
|
||||||
await db.schema.alterTable('nostr_tags_new').renameTo('nostr_tags').execute();
|
await db.schema.alterTable('nostr_tags_new').renameTo('nostr_tags').execute();
|
||||||
|
|
|
||||||
Loading…
Add table
Reference in a new issue