Server/scripts/syncronise.js

38 lines
1.1 KiB
JavaScript
Raw Permalink Normal View History

2024-09-26 04:01:06 -07:00
/*
ValkyrieChat: A re-implementation and extension of the Discord.com backend.
Copyright (C) 2024 ValkyrieChat
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
*/
2024-09-05 00:21:51 -07:00
/*
"Why?" I hear you say! "Why don't you just use `typeorm schema:sync`?"!
Because we have a lot ( like, 30? ) cyclic imports in the entities folder,
which breaks that command entirely!
however!
it doesn't break the below, thus we're left with this :sob:
*/
require("module-alias/register");
require("dotenv").config();
const { initDatabase } = require("..");
(async () => {
const db = await initDatabase();
console.log("synchronising");
await db.synchronize();
console.log("done");
db.destroy();
})();