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