🐛 fix migration + autojoin
This commit is contained in:
parent
ec0e2a804c
commit
4e6ffcbc4f
@ -8,7 +8,7 @@ export async function initInstance() {
|
|||||||
// TODO: check if any current user is not part of autoJoinGuilds
|
// TODO: check if any current user is not part of autoJoinGuilds
|
||||||
const { autoJoin } = Config.get().guild;
|
const { autoJoin } = Config.get().guild;
|
||||||
|
|
||||||
if (autoJoin.enabled && autoJoin.guilds?.length) {
|
if (autoJoin.enabled && !autoJoin.guilds?.length) {
|
||||||
let guild = await Guild.findOne({});
|
let guild = await Guild.findOne({});
|
||||||
if (!guild) guild = await Guild.createGuild({});
|
if (!guild) guild = await Guild.createGuild({});
|
||||||
|
|
||||||
|
@ -8,6 +8,7 @@ const {
|
|||||||
Attachment,
|
Attachment,
|
||||||
Ban,
|
Ban,
|
||||||
Channel,
|
Channel,
|
||||||
|
ConfigEntity,
|
||||||
ConnectedAccount,
|
ConnectedAccount,
|
||||||
Emoji,
|
Emoji,
|
||||||
Guild,
|
Guild,
|
||||||
@ -32,6 +33,7 @@ async function main() {
|
|||||||
|
|
||||||
// manually arrange them because of foreign keys
|
// manually arrange them because of foreign keys
|
||||||
const entities = [
|
const entities = [
|
||||||
|
ConfigEntity,
|
||||||
User,
|
User,
|
||||||
Guild,
|
Guild,
|
||||||
Channel,
|
Channel,
|
||||||
@ -61,12 +63,13 @@ async function main() {
|
|||||||
const isSqlite = type.includes("sqlite");
|
const isSqlite = type.includes("sqlite");
|
||||||
|
|
||||||
// @ts-ignore
|
// @ts-ignore
|
||||||
const oldDB = await createConnection({
|
const newDB = await createConnection({
|
||||||
type,
|
type,
|
||||||
url: isSqlite ? undefined : process.env.TO,
|
url: isSqlite ? undefined : process.env.TO,
|
||||||
database: isSqlite ? process.env.TO : undefined,
|
database: isSqlite ? process.env.TO : undefined,
|
||||||
entities,
|
entities,
|
||||||
name: "old",
|
name: "new",
|
||||||
|
synchronize: true,
|
||||||
});
|
});
|
||||||
let i = 0;
|
let i = 0;
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user