diff --git a/.idea/workspace.xml b/.idea/workspace.xml
index 25a9866f8..741d94a61 100644
--- a/.idea/workspace.xml
+++ b/.idea/workspace.xml
@@ -50,50 +50,50 @@
- {
+ "keyToString": {
+ "NIXITCH_NIXPKGS_CONFIG": "/etc/nix/nixpkgs-config.nix",
+ "NIXITCH_NIX_CONF_DIR": "",
+ "NIXITCH_NIX_OTHER_STORES": "",
+ "NIXITCH_NIX_PATH": "/home/Rory/.nix-defexpr/channels:nixpkgs=/nix/store/wb6agba4kfsxpbnb5hzlq58vkjzvbsk6-source",
+ "NIXITCH_NIX_PROFILES": "/run/current-system/sw /nix/var/nix/profiles/default /etc/profiles/per-user/Rory /home/Rory/.local/state/nix/profile /nix/profile /home/Rory/.nix-profile",
+ "NIXITCH_NIX_REMOTE": "",
+ "NIXITCH_NIX_USER_PROFILE_DIR": "/nix/var/nix/profiles/per-user/Rory",
+ "Node.js.Server.ts.executor": "Debug",
+ "RunOnceActivity.ShowReadmeOnStart": "true",
+ "RunOnceActivity.git.unshallow": "true",
+ "git-widget-placeholder": "master",
+ "javascript.nodejs.core.library.configured.version": "24.11.1",
+ "javascript.nodejs.core.library.typings.version": "24.10.4",
+ "last_opened_file_path": "/home/Rory/git/spacebar/server-master/src/util/migration/postgres",
+ "node.js.detected.package.eslint": "true",
+ "node.js.detected.package.standard": "true",
+ "node.js.selected.package.eslint": "(autodetect)",
+ "node.js.selected.package.standard": "",
+ "node.js.selected.package.tslint": "(autodetect)",
+ "nodejs_interpreter_path": "node",
+ "nodejs_package_manager_path": "npm",
+ "npm.Start API.executor": "Run",
+ "npm.Start CDN.executor": "Run",
+ "npm.Start Gateway.executor": "Run",
+ "npm.build.executor": "Run",
+ "npm.build:src.executor": "Run",
+ "npm.start.executor": "Debug",
+ "prettierjs.PrettierConfiguration.Package": "/home/Rory/git/spacebar/server-master/node_modules/prettier",
+ "settings.editor.selected.configurable": "com.github.copilot.settings.customInstructions.CopilotInstructionsConfigurable",
+ "ts.external.directory.path": "/home/Rory/git/spacebar/server-master/node_modules/typescript/lib"
},
- "keyToStringList": {
- "DatabaseDriversLRU": [
- "postgresql"
+ "keyToStringList": {
+ "DatabaseDriversLRU": [
+ "postgresql"
],
- "GitStage.ChangesTree.GroupingKeys": [
- "directory",
- "module",
- "repository"
+ "GitStage.ChangesTree.GroupingKeys": [
+ "directory",
+ "module",
+ "repository"
]
}
-}]]>
+}
@@ -125,8 +125,6 @@
-
-
@@ -177,6 +175,8 @@
+
+
diff --git a/assets/openapi.json b/assets/openapi.json
index edfae315d..319060a5e 100644
Binary files a/assets/openapi.json and b/assets/openapi.json differ
diff --git a/assets/schemas.json b/assets/schemas.json
index f691b79e8..8cb3da25d 100644
Binary files a/assets/schemas.json and b/assets/schemas.json differ
diff --git a/src/util/util/Database.ts b/src/util/util/Database.ts
index 7a0d084f0..95ced311d 100644
--- a/src/util/util/Database.ts
+++ b/src/util/util/Database.ts
@@ -29,43 +29,51 @@ import fs from "fs";
export let dbConnection: DataSource | undefined;
+let isHeadlessProcess = false;
// For typeorm cli
if (!process.env) {
+ isHeadlessProcess = true;
config({ quiet: true });
}
+if (process.argv[1]?.endsWith("scripts/openapi.js")) isHeadlessProcess = true;
const dbConnectionString = process.env.DATABASE || path.join(process.cwd(), "database.db");
export const DatabaseType = dbConnectionString.includes("://") ? dbConnectionString.split(":")[0]?.replace("+srv", "") : "sqlite";
const isSqlite = DatabaseType.includes("sqlite");
-let hasWarnedSqlite = false;
-if (isSqlite && !hasWarnedSqlite) {
- hasWarnedSqlite = true;
- console.log(`[Database] ${red(`You are running sqlite! Please keep in mind that we recommend setting up a dedicated database!`)}`);
- try {
- const _ = require("sqlite3");
- } catch (e) {
- console.log(`[Database] ${red(`Failed to load sqlite3 package. Please install it with 'npm install --no-save sqlite3', or switch to a real database like Postgres.`)}`);
- process.exit(1);
+// For openapi.js...
+if (!isHeadlessProcess) {
+ let hasWarnedSqlite = false;
+ if (isSqlite && !hasWarnedSqlite) {
+ hasWarnedSqlite = true;
+ console.log(`[Database] ${red(`You are running sqlite! Please keep in mind that we recommend setting up a dedicated database!`)}`);
+ try {
+ const _ = require("sqlite3");
+ } catch (e) {
+ console.log(`[Database] ${red(`Failed to load sqlite3 package. Please install it with 'npm install --no-save sqlite3', or switch to a real database like Postgres.`)}`);
+ process.exit(1);
+ }
}
}
-export const DataSourceOptions = new DataSource({
- // eslint-disable-next-line @typescript-eslint/ban-ts-comment
- //@ts-ignore type 'string' is not 'sqlite' | 'postgres' | etc etc
- type: DatabaseType,
- charset: "utf8mb4",
- url: isSqlite ? undefined : dbConnectionString,
- database: isSqlite ? dbConnectionString : undefined,
- entities: [path.join(__dirname, "..", "entities", "*.js")],
- synchronize: !!process.env.DB_SYNC,
- logging: !!process.env.DB_LOGGING,
- bigNumberStrings: false,
- supportBigNumbers: true,
- name: "default",
- migrations: [path.join(__dirname, "..", "migration", DatabaseType, "*.js")],
-});
+export const DataSourceOptions = isHeadlessProcess
+ ? (undefined as unknown as DataSource)
+ : new DataSource({
+ // eslint-disable-next-line @typescript-eslint/ban-ts-comment
+ //@ts-ignore type 'string' is not 'sqlite' | 'postgres' | etc etc
+ type: DatabaseType,
+ charset: "utf8mb4",
+ url: isSqlite ? undefined : dbConnectionString,
+ database: isSqlite ? dbConnectionString : undefined,
+ entities: [path.join(__dirname, "..", "entities", "*.js")],
+ synchronize: !!process.env.DB_SYNC,
+ logging: !!process.env.DB_LOGGING,
+ bigNumberStrings: false,
+ supportBigNumbers: true,
+ name: "default",
+ migrations: [path.join(__dirname, "..", "migration", DatabaseType, "*.js")],
+ });
// Gets the existing database connection
export function getDatabase(): DataSource | null {