-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
c8a040b
commit a0e7820
Showing
2 changed files
with
18 additions
and
10 deletions.
There are no files selected for viewing
21 changes: 16 additions & 5 deletions
21
src/migrations/db/1706110397838-add-isbot-to-guildmember-schema.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,14 +1,25 @@ | ||
import { connectDB } from '../../database'; | ||
import 'dotenv/config'; | ||
import { connectDB } from '../../database'; | ||
import isBotLogic from '../utils/isBotLogic'; | ||
import { DatabaseManager } from '@togethercrew.dev/db'; | ||
import { Client, GatewayIntentBits } from 'discord.js'; | ||
import config from '../../config'; | ||
const { Guilds, GuildMembers, GuildMessages, GuildPresences, DirectMessages } = GatewayIntentBits; | ||
|
||
|
||
export const up = async () => { | ||
await connectDB(); | ||
const connection = await DatabaseManager.getInstance().getTenantDb("681946187490000803"); | ||
const client = new Client({ | ||
intents: [Guilds, GuildMembers, GuildMessages, GuildPresences, DirectMessages], | ||
}); | ||
|
||
await connection.createCollection('my_collection'); | ||
await client.login(config.discord.botToken); | ||
await connectDB(); | ||
const connection1 = await DatabaseManager.getInstance().getTenantDb('1023936505321881641'); | ||
const connection2 = await DatabaseManager.getInstance().getTenantDb('949124961187016764'); | ||
await isBotLogic(connection1, client, '1023936505321881641'); | ||
await isBotLogic(connection2, client, '949124961187016764'); | ||
}; | ||
|
||
export const down = async () => { | ||
await connectDB(); | ||
// TODO: Implement rollback logic if needed | ||
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters