diff --git a/.gitignore b/.gitignore index ce6692e1..f2818846 100644 --- a/.gitignore +++ b/.gitignore @@ -3,9 +3,12 @@ src/config/*.env *.env # compiled output -/lib +/dist /node_modules +#migration +migrate.json +.migrate # Logs logs *.log diff --git a/package.json b/package.json index c51c1a32..e4368034 100644 --- a/package.json +++ b/package.json @@ -13,9 +13,9 @@ "lint": "eslint **/*.ts", "lint-fix": "eslint --fix **/*.ts", "format": "prettier --write src/**/*.ts", - "migrate:create": "migrate create --template-file ./src/migrations/utils/template.ts --migrations-dir=\"./src/migrations/db\" --compiler=\"ts:./src/migrations/utils/ts-compiler.js\"", - "migrate:up": "migrate --migrations-dir=\"./src/migrations/db\" --compiler=\"ts:./src/migrations/utils/ts-compiler.js\" up", - "migrate:down": "migrate --migrations-dir=\"./src/migrations/db\" --compiler=\"ts:./src/migrations/utils/ts-compiler.js\" down" + "migrate:create": "migrate create --template-file ./src/migrations/utils/template.ts --migrations-dir=\"./src/migrations/db\"", + "migrate:up": "migrate --migrations-dir=\"./dist/migrations/db\" up", + "migrate:down": "migrate --migrations-dir=\"./dist/migrations/db\" down" }, "repository": { "type": "git", @@ -67,4 +67,4 @@ "ts-node": "^10.9.1", "typescript": "^5.0.4" } -} +} \ No newline at end of file diff --git a/src/migrations/db/1695198084420-add-isgeneratedbyweebhook-to-rawinfo-schema.ts b/src/migrations/db/1695210587863-add-isgeneratedbyweebhook-to-rawinfo-schema.ts similarity index 99% rename from src/migrations/db/1695198084420-add-isgeneratedbyweebhook-to-rawinfo-schema.ts rename to src/migrations/db/1695210587863-add-isgeneratedbyweebhook-to-rawinfo-schema.ts index 8f980fe0..f54c567e 100644 --- a/src/migrations/db/1695198084420-add-isgeneratedbyweebhook-to-rawinfo-schema.ts +++ b/src/migrations/db/1695210587863-add-isgeneratedbyweebhook-to-rawinfo-schema.ts @@ -33,4 +33,6 @@ export const up = async () => { export const down = async () => { // TODO: Implement rollback logic if needed -}; \ No newline at end of file +}; + + diff --git a/src/migrations/utils/webhookLogic.ts b/src/migrations/utils/webhookLogic.ts index 0e8e1784..0182b1f2 100644 --- a/src/migrations/utils/webhookLogic.ts +++ b/src/migrations/utils/webhookLogic.ts @@ -20,10 +20,6 @@ async function fetchMessagesBetweenOldestAndNewest( ) { try { let allMessages: Message[] = []; - logger.info( - { guild_id: connection.name, channel_id: channel.id }, - 'Fetching channel messages is running' - ); const options: FetchOptions = { limit: 100 }; options.after = oldestRawInfo.messageId; let fetchedMessages = await channel.messages.fetch(options); @@ -42,16 +38,10 @@ async function fetchMessagesBetweenOldestAndNewest( 'Fetching channel messages failed' ); } - logger.info( - { guild_id: connection.name, channel_id: channel.id }, - 'Fetching channel messages is done' - ); } async function migrateIsGeneratedByWebhook(connection: Connection, channel: TextChannel) { try { - logger.info({ guild_id: connection.name, channel_id: channel.id }, 'Migration for isGeneratedByWebhook is running'); - // Fetch oldest rawInfo from DB const oldestChannelRawInfo = await rawInfoService.getOldestRawInfo(connection, { channelId: channel?.id, @@ -159,8 +149,6 @@ async function migrateIsGeneratedByWebhook(connection: Connection, channel: Text } } - logger.info({ guild_id: connection.name, channel_id: channel.id }, 'Migration for isGeneratedByWebhook is done'); - } catch (err) { logger.error({ guild_id: connection.name, channel_id: channel.id, err }, 'Migration for isGeneratedByWebhook failed'); } @@ -174,7 +162,6 @@ async function migrateIsGeneratedByWebhook(connection: Connection, channel: Text * @param {Snowflake} guildId - The identifier of the guild to extract information from. */ async function runRawInfoMigration(connection: Connection, client: Client, guildId: Snowflake) { - logger.info({ guild_id: guildId }, 'Migration is running'); try { const guild = await client.guilds.fetch(guildId); const channels = await channelService.getChannels(connection, {}); @@ -188,7 +175,6 @@ async function runRawInfoMigration(connection: Connection, client: Client, guild } catch (err) { logger.error({ guild_id: guildId, err }, 'Migration is failed'); } - logger.info({ guild_id: guildId }, 'Migration is done'); } export default runRawInfoMigration; \ No newline at end of file diff --git a/tsconfig.json b/tsconfig.json index 3b968e27..c06fc9cf 100644 --- a/tsconfig.json +++ b/tsconfig.json @@ -6,8 +6,8 @@ "emitDecoratorMetadata": true, "experimentalDecorators": true, "target": "ES2017", - "sourceMap": true, - "outDir": "./lib", + "sourceMap": false, + "outDir": "./dist", "baseUrl": "./", "incremental": true, "strict": true, @@ -26,7 +26,7 @@ }, "exclude": [ "./coverage", - "./lib", + "./dist", "__tests__", "jest.config.js" ],