mirror of
https://github.com/spacebarchat/server.git
synced 2026-05-24 08:05:29 +00:00
Fix schemas...
This commit is contained in:
Generated
+42
-42
@@ -50,50 +50,50 @@
|
||||
<option name="hideEmptyMiddlePackages" value="true" />
|
||||
<option name="showLibraryContents" value="true" />
|
||||
</component>
|
||||
<component name="PropertiesComponent"><![CDATA[{
|
||||
"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"
|
||||
<component name="PropertiesComponent">{
|
||||
"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"
|
||||
]
|
||||
}
|
||||
}]]></component>
|
||||
}</component>
|
||||
<component name="RecentsManager">
|
||||
<key name="CopyFile.RECENT_KEYS">
|
||||
<recent name="$PROJECT_DIR$/src/util/migration/postgres" />
|
||||
@@ -125,8 +125,6 @@
|
||||
<entry key="Start CDN" value="STOPPED" />
|
||||
<entry key="Start Gateway" value="STOPPED" />
|
||||
<entry key="Start bundle" value="STOPPED" />
|
||||
<entry key="build" value="STOPPED" />
|
||||
<entry key="build:src" value="STOPPED" />
|
||||
</map>
|
||||
</value>
|
||||
</entry>
|
||||
@@ -177,6 +175,8 @@
|
||||
<workItem from="1765142585081" duration="16912000" />
|
||||
<workItem from="1765849511651" duration="7921000" />
|
||||
<workItem from="1765861713706" duration="18045000" />
|
||||
<workItem from="1766715967914" duration="40995000" />
|
||||
<workItem from="1766823293461" duration="11580000" />
|
||||
</task>
|
||||
<servers />
|
||||
</component>
|
||||
|
||||
Binary file not shown.
Binary file not shown.
+32
-24
@@ -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 {
|
||||
|
||||
Reference in New Issue
Block a user