From be71b668217bbdcc99f597fe5c50e8476ea3512f Mon Sep 17 00:00:00 2001 From: Adolphe Kifungo <45813955+adkif@users.noreply.github.com> Date: Wed, 4 Oct 2023 21:49:19 +0200 Subject: [PATCH 01/30] feat: add better-sqlite-3 dependencie --- packages/desktop-libs/package.json | 1 + yarn.lock | 22 +++++++++++++++++++++- 2 files changed, 22 insertions(+), 1 deletion(-) diff --git a/packages/desktop-libs/package.json b/packages/desktop-libs/package.json index 034bad8780f..c84e8cc32c2 100644 --- a/packages/desktop-libs/package.json +++ b/packages/desktop-libs/package.json @@ -30,6 +30,7 @@ "@electron/remote": "^2.0.8", "@gauzy/desktop-window": "^0.1.0", "active-win": "^8.1.0", + "better-sqlite3": "^8.7.0", "electron": "20.2.0", "electron-store": "^8.1.0", "electron-util": "^0.17.2", diff --git a/yarn.lock b/yarn.lock index aa1c619fe5c..0b5b88dceb3 100644 --- a/yarn.lock +++ b/yarn.lock @@ -10020,6 +10020,14 @@ before-after-hook@^2.2.0: resolved "https://registry.yarnpkg.com/before-after-hook/-/before-after-hook-2.2.3.tgz#c51e809c81a4e354084422b9b26bad88249c517c" integrity sha512-NzUnlZexiaH/46WDhANlyR2bXRopNg4F/zuSA3OpZnllCUgRaOF2znDioDWrmbNVsuZk6l9pMquQB38cfBZwkQ== +better-sqlite3@^8.7.0: + version "8.7.0" + resolved "https://registry.yarnpkg.com/better-sqlite3/-/better-sqlite3-8.7.0.tgz#bcc341856187b1d110a8a47234fa89c48c8ef538" + integrity sha512-99jZU4le+f3G6aIl6PmmV0cxUIWqKieHxsiF7G34CVFiE+/UabpYqkU0NJIkY/96mQKikHeBjtR27vFfs5JpEw== + dependencies: + bindings "^1.5.0" + prebuild-install "^7.1.1" + big-integer@^1.6.17: version "1.6.51" resolved "https://registry.yarnpkg.com/big-integer/-/big-integer-1.6.51.tgz#0df92a5d9880560d3ff2d5fd20245c889d130686" @@ -10079,6 +10087,13 @@ binary@~0.3.0: buffers "~0.1.1" chainsaw "~0.1.0" +bindings@^1.5.0: + version "1.5.0" + resolved "https://registry.yarnpkg.com/bindings/-/bindings-1.5.0.tgz#10353c9e945334bc0511a6d90b38fbc7c9c504df" + integrity sha512-p2q/t/mhvuOj/UeLlV6566GD/guowlr0hHxClI0W9m7MWYkL1F0hLo+0Aexs9HSPCtR1SXQ0TD3MMKrXZajbiQ== + dependencies: + file-uri-to-path "1.0.0" + bl@^4.0.2, bl@^4.0.3, bl@^4.1.0: version "4.1.0" resolved "https://registry.yarnpkg.com/bl/-/bl-4.1.0.tgz#451535264182bec2fbbc83a62ab98cf11d9f7b3a" @@ -17019,6 +17034,11 @@ file-type@^3.3.0: resolved "https://registry.yarnpkg.com/file-type/-/file-type-3.9.0.tgz#257a078384d1db8087bc449d107d52a52672b9e9" integrity sha512-RLoqTXE8/vPmMuTI88DAzhMYC99I8BWv7zYP4A1puo5HIjEJ5EX48ighy4ZyKMG9EDXxBgW6e++cn7d1xuFghA== +file-uri-to-path@1.0.0: + version "1.0.0" + resolved "https://registry.yarnpkg.com/file-uri-to-path/-/file-uri-to-path-1.0.0.tgz#553a7b8446ff6f684359c445f1e37a05dacc33dd" + integrity sha512-0Zt+s3L7Vf1biwWZ29aARiVYLx7iMGnEUl9x33fbB/j3jR81u/O2LbqK+Bm1CDSNDKVtJ/YjwY7TUd5SkeLQLw== + file-uri-to-path@2: version "2.0.0" resolved "https://registry.yarnpkg.com/file-uri-to-path/-/file-uri-to-path-2.0.0.tgz#7b415aeba227d575851e0a5b0c640d7656403fba" @@ -29142,7 +29162,7 @@ preact@^10.0.5: resolved "https://registry.yarnpkg.com/preact/-/preact-10.13.1.tgz#d220bd8771b8fa197680d4917f3cefc5eed88720" integrity sha512-KyoXVDU5OqTpG9LXlB3+y639JAGzl8JSBXLn1J9HTSB3gbKcuInga7bZnXLlxmK94ntTs1EFeZp0lrja2AuBYQ== -prebuild-install@7.1.1: +prebuild-install@7.1.1, prebuild-install@^7.1.1: version "7.1.1" resolved "https://registry.yarnpkg.com/prebuild-install/-/prebuild-install-7.1.1.tgz#de97d5b34a70a0c81334fd24641f2a1702352e45" integrity sha512-jAXscXWMcCK8GgCoHOfIr0ODh5ai8mj63L2nWrjuAgXE6tDyYGnx4/8o/rCgU+B4JSyZBKbeZqzhtwtC3ovxjw== From 01e6e62f1f4d05c0897ee5a3584a17d7a8551d02 Mon Sep 17 00:00:00 2001 From: Adolphe Kifungo <45813955+adkif@users.noreply.github.com> Date: Wed, 4 Oct 2023 21:53:25 +0200 Subject: [PATCH 02/30] feat: create better sqlite provider class --- .../databases/better-sqlite-provider.ts | 44 +++++++++++++++++++ .../src/lib/offline/databases/index.ts | 1 + 2 files changed, 45 insertions(+) create mode 100644 packages/desktop-libs/src/lib/offline/databases/better-sqlite-provider.ts diff --git a/packages/desktop-libs/src/lib/offline/databases/better-sqlite-provider.ts b/packages/desktop-libs/src/lib/offline/databases/better-sqlite-provider.ts new file mode 100644 index 00000000000..8be450e64d2 --- /dev/null +++ b/packages/desktop-libs/src/lib/offline/databases/better-sqlite-provider.ts @@ -0,0 +1,44 @@ +import { IServerLessProvider } from '../../interfaces'; +import { Knex } from 'knex'; +import path from 'path'; +import { app } from 'electron'; + +export class BetterSqliteProvider implements IServerLessProvider { + private static _instance: IServerLessProvider; + private readonly _connection: Knex; + + private constructor() { + this._connection = require('knex')(this.config); + console.log('[provider]: ', 'Better SQLite connected...'); + } + + public static get instance(): IServerLessProvider { + if (!this._instance) { + this._instance = new BetterSqliteProvider(); + } + return this._instance; + } + + public get connection(): Knex { + return this._connection; + } + + public get config(): Knex.Config { + return { + client: 'better-sqlite3', + connection: { + filename: path.resolve( + app?.getPath('userData') || __dirname, + 'gauzy.better-sqlite3' + ), + timezone: 'utc', + }, + migrations: { + directory: __dirname + '/migrations', + }, + useNullAsDefault: true, + debug: false, + asyncStackTraces: true, + }; + } +} diff --git a/packages/desktop-libs/src/lib/offline/databases/index.ts b/packages/desktop-libs/src/lib/offline/databases/index.ts index 67e99b7d720..6bc44328547 100644 --- a/packages/desktop-libs/src/lib/offline/databases/index.ts +++ b/packages/desktop-libs/src/lib/offline/databases/index.ts @@ -2,3 +2,4 @@ export * from './mysql-provider'; export * from './postgres-provider'; export * from './provider-factory'; export * from './sqlite-provider'; +export * from './better-sqlite-provider'; From 3ff0ebb899e1e8d9b3a3e630ed7dbdafec821950 Mon Sep 17 00:00:00 2001 From: Adolphe Kifungo <45813955+adkif@users.noreply.github.com> Date: Wed, 4 Oct 2023 21:54:19 +0200 Subject: [PATCH 03/30] feat: set better sqlite as default provider --- .../src/lib/offline/databases/provider-factory.ts | 15 ++++++++++++--- 1 file changed, 12 insertions(+), 3 deletions(-) diff --git a/packages/desktop-libs/src/lib/offline/databases/provider-factory.ts b/packages/desktop-libs/src/lib/offline/databases/provider-factory.ts index f90f6aad9fe..2b60244d1f0 100644 --- a/packages/desktop-libs/src/lib/offline/databases/provider-factory.ts +++ b/packages/desktop-libs/src/lib/offline/databases/provider-factory.ts @@ -6,6 +6,7 @@ import { PostgresProvider } from './postgres-provider'; import { MysqlProvider } from './mysql-provider'; import { LocalStore } from '../../desktop-store'; import { AppError } from '../../error-handler'; +import { BetterSqliteProvider } from './better-sqlite-provider'; export class ProviderFactory implements IDatabaseProvider { private _dbContext: DatabaseProviderContext; @@ -34,15 +35,23 @@ export class ProviderFactory implements IDatabaseProvider { case 'mysql': this._dbContext.provider = MysqlProvider.instance; break; - default: + case 'sqlite': this._dbContext.provider = SqliteProvider.instance; break; + default: + this._dbContext.provider = BetterSqliteProvider.instance; + break; } } public get dialect(): string { - const cfg = LocalStore.getApplicationConfig().config; - return cfg && cfg.db ? cfg.db : 'sqlite'; + let cfg = LocalStore.getApplicationConfig().config; + if (!cfg?.db) { + // Set default database + LocalStore.updateAdditionalSetting({ db: 'better-sqlite' }); + cfg = LocalStore.getApplicationConfig().config; + } + return cfg?.db; } public async migrate(): Promise { From 93e35d31a0322cf4a17eaaffe222f3ad2e30aa92 Mon Sep 17 00:00:00 2001 From: Adolphe Kifungo <45813955+adkif@users.noreply.github.com> Date: Wed, 4 Oct 2023 21:55:51 +0200 Subject: [PATCH 04/30] feat: add better sqlite to settings --- .../src/lib/settings/settings.component.html | 4 ++-- .../desktop-ui-lib/src/lib/settings/settings.component.ts | 7 +++++-- .../desktop-ui-lib/src/lib/settings/settings.module.ts | 4 +++- .../src/lib/time-tracker/task-render/task-render.module.ts | 3 ++- 4 files changed, 12 insertions(+), 6 deletions(-) diff --git a/packages/desktop-ui-lib/src/lib/settings/settings.component.html b/packages/desktop-ui-lib/src/lib/settings/settings.component.html index 52ed631fb52..0bd1522da37 100644 --- a/packages/desktop-ui-lib/src/lib/settings/settings.component.html +++ b/packages/desktop-ui-lib/src/lib/settings/settings.component.html @@ -1178,7 +1178,7 @@

" [value]="item" > - {{ item }} + {{ item | replace: '-' : ' ' | titlecase }} @@ -1571,7 +1571,7 @@

- +

{{ 'TIMER_TRACKER.SETTINGS.DB_HOST' | translate }}

diff --git a/packages/desktop-ui-lib/src/lib/settings/settings.component.ts b/packages/desktop-ui-lib/src/lib/settings/settings.component.ts index bb9bda33aee..c28f4ccdf35 100644 --- a/packages/desktop-ui-lib/src/lib/settings/settings.component.ts +++ b/packages/desktop-ui-lib/src/lib/settings/settings.component.ts @@ -354,7 +354,7 @@ export class SettingsComponent implements OnInit, AfterViewInit { screenshotNotification = null; config = { /* Default Selected dialect */ - db: 'sqlite', + db: 'better-sqlite', /* Default Mysql config */ mysql: { dbHost: '127.0.0.1', @@ -404,7 +404,7 @@ export class SettingsComponent implements OnInit, AfterViewInit { ? [this.serverTypes.custom, this.serverTypes.live] : [this.serverTypes.integrated, this.serverTypes.custom, this.serverTypes.live]; - driverOptions = ['sqlite', 'postgres', ...(this.isDesktopTimer ? ['mysql'] : [])]; + driverOptions = ['better-sqlite', 'sqlite', 'postgres', ...(this.isDesktopTimer ? ['mysql'] : [])]; muted: boolean; delayOptions: number[] = [0.5, 1, 3, 24]; @@ -1034,6 +1034,9 @@ export class SettingsComponent implements OnInit, AfterViewInit { case 'mysql': this.config.db = 'mysql'; break; + case 'better-sqlite': + this.config.db = 'better-sqlite'; + break; default: break; } diff --git a/packages/desktop-ui-lib/src/lib/settings/settings.module.ts b/packages/desktop-ui-lib/src/lib/settings/settings.module.ts index 8e34c33b117..c18d207d8a3 100644 --- a/packages/desktop-ui-lib/src/lib/settings/settings.module.ts +++ b/packages/desktop-ui-lib/src/lib/settings/settings.module.ts @@ -28,6 +28,7 @@ import { LanguageModule } from '../language/language.module'; import { TranslateModule } from '@ngx-translate/core'; import { Store } from '../services'; import { LanguageSelectorService } from '../language/language-selector.service'; +import {TaskRenderModule} from "../time-tracker/task-render"; @NgModule({ declarations: [SettingsComponent], @@ -52,7 +53,8 @@ import { LanguageSelectorService } from '../language/language-selector.service'; NbSpinnerModule, DesktopDirectiveModule, LanguageModule, - TranslateModule + TranslateModule, + TaskRenderModule ], providers: [ NbToastrService, diff --git a/packages/desktop-ui-lib/src/lib/time-tracker/task-render/task-render.module.ts b/packages/desktop-ui-lib/src/lib/time-tracker/task-render/task-render.module.ts index 4f764edd9b7..921e5824b97 100644 --- a/packages/desktop-ui-lib/src/lib/time-tracker/task-render/task-render.module.ts +++ b/packages/desktop-ui-lib/src/lib/time-tracker/task-render/task-render.module.ts @@ -52,7 +52,8 @@ import { TaskDetailComponent } from './task-detail/task-detail.component'; TranslateModule, NbPopoverModule, NbBadgeModule, - NbCardModule + NbCardModule, ], + exports: [ReplacePipe], }) export class TaskRenderModule {} From 75240158ddbf1bb4f1685e6b4bb9d80c114c4fc9 Mon Sep 17 00:00:00 2001 From: Adolphe Kifungo <45813955+adkif@users.noreply.github.com> Date: Wed, 4 Oct 2023 21:57:00 +0200 Subject: [PATCH 05/30] feat: swap sqlite by better sqlite in setup --- packages/desktop-ui-lib/src/lib/setup/setup.component.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/packages/desktop-ui-lib/src/lib/setup/setup.component.ts b/packages/desktop-ui-lib/src/lib/setup/setup.component.ts index a0d0fd8f825..690f5c06cdf 100644 --- a/packages/desktop-ui-lib/src/lib/setup/setup.component.ts +++ b/packages/desktop-ui-lib/src/lib/setup/setup.component.ts @@ -278,7 +278,7 @@ export class SetupComponent implements OnInit { if (this.databaseDriver.sqlite) { return { - db: 'sqlite', + db: 'better-sqlite', }; } From 078d46ad21a26bf045620b93d85048e143f1df5a Mon Sep 17 00:00:00 2001 From: Adolphe Kifungo <45813955+adkif@users.noreply.github.com> Date: Thu, 5 Oct 2023 11:13:35 +0200 Subject: [PATCH 06/30] feat: add check method to db provider --- .../lib/offline/databases/provider-factory.ts | 41 +++++++++++++++++++ 1 file changed, 41 insertions(+) diff --git a/packages/desktop-libs/src/lib/offline/databases/provider-factory.ts b/packages/desktop-libs/src/lib/offline/databases/provider-factory.ts index 2b60244d1f0..1ae1d2c0d89 100644 --- a/packages/desktop-libs/src/lib/offline/databases/provider-factory.ts +++ b/packages/desktop-libs/src/lib/offline/databases/provider-factory.ts @@ -93,4 +93,45 @@ export class ProviderFactory implements IDatabaseProvider { throw new AppError('PRKILL', error); } } + + public async check(arg: any): Promise { + const dialect = arg.db; + const connection = { + host: arg[dialect]?.dbHost, + user: arg[dialect]?.dbUsername, + password: arg[dialect]?.dbPassword, + database: arg[dialect]?.dbName, + port: arg[dialect]?.dbPort, + }; + let databaseOptions: Knex.Config = {}; + let driver = ''; + switch (dialect) { + case 'postgres': + driver = 'PostgresSQL'; + databaseOptions = { + client: 'pg', + connection, + }; + break; + case 'mysql': + driver = 'MySQL'; + databaseOptions = { + client: 'mysql', + connection, + }; + break; + case 'sqlite': + driver = 'SQLite'; + databaseOptions = SqliteProvider.instance.config; + break; + default: + driver = 'Better SQLite 3'; + databaseOptions = BetterSqliteProvider.instance.config; + break; + } + const instance = require('knex')(databaseOptions); + await instance.raw('SELECT 1'); + await instance.destroy(); + return driver; + } } From 11f8f5ee749b55eaee3e90da9f5122573cefc145 Mon Sep 17 00:00:00 2001 From: Adolphe Kifungo <45813955+adkif@users.noreply.github.com> Date: Thu, 5 Oct 2023 11:17:13 +0200 Subject: [PATCH 07/30] feat: mark "journal_mode = WAL" for better sqlite 3 --- apps/desktop-timer/src/index.ts | 45 +++++---------------------------- 1 file changed, 6 insertions(+), 39 deletions(-) diff --git a/apps/desktop-timer/src/index.ts b/apps/desktop-timer/src/index.ts index 531a200cb64..1f120b4f003 100644 --- a/apps/desktop-timer/src/index.ts +++ b/apps/desktop-timer/src/index.ts @@ -392,7 +392,7 @@ app.on('ready', async () => { if (!settings) { launchAtStartup(true, false); } - if (provider.dialect === 'sqlite') { + if (provider.dialect === 'sqlite' || provider.dialect === 'better-sqlite') { try { const res = await knex.raw(`pragma journal_mode = WAL;`); console.log(res); @@ -600,46 +600,13 @@ ipcMain.on('restart_and_update', () => { ipcMain.on('check_database_connection', async (event, arg) => { try { - const provider = arg.db; - let databaseOptions; - if (provider === 'postgres' || provider === 'mysql') { - databaseOptions = { - client: provider === 'postgres' ? 'pg' : 'mysql', - connection: { - host: arg[provider].dbHost, - user: arg[provider].dbUsername, - password: arg[provider].dbPassword, - database: arg[provider].dbName, - port: arg[provider].dbPort, - }, - }; - } else { - databaseOptions = { - client: 'sqlite3', - connection: { - filename: sqlite3filename, - }, - }; - } - const dbConn = require('knex')(databaseOptions); - await dbConn.raw('select 1+1 as result'); + const driver = await provider.check(arg); event.sender.send('database_status', { status: true, - message: - provider === 'postgres' - ? TranslateService.instant( - 'TIMER_TRACKER.DIALOG.CONNECTION_DRIVER', - { driver: 'PostgresSQL' } - ) - : provider === 'mysql' - ? TranslateService.instant( - 'TIMER_TRACKER.DIALOG.CONNECTION_DRIVER', - { driver: 'MySQL' } - ) - : TranslateService.instant( - 'TIMER_TRACKER.DIALOG.CONNECTION_DRIVER', - { driver: 'SQLite' } - ), + message: TranslateService.instant( + 'TIMER_TRACKER.DIALOG.CONNECTION_DRIVER', + { driver } + ), }); } catch (error) { event.sender.send('database_status', { From 2f68819eb37082fc64a77bca297a9aabef159718 Mon Sep 17 00:00:00 2001 From: Adolphe Kifungo <45813955+adkif@users.noreply.github.com> Date: Thu, 5 Oct 2023 14:18:04 +0200 Subject: [PATCH 08/30] feat: add better sqlite 3 driver for typeORM to @gauzy/core --- packages/core/package.json | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/packages/core/package.json b/packages/core/package.json index e30e7c85a9f..2a3350aa948 100644 --- a/packages/core/package.json +++ b/packages/core/package.json @@ -46,10 +46,10 @@ "@gauzy/config": "^0.1.0", "@gauzy/contracts": "^0.1.0", "@gauzy/integration-ai": "^0.1.0", - "@gauzy/integration-hubstaff": "^0.1.0", - "@gauzy/integration-upwork": "^0.1.0", "@gauzy/integration-github": "^0.1.0", + "@gauzy/integration-hubstaff": "^0.1.0", "@gauzy/integration-jira": "^0.1.0", + "@gauzy/integration-upwork": "^0.1.0", "@gauzy/plugin": "^0.1.0", "@godaddy/terminus": "^4.5.0", "@grpc/grpc-js": "^1.6.7", @@ -86,6 +86,7 @@ "aws-sdk": "^2.1082.0", "axios": "^1.5.0", "bcrypt": "^5.1.0", + "better-sqlite3": "^8.7.0", "cache-manager": "^3.4.0", "camelcase": "^6.2.1", "chalk": "4.1.2", From 134ec8431f5db28d2480bc3af677e8a5d1f6db29 Mon Sep 17 00:00:00 2001 From: Adolphe Kifungo <45813955+adkif@users.noreply.github.com> Date: Thu, 5 Oct 2023 14:19:00 +0200 Subject: [PATCH 09/30] feat: add better sqlite 3 configuration --- apps/api/src/plugin-config.ts | 19 +++++++++++++++++++ packages/config/src/database.ts | 27 +++++++++++++++++++++++++++ 2 files changed, 46 insertions(+) diff --git a/apps/api/src/plugin-config.ts b/apps/api/src/plugin-config.ts index d64b7f8cb35..d2a86323465 100644 --- a/apps/api/src/plugin-config.ts +++ b/apps/api/src/plugin-config.ts @@ -129,5 +129,24 @@ function getDbConfig(): DataSourceOptions { logger: 'file', // Removes console logging, instead logs all queries in a file ormlogs.log synchronize: process.env.DB_SYNCHRONIZE === 'true' ? true : false, // We are using migrations, synchronize should be set to false. }; + case 'better-sqlite3': + const betterSqlitePath = + process.env.DB_PATH || + path.join( + path.resolve('.', ...['apps', 'api', 'data']), + 'gauzy.better-sqlite3' + ); + + return { + type: dbType, + database: betterSqlitePath, + logging: 'all', + logger: 'file', // Removes console logging, instead logs all queries in a file ormlogs.log + synchronize: process.env.DB_SYNCHRONIZE === 'true', // We are using migrations, synchronize should be set to false. + prepareDatabase: (db) => { + // Enhance performance + db.pragma('journal_mode = WAL'); + } + }; } } diff --git a/packages/config/src/database.ts b/packages/config/src/database.ts index fe70da8a208..c9a12f54d66 100644 --- a/packages/config/src/database.ts +++ b/packages/config/src/database.ts @@ -81,6 +81,33 @@ switch (dbType) { connectionConfig = sqliteConfig; + break; + + case 'better-sqlite3': + const betterSqlitePath = + process.env.DB_PATH || + path.join( + process.cwd(), + ...['apps', 'api', 'data'], + 'gauzy.better-sqlite3' + ); + + console.log('Better Sqlite DB Path: ' + betterSqlitePath); + + const betterSqliteConfig: DataSourceOptions = { + type: dbType, + database: betterSqlitePath, + logging: 'all', + logger: 'file', // Removes console logging, instead logs all queries in a file ormlogs.log + synchronize: process.env.DB_SYNCHRONIZE === 'true', // We are using migrations, synchronize should be set to false. + prepareDatabase: (db) => { + // Enhance performance + db.pragma('journal_mode = WAL'); + } + }; + + connectionConfig = betterSqliteConfig; + break; } From 07b3ac08810082648e1bfa593e70f4949a081d8e Mon Sep 17 00:00:00 2001 From: Adolphe Kifungo <45813955+adkif@users.noreply.github.com> Date: Thu, 5 Oct 2023 14:19:37 +0200 Subject: [PATCH 10/30] feat: add better sqlite 3 to desktop full app --- apps/desktop/src/index.ts | 36 ++++++++++-------------------------- 1 file changed, 10 insertions(+), 26 deletions(-) diff --git a/apps/desktop/src/index.ts b/apps/desktop/src/index.ts index 924616e924a..ddf62e146b4 100644 --- a/apps/desktop/src/index.ts +++ b/apps/desktop/src/index.ts @@ -66,6 +66,9 @@ log.info(`GAUZY_USER_PATH: ${process.env.GAUZY_USER_PATH}`); const sqlite3filename = `${process.env.GAUZY_USER_PATH}/gauzy.sqlite3`; log.info(`Sqlite DB path: ${sqlite3filename}`); +const betterSqlite3filename = `${process.env.GAUZY_USER_PATH}/gauzy.better-sqlite3`; +log.info(`Better Sqlite DB path: ${betterSqlite3filename}`); + const provider = ProviderFactory.instance; const knex = provider.connection; @@ -233,7 +236,10 @@ async function startServer(value, restart = false) { if (value.db === 'sqlite') { process.env.DB_PATH = sqlite3filename; process.env.DB_TYPE = 'sqlite'; - } else { + }else if(value.db === 'better-sqlite') { + process.env.DB_PATH = betterSqlite3filename; + process.env.DB_TYPE = 'better-sqlite3'; + }else { process.env.DB_TYPE = 'postgres'; process.env.DB_HOST = value['postgres']?.dbHost; process.env.DB_PORT = value['postgres']?.dbPort; @@ -462,7 +468,7 @@ app.on('ready', async () => { splashScreen = new SplashScreen(pathWindow.timeTrackerUi); await splashScreen.loadURL(); splashScreen.show(); - if (provider.dialect === 'sqlite') { + if (provider.dialect === 'sqlite' || provider.dialect === 'better-sqlite') { try { const res = await knex.raw(`pragma journal_mode = WAL;`) console.log(res); @@ -698,34 +704,12 @@ ipcMain.on('restart_and_update', () => { ipcMain.on('check_database_connection', async (event, arg) => { try { - const provider = arg.db; - let databaseOptions; - if (provider === 'postgres') { - databaseOptions = { - client: 'pg', - connection: { - host: arg[provider].dbHost, - user: arg[provider].dbUsername, - password: arg[provider].dbPassword, - database: arg[provider].dbName, - port: arg[provider].dbPort - } - }; - } else { - databaseOptions = { - client: 'sqlite', - connection: { - filename: sqlite3filename, - }, - }; - } - const dbConn = require('knex')(databaseOptions); - await dbConn.raw('select 1+1 as result'); + const driver = await provider.check(arg); event.sender.send('database_status', { status: true, message: TranslateService.instant( 'TIMER_TRACKER.DIALOG.CONNECTION_DRIVER', - { driver: provider === 'postgres' ? 'PostgresSQL' : 'SQLite' } + { driver } ) }); } catch (error) { From 0ecaa439c1dca71ac0fde82bed2955b43bf88ecc Mon Sep 17 00:00:00 2001 From: BM-Nadir Date: Thu, 5 Oct 2023 22:41:04 +0100 Subject: [PATCH 11/30] remove extra space when user click submit from the login credentials --- .../src/app/@core/services/auth.service.ts | 24 +++++++++++-------- 1 file changed, 14 insertions(+), 10 deletions(-) diff --git a/apps/gauzy/src/app/@core/services/auth.service.ts b/apps/gauzy/src/app/@core/services/auth.service.ts index daeda500f7e..1bc48dca821 100644 --- a/apps/gauzy/src/app/@core/services/auth.service.ts +++ b/apps/gauzy/src/app/@core/services/auth.service.ts @@ -18,10 +18,7 @@ import { API_PREFIX } from '../constants/app.constants'; @Injectable() export class AuthService { - - constructor( - private readonly http: HttpClient - ) { } + constructor(private readonly http: HttpClient) {} isAuthenticated(): Promise { return firstValueFrom( @@ -33,7 +30,9 @@ export class AuthService { return this.http.post(`${API_PREFIX}/auth/email/verify`, body); } - login(loginInput): Observable { + login(loginInput: IUserLoginInput): Observable { + loginInput.email = loginInput.email?.trim(); + loginInput.password = loginInput.password?.trim(); return this.http.post( `${API_PREFIX}/auth/login`, loginInput @@ -45,9 +44,14 @@ export class AuthService { * @param input - IUserLoginInput containing email and password. * @returns Promise representing the response from the server. */ - signinWorkspaces(input: IUserLoginInput): Observable { + signinWorkspaces( + input: IUserLoginInput + ): Observable { try { - return this.http.post(`${API_PREFIX}/auth/signin.workspaces`, input); + return this.http.post( + `${API_PREFIX}/auth/signin.workspaces`, + input + ); } catch (error) { console.log('Error while signin workspaces: %s', error?.message); // Handle errors appropriately (e.g., log, throw, etc.) @@ -89,13 +93,13 @@ export class AuthService { hasRole(roles: RolesEnum[]): Observable { return this.http.get(`${API_PREFIX}/auth/role`, { - params: toParams({ roles }) + params: toParams({ roles }), }); } hasPermissions(...permissions: PermissionsEnum[]): Observable { return this.http.get(`${API_PREFIX}/auth/permissions`, { - params: toParams({ permissions }) + params: toParams({ permissions }), }); } @@ -108,7 +112,7 @@ export class AuthService { refreshToken(refresh_token: string): Promise { return firstValueFrom( this.http.post(`${API_PREFIX}/auth/refresh-token`, { - refresh_token: refresh_token + refresh_token: refresh_token, }) ); } From 78806b86f0194e88d45978c03124d42df38ef3fe Mon Sep 17 00:00:00 2001 From: CoderNadir Date: Thu, 5 Oct 2023 23:38:57 +0100 Subject: [PATCH 12/30] remove extra space when user click submit from the login credentials --- .../src/app/@core/services/auth.service.ts | 24 ++++++++----------- 1 file changed, 10 insertions(+), 14 deletions(-) diff --git a/apps/gauzy/src/app/@core/services/auth.service.ts b/apps/gauzy/src/app/@core/services/auth.service.ts index 1bc48dca821..daeda500f7e 100644 --- a/apps/gauzy/src/app/@core/services/auth.service.ts +++ b/apps/gauzy/src/app/@core/services/auth.service.ts @@ -18,7 +18,10 @@ import { API_PREFIX } from '../constants/app.constants'; @Injectable() export class AuthService { - constructor(private readonly http: HttpClient) {} + + constructor( + private readonly http: HttpClient + ) { } isAuthenticated(): Promise { return firstValueFrom( @@ -30,9 +33,7 @@ export class AuthService { return this.http.post(`${API_PREFIX}/auth/email/verify`, body); } - login(loginInput: IUserLoginInput): Observable { - loginInput.email = loginInput.email?.trim(); - loginInput.password = loginInput.password?.trim(); + login(loginInput): Observable { return this.http.post( `${API_PREFIX}/auth/login`, loginInput @@ -44,14 +45,9 @@ export class AuthService { * @param input - IUserLoginInput containing email and password. * @returns Promise representing the response from the server. */ - signinWorkspaces( - input: IUserLoginInput - ): Observable { + signinWorkspaces(input: IUserLoginInput): Observable { try { - return this.http.post( - `${API_PREFIX}/auth/signin.workspaces`, - input - ); + return this.http.post(`${API_PREFIX}/auth/signin.workspaces`, input); } catch (error) { console.log('Error while signin workspaces: %s', error?.message); // Handle errors appropriately (e.g., log, throw, etc.) @@ -93,13 +89,13 @@ export class AuthService { hasRole(roles: RolesEnum[]): Observable { return this.http.get(`${API_PREFIX}/auth/role`, { - params: toParams({ roles }), + params: toParams({ roles }) }); } hasPermissions(...permissions: PermissionsEnum[]): Observable { return this.http.get(`${API_PREFIX}/auth/permissions`, { - params: toParams({ permissions }), + params: toParams({ permissions }) }); } @@ -112,7 +108,7 @@ export class AuthService { refreshToken(refresh_token: string): Promise { return firstValueFrom( this.http.post(`${API_PREFIX}/auth/refresh-token`, { - refresh_token: refresh_token, + refresh_token: refresh_token }) ); } From fa0ee2fa10bbeb0edb31a958df57865267de0556 Mon Sep 17 00:00:00 2001 From: Adolphe Kifungo <45813955+adkif@users.noreply.github.com> Date: Sat, 7 Oct 2023 06:25:43 +0200 Subject: [PATCH 13/30] feat: reuse sqlite migrations with better-sqlite3 --- .../1638541848595-SwitchToMigration.ts | 26 +++++----- .../1638793919144-KnowledgeBasePlugin.ts | 28 +++++------ .../1638797573521-ChangelogPlugin.ts | 24 +++++----- .../1639729354753-CreatePasswordResetTable.ts | 30 ++++++------ .../1640784835692-AlterActivityTable.ts | 24 +++++----- ...42411409517-AlterCandidateEmployeeTable.ts | 28 +++++------ .../1642770124831-AlterEmailHistoryTable.ts | 26 +++++----- .../1643201180573-AlterTaskTable.ts | 24 +++++----- .../1643807301083-AlterRolePermissionTable.ts | 24 +++++----- .../1644491785525-AdjustTimeLogStopDate.ts | 48 +++++++++---------- .../1644568289509-AlterTimeLogTable.ts | 24 +++++----- .../1644915598578-AlterEmployeeTable.ts | 28 +++++------ .../1645012749640-AlterPaymentTable.ts | 24 +++++----- .../1645087150917-AlterEmailTable.ts | 24 +++++----- .../1645179275947-AlterInvoiceTable.ts | 24 +++++----- ...7-AddTimeTrackingFeatureToEmployeeTable.ts | 24 +++++----- .../1645726031706-AlterIntegrationTable.ts | 26 +++++----- ...9050-AlterEmployeeRecurringExpenseTable.ts | 24 +++++----- .../1646117679347-AlterScreenshotTable.ts | 24 +++++----- .../1646206946845-AlterExpenseTable.ts | 24 +++++----- .../1647417832147-AlterActivityTable.ts | 20 ++++---- .../1648899149818-AlterTenantTable.ts | 28 +++++------ .../1650532321598-AlterOrganizationProject.ts | 4 +- .../1650704972412-AlterChangelogTable.ts | 26 +++++----- .../1652270907163-AlterTimeOffRequestTable.ts | 26 +++++----- .../1652703299052-AlterTaskTableColumns.ts | 22 ++++----- .../1653482244724-AlterExpenseTable.ts | 22 ++++----- ...742570167-AlterOrganizationContactTable.ts | 24 +++++----- .../1654675304373-SeedChangeLogFeature.ts | 6 +-- ...885355508-OrganizationProjectAlterTable.ts | 22 ++++----- .../1656833636109-AlterUserTable.ts | 6 +-- ...59618978087-AlterInvoiceEstimateHistory.ts | 6 +-- .../1659684413063-AlterContactTable.ts | 6 +-- .../1659696180759-AlterTenantTable.ts | 6 +-- ...660988196279-AlterWarehouseProductTable.ts | 4 +- .../1661599336316-AlterWarehouseMerchant.ts | 4 +- .../1661853087396-AlterTimesheetTable.ts | 4 +- .../1662994539197-AlterInvoiceTable.ts | 4 +- ...64869127437-AlterCandidateFeedbackTable.ts | 4 +- ...5044607000-AlterCandidateInterviewTable.ts | 4 +- .../1665388204010-AlterWarehouseTable.ts | 4 +- .../1665399395983-AlterOrganizationTable.ts | 4 +- .../1665767813286-AltereInviteTable.ts | 4 +- .../1666007548644-AlterEmployeeTable.ts | 6 +-- .../1666181221327-AlterOrganizationTable.ts | 4 +- .../1666780716428-AlterEmployeeTable.ts | 6 +-- .../1668064327561-AlterOrganizationTable.ts | 4 +- ...1668084518509-AlterEmployeeTableColumns.ts | 4 +- .../1668256889786-AlterCustomSmtpTable.ts | 4 +- ...68446646237-AlterTableRelationCascading.ts | 4 +- .../1668502997873-AlterUserTable.ts | 4 +- ...68504932478-AlterTableRelationCascading.ts | 4 +- ...-AlterUserTableEmailVerificationColumns.ts | 4 +- .../1669280426592-AlterInviteTable.ts | 4 +- .../1669453028914-AlterUserInviteTable.ts | 4 +- ...670313962263-AlterOrganizationTeamTable.ts | 4 +- ...058-AlterInviteAllowedOrganizationTable.ts | 4 +- ...671706727549-AlterOrganizationTeamTable.ts | 4 +- .../1672211594766-AlterCandidateTable.ts | 4 +- .../1673005639130-AlterTimeLogTable.ts | 4 +- .../1673423542165-AlterTaskTable.ts | 4 +- .../1673589923548-CreateStatusTable.ts | 4 +- .../1673946248066-AlterTaskTable.ts | 4 +- ...74044473393-SeedDefaultGlobalTaskStatus.ts | 2 +- .../1674109138954-AlterEmailSentTable.ts | 4 +- .../1674535367176-CreateTaskPriorityTable.ts | 4 +- .../1674538040466-CreateTaskSizeTable.ts | 4 +- ...88-SeedDefaultGlobalTaskPriorityAndSize.ts | 4 +- .../1675186090641-AlterTaskStatusTable.ts | 4 +- .../1675240711524-CreateEmployeePhoneTable.ts | 4 +- .../1675241589518-AlterUserTable.ts | 4 +- .../1675410785835-AlterTaskTable.ts | 4 +- ...5687502784-AddTimeZoneColumnToUserTable.ts | 4 +- ...676351186923-AlterOrganizationTeamTable.ts | 4 +- ...ngColumnToOrganizationTeamEmployeeTable.ts | 4 +- ...30369336-AddLogoToOrganizationTeamTable.ts | 4 +- .../1676827319035-AlterEmployeeTable.ts | 4 +- .../1676978573552-AlterOrganizationTable.ts | 4 +- ...677063195155-AlterOrganizationTeamTable.ts | 4 +- .../migrations/1677142065591-AlterTagTable.ts | 4 +- .../1677156446733-AlterTaskTable.ts | 4 +- .../1677313663312-AlterEmployeeTable.ts | 4 +- .../1677508195152-AlterScreenshotTable.ts | 4 +- ...-CreateOrganizationTeamJoinRequestTable.ts | 4 +- .../1678190791247-CreateEmailResetTable.ts | 4 +- ...678436030249-AlterOrganizationTeamTable.ts | 4 +- .../1678461100447-AlterEmailResetTable.ts | 4 +- ...atusTableTaskSizeTableTaskPriorityTable.ts | 4 +- ...4-AlterOrganizationTeamJoinRequestTable.ts | 4 +- .../1679308324164-AlterImageAssetTable.ts | 4 +- ...79406665415-AddImageAssetColumnToTables.ts | 4 +- ...dImageAssetColumnToTheOrganizationTable.ts | 4 +- ...ageAssetColumnToTheProductCategoryTable.ts | 4 +- .../1680071714132-CreateIssueTypeTable.ts | 4 +- ...411434-AddIssueTypeColumnToTheTaskTable.ts | 4 +- ...586-AddIndexesColumnsToTheTimeSlotTable.ts | 4 +- ...9-AddIndexesColumnsToTheScreenshotTable.ts | 4 +- ...492-AddIndexesColumnsToTheActivityTable.ts | 4 +- ...93-AddIndexesColumnsToTheTimesheetTable.ts | 4 +- ...2764-AddIndexesColumnsToTheTimeLogTable.ts | 4 +- ...30165590-AlterJobSearchRelationalTables.ts | 4 +- ...680622389221-SeedDafaultGlobalIssueType.ts | 2 +- ...orkOrganizationIdToTheOrganizationTable.ts | 4 +- .../1680692867660-AlterEmployeeTable.ts | 4 +- ...setColumnToTheOrganizationDocumentTable.ts | 4 +- ...mentAssetColumnToTheTimeOffRequestTable.ts | 4 +- ...EmployeeStatusColumnsToTheEmployeeTable.ts | 4 +- ...ganizationTeamIdColumnToTheTimeLogTable.ts | 4 +- ...686195290990-AlterOrganizationTeamTable.ts | 4 +- ...MinimumBillingRateColumnToEmployeeTable.ts | 4 +- ...inimumBillingRateColumnToCandidateTable.ts | 4 +- .../1687974863736-CreateTaskVersionTable.ts | 4 +- .../1688122296981-AlterTableEmployee.ts | 4 +- ...88168798377-CreateRelatedIssueTypeTable.ts | 4 +- ...8886388219-AddParentIdColumnToTaskTable.ts | 4 +- ...2457-AddRelatedIssueRelationToTaskTable.ts | 4 +- ...689150247379-CreateTaskLinkedIssueTable.ts | 4 +- ...1441-CreateOrganizationTaskSettingTable.ts | 4 +- ...689611487195-DropTaskRelatedIssuesTable.ts | 4 +- ...1689670799675-CreateTaskEstimationTable.ts | 4 +- .../1690040638765-AlterReportTable.ts | 4 +- ...iveTaskColumnToOrganizationTeamEmployee.ts | 4 +- ...kOrganizationNameToTheOrganizationTable.ts | 4 +- .../1691493358068-AlterIntegrationTable.ts | 4 +- .../1691494801748-SeedIntegrationTable.ts | 2 +- ...691756595248-AddUserIdColumnToUserTable.ts | 4 +- .../1692171665427-SeedIntegrationTable.ts | 2 +- ...1607-AddOrganizationProjectTeamRelation.ts | 4 +- ...-AlterIntegrationTableRelationCascading.ts | 4 +- ...92433732267-AlterIntegrationTenantTable.ts | 4 +- ...547294428-AlterCodeToAlphaNumericFormat.ts | 4 +- ...1-AlterOrganizationTeamJoinRequestTable.ts | 4 +- ...3907817-AddColumnsToTheIntegrationTable.ts | 4 +- ...783-AddColumnsToTheIntegrationTypeTable.ts | 4 +- .../1695570009125-AlterTableTask.ts | 4 +- ...1695958130201-AddedArchivedColumnToUser.ts | 4 +- ...-AddedActiveArchivedColumnsToBaseEntity.ts | 4 +- 137 files changed, 580 insertions(+), 580 deletions(-) diff --git a/packages/core/src/database/migrations/1638541848595-SwitchToMigration.ts b/packages/core/src/database/migrations/1638541848595-SwitchToMigration.ts index 1f7e5681f96..a4903e4cfa5 100644 --- a/packages/core/src/database/migrations/1638541848595-SwitchToMigration.ts +++ b/packages/core/src/database/migrations/1638541848595-SwitchToMigration.ts @@ -4,7 +4,7 @@ export class SwitchToMigration1638541848595 implements MigrationInterface { name = 'SwitchToMigration1638541848595' public async up(queryRunner: QueryRunner): Promise { - if (queryRunner.connection.options.type === 'sqlite') { + if (['sqlite', 'better-sqlite3'].includes(queryRunner.connection.options.type)) { await this.sqliteUpQueryRunner(queryRunner); } else { await this.postgresUpQueryRunner(queryRunner); @@ -12,7 +12,7 @@ export class SwitchToMigration1638541848595 implements MigrationInterface { } public async down(queryRunner: QueryRunner): Promise { - if (queryRunner.connection.options.type === 'sqlite') { + if (['sqlite', 'better-sqlite3'].includes(queryRunner.connection.options.type)) { await this.sqliteDownQueryRunner(queryRunner); } else { await this.postgresDownQueryRunner(queryRunner); @@ -21,8 +21,8 @@ export class SwitchToMigration1638541848595 implements MigrationInterface { /** * PostgresDB Up Migration - * - * @param queryRunner + * + * @param queryRunner */ private async postgresUpQueryRunner(queryRunner: QueryRunner): Promise { await queryRunner.query(`CREATE EXTENSION IF NOT EXISTS "uuid-ossp"`); @@ -942,11 +942,11 @@ export class SwitchToMigration1638541848595 implements MigrationInterface { await queryRunner.query(`ALTER TABLE IF EXISTS "employee" DROP CONSTRAINT IF EXISTS "FK_1c0c1370ecd98040259625e17e2"`); await queryRunner.query(`ALTER TABLE "employee" ADD CONSTRAINT "FK_1c0c1370ecd98040259625e17e2" FOREIGN KEY ("contactId") REFERENCES "contact"("id") ON DELETE SET NULL ON UPDATE NO ACTION`); await queryRunner.query(`ALTER TABLE IF EXISTS "employee" DROP CONSTRAINT IF EXISTS "FK_5e719204dcafa8d6b2ecdeda130"`); - await queryRunner.query(`ALTER TABLE "employee" ADD CONSTRAINT "FK_5e719204dcafa8d6b2ecdeda130" FOREIGN KEY ("organizationPositionId") REFERENCES "organization_position"("id") ON DELETE NO ACTION ON UPDATE NO ACTION`); + await queryRunner.query(`ALTER TABLE "employee" ADD CONSTRAINT "FK_5e719204dcafa8d6b2ecdeda130" FOREIGN KEY ("organizationPositionId") REFERENCES "organization_position"("id") ON DELETE NO ACTION ON UPDATE NO ACTION`); await queryRunner.query(`ALTER TABLE IF EXISTS "equipment_sharing_policy" DROP CONSTRAINT IF EXISTS "FK_5443ca8ed830626656d8cfecef7"`); await queryRunner.query(`ALTER TABLE "equipment_sharing_policy" ADD CONSTRAINT "FK_5443ca8ed830626656d8cfecef7" FOREIGN KEY ("tenantId") REFERENCES "tenant"("id") ON DELETE CASCADE ON UPDATE NO ACTION`); await queryRunner.query(`ALTER TABLE IF EXISTS "equipment_sharing_policy" DROP CONSTRAINT IF EXISTS "FK_5311a833ff255881454bd5b3b58"`); - await queryRunner.query(`ALTER TABLE "equipment_sharing_policy" ADD CONSTRAINT "FK_5311a833ff255881454bd5b3b58" FOREIGN KEY ("organizationId") REFERENCES "organization"("id") ON DELETE CASCADE ON UPDATE CASCADE`); + await queryRunner.query(`ALTER TABLE "equipment_sharing_policy" ADD CONSTRAINT "FK_5311a833ff255881454bd5b3b58" FOREIGN KEY ("organizationId") REFERENCES "organization"("id") ON DELETE CASCADE ON UPDATE CASCADE`); await queryRunner.query(`ALTER TABLE IF EXISTS "equipment_sharing" DROP CONSTRAINT IF EXISTS "FK_fa525e61fb3d8d9efec0f364a4b"`); await queryRunner.query(`ALTER TABLE "equipment_sharing" ADD CONSTRAINT "FK_fa525e61fb3d8d9efec0f364a4b" FOREIGN KEY ("tenantId") REFERENCES "tenant"("id") ON DELETE CASCADE ON UPDATE NO ACTION`); await queryRunner.query(`ALTER TABLE IF EXISTS "equipment_sharing" DROP CONSTRAINT IF EXISTS "FK_ea9254be07ae4a8604f0aaab196"`); @@ -1482,7 +1482,7 @@ export class SwitchToMigration1638541848595 implements MigrationInterface { await queryRunner.query(`ALTER TABLE IF EXISTS "warehouse" DROP CONSTRAINT IF EXISTS "FK_f502dc6d9802306f9d1584932b8"`); await queryRunner.query(`ALTER TABLE IF EXISTS "warehouse" ADD CONSTRAINT "FK_f502dc6d9802306f9d1584932b8" FOREIGN KEY ("logoId") REFERENCES "image_asset"("id") ON DELETE SET NULL ON UPDATE NO ACTION`); await queryRunner.query(`ALTER TABLE IF EXISTS "warehouse" DROP CONSTRAINT IF EXISTS "FK_84594016a98da8b87e0f51cd931"`); - await queryRunner.query(`ALTER TABLE IF EXISTS "warehouse" ADD CONSTRAINT "FK_84594016a98da8b87e0f51cd931" FOREIGN KEY ("contactId") REFERENCES "contact"("id") ON DELETE CASCADE ON UPDATE NO ACTION`); + await queryRunner.query(`ALTER TABLE IF EXISTS "warehouse" ADD CONSTRAINT "FK_84594016a98da8b87e0f51cd931" FOREIGN KEY ("contactId") REFERENCES "contact"("id") ON DELETE CASCADE ON UPDATE NO ACTION`); await queryRunner.query(`ALTER TABLE IF EXISTS "warehouse_product_variant" DROP CONSTRAINT IF EXISTS "FK_a1c4a97b928b547c3041d3ac1f6"`); await queryRunner.query(`ALTER TABLE IF EXISTS "warehouse_product_variant" ADD CONSTRAINT "FK_a1c4a97b928b547c3041d3ac1f6" FOREIGN KEY ("tenantId") REFERENCES "tenant"("id") ON DELETE CASCADE ON UPDATE NO ACTION`); await queryRunner.query(`ALTER TABLE IF EXISTS "warehouse_product_variant" DROP CONSTRAINT IF EXISTS "FK_a2f863689d1316810c41c1ea38e"`); @@ -1705,8 +1705,8 @@ export class SwitchToMigration1638541848595 implements MigrationInterface { /** * PostgresDB Down Migration - * - * @param queryRunner + * + * @param queryRunner */ private async postgresDownQueryRunner(queryRunner: QueryRunner): Promise { await queryRunner.query(`ALTER TABLE "tag_warehouse" DROP CONSTRAINT "FK_3557d514afd3794d40128e05423"`); @@ -2905,8 +2905,8 @@ export class SwitchToMigration1638541848595 implements MigrationInterface { /** * SqliteDB Up Migration - * - * @param queryRunner + * + * @param queryRunner */ private async sqliteUpQueryRunner(queryRunner: QueryRunner): Promise { await queryRunner.query(`CREATE TABLE IF NOT EXISTS "appointment_employee" ("id" varchar PRIMARY KEY NOT NULL, "createdAt" datetime NOT NULL DEFAULT (datetime('now')), "updatedAt" datetime NOT NULL DEFAULT (datetime('now')), "tenantId" varchar, "organizationId" varchar, "appointmentId" varchar NOT NULL, "employeeId" varchar NOT NULL, "employeeAppointmentId" varchar)`); @@ -5360,8 +5360,8 @@ export class SwitchToMigration1638541848595 implements MigrationInterface { /** * SqliteDB Down Migration - * - * @param queryRunner + * + * @param queryRunner */ private async sqliteDownQueryRunner(queryRunner: QueryRunner): Promise { await queryRunner.query(`DROP INDEX "IDX_3557d514afd3794d40128e0542"`); diff --git a/packages/core/src/database/migrations/1638793919144-KnowledgeBasePlugin.ts b/packages/core/src/database/migrations/1638793919144-KnowledgeBasePlugin.ts index 462ca1f5c8b..832fd85fca5 100644 --- a/packages/core/src/database/migrations/1638793919144-KnowledgeBasePlugin.ts +++ b/packages/core/src/database/migrations/1638793919144-KnowledgeBasePlugin.ts @@ -1,10 +1,10 @@ import { MigrationInterface, QueryRunner } from "typeorm"; - + export class KnowledgeBasePlugin1638793919144 implements MigrationInterface { name = 'KnowledgeBasePlugin1638793919144'; public async up(queryRunner: QueryRunner): Promise { - if (queryRunner.connection.options.type === 'sqlite') { + if (['sqlite', 'better-sqlite3'].includes(queryRunner.connection.options.type)) { await this.sqliteUpQueryRunner(queryRunner); } else { await this.postgresUpQueryRunner(queryRunner); @@ -12,7 +12,7 @@ export class KnowledgeBasePlugin1638793919144 implements MigrationInterface { } public async down(queryRunner: QueryRunner): Promise { - if (queryRunner.connection.options.type === 'sqlite') { + if (['sqlite', 'better-sqlite3'].includes(queryRunner.connection.options.type)) { await this.sqliteDownQueryRunner(queryRunner); } else { await this.postgresDownQueryRunner(queryRunner); @@ -21,8 +21,8 @@ export class KnowledgeBasePlugin1638793919144 implements MigrationInterface { /** * PostgresDB Up Migration - * - * @param queryRunner + * + * @param queryRunner */ public async postgresUpQueryRunner(queryRunner: QueryRunner): Promise { await queryRunner.query(`CREATE TABLE "knowledge_base" ("id" uuid NOT NULL DEFAULT gen_random_uuid(), "createdAt" TIMESTAMP NOT NULL DEFAULT now(), "updatedAt" TIMESTAMP NOT NULL DEFAULT now(), "tenantId" uuid, "organizationId" uuid, "name" character varying NOT NULL, "flag" character varying NOT NULL, "icon" character varying NOT NULL, "privacy" character varying NOT NULL, "language" character varying NOT NULL, "color" character varying NOT NULL, "description" character varying, "data" character varying, "index" integer, "parentId" uuid, CONSTRAINT "PK_19d3f52f6da1501b7e235f1da5c" PRIMARY KEY ("id"))`); @@ -51,11 +51,11 @@ export class KnowledgeBasePlugin1638793919144 implements MigrationInterface { await queryRunner.query(`ALTER TABLE "knowledge_base_author" ADD CONSTRAINT "FK_8eb7e413257d7a26104f4e326fd" FOREIGN KEY ("employeeId") REFERENCES "employee"("id") ON DELETE CASCADE ON UPDATE NO ACTION`); await queryRunner.query(`ALTER TABLE "knowledge_base_author" ADD CONSTRAINT "FK_2d5ecab1f06b327bad545536143" FOREIGN KEY ("articleId") REFERENCES "knowledge_base_article"("id") ON DELETE CASCADE ON UPDATE NO ACTION`); } - + /** * PostgresDB Down Migration - * - * @param queryRunner + * + * @param queryRunner */ public async postgresDownQueryRunner(queryRunner: QueryRunner): Promise { await queryRunner.query(`ALTER TABLE "knowledge_base_author" DROP CONSTRAINT "FK_2d5ecab1f06b327bad545536143"`); @@ -87,8 +87,8 @@ export class KnowledgeBasePlugin1638793919144 implements MigrationInterface { /** * SqliteDB Up Migration - * - * @param queryRunner + * + * @param queryRunner */ public async sqliteUpQueryRunner(queryRunner: QueryRunner): Promise { await queryRunner.query(`CREATE TABLE "knowledge_base" ("id" varchar PRIMARY KEY NOT NULL, "createdAt" datetime NOT NULL DEFAULT (datetime('now')), "updatedAt" datetime NOT NULL DEFAULT (datetime('now')), "tenantId" varchar, "organizationId" varchar, "name" varchar NOT NULL, "flag" varchar NOT NULL, "icon" varchar NOT NULL, "privacy" varchar NOT NULL, "language" varchar NOT NULL, "color" varchar NOT NULL, "description" varchar, "data" varchar, "index" integer, "parentId" varchar)`); @@ -145,11 +145,11 @@ export class KnowledgeBasePlugin1638793919144 implements MigrationInterface { await queryRunner.query(`CREATE INDEX "IDX_8eb7e413257d7a26104f4e326f" ON "knowledge_base_author" ("employeeId") `); await queryRunner.query(`CREATE INDEX "IDX_2d5ecab1f06b327bad54553614" ON "knowledge_base_author" ("articleId") `); } - + /** * SqliteDB Down Migration - * - * @param queryRunner + * + * @param queryRunner */ public async sqliteDownQueryRunner(queryRunner: QueryRunner): Promise { await queryRunner.query(`DROP INDEX "IDX_2d5ecab1f06b327bad54553614"`); @@ -206,4 +206,4 @@ export class KnowledgeBasePlugin1638793919144 implements MigrationInterface { await queryRunner.query(`DROP INDEX "IDX_bcb30c9893f4c8d0c4e556b4ed"`); await queryRunner.query(`DROP TABLE "knowledge_base"`); } -} \ No newline at end of file +} diff --git a/packages/core/src/database/migrations/1638797573521-ChangelogPlugin.ts b/packages/core/src/database/migrations/1638797573521-ChangelogPlugin.ts index 9260b3ccf32..c44ee25541a 100644 --- a/packages/core/src/database/migrations/1638797573521-ChangelogPlugin.ts +++ b/packages/core/src/database/migrations/1638797573521-ChangelogPlugin.ts @@ -1,11 +1,11 @@ import { MigrationInterface, QueryRunner } from "typeorm"; - + export class ChangelogPlugin1638797573521 implements MigrationInterface { name = 'ChangelogPlugin1638797573521'; public async up(queryRunner: QueryRunner): Promise { - if (queryRunner.connection.options.type === 'sqlite') { + if (['sqlite', 'better-sqlite3'].includes(queryRunner.connection.options.type)) { await this.sqliteUpQueryRunner(queryRunner); } else { await this.postgresUpQueryRunner(queryRunner); @@ -13,7 +13,7 @@ export class ChangelogPlugin1638797573521 implements MigrationInterface { } public async down(queryRunner: QueryRunner): Promise { - if (queryRunner.connection.options.type === 'sqlite') { + if (['sqlite', 'better-sqlite3'].includes(queryRunner.connection.options.type)) { await this.sqliteDownQueryRunner(queryRunner); } else { await this.postgresDownQueryRunner(queryRunner); @@ -22,8 +22,8 @@ export class ChangelogPlugin1638797573521 implements MigrationInterface { /** * PostgresDB Up Migration - * - * @param queryRunner + * + * @param queryRunner */ public async postgresUpQueryRunner(queryRunner: QueryRunner): Promise { await queryRunner.query(`CREATE TABLE "changelog" ("id" uuid NOT NULL DEFAULT gen_random_uuid(), "createdAt" TIMESTAMP NOT NULL DEFAULT now(), "updatedAt" TIMESTAMP NOT NULL DEFAULT now(), "tenantId" uuid, "organizationId" uuid, "icon" character varying, "title" character varying, "date" TIMESTAMP NOT NULL, "content" character varying NOT NULL, "learnMoreUrl" character varying NOT NULL, CONSTRAINT "PK_9d12e70193212a9f6d2c542433d" PRIMARY KEY ("id"))`); @@ -37,8 +37,8 @@ export class ChangelogPlugin1638797573521 implements MigrationInterface { /** * PostgresDB Down Migration - * - * @param queryRunner + * + * @param queryRunner */ public async postgresDownQueryRunner(queryRunner: QueryRunner): Promise { await queryRunner.query(`ALTER TABLE "changelog" DROP CONSTRAINT "FK_c2037b621d2e8023898aee4ac74"`); @@ -52,8 +52,8 @@ export class ChangelogPlugin1638797573521 implements MigrationInterface { /** * SqliteDB Up Migration - * - * @param queryRunner + * + * @param queryRunner */ public async sqliteUpQueryRunner(queryRunner: QueryRunner): Promise { await queryRunner.query(`CREATE TABLE "changelog" ("id" varchar PRIMARY KEY NOT NULL, "createdAt" datetime NOT NULL DEFAULT (datetime('now')), "updatedAt" datetime NOT NULL DEFAULT (datetime('now')), "tenantId" varchar, "organizationId" varchar, "icon" varchar, "title" varchar, "date" datetime NOT NULL, "content" varchar NOT NULL, "learnMoreUrl" varchar NOT NULL)`); @@ -79,8 +79,8 @@ export class ChangelogPlugin1638797573521 implements MigrationInterface { /** * SqliteDB Down Migration - * - * @param queryRunner + * + * @param queryRunner */ public async sqliteDownQueryRunner(queryRunner: QueryRunner): Promise { await queryRunner.query(`DROP INDEX "IDX_c2037b621d2e8023898aee4ac7"`); @@ -103,4 +103,4 @@ export class ChangelogPlugin1638797573521 implements MigrationInterface { await queryRunner.query(`DROP INDEX "IDX_744268ee0ec6073883267bc3b6"`); await queryRunner.query(`DROP TABLE "changelog"`); } -} \ No newline at end of file +} diff --git a/packages/core/src/database/migrations/1639729354753-CreatePasswordResetTable.ts b/packages/core/src/database/migrations/1639729354753-CreatePasswordResetTable.ts index 0036602d5fb..9683c6ac19c 100644 --- a/packages/core/src/database/migrations/1639729354753-CreatePasswordResetTable.ts +++ b/packages/core/src/database/migrations/1639729354753-CreatePasswordResetTable.ts @@ -1,29 +1,29 @@ import { MigrationInterface, QueryRunner } from "typeorm"; - + export class CreatePasswordResetTable1639729354753 implements MigrationInterface { name = 'CreatePasswordResetTable1639729354753'; public async up(queryRunner: QueryRunner): Promise { - if (queryRunner.connection.options.type === 'sqlite') { + if (['sqlite', 'better-sqlite3'].includes(queryRunner.connection.options.type)) { await this.sqliteUpQueryRunner(queryRunner); } else { await this.postgresUpQueryRunner(queryRunner); } } - + public async down(queryRunner: QueryRunner): Promise { - if (queryRunner.connection.options.type === 'sqlite') { + if (['sqlite', 'better-sqlite3'].includes(queryRunner.connection.options.type)) { await this.sqliteDownQueryRunner(queryRunner); } else { await this.postgresDownQueryRunner(queryRunner); } } - + /** * PostgresDB Up Migration - * - * @param queryRunner + * + * @param queryRunner */ public async postgresUpQueryRunner(queryRunner: QueryRunner): Promise { await queryRunner.query(`CREATE TABLE "password_reset" ("id" uuid NOT NULL DEFAULT gen_random_uuid(), "createdAt" TIMESTAMP NOT NULL DEFAULT now(), "updatedAt" TIMESTAMP NOT NULL DEFAULT now(), "email" character varying NOT NULL, "token" character varying NOT NULL, CONSTRAINT "PK_8515e60a2cc41584fa4784f52ce" PRIMARY KEY ("id"))`); @@ -32,11 +32,11 @@ import { MigrationInterface, QueryRunner } from "typeorm"; await queryRunner.query(`ALTER TABLE "contact" ALTER COLUMN "latitude" TYPE double precision`); await queryRunner.query(`ALTER TABLE "contact" ALTER COLUMN "longitude" TYPE double precision`); } - + /** * PostgresDB Down Migration - * - * @param queryRunner + * + * @param queryRunner */ public async postgresDownQueryRunner(queryRunner: QueryRunner): Promise { await queryRunner.query(`ALTER TABLE "contact" ALTER COLUMN "longitude" TYPE double precision`); @@ -48,8 +48,8 @@ import { MigrationInterface, QueryRunner } from "typeorm"; /** * SqliteDB Up Migration - * - * @param queryRunner + * + * @param queryRunner */ public async sqliteUpQueryRunner(queryRunner: QueryRunner): Promise { await queryRunner.query(`CREATE TABLE "password_reset" ("id" varchar PRIMARY KEY NOT NULL, "createdAt" datetime NOT NULL DEFAULT (datetime('now')), "updatedAt" datetime NOT NULL DEFAULT (datetime('now')), "email" varchar NOT NULL, "token" varchar NOT NULL)`); @@ -67,8 +67,8 @@ import { MigrationInterface, QueryRunner } from "typeorm"; /** * SqliteDB Down Migration - * - * @param queryRunner + * + * @param queryRunner */ public async sqliteDownQueryRunner(queryRunner: QueryRunner): Promise { await queryRunner.query(`DROP INDEX "IDX_60468af1ce34043a900809c84f"`); @@ -83,4 +83,4 @@ import { MigrationInterface, QueryRunner } from "typeorm"; await queryRunner.query(`DROP INDEX "IDX_1c88db6e50f0704688d1f1978c"`); await queryRunner.query(`DROP TABLE "password_reset"`); } - } \ No newline at end of file + } diff --git a/packages/core/src/database/migrations/1640784835692-AlterActivityTable.ts b/packages/core/src/database/migrations/1640784835692-AlterActivityTable.ts index 7e2da53d036..aeb88e62c40 100644 --- a/packages/core/src/database/migrations/1640784835692-AlterActivityTable.ts +++ b/packages/core/src/database/migrations/1640784835692-AlterActivityTable.ts @@ -1,11 +1,11 @@ import { MigrationInterface, QueryRunner } from "typeorm"; - + export class AlterActivityTable1640784835692 implements MigrationInterface { name = 'AlterActivityTable1640784835692'; public async up(queryRunner: QueryRunner): Promise { - if (queryRunner.connection.options.type === 'sqlite') { + if (['sqlite', 'better-sqlite3'].includes(queryRunner.connection.options.type)) { await this.sqliteUpQueryRunner(queryRunner); } else { await this.postgresUpQueryRunner(queryRunner); @@ -13,7 +13,7 @@ export class AlterActivityTable1640784835692 implements MigrationInterface { } public async down(queryRunner: QueryRunner): Promise { - if (queryRunner.connection.options.type === 'sqlite') { + if (['sqlite', 'better-sqlite3'].includes(queryRunner.connection.options.type)) { await this.sqliteDownQueryRunner(queryRunner); } else { await this.postgresDownQueryRunner(queryRunner); @@ -22,8 +22,8 @@ export class AlterActivityTable1640784835692 implements MigrationInterface { /** * PostgresDB Up Migration - * - * @param queryRunner + * + * @param queryRunner */ public async postgresUpQueryRunner(queryRunner: QueryRunner): Promise { await queryRunner.query(`ALTER TABLE "activity" ALTER COLUMN "title" DROP NOT NULL`); @@ -31,8 +31,8 @@ export class AlterActivityTable1640784835692 implements MigrationInterface { /** * PostgresDB Down Migration - * - * @param queryRunner + * + * @param queryRunner */ public async postgresDownQueryRunner(queryRunner: QueryRunner): Promise { await queryRunner.query(`ALTER TABLE "activity" ALTER COLUMN "title" SET NOT NULL`); @@ -40,8 +40,8 @@ export class AlterActivityTable1640784835692 implements MigrationInterface { /** * SqliteDB Up Migration - * - * @param queryRunner + * + * @param queryRunner */ public async sqliteUpQueryRunner(queryRunner: QueryRunner): Promise { await queryRunner.query(`DROP INDEX "IDX_2743f8990fde12f9586287eb09"`); @@ -96,8 +96,8 @@ export class AlterActivityTable1640784835692 implements MigrationInterface { /** * SqliteDB Down Migration - * - * @param queryRunner + * + * @param queryRunner */ public async sqliteDownQueryRunner(queryRunner: QueryRunner): Promise { await queryRunner.query(`DROP INDEX "IDX_f2401d8fdff5d8970dfe30d3ae"`); @@ -149,4 +149,4 @@ export class AlterActivityTable1640784835692 implements MigrationInterface { await queryRunner.query(`CREATE INDEX "IDX_4e382caaf07ab0923b2e06bf91" ON "activity" ("timeSlotId") `); await queryRunner.query(`CREATE INDEX "IDX_2743f8990fde12f9586287eb09" ON "activity" ("taskId") `); } -} \ No newline at end of file +} diff --git a/packages/core/src/database/migrations/1642411409517-AlterCandidateEmployeeTable.ts b/packages/core/src/database/migrations/1642411409517-AlterCandidateEmployeeTable.ts index 91c263ca0fa..d5568f2ccfe 100644 --- a/packages/core/src/database/migrations/1642411409517-AlterCandidateEmployeeTable.ts +++ b/packages/core/src/database/migrations/1642411409517-AlterCandidateEmployeeTable.ts @@ -1,11 +1,11 @@ import { MigrationInterface, QueryRunner } from "typeorm"; - + export class AlterCandidateEmployeeTable1642411409517 implements MigrationInterface { name = 'AlterCandidateEmployeeTable1642411409517'; public async up(queryRunner: QueryRunner): Promise { - if (queryRunner.connection.options.type === 'sqlite') { + if (['sqlite', 'better-sqlite3'].includes(queryRunner.connection.options.type)) { await this.sqliteUpQueryRunner(queryRunner); } else { await this.postgresUpQueryRunner(queryRunner); @@ -13,17 +13,17 @@ export class AlterCandidateEmployeeTable1642411409517 implements MigrationInterf } public async down(queryRunner: QueryRunner): Promise { - if (queryRunner.connection.options.type === 'sqlite') { + if (['sqlite', 'better-sqlite3'].includes(queryRunner.connection.options.type)) { await this.sqliteDownQueryRunner(queryRunner); } else { await this.postgresDownQueryRunner(queryRunner); } } - + /** * PostgresDB Up Migration - * - * @param queryRunner + * + * @param queryRunner */ public async postgresUpQueryRunner(queryRunner: QueryRunner): Promise { await queryRunner.query(`ALTER TABLE "candidate" ADD "employeeId" uuid`); @@ -33,11 +33,11 @@ export class AlterCandidateEmployeeTable1642411409517 implements MigrationInterf await queryRunner.query(`CREATE INDEX "IDX_8b900e8a39f76125e610ab30c0" ON "candidate" ("employeeId") `); await queryRunner.query(`ALTER TABLE "candidate" ADD CONSTRAINT "FK_8b900e8a39f76125e610ab30c0e" FOREIGN KEY ("employeeId") REFERENCES "employee"("id") ON DELETE NO ACTION ON UPDATE NO ACTION`); } - + /** * PostgresDB Down Migration - * - * @param queryRunner + * + * @param queryRunner */ public async postgresDownQueryRunner(queryRunner: QueryRunner): Promise { await queryRunner.query(`ALTER TABLE "candidate" DROP CONSTRAINT "FK_8b900e8a39f76125e610ab30c0e"`); @@ -50,8 +50,8 @@ export class AlterCandidateEmployeeTable1642411409517 implements MigrationInterf /** * SqliteDB Up Migration - * - * @param queryRunner + * + * @param queryRunner */ public async sqliteUpQueryRunner(queryRunner: QueryRunner): Promise { await queryRunner.query(`DROP INDEX "IDX_3930aa71e0fa24f09201811b1b"`); @@ -101,8 +101,8 @@ export class AlterCandidateEmployeeTable1642411409517 implements MigrationInterf /** * SqliteDB Down Migration - * - * @param queryRunner + * + * @param queryRunner */ public async sqliteDownQueryRunner(queryRunner: QueryRunner): Promise { await queryRunner.query(`DROP INDEX "IDX_8b900e8a39f76125e610ab30c0"`); @@ -149,4 +149,4 @@ export class AlterCandidateEmployeeTable1642411409517 implements MigrationInterf await queryRunner.query(`CREATE INDEX "IDX_4ea108fd8b089237964d5f98fb" ON "candidate" ("sourceId") `); await queryRunner.query(`CREATE INDEX "IDX_3930aa71e0fa24f09201811b1b" ON "candidate" ("userId") `); } -} \ No newline at end of file +} diff --git a/packages/core/src/database/migrations/1642770124831-AlterEmailHistoryTable.ts b/packages/core/src/database/migrations/1642770124831-AlterEmailHistoryTable.ts index 57dae735ddf..6a9d8f0848f 100644 --- a/packages/core/src/database/migrations/1642770124831-AlterEmailHistoryTable.ts +++ b/packages/core/src/database/migrations/1642770124831-AlterEmailHistoryTable.ts @@ -1,11 +1,11 @@ import { MigrationInterface, QueryRunner } from "typeorm"; - + export class AlterEmailHistoryTable1642770124831 implements MigrationInterface { name = 'AlterEmailHistoryTable1642770124831'; - + public async up(queryRunner: QueryRunner): Promise { - if (queryRunner.connection.options.type === 'sqlite') { + if (['sqlite', 'better-sqlite3'].includes(queryRunner.connection.options.type)) { await this.sqliteUpQueryRunner(queryRunner); } else { await this.postgresUpQueryRunner(queryRunner); @@ -13,7 +13,7 @@ export class AlterEmailHistoryTable1642770124831 implements MigrationInterface { } public async down(queryRunner: QueryRunner): Promise { - if (queryRunner.connection.options.type === 'sqlite') { + if (['sqlite', 'better-sqlite3'].includes(queryRunner.connection.options.type)) { await this.sqliteDownQueryRunner(queryRunner); } else { await this.postgresDownQueryRunner(queryRunner); @@ -22,8 +22,8 @@ export class AlterEmailHistoryTable1642770124831 implements MigrationInterface { /** * PostgresDB Up Migration - * - * @param queryRunner + * + * @param queryRunner */ public async postgresUpQueryRunner(queryRunner: QueryRunner): Promise { await queryRunner.query(`ALTER TABLE "email_sent" ALTER COLUMN "name" DROP NOT NULL`); @@ -33,8 +33,8 @@ export class AlterEmailHistoryTable1642770124831 implements MigrationInterface { /** * PostgresDB Down Migration - * - * @param queryRunner + * + * @param queryRunner */ public async postgresDownQueryRunner(queryRunner: QueryRunner): Promise { await queryRunner.query(`DROP INDEX "public"."IDX_a954fda57cca81dc48446e73b8"`); @@ -44,8 +44,8 @@ export class AlterEmailHistoryTable1642770124831 implements MigrationInterface { /** * SqliteDB Up Migration - * - * @param queryRunner + * + * @param queryRunner */ public async sqliteUpQueryRunner(queryRunner: QueryRunner): Promise { await queryRunner.query(`DROP INDEX "IDX_5e719204dcafa8d6b2ecdeda13"`); @@ -105,8 +105,8 @@ export class AlterEmailHistoryTable1642770124831 implements MigrationInterface { /** * SqliteDB Down Migration - * - * @param queryRunner + * + * @param queryRunner */ public async sqliteDownQueryRunner(queryRunner: QueryRunner): Promise { await queryRunner.query(`DROP INDEX "IDX_a954fda57cca81dc48446e73b8"`); @@ -163,4 +163,4 @@ export class AlterEmailHistoryTable1642770124831 implements MigrationInterface { await queryRunner.query(`CREATE INDEX "IDX_1c0c1370ecd98040259625e17e" ON "employee" ("contactId") `); await queryRunner.query(`CREATE INDEX "IDX_5e719204dcafa8d6b2ecdeda13" ON "employee" ("organizationPositionId") `); } -} \ No newline at end of file +} diff --git a/packages/core/src/database/migrations/1643201180573-AlterTaskTable.ts b/packages/core/src/database/migrations/1643201180573-AlterTaskTable.ts index ca0a9c3bcd2..8219e8dc3be 100644 --- a/packages/core/src/database/migrations/1643201180573-AlterTaskTable.ts +++ b/packages/core/src/database/migrations/1643201180573-AlterTaskTable.ts @@ -1,11 +1,11 @@ import { MigrationInterface, QueryRunner } from "typeorm"; - + export class AlterTaskTable1643201180573 implements MigrationInterface { name = 'AlterTaskTable1643201180573'; public async up(queryRunner: QueryRunner): Promise { - if (queryRunner.connection.options.type === 'sqlite') { + if (['sqlite', 'better-sqlite3'].includes(queryRunner.connection.options.type)) { await this.sqliteUpQueryRunner(queryRunner); } else { await this.postgresUpQueryRunner(queryRunner); @@ -13,7 +13,7 @@ export class AlterTaskTable1643201180573 implements MigrationInterface { } public async down(queryRunner: QueryRunner): Promise { - if (queryRunner.connection.options.type === 'sqlite') { + if (['sqlite', 'better-sqlite3'].includes(queryRunner.connection.options.type)) { await this.sqliteDownQueryRunner(queryRunner); } else { await this.postgresDownQueryRunner(queryRunner); @@ -22,8 +22,8 @@ export class AlterTaskTable1643201180573 implements MigrationInterface { /** * PostgresDB Up Migration - * - * @param queryRunner + * + * @param queryRunner */ public async postgresUpQueryRunner(queryRunner: QueryRunner): Promise { await queryRunner.query(`ALTER TABLE "task" ALTER COLUMN "status" SET DEFAULT 'Todo'`); @@ -31,8 +31,8 @@ export class AlterTaskTable1643201180573 implements MigrationInterface { /** * PostgresDB Down Migration - * - * @param queryRunner + * + * @param queryRunner */ public async postgresDownQueryRunner(queryRunner: QueryRunner): Promise { await queryRunner.query(`ALTER TABLE "task" ALTER COLUMN "status" DROP DEFAULT`); @@ -40,8 +40,8 @@ export class AlterTaskTable1643201180573 implements MigrationInterface { /** * SqliteDB Up Migration - * - * @param queryRunner + * + * @param queryRunner */ public async sqliteUpQueryRunner(queryRunner: QueryRunner): Promise { await queryRunner.query(`DROP INDEX "IDX_1e1f64696aa3a26d3e12c840e5"`); @@ -62,8 +62,8 @@ export class AlterTaskTable1643201180573 implements MigrationInterface { /** * SqliteDB Down Migration - * - * @param queryRunner + * + * @param queryRunner */ public async sqliteDownQueryRunner(queryRunner: QueryRunner): Promise { await queryRunner.query(`DROP INDEX "IDX_e91cbff3d206f150ccc14d0c3a"`); @@ -81,4 +81,4 @@ export class AlterTaskTable1643201180573 implements MigrationInterface { await queryRunner.query(`CREATE INDEX "IDX_94fe6b3a5aec5f85427df4f8cd" ON "task" ("creatorId") `); await queryRunner.query(`CREATE INDEX "IDX_1e1f64696aa3a26d3e12c840e5" ON "task" ("organizationSprintId") `); } -} \ No newline at end of file +} diff --git a/packages/core/src/database/migrations/1643807301083-AlterRolePermissionTable.ts b/packages/core/src/database/migrations/1643807301083-AlterRolePermissionTable.ts index fd3ddf3f338..6df714fff5a 100644 --- a/packages/core/src/database/migrations/1643807301083-AlterRolePermissionTable.ts +++ b/packages/core/src/database/migrations/1643807301083-AlterRolePermissionTable.ts @@ -1,11 +1,11 @@ import { MigrationInterface, QueryRunner } from "typeorm"; - + export class AlterRolePermissionTable1643807301083 implements MigrationInterface { name = 'AlterRolePermissionTable1643807301083'; public async up(queryRunner: QueryRunner): Promise { - if (queryRunner.connection.options.type === 'sqlite') { + if (['sqlite', 'better-sqlite3'].includes(queryRunner.connection.options.type)) { await this.sqliteUpQueryRunner(queryRunner); } else { await this.postgresUpQueryRunner(queryRunner); @@ -13,7 +13,7 @@ export class AlterRolePermissionTable1643807301083 implements MigrationInterface } public async down(queryRunner: QueryRunner): Promise { - if (queryRunner.connection.options.type === 'sqlite') { + if (['sqlite', 'better-sqlite3'].includes(queryRunner.connection.options.type)) { await this.sqliteDownQueryRunner(queryRunner); } else { await this.postgresDownQueryRunner(queryRunner); @@ -22,8 +22,8 @@ export class AlterRolePermissionTable1643807301083 implements MigrationInterface /** * PostgresDB Up Migration - * - * @param queryRunner + * + * @param queryRunner */ public async postgresUpQueryRunner(queryRunner: QueryRunner): Promise { await queryRunner.query(`ALTER TABLE "role_permission" ADD "description" character varying`); @@ -31,8 +31,8 @@ export class AlterRolePermissionTable1643807301083 implements MigrationInterface /** * PostgresDB Down Migration - * - * @param queryRunner + * + * @param queryRunner */ public async postgresDownQueryRunner(queryRunner: QueryRunner): Promise { await queryRunner.query(`ALTER TABLE "role_permission" DROP COLUMN "description"`); @@ -40,8 +40,8 @@ export class AlterRolePermissionTable1643807301083 implements MigrationInterface /** * SqliteDB Up Migration - * - * @param queryRunner + * + * @param queryRunner */ public async sqliteUpQueryRunner(queryRunner: QueryRunner): Promise { await queryRunner.query(`DROP INDEX "IDX_e3130a39c1e4a740d044e68573"`); @@ -58,8 +58,8 @@ export class AlterRolePermissionTable1643807301083 implements MigrationInterface /** * SqliteDB Down Migration - * - * @param queryRunner + * + * @param queryRunner */ public async sqliteDownQueryRunner(queryRunner: QueryRunner): Promise { await queryRunner.query(`DROP INDEX "IDX_cbd053921056e77c0a8e03122a"`); @@ -73,4 +73,4 @@ export class AlterRolePermissionTable1643807301083 implements MigrationInterface await queryRunner.query(`CREATE INDEX "IDX_8307c5c44a4ad6210b767b17a9" ON "role_permission" ("permission") `); await queryRunner.query(`CREATE INDEX "IDX_e3130a39c1e4a740d044e68573" ON "role_permission" ("roleId") `); } -} \ No newline at end of file +} diff --git a/packages/core/src/database/migrations/1644491785525-AdjustTimeLogStopDate.ts b/packages/core/src/database/migrations/1644491785525-AdjustTimeLogStopDate.ts index 3d105ab39f5..4b6453d0935 100644 --- a/packages/core/src/database/migrations/1644491785525-AdjustTimeLogStopDate.ts +++ b/packages/core/src/database/migrations/1644491785525-AdjustTimeLogStopDate.ts @@ -2,17 +2,17 @@ import { MigrationInterface, QueryRunner } from "typeorm"; import { chain } from 'underscore'; import * as moment from 'moment'; import { isEmpty, isNotEmpty } from "@gauzy/common"; - + export class AdjustTimeLogStopDate1644491785525 implements MigrationInterface { name = 'AdjustTimeLogStopDate1644491785525'; - + public async up(queryRunner: QueryRunner): Promise { const timeSlots = await queryRunner.connection.manager.query(` - SELECT * FROM - "time_slot" - WHERE - "time_slot"."overall" < $1 OR + SELECT * FROM + "time_slot" + WHERE + "time_slot"."overall" < $1 OR "time_slot"."keyboard" < $2 OR "time_slot"."mouse" < $3 OR "time_slot"."duration" > $4 @@ -28,7 +28,7 @@ export class AdjustTimeLogStopDate1644491785525 implements MigrationInterface { "overall" = $2, "keyboard" = $3, "mouse" = $4 - WHERE + WHERE "id" IN($5)`, [ duration, @@ -41,15 +41,15 @@ export class AdjustTimeLogStopDate1644491785525 implements MigrationInterface { } const timelogs = await queryRunner.connection.manager.query(` - SELECT + SELECT "time_log"."id" AS "time_log_id", "time_slot"."id" AS "time_slot_id" FROM "time_log" - LEFT JOIN "time_slot_time_logs" - ON "time_slot_time_logs"."timeLogId" = "time_log"."id" + LEFT JOIN "time_slot_time_logs" + ON "time_slot_time_logs"."timeLogId" = "time_log"."id" LEFT JOIN "time_slot" ON "time_slot"."id" = "time_slot_time_logs"."timeSlotId" - WHERE + WHERE "time_log"."stoppedAt" IS NULL `); const timeLogs = chain(timelogs).groupBy((log: any) => log.time_log_id).value(); @@ -60,7 +60,7 @@ export class AdjustTimeLogStopDate1644491785525 implements MigrationInterface { ) .filter(Boolean); const [timeLog] = await queryRunner.connection.manager.query(` - SELECT * FROM "time_log" WHERE "time_log"."id" = $1 LIMIT 1`, + SELECT * FROM "time_log" WHERE "time_log"."id" = $1 LIMIT 1`, [ timeLogId ] @@ -72,10 +72,10 @@ export class AdjustTimeLogStopDate1644491785525 implements MigrationInterface { logDifference > 10 ) { await queryRunner.connection.manager.query(` - UPDATE "time_log" SET + UPDATE "time_log" SET "stoppedAt" = $1 - WHERE - "id" IN($2)`, + WHERE + "id" IN($2)`, [ timeLog.startedAt, timeLog.id @@ -83,11 +83,11 @@ export class AdjustTimeLogStopDate1644491785525 implements MigrationInterface { ); } else if (isNotEmpty(timeSlotsIds)) { const timeSlots = await queryRunner.connection.manager.query(` - SELECT * FROM - "time_slot" - WHERE - "time_slot"."id" IN ('${timeSlotsIds.join("','")}') - ORDER BY + SELECT * FROM + "time_slot" + WHERE + "time_slot"."id" IN ('${timeSlotsIds.join("','")}') + ORDER BY "time_slot"."startedAt" DESC `); let stoppedAt: any; @@ -98,7 +98,7 @@ export class AdjustTimeLogStopDate1644491785525 implements MigrationInterface { /** * Adjust stopped date as per database selection */ - if (queryRunner.connection.options.type === 'sqlite') { + if (['sqlite', 'better-sqlite3'].includes(queryRunner.connection.options.type)) { stoppedAt = moment.utc(lastTimeSlot.startedAt) .add(duration, 'seconds') .format('YYYY-MM-DD HH:mm:ss.SSS'); @@ -113,7 +113,7 @@ export class AdjustTimeLogStopDate1644491785525 implements MigrationInterface { await queryRunner.connection.manager.query(` UPDATE "time_log" SET "stoppedAt" = $1 - WHERE + WHERE "id" IN($2)`, [ stoppedAt, @@ -124,6 +124,6 @@ export class AdjustTimeLogStopDate1644491785525 implements MigrationInterface { } } } - + public async down(queryRunner: QueryRunner): Promise {} -} \ No newline at end of file +} diff --git a/packages/core/src/database/migrations/1644568289509-AlterTimeLogTable.ts b/packages/core/src/database/migrations/1644568289509-AlterTimeLogTable.ts index 2623d6f7f07..8cacf5fdb65 100644 --- a/packages/core/src/database/migrations/1644568289509-AlterTimeLogTable.ts +++ b/packages/core/src/database/migrations/1644568289509-AlterTimeLogTable.ts @@ -1,11 +1,11 @@ import { MigrationInterface, QueryRunner } from "typeorm"; - + export class AlterTimeLogTable1644568289509 implements MigrationInterface { name = 'AlterTimeLogTable1644568289509'; public async up(queryRunner: QueryRunner): Promise { - if (queryRunner.connection.options.type === 'sqlite') { + if (['sqlite', 'better-sqlite3'].includes(queryRunner.connection.options.type)) { await this.sqliteUpQueryRunner(queryRunner); } else { await this.postgresUpQueryRunner(queryRunner); @@ -13,7 +13,7 @@ export class AlterTimeLogTable1644568289509 implements MigrationInterface { } public async down(queryRunner: QueryRunner): Promise { - if (queryRunner.connection.options.type === 'sqlite') { + if (['sqlite', 'better-sqlite3'].includes(queryRunner.connection.options.type)) { await this.sqliteDownQueryRunner(queryRunner); } else { await this.postgresDownQueryRunner(queryRunner); @@ -22,8 +22,8 @@ export class AlterTimeLogTable1644568289509 implements MigrationInterface { /** * PostgresDB Up Migration - * - * @param queryRunner + * + * @param queryRunner */ public async postgresUpQueryRunner(queryRunner: QueryRunner): Promise { await queryRunner.query(`ALTER TABLE "time_log" ADD "isRunning" boolean`); @@ -31,8 +31,8 @@ export class AlterTimeLogTable1644568289509 implements MigrationInterface { /** * PostgresDB Down Migration - * - * @param queryRunner + * + * @param queryRunner */ public async postgresDownQueryRunner(queryRunner: QueryRunner): Promise { await queryRunner.query(`ALTER TABLE "time_log" DROP COLUMN "isRunning"`); @@ -40,8 +40,8 @@ export class AlterTimeLogTable1644568289509 implements MigrationInterface { /** * SqliteDB Up Migration - * - * @param queryRunner + * + * @param queryRunner */ public async sqliteUpQueryRunner(queryRunner: QueryRunner): Promise { await queryRunner.query(`DROP INDEX "IDX_d1e8f22c02c5e949453dde7f2d"`); @@ -66,8 +66,8 @@ export class AlterTimeLogTable1644568289509 implements MigrationInterface { /** * SqliteDB Down Migration - * - * @param queryRunner + * + * @param queryRunner */ public async sqliteDownQueryRunner(queryRunner: QueryRunner): Promise { await queryRunner.query(`DROP INDEX "IDX_fa9018cb248ea0f3b2b30ef143"`); @@ -89,4 +89,4 @@ export class AlterTimeLogTable1644568289509 implements MigrationInterface { await queryRunner.query(`CREATE INDEX "IDX_1ddf2da35e34378fd845d80a18" ON "time_log" ("taskId")`); await queryRunner.query(`CREATE INDEX "IDX_d1e8f22c02c5e949453dde7f2d" ON "time_log" ("organizationContactId")`); } -} \ No newline at end of file +} diff --git a/packages/core/src/database/migrations/1644915598578-AlterEmployeeTable.ts b/packages/core/src/database/migrations/1644915598578-AlterEmployeeTable.ts index df8dc32624e..6113dc48a10 100644 --- a/packages/core/src/database/migrations/1644915598578-AlterEmployeeTable.ts +++ b/packages/core/src/database/migrations/1644915598578-AlterEmployeeTable.ts @@ -1,11 +1,11 @@ import { MigrationInterface, QueryRunner } from "typeorm"; - + export class AlterEmployeeTable1644915598578 implements MigrationInterface { name = 'AlterEmployeeTable1644915598578'; public async up(queryRunner: QueryRunner): Promise { - if (queryRunner.connection.options.type === 'sqlite') { + if (['sqlite', 'better-sqlite3'].includes(queryRunner.connection.options.type)) { await this.sqliteUpQueryRunner(queryRunner); } else { await this.postgresUpQueryRunner(queryRunner); @@ -13,7 +13,7 @@ export class AlterEmployeeTable1644915598578 implements MigrationInterface { } public async down(queryRunner: QueryRunner): Promise { - if (queryRunner.connection.options.type === 'sqlite') { + if (['sqlite', 'better-sqlite3'].includes(queryRunner.connection.options.type)) { await this.sqliteDownQueryRunner(queryRunner); } else { await this.postgresDownQueryRunner(queryRunner); @@ -22,8 +22,8 @@ export class AlterEmployeeTable1644915598578 implements MigrationInterface { /** * PostgresDB Up Migration - * - * @param queryRunner + * + * @param queryRunner */ public async postgresUpQueryRunner(queryRunner: QueryRunner): Promise { await queryRunner.query(`ALTER TABLE "employee" ALTER COLUMN "totalWorkHours" DROP NOT NULL`); @@ -31,17 +31,17 @@ export class AlterEmployeeTable1644915598578 implements MigrationInterface { /** * PostgresDB Down Migration - * - * @param queryRunner + * + * @param queryRunner */ public async postgresDownQueryRunner(queryRunner: QueryRunner): Promise { await queryRunner.query(`ALTER TABLE "employee" ALTER COLUMN "totalWorkHours" SET NOT NULL`); } - + /** * SqliteDB Up Migration - * - * @param queryRunner + * + * @param queryRunner */ public async sqliteUpQueryRunner(queryRunner: QueryRunner): Promise { await queryRunner.query(`DROP INDEX "IDX_4b3303a6b7eb92d237a4379734"`); @@ -85,11 +85,11 @@ export class AlterEmployeeTable1644915598578 implements MigrationInterface { await queryRunner.query(`CREATE INDEX "IDX_1c0c1370ecd98040259625e17e" ON "employee" ("contactId") `); await queryRunner.query(`CREATE INDEX "IDX_5e719204dcafa8d6b2ecdeda13" ON "employee" ("organizationPositionId") `); } - + /** * SqliteDB Down Migration - * - * @param queryRunner + * + * @param queryRunner */ public async sqliteDownQueryRunner(queryRunner: QueryRunner): Promise { await queryRunner.query(`DROP INDEX "IDX_5e719204dcafa8d6b2ecdeda13"`); @@ -133,4 +133,4 @@ export class AlterEmployeeTable1644915598578 implements MigrationInterface { await queryRunner.query(`CREATE INDEX "IDX_c6a48286f3aa8ae903bee0d1e7" ON "employee" ("organizationId") `); await queryRunner.query(`CREATE INDEX "IDX_4b3303a6b7eb92d237a4379734" ON "employee" ("tenantId") `); } -} \ No newline at end of file +} diff --git a/packages/core/src/database/migrations/1645012749640-AlterPaymentTable.ts b/packages/core/src/database/migrations/1645012749640-AlterPaymentTable.ts index 80a9a03e204..a9601f61f11 100644 --- a/packages/core/src/database/migrations/1645012749640-AlterPaymentTable.ts +++ b/packages/core/src/database/migrations/1645012749640-AlterPaymentTable.ts @@ -1,11 +1,11 @@ import { MigrationInterface, QueryRunner } from "typeorm"; - + export class AlterPaymentTable1645012749640 implements MigrationInterface { name = 'AlterPaymentTable1645012749640'; public async up(queryRunner: QueryRunner): Promise { - if (queryRunner.connection.options.type === 'sqlite') { + if (['sqlite', 'better-sqlite3'].includes(queryRunner.connection.options.type)) { await this.sqliteUpQueryRunner(queryRunner); } else { await this.postgresUpQueryRunner(queryRunner); @@ -13,7 +13,7 @@ export class AlterPaymentTable1645012749640 implements MigrationInterface { } public async down(queryRunner: QueryRunner): Promise { - if (queryRunner.connection.options.type === 'sqlite') { + if (['sqlite', 'better-sqlite3'].includes(queryRunner.connection.options.type)) { await this.sqliteDownQueryRunner(queryRunner); } else { await this.postgresDownQueryRunner(queryRunner); @@ -22,8 +22,8 @@ export class AlterPaymentTable1645012749640 implements MigrationInterface { /** * PostgresDB Up Migration - * - * @param queryRunner + * + * @param queryRunner */ public async postgresUpQueryRunner(queryRunner: QueryRunner): Promise { await queryRunner.query(`ALTER TABLE "payment" DROP COLUMN "paymentMethod"`); @@ -33,8 +33,8 @@ export class AlterPaymentTable1645012749640 implements MigrationInterface { /** * PostgresDB Down Migration - * - * @param queryRunner + * + * @param queryRunner */ public async postgresDownQueryRunner(queryRunner: QueryRunner): Promise { await queryRunner.query(`ALTER TABLE "payment" DROP COLUMN "paymentMethod"`); @@ -44,15 +44,15 @@ export class AlterPaymentTable1645012749640 implements MigrationInterface { /** * SqliteDB Up Migration - * - * @param queryRunner + * + * @param queryRunner */ public async sqliteUpQueryRunner(queryRunner: QueryRunner): Promise {} /** * SqliteDB Down Migration - * - * @param queryRunner + * + * @param queryRunner */ public async sqliteDownQueryRunner(queryRunner: QueryRunner): Promise {} -} \ No newline at end of file +} diff --git a/packages/core/src/database/migrations/1645087150917-AlterEmailTable.ts b/packages/core/src/database/migrations/1645087150917-AlterEmailTable.ts index 4b2724d20bf..c37a9499211 100644 --- a/packages/core/src/database/migrations/1645087150917-AlterEmailTable.ts +++ b/packages/core/src/database/migrations/1645087150917-AlterEmailTable.ts @@ -1,11 +1,11 @@ import { MigrationInterface, QueryRunner } from "typeorm"; - + export class AlterEmailTable1645087150917 implements MigrationInterface { name = 'AlterEmailTable1645087150917'; public async up(queryRunner: QueryRunner): Promise { - if (queryRunner.connection.options.type === 'sqlite') { + if (['sqlite', 'better-sqlite3'].includes(queryRunner.connection.options.type)) { await this.sqliteUpQueryRunner(queryRunner); } else { await this.postgresUpQueryRunner(queryRunner); @@ -13,7 +13,7 @@ export class AlterEmailTable1645087150917 implements MigrationInterface { } public async down(queryRunner: QueryRunner): Promise { - if (queryRunner.connection.options.type === 'sqlite') { + if (['sqlite', 'better-sqlite3'].includes(queryRunner.connection.options.type)) { await this.sqliteDownQueryRunner(queryRunner); } else { await this.postgresDownQueryRunner(queryRunner); @@ -22,8 +22,8 @@ export class AlterEmailTable1645087150917 implements MigrationInterface { /** * PostgresDB Up Migration - * - * @param queryRunner + * + * @param queryRunner */ public async postgresUpQueryRunner(queryRunner: QueryRunner): Promise { await queryRunner.query(`ALTER TABLE "email_sent" ALTER COLUMN "isArchived" SET DEFAULT false`); @@ -35,8 +35,8 @@ export class AlterEmailTable1645087150917 implements MigrationInterface { /** * PostgresDB Down Migration - * - * @param queryRunner + * + * @param queryRunner */ public async postgresDownQueryRunner(queryRunner: QueryRunner): Promise { await queryRunner.query(`ALTER TABLE "email_sent" ALTER COLUMN "isArchived" DROP DEFAULT`); @@ -44,8 +44,8 @@ export class AlterEmailTable1645087150917 implements MigrationInterface { /** * SqliteDB Up Migration - * - * @param queryRunner + * + * @param queryRunner */ public async sqliteUpQueryRunner(queryRunner: QueryRunner): Promise { await queryRunner.query(`DROP INDEX "IDX_a954fda57cca81dc48446e73b8"`); @@ -70,8 +70,8 @@ export class AlterEmailTable1645087150917 implements MigrationInterface { /** * SqliteDB Down Migration - * - * @param queryRunner + * + * @param queryRunner */ public async sqliteDownQueryRunner(queryRunner: QueryRunner): Promise { await queryRunner.query(`DROP INDEX "IDX_1261c457b3035b77719556995b"`); @@ -89,4 +89,4 @@ export class AlterEmailTable1645087150917 implements MigrationInterface { await queryRunner.query(`CREATE INDEX "IDX_0af511c44de7a16beb45cc3785" ON "email_sent" ("tenantId") `); await queryRunner.query(`CREATE INDEX "IDX_a954fda57cca81dc48446e73b8" ON "email_sent" ("email") `); } -} \ No newline at end of file +} diff --git a/packages/core/src/database/migrations/1645179275947-AlterInvoiceTable.ts b/packages/core/src/database/migrations/1645179275947-AlterInvoiceTable.ts index 444abd07ea6..27f36f11422 100644 --- a/packages/core/src/database/migrations/1645179275947-AlterInvoiceTable.ts +++ b/packages/core/src/database/migrations/1645179275947-AlterInvoiceTable.ts @@ -1,11 +1,11 @@ import { MigrationInterface, QueryRunner } from "typeorm"; - + export class AlterInvoiceTable1645179275947 implements MigrationInterface { name = 'AlterInvoiceTable1645179275947'; public async up(queryRunner: QueryRunner): Promise { - if (queryRunner.connection.options.type === 'sqlite') { + if (['sqlite', 'better-sqlite3'].includes(queryRunner.connection.options.type)) { await this.sqliteUpQueryRunner(queryRunner); } else { await this.postgresUpQueryRunner(queryRunner); @@ -13,7 +13,7 @@ export class AlterInvoiceTable1645179275947 implements MigrationInterface { } public async down(queryRunner: QueryRunner): Promise { - if (queryRunner.connection.options.type === 'sqlite') { + if (['sqlite', 'better-sqlite3'].includes(queryRunner.connection.options.type)) { await this.sqliteDownQueryRunner(queryRunner); } else { await this.postgresDownQueryRunner(queryRunner); @@ -22,8 +22,8 @@ export class AlterInvoiceTable1645179275947 implements MigrationInterface { /** * PostgresDB Up Migration - * - * @param queryRunner + * + * @param queryRunner */ public async postgresUpQueryRunner(queryRunner: QueryRunner): Promise { await queryRunner.query(`ALTER TABLE "invoice" ALTER COLUMN "isArchived" SET DEFAULT false`); @@ -31,8 +31,8 @@ export class AlterInvoiceTable1645179275947 implements MigrationInterface { /** * PostgresDB Down Migration - * - * @param queryRunner + * + * @param queryRunner */ public async postgresDownQueryRunner(queryRunner: QueryRunner): Promise { await queryRunner.query(`ALTER TABLE "invoice" ALTER COLUMN "isArchived" DROP DEFAULT`); @@ -41,8 +41,8 @@ export class AlterInvoiceTable1645179275947 implements MigrationInterface { /** * SqliteDB Up Migration - * - * @param queryRunner + * + * @param queryRunner */ public async sqliteUpQueryRunner(queryRunner: QueryRunner): Promise { await queryRunner.query(`DROP INDEX "IDX_d9e965da0f63c94983d3a1006a"`); @@ -61,8 +61,8 @@ export class AlterInvoiceTable1645179275947 implements MigrationInterface { /** * SqliteDB Down Migration - * - * @param queryRunner + * + * @param queryRunner */ public async sqliteDownQueryRunner(queryRunner: QueryRunner): Promise { await queryRunner.query(`DROP INDEX "IDX_7fb52a5f267f53b7d93af3d8c3"`); @@ -78,4 +78,4 @@ export class AlterInvoiceTable1645179275947 implements MigrationInterface { await queryRunner.query(`CREATE INDEX "IDX_b5c33892e630b66c65d623baf8" ON "invoice" ("fromOrganizationId") `); await queryRunner.query(`CREATE INDEX "IDX_d9e965da0f63c94983d3a1006a" ON "invoice" ("toContactId") `); } -} \ No newline at end of file +} diff --git a/packages/core/src/database/migrations/1645441629137-AddTimeTrackingFeatureToEmployeeTable.ts b/packages/core/src/database/migrations/1645441629137-AddTimeTrackingFeatureToEmployeeTable.ts index 826c0d2b3ca..a46fe1af74f 100644 --- a/packages/core/src/database/migrations/1645441629137-AddTimeTrackingFeatureToEmployeeTable.ts +++ b/packages/core/src/database/migrations/1645441629137-AddTimeTrackingFeatureToEmployeeTable.ts @@ -1,11 +1,11 @@ import { MigrationInterface, QueryRunner } from "typeorm"; - + export class AddTimeTrackingFeatureToEmployeeTable1645441629137 implements MigrationInterface { name = 'AddTimeTrackingFeatureToEmployeeTable1645441629137'; public async up(queryRunner: QueryRunner): Promise { - if (queryRunner.connection.options.type === 'sqlite') { + if (['sqlite', 'better-sqlite3'].includes(queryRunner.connection.options.type)) { await this.sqliteUpQueryRunner(queryRunner); } else { await this.postgresUpQueryRunner(queryRunner); @@ -13,7 +13,7 @@ export class AddTimeTrackingFeatureToEmployeeTable1645441629137 implements Migra } public async down(queryRunner: QueryRunner): Promise { - if (queryRunner.connection.options.type === 'sqlite') { + if (['sqlite', 'better-sqlite3'].includes(queryRunner.connection.options.type)) { await this.sqliteDownQueryRunner(queryRunner); } else { await this.postgresDownQueryRunner(queryRunner); @@ -22,8 +22,8 @@ export class AddTimeTrackingFeatureToEmployeeTable1645441629137 implements Migra /** * PostgresDB Up Migration - * - * @param queryRunner + * + * @param queryRunner */ public async postgresUpQueryRunner(queryRunner: QueryRunner): Promise { await queryRunner.query(`ALTER TABLE "employee" ADD "isTrackingEnabled" boolean DEFAULT true`); @@ -31,8 +31,8 @@ export class AddTimeTrackingFeatureToEmployeeTable1645441629137 implements Migra /** * PostgresDB Down Migration - * - * @param queryRunner + * + * @param queryRunner */ public async postgresDownQueryRunner(queryRunner: QueryRunner): Promise { await queryRunner.query(`ALTER TABLE "employee" DROP COLUMN "isTrackingEnabled"`); @@ -41,8 +41,8 @@ export class AddTimeTrackingFeatureToEmployeeTable1645441629137 implements Migra /** * SqliteDB Up Migration - * - * @param queryRunner + * + * @param queryRunner */ public async sqliteUpQueryRunner(queryRunner: QueryRunner): Promise { await queryRunner.query(`DROP INDEX "IDX_5e719204dcafa8d6b2ecdeda13"`); @@ -65,8 +65,8 @@ export class AddTimeTrackingFeatureToEmployeeTable1645441629137 implements Migra /** * SqliteDB Down Migration - * - * @param queryRunner + * + * @param queryRunner */ public async sqliteDownQueryRunner(queryRunner: QueryRunner): Promise { await queryRunner.query(`DROP INDEX "IDX_4b3303a6b7eb92d237a4379734"`); @@ -86,4 +86,4 @@ export class AddTimeTrackingFeatureToEmployeeTable1645441629137 implements Migra await queryRunner.query(`CREATE INDEX "IDX_1c0c1370ecd98040259625e17e" ON "employee" ("contactId")`); await queryRunner.query(`CREATE INDEX "IDX_5e719204dcafa8d6b2ecdeda13" ON "employee" ("organizationPositionId")`); } -} \ No newline at end of file +} diff --git a/packages/core/src/database/migrations/1645726031706-AlterIntegrationTable.ts b/packages/core/src/database/migrations/1645726031706-AlterIntegrationTable.ts index 12a73fc49ed..b45e568ab29 100644 --- a/packages/core/src/database/migrations/1645726031706-AlterIntegrationTable.ts +++ b/packages/core/src/database/migrations/1645726031706-AlterIntegrationTable.ts @@ -1,11 +1,11 @@ import { MigrationInterface, QueryRunner } from "typeorm"; - + export class AlterIntegrationTable1645726031706 implements MigrationInterface { name = 'AlterIntegrationTable1645726031706'; - + public async up(queryRunner: QueryRunner): Promise { - if (queryRunner.connection.options.type === 'sqlite') { + if (['sqlite', 'better-sqlite3'].includes(queryRunner.connection.options.type)) { await this.sqliteUpQueryRunner(queryRunner); } else { await this.postgresUpQueryRunner(queryRunner); @@ -13,7 +13,7 @@ export class AlterIntegrationTable1645726031706 implements MigrationInterface { } public async down(queryRunner: QueryRunner): Promise { - if (queryRunner.connection.options.type === 'sqlite') { + if (['sqlite', 'better-sqlite3'].includes(queryRunner.connection.options.type)) { await this.sqliteDownQueryRunner(queryRunner); } else { await this.postgresDownQueryRunner(queryRunner); @@ -22,8 +22,8 @@ export class AlterIntegrationTable1645726031706 implements MigrationInterface { /** * PostgresDB Up Migration - * - * @param queryRunner + * + * @param queryRunner */ public async postgresUpQueryRunner(queryRunner: QueryRunner): Promise { await queryRunner.query(`ALTER TABLE "integration" ALTER COLUMN "freeTrialPeriod" DROP NOT NULL`); @@ -31,8 +31,8 @@ export class AlterIntegrationTable1645726031706 implements MigrationInterface { /** * PostgresDB Down Migration - * - * @param queryRunner + * + * @param queryRunner */ public async postgresDownQueryRunner(queryRunner: QueryRunner): Promise { await queryRunner.query(`ALTER TABLE "integration" ALTER COLUMN "freeTrialPeriod" SET NOT NULL`); @@ -41,8 +41,8 @@ export class AlterIntegrationTable1645726031706 implements MigrationInterface { /** * SqliteDB Up Migration - * - * @param queryRunner + * + * @param queryRunner */ public async sqliteUpQueryRunner(queryRunner: QueryRunner): Promise { await queryRunner.query(`CREATE TABLE "temporary_integration" ("id" varchar PRIMARY KEY NOT NULL, "createdAt" datetime NOT NULL DEFAULT (datetime('now')), "updatedAt" datetime NOT NULL DEFAULT (datetime('now')), "name" varchar NOT NULL, "imgSrc" varchar, "isComingSoon" boolean NOT NULL DEFAULT (0), "isPaid" boolean NOT NULL DEFAULT (0), "version" varchar, "docUrl" varchar, "isFreeTrial" boolean NOT NULL DEFAULT (0), "freeTrialPeriod" numeric NOT NULL DEFAULT (0), "order" integer)`); @@ -57,8 +57,8 @@ export class AlterIntegrationTable1645726031706 implements MigrationInterface { /** * SqliteDB Down Migration - * - * @param queryRunner + * + * @param queryRunner */ public async sqliteDownQueryRunner(queryRunner: QueryRunner): Promise { await queryRunner.query(`ALTER TABLE "integration" RENAME TO "temporary_integration"`); @@ -70,4 +70,4 @@ export class AlterIntegrationTable1645726031706 implements MigrationInterface { await queryRunner.query(`INSERT INTO "integration"("id", "createdAt", "updatedAt", "name", "imgSrc", "isComingSoon", "isPaid", "version", "docUrl", "isFreeTrial", "freeTrialPeriod", "order") SELECT "id", "createdAt", "updatedAt", "name", "imgSrc", "isComingSoon", "isPaid", "version", "docUrl", "isFreeTrial", "freeTrialPeriod", "order" FROM "temporary_integration"`); await queryRunner.query(`DROP TABLE "temporary_integration"`); } -} \ No newline at end of file +} diff --git a/packages/core/src/database/migrations/1646056129050-AlterEmployeeRecurringExpenseTable.ts b/packages/core/src/database/migrations/1646056129050-AlterEmployeeRecurringExpenseTable.ts index 2a2f3adf612..9fe69a5956c 100644 --- a/packages/core/src/database/migrations/1646056129050-AlterEmployeeRecurringExpenseTable.ts +++ b/packages/core/src/database/migrations/1646056129050-AlterEmployeeRecurringExpenseTable.ts @@ -1,11 +1,11 @@ import { MigrationInterface, QueryRunner } from "typeorm"; - + export class AlterEmployeeRecurringExpenseTable1646056129050 implements MigrationInterface { name = 'AlterEmployeeRecurringExpenseTable1646056129050'; public async up(queryRunner: QueryRunner): Promise { - if (queryRunner.connection.options.type === 'sqlite') { + if (['sqlite', 'better-sqlite3'].includes(queryRunner.connection.options.type)) { await this.sqliteUpQueryRunner(queryRunner); } else { await this.postgresUpQueryRunner(queryRunner); @@ -13,7 +13,7 @@ export class AlterEmployeeRecurringExpenseTable1646056129050 implements Migratio } public async down(queryRunner: QueryRunner): Promise { - if (queryRunner.connection.options.type === 'sqlite') { + if (['sqlite', 'better-sqlite3'].includes(queryRunner.connection.options.type)) { await this.sqliteDownQueryRunner(queryRunner); } else { await this.postgresDownQueryRunner(queryRunner); @@ -22,8 +22,8 @@ export class AlterEmployeeRecurringExpenseTable1646056129050 implements Migratio /** * PostgresDB Up Migration - * - * @param queryRunner + * + * @param queryRunner */ public async postgresUpQueryRunner(queryRunner: QueryRunner): Promise { await queryRunner.query(`ALTER TABLE "employee_recurring_expense" DROP CONSTRAINT "FK_0ac8526c48a3daa267c86225fb5"`); @@ -33,8 +33,8 @@ export class AlterEmployeeRecurringExpenseTable1646056129050 implements Migratio /** * PostgresDB Down Migration - * - * @param queryRunner + * + * @param queryRunner */ public async postgresDownQueryRunner(queryRunner: QueryRunner): Promise { await queryRunner.query(`ALTER TABLE "employee_recurring_expense" DROP CONSTRAINT "FK_0ac8526c48a3daa267c86225fb5"`); @@ -45,8 +45,8 @@ export class AlterEmployeeRecurringExpenseTable1646056129050 implements Migratio /** * SqliteDB Up Migration - * - * @param queryRunner + * + * @param queryRunner */ public async sqliteUpQueryRunner(queryRunner: QueryRunner): Promise { await queryRunner.query(`DROP INDEX "IDX_0ac8526c48a3daa267c86225fb"`); @@ -117,8 +117,8 @@ export class AlterEmployeeRecurringExpenseTable1646056129050 implements Migratio /** * SqliteDB Down Migration - * - * @param queryRunner + * + * @param queryRunner */ public async sqliteDownQueryRunner(queryRunner: QueryRunner): Promise { await queryRunner.query(`DROP INDEX "IDX_5fde7be40b3c03bc0fdac0c2f6"`); @@ -186,4 +186,4 @@ export class AlterEmployeeRecurringExpenseTable1646056129050 implements Migratio await queryRunner.query(`CREATE INDEX "IDX_6e570174fda71e97616e9d2eea" ON "employee_recurring_expense" ("parentRecurringExpenseId") `); await queryRunner.query(`CREATE INDEX "IDX_0ac8526c48a3daa267c86225fb" ON "employee_recurring_expense" ("employeeId") `); } -} \ No newline at end of file +} diff --git a/packages/core/src/database/migrations/1646117679347-AlterScreenshotTable.ts b/packages/core/src/database/migrations/1646117679347-AlterScreenshotTable.ts index 4181f22de4d..8c8c96e4dc0 100644 --- a/packages/core/src/database/migrations/1646117679347-AlterScreenshotTable.ts +++ b/packages/core/src/database/migrations/1646117679347-AlterScreenshotTable.ts @@ -1,11 +1,11 @@ import { MigrationInterface, QueryRunner } from "typeorm"; - + export class AlterScreenshotTable1646117679347 implements MigrationInterface { name = 'AlterScreenshotTable1646117679347'; public async up(queryRunner: QueryRunner): Promise { - if (queryRunner.connection.options.type === 'sqlite') { + if (['sqlite', 'better-sqlite3'].includes(queryRunner.connection.options.type)) { await this.sqliteUpQueryRunner(queryRunner); } else { await this.postgresUpQueryRunner(queryRunner); @@ -13,7 +13,7 @@ export class AlterScreenshotTable1646117679347 implements MigrationInterface { } public async down(queryRunner: QueryRunner): Promise { - if (queryRunner.connection.options.type === 'sqlite') { + if (['sqlite', 'better-sqlite3'].includes(queryRunner.connection.options.type)) { await this.sqliteDownQueryRunner(queryRunner); } else { await this.postgresDownQueryRunner(queryRunner); @@ -22,8 +22,8 @@ export class AlterScreenshotTable1646117679347 implements MigrationInterface { /** * PostgresDB Up Migration - * - * @param queryRunner + * + * @param queryRunner */ public async postgresUpQueryRunner(queryRunner: QueryRunner): Promise { await queryRunner.query(`CREATE TYPE "public"."screenshot_storageprovider_enum" AS ENUM('LOCAL', 'S3', 'WASABI')`); @@ -32,8 +32,8 @@ export class AlterScreenshotTable1646117679347 implements MigrationInterface { /** * PostgresDB Down Migration - * - * @param queryRunner + * + * @param queryRunner */ public async postgresDownQueryRunner(queryRunner: QueryRunner): Promise { await queryRunner.query(`ALTER TABLE "screenshot" DROP COLUMN "storageProvider"`); @@ -43,8 +43,8 @@ export class AlterScreenshotTable1646117679347 implements MigrationInterface { /** * SqliteDB Up Migration - * - * @param queryRunner + * + * @param queryRunner */ public async sqliteUpQueryRunner(queryRunner: QueryRunner): Promise { await queryRunner.query(`DROP INDEX "IDX_5b594d02d98d5defcde323abe5"`); @@ -61,8 +61,8 @@ export class AlterScreenshotTable1646117679347 implements MigrationInterface { /** * SqliteDB Down Migration - * - * @param queryRunner + * + * @param queryRunner */ public async sqliteDownQueryRunner(queryRunner: QueryRunner): Promise { await queryRunner.query(`DROP INDEX "IDX_235004f3dafac90692cd64d915"`); @@ -76,4 +76,4 @@ export class AlterScreenshotTable1646117679347 implements MigrationInterface { await queryRunner.query(`CREATE INDEX "IDX_0951aacffe3f8d0cff54cf2f34" ON "screenshot" ("organizationId") `); await queryRunner.query(`CREATE INDEX "IDX_5b594d02d98d5defcde323abe5" ON "screenshot" ("timeSlotId") `); } -} \ No newline at end of file +} diff --git a/packages/core/src/database/migrations/1646206946845-AlterExpenseTable.ts b/packages/core/src/database/migrations/1646206946845-AlterExpenseTable.ts index 01f4ac66e8d..1e41ae74ee7 100644 --- a/packages/core/src/database/migrations/1646206946845-AlterExpenseTable.ts +++ b/packages/core/src/database/migrations/1646206946845-AlterExpenseTable.ts @@ -1,11 +1,11 @@ import { MigrationInterface, QueryRunner } from "typeorm"; - + export class AlterExpenseTable1646206946845 implements MigrationInterface { name = 'AlterExpenseTable1646206946845'; public async up(queryRunner: QueryRunner): Promise { - if (queryRunner.connection.options.type === 'sqlite') { + if (['sqlite', 'better-sqlite3'].includes(queryRunner.connection.options.type)) { await this.sqliteUpQueryRunner(queryRunner); } else { await this.postgresUpQueryRunner(queryRunner); @@ -13,7 +13,7 @@ export class AlterExpenseTable1646206946845 implements MigrationInterface { } public async down(queryRunner: QueryRunner): Promise { - if (queryRunner.connection.options.type === 'sqlite') { + if (['sqlite', 'better-sqlite3'].includes(queryRunner.connection.options.type)) { await this.sqliteDownQueryRunner(queryRunner); } else { await this.postgresDownQueryRunner(queryRunner); @@ -22,8 +22,8 @@ export class AlterExpenseTable1646206946845 implements MigrationInterface { /** * PostgresDB Up Migration - * - * @param queryRunner + * + * @param queryRunner */ public async postgresUpQueryRunner(queryRunner: QueryRunner): Promise { await queryRunner.query(`ALTER TABLE "expense" DROP CONSTRAINT "FK_eacb116ab0521ad9b96f2bb53ba"`); @@ -34,8 +34,8 @@ export class AlterExpenseTable1646206946845 implements MigrationInterface { /** * PostgresDB Down Migration - * - * @param queryRunner + * + * @param queryRunner */ public async postgresDownQueryRunner(queryRunner: QueryRunner): Promise { await queryRunner.query(`ALTER TABLE "expense" DROP CONSTRAINT "FK_42eea5debc63f4d1bf89881c10a"`); @@ -47,8 +47,8 @@ export class AlterExpenseTable1646206946845 implements MigrationInterface { /** * SqliteDB Up Migration - * - * @param queryRunner + * + * @param queryRunner */ public async sqliteUpQueryRunner(queryRunner: QueryRunner): Promise { await queryRunner.query(`DROP INDEX "IDX_047b8b5c0782d5a6d4c8bfc1a4"`); @@ -163,8 +163,8 @@ export class AlterExpenseTable1646206946845 implements MigrationInterface { /** * SqliteDB Down Migration - * - * @param queryRunner + * + * @param queryRunner */ public async sqliteDownQueryRunner(queryRunner: QueryRunner): Promise { await queryRunner.query(`DROP INDEX "IDX_6d171c9d5f81095436b99da5e6"`); @@ -276,4 +276,4 @@ export class AlterExpenseTable1646206946845 implements MigrationInterface { await queryRunner.query(`CREATE INDEX "IDX_9971c4171ae051e74b833984a3" ON "expense" ("projectId") `); await queryRunner.query(`CREATE INDEX "IDX_047b8b5c0782d5a6d4c8bfc1a4" ON "expense" ("organizationContactId") `); } -} \ No newline at end of file +} diff --git a/packages/core/src/database/migrations/1647417832147-AlterActivityTable.ts b/packages/core/src/database/migrations/1647417832147-AlterActivityTable.ts index 13fcc05b0c4..e3d12eb5241 100644 --- a/packages/core/src/database/migrations/1647417832147-AlterActivityTable.ts +++ b/packages/core/src/database/migrations/1647417832147-AlterActivityTable.ts @@ -1,11 +1,11 @@ import { MigrationInterface, QueryRunner } from "typeorm"; - + export class AlterActivityTable1647417832147 implements MigrationInterface { name = 'AlterActivityTable1647417832147'; public async up(queryRunner: QueryRunner): Promise { - if (queryRunner.connection.options.type === 'sqlite') { + if (['sqlite', 'better-sqlite3'].includes(queryRunner.connection.options.type)) { await this.sqliteUpQueryRunner(queryRunner); } else { await this.postgresUpQueryRunner(queryRunner); @@ -13,7 +13,7 @@ export class AlterActivityTable1647417832147 implements MigrationInterface { } public async down(queryRunner: QueryRunner): Promise { - if (queryRunner.connection.options.type === 'sqlite') { + if (['sqlite', 'better-sqlite3'].includes(queryRunner.connection.options.type)) { await this.sqliteDownQueryRunner(queryRunner); } else { await this.postgresDownQueryRunner(queryRunner); @@ -22,8 +22,8 @@ export class AlterActivityTable1647417832147 implements MigrationInterface { /** * PostgresDB Up Migration - * - * @param queryRunner + * + * @param queryRunner */ public async postgresUpQueryRunner(queryRunner: QueryRunner): Promise { await queryRunner.query(`ALTER TABLE "activity" ADD "recordedAt" TIMESTAMP`); @@ -31,13 +31,13 @@ export class AlterActivityTable1647417832147 implements MigrationInterface { /** * PostgresDB Down Migration - * - * @param queryRunner + * + * @param queryRunner */ public async postgresDownQueryRunner(queryRunner: QueryRunner): Promise { await queryRunner.query(`ALTER TABLE "activity" DROP COLUMN "recordedAt"`); } - + public async sqliteUpQueryRunner(queryRunner: QueryRunner): Promise { await queryRunner.query(`DROP INDEX "IDX_f2401d8fdff5d8970dfe30d3ae"`); await queryRunner.query(`DROP INDEX "IDX_fdb3f018c2bba4885bfa5757d1"`); @@ -56,7 +56,7 @@ export class AlterActivityTable1647417832147 implements MigrationInterface { await queryRunner.query(`CREATE INDEX "IDX_4e382caaf07ab0923b2e06bf91" ON "activity" ("timeSlotId") `); await queryRunner.query(`CREATE INDEX "IDX_2743f8990fde12f9586287eb09" ON "activity" ("taskId") `); } - + public async sqliteDownQueryRunner(queryRunner: QueryRunner): Promise { await queryRunner.query(`DROP INDEX "IDX_2743f8990fde12f9586287eb09"`); await queryRunner.query(`DROP INDEX "IDX_4e382caaf07ab0923b2e06bf91"`); @@ -75,4 +75,4 @@ export class AlterActivityTable1647417832147 implements MigrationInterface { await queryRunner.query(`CREATE INDEX "IDX_fdb3f018c2bba4885bfa5757d1" ON "activity" ("organizationId") `); await queryRunner.query(`CREATE INDEX "IDX_f2401d8fdff5d8970dfe30d3ae" ON "activity" ("tenantId") `); } -} \ No newline at end of file +} diff --git a/packages/core/src/database/migrations/1648899149818-AlterTenantTable.ts b/packages/core/src/database/migrations/1648899149818-AlterTenantTable.ts index 38eaabb3722..e4888a25f51 100644 --- a/packages/core/src/database/migrations/1648899149818-AlterTenantTable.ts +++ b/packages/core/src/database/migrations/1648899149818-AlterTenantTable.ts @@ -1,11 +1,11 @@ import { MigrationInterface, QueryRunner } from "typeorm"; - + export class AlterTenantTable1648899149818 implements MigrationInterface { name = 'AlterTenantTable1648899149818'; public async up(queryRunner: QueryRunner): Promise { - if (queryRunner.connection.options.type === 'sqlite') { + if (['sqlite', 'better-sqlite3'].includes(queryRunner.connection.options.type)) { await this.sqliteUpQueryRunner(queryRunner); } else { await this.postgresUpQueryRunner(queryRunner); @@ -13,7 +13,7 @@ export class AlterTenantTable1648899149818 implements MigrationInterface { } public async down(queryRunner: QueryRunner): Promise { - if (queryRunner.connection.options.type === 'sqlite') { + if (['sqlite', 'better-sqlite3'].includes(queryRunner.connection.options.type)) { await this.sqliteDownQueryRunner(queryRunner); } else { await this.postgresDownQueryRunner(queryRunner); @@ -22,8 +22,8 @@ export class AlterTenantTable1648899149818 implements MigrationInterface { /** * PostgresDB Up Migration - * - * @param queryRunner + * + * @param queryRunner */ public async postgresUpQueryRunner(queryRunner: QueryRunner): Promise { await queryRunner.query(`ALTER TABLE "tenant" ADD "logo" character varying`); @@ -31,17 +31,17 @@ export class AlterTenantTable1648899149818 implements MigrationInterface { /** * PostgresDB Down Migration - * - * @param queryRunner + * + * @param queryRunner */ public async postgresDownQueryRunner(queryRunner: QueryRunner): Promise { await queryRunner.query(`ALTER TABLE "tenant" DROP COLUMN "logo"`); } - + /** * SqliteDB Up Migration - * - * @param queryRunner + * + * @param queryRunner */ public async sqliteUpQueryRunner(queryRunner: QueryRunner): Promise { await queryRunner.query(`DROP INDEX "IDX_56211336b5ff35fd944f225917"`); @@ -52,11 +52,11 @@ export class AlterTenantTable1648899149818 implements MigrationInterface { await queryRunner.query(`CREATE INDEX "IDX_56211336b5ff35fd944f225917" ON "tenant" ("name") `); await queryRunner.query(`CREATE INDEX "IDX_3062637d94040b8a277c5e6367" ON "tenant" ("logo") `); } - + /** * SqliteDB Down Migration - * - * @param queryRunner + * + * @param queryRunner */ public async sqliteDownQueryRunner(queryRunner: QueryRunner): Promise { await queryRunner.query(`DROP INDEX "IDX_3062637d94040b8a277c5e6367"`); @@ -67,4 +67,4 @@ export class AlterTenantTable1648899149818 implements MigrationInterface { await queryRunner.query(`DROP TABLE "temporary_tenant"`); await queryRunner.query(`CREATE INDEX "IDX_56211336b5ff35fd944f225917" ON "tenant" ("name") `); } -} \ No newline at end of file +} diff --git a/packages/core/src/database/migrations/1650532321598-AlterOrganizationProject.ts b/packages/core/src/database/migrations/1650532321598-AlterOrganizationProject.ts index aaedb92e65d..61de3104c42 100644 --- a/packages/core/src/database/migrations/1650532321598-AlterOrganizationProject.ts +++ b/packages/core/src/database/migrations/1650532321598-AlterOrganizationProject.ts @@ -6,7 +6,7 @@ export class AlterOrganizationProject1650532321598 implements MigrationInterface name = 'AlterOrganizationProject1650532321598'; public async up(queryRunner: QueryRunner): Promise { - if (queryRunner.connection.options.type === 'sqlite') { + if (['sqlite', 'better-sqlite3'].includes(queryRunner.connection.options.type)) { await this.sqliteUpQueryRunner(queryRunner); } else { await this.postgresUpQueryRunner(queryRunner); @@ -16,7 +16,7 @@ export class AlterOrganizationProject1650532321598 implements MigrationInterface } public async down(queryRunner: QueryRunner): Promise { - if (queryRunner.connection.options.type === 'sqlite') { + if (['sqlite', 'better-sqlite3'].includes(queryRunner.connection.options.type)) { await this.sqliteDownQueryRunner(queryRunner); } else { await this.postgresDownQueryRunner(queryRunner); diff --git a/packages/core/src/database/migrations/1650704972412-AlterChangelogTable.ts b/packages/core/src/database/migrations/1650704972412-AlterChangelogTable.ts index 6283ac5577c..b4086f932b8 100644 --- a/packages/core/src/database/migrations/1650704972412-AlterChangelogTable.ts +++ b/packages/core/src/database/migrations/1650704972412-AlterChangelogTable.ts @@ -5,7 +5,7 @@ export class AlterChangelogTable1650704972412 implements MigrationInterface { name = 'AlterChangelogTable1650704972412'; public async up(queryRunner: QueryRunner): Promise { - if (queryRunner.connection.options.type === 'sqlite') { + if (['sqlite', 'better-sqlite3'].includes(queryRunner.connection.options.type)) { await this.sqliteUpQueryRunner(queryRunner); } else { await this.postgresUpQueryRunner(queryRunner); @@ -13,7 +13,7 @@ export class AlterChangelogTable1650704972412 implements MigrationInterface { } public async down(queryRunner: QueryRunner): Promise { - if (queryRunner.connection.options.type === 'sqlite') { + if (['sqlite', 'better-sqlite3'].includes(queryRunner.connection.options.type)) { await this.sqliteDownQueryRunner(queryRunner); } else { await this.postgresDownQueryRunner(queryRunner); @@ -22,8 +22,8 @@ export class AlterChangelogTable1650704972412 implements MigrationInterface { /** * PostgresDB Up Migration - * - * @param queryRunner + * + * @param queryRunner */ public async postgresUpQueryRunner(queryRunner: QueryRunner): Promise { await queryRunner.query(`ALTER TABLE "changelog" ADD "isFeature" boolean`); @@ -33,19 +33,19 @@ export class AlterChangelogTable1650704972412 implements MigrationInterface { /** * PostgresDB Down Migration - * - * @param queryRunner + * + * @param queryRunner */ public async postgresDownQueryRunner(queryRunner: QueryRunner): Promise { await queryRunner.query(`ALTER TABLE "changelog" ALTER COLUMN "learnMoreUrl" SET NOT NULL`); await queryRunner.query(`ALTER TABLE "changelog" DROP COLUMN "imageUrl"`); await queryRunner.query(`ALTER TABLE "changelog" DROP COLUMN "isFeature"`); } - + /** * SqliteDB Up Migration - * - * @param queryRunner + * + * @param queryRunner */ public async sqliteUpQueryRunner(queryRunner: QueryRunner): Promise { await queryRunner.query(`DROP INDEX "IDX_c2037b621d2e8023898aee4ac7"`); @@ -65,11 +65,11 @@ export class AlterChangelogTable1650704972412 implements MigrationInterface { await queryRunner.query(`CREATE INDEX "IDX_c2037b621d2e8023898aee4ac7" ON "changelog" ("organizationId") `); await queryRunner.query(`CREATE INDEX "IDX_744268ee0ec6073883267bc3b6" ON "changelog" ("tenantId") `); } - + /** * SqliteDB Down Migration - * - * @param queryRunner + * + * @param queryRunner */ public async sqliteDownQueryRunner(queryRunner: QueryRunner): Promise { await queryRunner.query(`DROP INDEX "IDX_744268ee0ec6073883267bc3b6"`); @@ -89,4 +89,4 @@ export class AlterChangelogTable1650704972412 implements MigrationInterface { await queryRunner.query(`CREATE INDEX "IDX_744268ee0ec6073883267bc3b6" ON "changelog" ("tenantId") `); await queryRunner.query(`CREATE INDEX "IDX_c2037b621d2e8023898aee4ac7" ON "changelog" ("organizationId") `); } -} \ No newline at end of file +} diff --git a/packages/core/src/database/migrations/1652270907163-AlterTimeOffRequestTable.ts b/packages/core/src/database/migrations/1652270907163-AlterTimeOffRequestTable.ts index 58a8b9c98d7..3343d0a2889 100644 --- a/packages/core/src/database/migrations/1652270907163-AlterTimeOffRequestTable.ts +++ b/packages/core/src/database/migrations/1652270907163-AlterTimeOffRequestTable.ts @@ -1,10 +1,10 @@ import { MigrationInterface, QueryRunner } from "typeorm"; - + export class AlterTimeOffRequestTable1652270907163 implements MigrationInterface { name = 'AlterTimeOffRequestTable1652270907163'; public async up(queryRunner: QueryRunner): Promise { - if (queryRunner.connection.options.type === 'sqlite') { + if (['sqlite', 'better-sqlite3'].includes(queryRunner.connection.options.type)) { await this.sqliteUpQueryRunner(queryRunner); } else { await this.postgresUpQueryRunner(queryRunner); @@ -12,7 +12,7 @@ export class AlterTimeOffRequestTable1652270907163 implements MigrationInterface } public async down(queryRunner: QueryRunner): Promise { - if (queryRunner.connection.options.type === 'sqlite') { + if (['sqlite', 'better-sqlite3'].includes(queryRunner.connection.options.type)) { await this.sqliteDownQueryRunner(queryRunner); } else { await this.postgresDownQueryRunner(queryRunner); @@ -21,19 +21,19 @@ export class AlterTimeOffRequestTable1652270907163 implements MigrationInterface /** * PostgresDB Up Migration - * - * @param queryRunner + * + * @param queryRunner */ public async postgresUpQueryRunner(queryRunner: QueryRunner): Promise { await queryRunner.query(`ALTER TABLE "time_off_request" ALTER COLUMN "isHoliday" DROP NOT NULL`); await queryRunner.query(`ALTER TABLE "time_off_request" ALTER COLUMN "isHoliday" SET DEFAULT false`); await queryRunner.query(`ALTER TABLE "time_off_request" ALTER COLUMN "isArchived" SET DEFAULT false`); } - + /** * PostgresDB Down Migration - * - * @param queryRunner + * + * @param queryRunner */ public async postgresDownQueryRunner(queryRunner: QueryRunner): Promise { await queryRunner.query(`ALTER TABLE "time_off_request" ALTER COLUMN "isArchived" DROP DEFAULT`); @@ -43,8 +43,8 @@ export class AlterTimeOffRequestTable1652270907163 implements MigrationInterface /** * SqliteDB Up Migration - * - * @param queryRunner + * + * @param queryRunner */ public async sqliteUpQueryRunner(queryRunner: QueryRunner): Promise { await queryRunner.query(`DROP INDEX "IDX_c1f8ae47dc2f1882afc5045c73"`); @@ -71,8 +71,8 @@ export class AlterTimeOffRequestTable1652270907163 implements MigrationInterface /** * SqliteDB Down Migration - * - * @param queryRunner + * + * @param queryRunner */ public async sqliteDownQueryRunner(queryRunner: QueryRunner): Promise { await queryRunner.query(`DROP INDEX "IDX_4989834dd1c9c8ea3576ed99ce"`); @@ -96,4 +96,4 @@ export class AlterTimeOffRequestTable1652270907163 implements MigrationInterface await queryRunner.query(`CREATE INDEX "IDX_981333982a6df8b815957dcbf2" ON "time_off_request" ("organizationId") `); await queryRunner.query(`CREATE INDEX "IDX_c1f8ae47dc2f1882afc5045c73" ON "time_off_request" ("policyId") `); } -} \ No newline at end of file +} diff --git a/packages/core/src/database/migrations/1652703299052-AlterTaskTableColumns.ts b/packages/core/src/database/migrations/1652703299052-AlterTaskTableColumns.ts index 6823c5d36da..0aee8568ca1 100644 --- a/packages/core/src/database/migrations/1652703299052-AlterTaskTableColumns.ts +++ b/packages/core/src/database/migrations/1652703299052-AlterTaskTableColumns.ts @@ -5,7 +5,7 @@ export class AlterTaskTableColumns1652703299052 implements MigrationInterface { name = 'AlterTaskTableColumns1652703299052'; public async up(queryRunner: QueryRunner): Promise { - if (queryRunner.connection.options.type === 'sqlite') { + if (['sqlite', 'better-sqlite3'].includes(queryRunner.connection.options.type)) { await this.sqliteUpQueryRunner(queryRunner); } else { await this.postgresUpQueryRunner(queryRunner); @@ -13,7 +13,7 @@ export class AlterTaskTableColumns1652703299052 implements MigrationInterface { } public async down(queryRunner: QueryRunner): Promise { - if (queryRunner.connection.options.type === 'sqlite') { + if (['sqlite', 'better-sqlite3'].includes(queryRunner.connection.options.type)) { await this.sqliteDownQueryRunner(queryRunner); } else { await this.postgresDownQueryRunner(queryRunner); @@ -22,8 +22,8 @@ export class AlterTaskTableColumns1652703299052 implements MigrationInterface { /** * PostgresDB Up Migration - * - * @param queryRunner + * + * @param queryRunner */ public async postgresUpQueryRunner(queryRunner: QueryRunner): Promise { await queryRunner.query(`ALTER TABLE "task" ADD "number" integer`); @@ -33,8 +33,8 @@ export class AlterTaskTableColumns1652703299052 implements MigrationInterface { /** * PostgresDB Down Migration - * - * @param queryRunner + * + * @param queryRunner */ public async postgresDownQueryRunner(queryRunner: QueryRunner): Promise { await queryRunner.query(`DROP INDEX "public"."taskNumber"`); @@ -44,8 +44,8 @@ export class AlterTaskTableColumns1652703299052 implements MigrationInterface { /** * SqliteDB Up Migration - * - * @param queryRunner + * + * @param queryRunner */ public async sqliteUpQueryRunner(queryRunner: QueryRunner): Promise { await queryRunner.query(`DROP INDEX "IDX_e91cbff3d206f150ccc14d0c3a"`); @@ -67,8 +67,8 @@ export class AlterTaskTableColumns1652703299052 implements MigrationInterface { /** * SqliteDB Down Migration - * - * @param queryRunner + * + * @param queryRunner */ public async sqliteDownQueryRunner(queryRunner: QueryRunner): Promise { await queryRunner.query(`DROP INDEX "taskNumber"`); @@ -87,4 +87,4 @@ export class AlterTaskTableColumns1652703299052 implements MigrationInterface { await queryRunner.query(`CREATE INDEX "IDX_5b0272d923a31c972bed1a1ac4" ON "task" ("organizationId") `); await queryRunner.query(`CREATE INDEX "IDX_e91cbff3d206f150ccc14d0c3a" ON "task" ("tenantId") `); } -} \ No newline at end of file +} diff --git a/packages/core/src/database/migrations/1653482244724-AlterExpenseTable.ts b/packages/core/src/database/migrations/1653482244724-AlterExpenseTable.ts index 4052186f60f..8b5c7977373 100644 --- a/packages/core/src/database/migrations/1653482244724-AlterExpenseTable.ts +++ b/packages/core/src/database/migrations/1653482244724-AlterExpenseTable.ts @@ -5,7 +5,7 @@ export class AlterExpenseTable1653482244724 implements MigrationInterface { name = 'AlterExpenseTable1653482244724'; public async up(queryRunner: QueryRunner): Promise { - if (queryRunner.connection.options.type === 'sqlite') { + if (['sqlite', 'better-sqlite3'].includes(queryRunner.connection.options.type)) { await this.sqliteUpQueryRunner(queryRunner); } else { await this.postgresUpQueryRunner(queryRunner); @@ -13,7 +13,7 @@ export class AlterExpenseTable1653482244724 implements MigrationInterface { } public async down(queryRunner: QueryRunner): Promise { - if (queryRunner.connection.options.type === 'sqlite') { + if (['sqlite', 'better-sqlite3'].includes(queryRunner.connection.options.type)) { await this.sqliteDownQueryRunner(queryRunner); } else { await this.postgresDownQueryRunner(queryRunner); @@ -22,8 +22,8 @@ export class AlterExpenseTable1653482244724 implements MigrationInterface { /** * PostgresDB Up Migration - * - * @param queryRunner + * + * @param queryRunner */ public async postgresUpQueryRunner(queryRunner: QueryRunner): Promise { await queryRunner.query(`ALTER TABLE "expense" DROP CONSTRAINT "FK_eacb116ab0521ad9b96f2bb53ba"`); @@ -40,8 +40,8 @@ export class AlterExpenseTable1653482244724 implements MigrationInterface { /** * PostgresDB Down Migration - * - * @param queryRunner + * + * @param queryRunner */ public async postgresDownQueryRunner(queryRunner: QueryRunner): Promise { await queryRunner.query(`ALTER TABLE "expense" DROP CONSTRAINT "FK_42eea5debc63f4d1bf89881c10a"`); @@ -58,15 +58,15 @@ export class AlterExpenseTable1653482244724 implements MigrationInterface { /** * SqliteDB Up Migration - * - * @param queryRunner + * + * @param queryRunner */ public async sqliteUpQueryRunner(queryRunner: QueryRunner): Promise {} /** * SqliteDB Down Migration - * - * @param queryRunner + * + * @param queryRunner */ public async sqliteDownQueryRunner(queryRunner: QueryRunner): Promise {} -} \ No newline at end of file +} diff --git a/packages/core/src/database/migrations/1653742570167-AlterOrganizationContactTable.ts b/packages/core/src/database/migrations/1653742570167-AlterOrganizationContactTable.ts index 4a8ae6d3e3a..ed69fd2e046 100644 --- a/packages/core/src/database/migrations/1653742570167-AlterOrganizationContactTable.ts +++ b/packages/core/src/database/migrations/1653742570167-AlterOrganizationContactTable.ts @@ -5,7 +5,7 @@ export class AlterOrganizationContactTable1653742570167 implements MigrationInte name = 'AlterOrganizationContactTable1653742570167'; public async up(queryRunner: QueryRunner): Promise { - if (queryRunner.connection.options.type === 'sqlite') { + if (['sqlite', 'better-sqlite3'].includes(queryRunner.connection.options.type)) { await this.sqliteUpQueryRunner(queryRunner); } else { await this.postgresUpQueryRunner(queryRunner); @@ -13,7 +13,7 @@ export class AlterOrganizationContactTable1653742570167 implements MigrationInte } public async down(queryRunner: QueryRunner): Promise { - if (queryRunner.connection.options.type === 'sqlite') { + if (['sqlite', 'better-sqlite3'].includes(queryRunner.connection.options.type)) { await this.sqliteDownQueryRunner(queryRunner); } else { await this.postgresDownQueryRunner(queryRunner); @@ -22,8 +22,8 @@ export class AlterOrganizationContactTable1653742570167 implements MigrationInte /** * PostgresDB Up Migration - * - * @param queryRunner + * + * @param queryRunner */ public async postgresUpQueryRunner(queryRunner: QueryRunner): Promise { await queryRunner.query(`ALTER TABLE "organization_contact" DROP COLUMN "inviteStatus"`); @@ -39,8 +39,8 @@ export class AlterOrganizationContactTable1653742570167 implements MigrationInte /** * PostgresDB Down Migration - * - * @param queryRunner + * + * @param queryRunner */ public async postgresDownQueryRunner(queryRunner: QueryRunner): Promise { await queryRunner.query(`ALTER TABLE "organization_contact" DROP COLUMN "budgetType"`); @@ -56,8 +56,8 @@ export class AlterOrganizationContactTable1653742570167 implements MigrationInte /** * SqliteDB Up Migration - * - * @param queryRunner + * + * @param queryRunner */ public async sqliteUpQueryRunner(queryRunner: QueryRunner): Promise { await queryRunner.query(`DROP INDEX "IDX_a86d2e378b953cb39261f457d2"`); @@ -88,8 +88,8 @@ export class AlterOrganizationContactTable1653742570167 implements MigrationInte /** * SqliteDB Down Migration - * - * @param queryRunner + * + * @param queryRunner */ public async sqliteDownQueryRunner(queryRunner: QueryRunner): Promise { await queryRunner.query(`DROP INDEX "IDX_e68c43e315ad3aaea4e99cf461"`); @@ -103,7 +103,7 @@ export class AlterOrganizationContactTable1653742570167 implements MigrationInte await queryRunner.query(`CREATE INDEX "IDX_e68c43e315ad3aaea4e99cf461" ON "organization_contact" ("tenantId") `); await queryRunner.query(`CREATE INDEX "IDX_6200736cb4d3617b004e5b647f" ON "organization_contact" ("organizationId") `); await queryRunner.query(`CREATE INDEX "IDX_de33f92e042365d196d959e774" ON "organization_contact" ("name") `); - await queryRunner.query(`CREATE INDEX "IDX_a86d2e378b953cb39261f457d2" ON "organization_contact" ("contactId") `); + await queryRunner.query(`CREATE INDEX "IDX_a86d2e378b953cb39261f457d2" ON "organization_contact" ("contactId") `); await queryRunner.query(`DROP INDEX "IDX_e68c43e315ad3aaea4e99cf461"`); await queryRunner.query(`DROP INDEX "IDX_6200736cb4d3617b004e5b647f"`); await queryRunner.query(`DROP INDEX "IDX_de33f92e042365d196d959e774"`); @@ -117,4 +117,4 @@ export class AlterOrganizationContactTable1653742570167 implements MigrationInte await queryRunner.query(`CREATE INDEX "IDX_de33f92e042365d196d959e774" ON "organization_contact" ("name") `); await queryRunner.query(`CREATE INDEX "IDX_a86d2e378b953cb39261f457d2" ON "organization_contact" ("contactId") `); } -} \ No newline at end of file +} diff --git a/packages/core/src/database/migrations/1654675304373-SeedChangeLogFeature.ts b/packages/core/src/database/migrations/1654675304373-SeedChangeLogFeature.ts index 7e5a06be341..687a9b16c0c 100644 --- a/packages/core/src/database/migrations/1654675304373-SeedChangeLogFeature.ts +++ b/packages/core/src/database/migrations/1654675304373-SeedChangeLogFeature.ts @@ -38,7 +38,7 @@ export class SeedChangeLogFeature1654675304373 implements MigrationInterface { try { for await (const feature of features) { const payload = Object.values(feature); - if (queryRunner.connection.options.type === 'sqlite') { + if (['sqlite', 'better-sqlite3'].includes(queryRunner.connection.options.type)) { payload.push(uuidV4()); await queryRunner.connection.manager.query(` INSERT INTO "changelog" ("icon", "title", "date", "isFeature", "content", "learnMoreUrl", "imageUrl", "id") VALUES($1, $2, $3, $4, $5, $6, $7, $8)`, @@ -58,6 +58,6 @@ export class SeedChangeLogFeature1654675304373 implements MigrationInterface { } public async down(queryRunner: QueryRunner): Promise { - + } -} \ No newline at end of file +} diff --git a/packages/core/src/database/migrations/1655885355508-OrganizationProjectAlterTable.ts b/packages/core/src/database/migrations/1655885355508-OrganizationProjectAlterTable.ts index 6f33d93334c..f4ebc0e0206 100644 --- a/packages/core/src/database/migrations/1655885355508-OrganizationProjectAlterTable.ts +++ b/packages/core/src/database/migrations/1655885355508-OrganizationProjectAlterTable.ts @@ -5,7 +5,7 @@ export class OrganizationProjectAlterTable1655885355508 implements MigrationInte name = 'OrganizationProjectAlterTable1655885355508'; public async up(queryRunner: QueryRunner): Promise { - if (queryRunner.connection.options.type === 'sqlite') { + if (['sqlite', 'better-sqlite3'].includes(queryRunner.connection.options.type)) { await this.sqliteUpQueryRunner(queryRunner); } else { await this.postgresUpQueryRunner(queryRunner); @@ -13,7 +13,7 @@ export class OrganizationProjectAlterTable1655885355508 implements MigrationInte } public async down(queryRunner: QueryRunner): Promise { - if (queryRunner.connection.options.type === 'sqlite') { + if (['sqlite', 'better-sqlite3'].includes(queryRunner.connection.options.type)) { await this.sqliteDownQueryRunner(queryRunner); } else { await this.postgresDownQueryRunner(queryRunner); @@ -22,8 +22,8 @@ export class OrganizationProjectAlterTable1655885355508 implements MigrationInte /** * PostgresDB Up Migration - * - * @param queryRunner + * + * @param queryRunner */ public async postgresUpQueryRunner(queryRunner: QueryRunner): Promise { await queryRunner.query(`ALTER TABLE "organization_project" ADD "imageUrl" character varying(500)`); @@ -31,8 +31,8 @@ export class OrganizationProjectAlterTable1655885355508 implements MigrationInte /** * PostgresDB Down Migration - * - * @param queryRunner + * + * @param queryRunner */ public async postgresDownQueryRunner(queryRunner: QueryRunner): Promise { await queryRunner.query(`ALTER TABLE "organization_project" DROP COLUMN "imageUrl"`); @@ -40,8 +40,8 @@ export class OrganizationProjectAlterTable1655885355508 implements MigrationInte /** * SqliteDB Up Migration - * - * @param queryRunner + * + * @param queryRunner */ public async sqliteUpQueryRunner(queryRunner: QueryRunner): Promise { await queryRunner.query(`DROP INDEX "IDX_7cf84e8b5775f349f81a1f3cc4"`); @@ -62,8 +62,8 @@ export class OrganizationProjectAlterTable1655885355508 implements MigrationInte /** * SqliteDB Down Migration - * - * @param queryRunner + * + * @param queryRunner */ public async sqliteDownQueryRunner(queryRunner: QueryRunner): Promise { await queryRunner.query(`DROP INDEX "IDX_bc1e32c13683dbb16ada1c6da1"`); @@ -81,4 +81,4 @@ export class OrganizationProjectAlterTable1655885355508 implements MigrationInte await queryRunner.query(`CREATE INDEX "IDX_9d8afc1e1e64d4b7d48dd2229d" ON "organization_project" ("organizationId") `); await queryRunner.query(`CREATE INDEX "IDX_7cf84e8b5775f349f81a1f3cc4" ON "organization_project" ("tenantId") `); } -} \ No newline at end of file +} diff --git a/packages/core/src/database/migrations/1656833636109-AlterUserTable.ts b/packages/core/src/database/migrations/1656833636109-AlterUserTable.ts index 70417d814ce..78a81817570 100644 --- a/packages/core/src/database/migrations/1656833636109-AlterUserTable.ts +++ b/packages/core/src/database/migrations/1656833636109-AlterUserTable.ts @@ -5,7 +5,7 @@ export class AlterUserTable1656833636109 implements MigrationInterface { name = 'AlterUserTable1656833636109'; public async up(queryRunner: QueryRunner): Promise { - if (queryRunner.connection.options.type === 'sqlite') { + if (['sqlite', 'better-sqlite3'].includes(queryRunner.connection.options.type)) { await this.sqliteUpQueryRunner(queryRunner); } else { await this.postgresUpQueryRunner(queryRunner); @@ -13,7 +13,7 @@ export class AlterUserTable1656833636109 implements MigrationInterface { } public async down(queryRunner: QueryRunner): Promise { - if (queryRunner.connection.options.type === 'sqlite') { + if (['sqlite', 'better-sqlite3'].includes(queryRunner.connection.options.type)) { await this.sqliteDownQueryRunner(queryRunner); } else { await this.postgresDownQueryRunner(queryRunner); @@ -135,4 +135,4 @@ export class AlterUserTable1656833636109 implements MigrationInterface { await queryRunner.query(`CREATE INDEX "IDX_78a916df40e02a9deb1c4b75ed" ON "user" ("username") `); await queryRunner.query(`CREATE INDEX "IDX_c28e52f758e7bbc53828db9219" ON "user" ("roleId") `); } -} \ No newline at end of file +} diff --git a/packages/core/src/database/migrations/1659618978087-AlterInvoiceEstimateHistory.ts b/packages/core/src/database/migrations/1659618978087-AlterInvoiceEstimateHistory.ts index e4be2d2d4f0..cfb0698d4a0 100644 --- a/packages/core/src/database/migrations/1659618978087-AlterInvoiceEstimateHistory.ts +++ b/packages/core/src/database/migrations/1659618978087-AlterInvoiceEstimateHistory.ts @@ -5,7 +5,7 @@ export class AlterInvoiceEstimateHistory1659618978087 implements MigrationInterf name = 'AlterInvoiceEstimateHistory1659618978087'; public async up(queryRunner: QueryRunner): Promise { - if (queryRunner.connection.options.type === 'sqlite') { + if (['sqlite', 'better-sqlite3'].includes(queryRunner.connection.options.type)) { await this.sqliteUpQueryRunner(queryRunner); } else { await this.postgresUpQueryRunner(queryRunner); @@ -13,7 +13,7 @@ export class AlterInvoiceEstimateHistory1659618978087 implements MigrationInterf } public async down(queryRunner: QueryRunner): Promise { - if (queryRunner.connection.options.type === 'sqlite') { + if (['sqlite', 'better-sqlite3'].includes(queryRunner.connection.options.type)) { await this.sqliteDownQueryRunner(queryRunner); } else { await this.postgresDownQueryRunner(queryRunner); @@ -154,4 +154,4 @@ export class AlterInvoiceEstimateHistory1659618978087 implements MigrationInterf await queryRunner.query(`CREATE INDEX "IDX_da2893697d57368470952a76f6" ON "invoice_estimate_history" ("userId") `); await queryRunner.query(`CREATE INDEX "IDX_31ec3d5a6b0985cec544c64217" ON "invoice_estimate_history" ("invoiceId") `); } -} \ No newline at end of file +} diff --git a/packages/core/src/database/migrations/1659684413063-AlterContactTable.ts b/packages/core/src/database/migrations/1659684413063-AlterContactTable.ts index a7f4c2d97d9..42743a85f01 100644 --- a/packages/core/src/database/migrations/1659684413063-AlterContactTable.ts +++ b/packages/core/src/database/migrations/1659684413063-AlterContactTable.ts @@ -5,7 +5,7 @@ export class AlterContactTable1659684413063 implements MigrationInterface { name = 'AlterContactTable1659684413063'; public async up(queryRunner: QueryRunner): Promise { - if (queryRunner.connection.options.type === 'sqlite') { + if (['sqlite', 'better-sqlite3'].includes(queryRunner.connection.options.type)) { await this.sqliteUpQueryRunner(queryRunner); } else { await this.postgresUpQueryRunner(queryRunner); @@ -13,7 +13,7 @@ export class AlterContactTable1659684413063 implements MigrationInterface { } public async down(queryRunner: QueryRunner): Promise { - if (queryRunner.connection.options.type === 'sqlite') { + if (['sqlite', 'better-sqlite3'].includes(queryRunner.connection.options.type)) { await this.sqliteDownQueryRunner(queryRunner); } else { await this.postgresDownQueryRunner(queryRunner); @@ -75,4 +75,4 @@ export class AlterContactTable1659684413063 implements MigrationInterface { await queryRunner.query(`CREATE INDEX "IDX_60468af1ce34043a900809c84f" ON "contact" ("tenantId") `); await queryRunner.query(`CREATE INDEX "IDX_7719d73cd16a9f57ecc6ac24b3" ON "contact" ("organizationId") `); } -} \ No newline at end of file +} diff --git a/packages/core/src/database/migrations/1659696180759-AlterTenantTable.ts b/packages/core/src/database/migrations/1659696180759-AlterTenantTable.ts index 72d37c17f58..b9ba7321ae0 100644 --- a/packages/core/src/database/migrations/1659696180759-AlterTenantTable.ts +++ b/packages/core/src/database/migrations/1659696180759-AlterTenantTable.ts @@ -5,7 +5,7 @@ export class AlterTenantTable1659696180759 implements MigrationInterface { name = 'AlterTenantTable1659696180759'; public async up(queryRunner: QueryRunner): Promise { - if (queryRunner.connection.options.type === 'sqlite') { + if (['sqlite', 'better-sqlite3'].includes(queryRunner.connection.options.type)) { await this.sqliteUpQueryRunner(queryRunner); } else { await this.postgresUpQueryRunner(queryRunner); @@ -13,7 +13,7 @@ export class AlterTenantTable1659696180759 implements MigrationInterface { } public async down(queryRunner: QueryRunner): Promise { - if (queryRunner.connection.options.type === 'sqlite') { + if (['sqlite', 'better-sqlite3'].includes(queryRunner.connection.options.type)) { await this.sqliteDownQueryRunner(queryRunner); } else { await this.postgresDownQueryRunner(queryRunner); @@ -51,4 +51,4 @@ export class AlterTenantTable1659696180759 implements MigrationInterface { public async sqliteDownQueryRunner(queryRunner: QueryRunner): Promise { await queryRunner.query(`CREATE INDEX "IDX_3062637d94040b8a277c5e6367" ON "tenant" ("logo") `); } -} \ No newline at end of file +} diff --git a/packages/core/src/database/migrations/1660988196279-AlterWarehouseProductTable.ts b/packages/core/src/database/migrations/1660988196279-AlterWarehouseProductTable.ts index 3122fdc71a6..79c69965364 100644 --- a/packages/core/src/database/migrations/1660988196279-AlterWarehouseProductTable.ts +++ b/packages/core/src/database/migrations/1660988196279-AlterWarehouseProductTable.ts @@ -11,7 +11,7 @@ export class AlterWarehouseProductTable1660988196279 implements MigrationInterfa * @param queryRunner */ public async up(queryRunner: QueryRunner): Promise { - if (queryRunner.connection.options.type === 'sqlite') { + if (['sqlite', 'better-sqlite3'].includes(queryRunner.connection.options.type)) { await this.sqliteUpQueryRunner(queryRunner); } else { await this.postgresUpQueryRunner(queryRunner); @@ -24,7 +24,7 @@ export class AlterWarehouseProductTable1660988196279 implements MigrationInterfa * @param queryRunner */ public async down(queryRunner: QueryRunner): Promise { - if (queryRunner.connection.options.type === 'sqlite') { + if (['sqlite', 'better-sqlite3'].includes(queryRunner.connection.options.type)) { await this.sqliteDownQueryRunner(queryRunner); } else { await this.postgresDownQueryRunner(queryRunner); diff --git a/packages/core/src/database/migrations/1661599336316-AlterWarehouseMerchant.ts b/packages/core/src/database/migrations/1661599336316-AlterWarehouseMerchant.ts index 86c9f25e3f8..06355e75439 100644 --- a/packages/core/src/database/migrations/1661599336316-AlterWarehouseMerchant.ts +++ b/packages/core/src/database/migrations/1661599336316-AlterWarehouseMerchant.ts @@ -11,7 +11,7 @@ export class AlterWarehouseMerchant1661599336316 implements MigrationInterface { * @param queryRunner */ public async up(queryRunner: QueryRunner): Promise { - if (queryRunner.connection.options.type === 'sqlite') { + if (['sqlite', 'better-sqlite3'].includes(queryRunner.connection.options.type)) { await this.sqliteUpQueryRunner(queryRunner); } else { await this.postgresUpQueryRunner(queryRunner); @@ -24,7 +24,7 @@ export class AlterWarehouseMerchant1661599336316 implements MigrationInterface { * @param queryRunner */ public async down(queryRunner: QueryRunner): Promise { - if (queryRunner.connection.options.type === 'sqlite') { + if (['sqlite', 'better-sqlite3'].includes(queryRunner.connection.options.type)) { await this.sqliteDownQueryRunner(queryRunner); } else { await this.postgresDownQueryRunner(queryRunner); diff --git a/packages/core/src/database/migrations/1661853087396-AlterTimesheetTable.ts b/packages/core/src/database/migrations/1661853087396-AlterTimesheetTable.ts index ea2f3101912..9fc858979dd 100644 --- a/packages/core/src/database/migrations/1661853087396-AlterTimesheetTable.ts +++ b/packages/core/src/database/migrations/1661853087396-AlterTimesheetTable.ts @@ -11,7 +11,7 @@ export class AlterTimesheetTable1661853087396 implements MigrationInterface { * @param queryRunner */ public async up(queryRunner: QueryRunner): Promise { - if (queryRunner.connection.options.type === 'sqlite') { + if (['sqlite', 'better-sqlite3'].includes(queryRunner.connection.options.type)) { await this.sqliteUpQueryRunner(queryRunner); } else { await this.postgresUpQueryRunner(queryRunner); @@ -24,7 +24,7 @@ export class AlterTimesheetTable1661853087396 implements MigrationInterface { * @param queryRunner */ public async down(queryRunner: QueryRunner): Promise { - if (queryRunner.connection.options.type === 'sqlite') { + if (['sqlite', 'better-sqlite3'].includes(queryRunner.connection.options.type)) { await this.sqliteDownQueryRunner(queryRunner); } else { await this.postgresDownQueryRunner(queryRunner); diff --git a/packages/core/src/database/migrations/1662994539197-AlterInvoiceTable.ts b/packages/core/src/database/migrations/1662994539197-AlterInvoiceTable.ts index 96b9b7da87b..79f96fc3f7b 100644 --- a/packages/core/src/database/migrations/1662994539197-AlterInvoiceTable.ts +++ b/packages/core/src/database/migrations/1662994539197-AlterInvoiceTable.ts @@ -11,7 +11,7 @@ export class AlterInvoiceTable1662994539197 implements MigrationInterface { * @param queryRunner */ public async up(queryRunner: QueryRunner): Promise { - if (queryRunner.connection.options.type === 'sqlite') { + if (['sqlite', 'better-sqlite3'].includes(queryRunner.connection.options.type)) { await this.sqliteUpQueryRunner(queryRunner); } else { await this.postgresUpQueryRunner(queryRunner); @@ -24,7 +24,7 @@ export class AlterInvoiceTable1662994539197 implements MigrationInterface { * @param queryRunner */ public async down(queryRunner: QueryRunner): Promise { - if (queryRunner.connection.options.type === 'sqlite') { + if (['sqlite', 'better-sqlite3'].includes(queryRunner.connection.options.type)) { await this.sqliteDownQueryRunner(queryRunner); } else { await this.postgresDownQueryRunner(queryRunner); diff --git a/packages/core/src/database/migrations/1664869127437-AlterCandidateFeedbackTable.ts b/packages/core/src/database/migrations/1664869127437-AlterCandidateFeedbackTable.ts index dd2d616b275..8d89b6ad28d 100644 --- a/packages/core/src/database/migrations/1664869127437-AlterCandidateFeedbackTable.ts +++ b/packages/core/src/database/migrations/1664869127437-AlterCandidateFeedbackTable.ts @@ -11,7 +11,7 @@ export class AlterCandidateFeedbackTable1664869127437 implements MigrationInterf * @param queryRunner */ public async up(queryRunner: QueryRunner): Promise { - if (queryRunner.connection.options.type === 'sqlite') { + if (['sqlite', 'better-sqlite3'].includes(queryRunner.connection.options.type)) { await this.sqliteUpQueryRunner(queryRunner); } else { await this.postgresUpQueryRunner(queryRunner); @@ -24,7 +24,7 @@ export class AlterCandidateFeedbackTable1664869127437 implements MigrationInterf * @param queryRunner */ public async down(queryRunner: QueryRunner): Promise { - if (queryRunner.connection.options.type === 'sqlite') { + if (['sqlite', 'better-sqlite3'].includes(queryRunner.connection.options.type)) { await this.sqliteDownQueryRunner(queryRunner); } else { await this.postgresDownQueryRunner(queryRunner); diff --git a/packages/core/src/database/migrations/1665044607000-AlterCandidateInterviewTable.ts b/packages/core/src/database/migrations/1665044607000-AlterCandidateInterviewTable.ts index f5e25e4586e..9b30f411ec7 100644 --- a/packages/core/src/database/migrations/1665044607000-AlterCandidateInterviewTable.ts +++ b/packages/core/src/database/migrations/1665044607000-AlterCandidateInterviewTable.ts @@ -11,7 +11,7 @@ export class AlterCandidateInterviewTable1665044607000 implements MigrationInter * @param queryRunner */ public async up(queryRunner: QueryRunner): Promise { - if (queryRunner.connection.options.type === 'sqlite') { + if (['sqlite', 'better-sqlite3'].includes(queryRunner.connection.options.type)) { await this.sqliteUpQueryRunner(queryRunner); } else { await this.postgresUpQueryRunner(queryRunner); @@ -24,7 +24,7 @@ export class AlterCandidateInterviewTable1665044607000 implements MigrationInter * @param queryRunner */ public async down(queryRunner: QueryRunner): Promise { - if (queryRunner.connection.options.type === 'sqlite') { + if (['sqlite', 'better-sqlite3'].includes(queryRunner.connection.options.type)) { await this.sqliteDownQueryRunner(queryRunner); } else { await this.postgresDownQueryRunner(queryRunner); diff --git a/packages/core/src/database/migrations/1665388204010-AlterWarehouseTable.ts b/packages/core/src/database/migrations/1665388204010-AlterWarehouseTable.ts index dae2c3a8006..458d1c7e1e0 100644 --- a/packages/core/src/database/migrations/1665388204010-AlterWarehouseTable.ts +++ b/packages/core/src/database/migrations/1665388204010-AlterWarehouseTable.ts @@ -11,7 +11,7 @@ export class AlterWarehouseTable1665388204010 implements MigrationInterface { * @param queryRunner */ public async up(queryRunner: QueryRunner): Promise { - if (queryRunner.connection.options.type === 'sqlite') { + if (['sqlite', 'better-sqlite3'].includes(queryRunner.connection.options.type)) { await this.sqliteUpQueryRunner(queryRunner); } else { await this.postgresUpQueryRunner(queryRunner); @@ -24,7 +24,7 @@ export class AlterWarehouseTable1665388204010 implements MigrationInterface { * @param queryRunner */ public async down(queryRunner: QueryRunner): Promise { - if (queryRunner.connection.options.type === 'sqlite') { + if (['sqlite', 'better-sqlite3'].includes(queryRunner.connection.options.type)) { await this.sqliteDownQueryRunner(queryRunner); } else { await this.postgresDownQueryRunner(queryRunner); diff --git a/packages/core/src/database/migrations/1665399395983-AlterOrganizationTable.ts b/packages/core/src/database/migrations/1665399395983-AlterOrganizationTable.ts index e6682b681bf..1596755ae7d 100644 --- a/packages/core/src/database/migrations/1665399395983-AlterOrganizationTable.ts +++ b/packages/core/src/database/migrations/1665399395983-AlterOrganizationTable.ts @@ -11,7 +11,7 @@ export class AlterOrganizationTable1665399395983 implements MigrationInterface { * @param queryRunner */ public async up(queryRunner: QueryRunner): Promise { - if (queryRunner.connection.options.type === 'sqlite') { + if (['sqlite', 'better-sqlite3'].includes(queryRunner.connection.options.type)) { await this.sqliteUpQueryRunner(queryRunner); } else { await this.postgresUpQueryRunner(queryRunner); @@ -24,7 +24,7 @@ export class AlterOrganizationTable1665399395983 implements MigrationInterface { * @param queryRunner */ public async down(queryRunner: QueryRunner): Promise { - if (queryRunner.connection.options.type === 'sqlite') { + if (['sqlite', 'better-sqlite3'].includes(queryRunner.connection.options.type)) { await this.sqliteDownQueryRunner(queryRunner); } else { await this.postgresDownQueryRunner(queryRunner); diff --git a/packages/core/src/database/migrations/1665767813286-AltereInviteTable.ts b/packages/core/src/database/migrations/1665767813286-AltereInviteTable.ts index 1cbb484c0d4..5d973123799 100644 --- a/packages/core/src/database/migrations/1665767813286-AltereInviteTable.ts +++ b/packages/core/src/database/migrations/1665767813286-AltereInviteTable.ts @@ -11,7 +11,7 @@ export class AltereInviteTable1665767813286 implements MigrationInterface { * @param queryRunner */ public async up(queryRunner: QueryRunner): Promise { - if (queryRunner.connection.options.type === 'sqlite') { + if (['sqlite', 'better-sqlite3'].includes(queryRunner.connection.options.type)) { await this.sqliteUpQueryRunner(queryRunner); } else { await this.postgresUpQueryRunner(queryRunner); @@ -24,7 +24,7 @@ export class AltereInviteTable1665767813286 implements MigrationInterface { * @param queryRunner */ public async down(queryRunner: QueryRunner): Promise { - if (queryRunner.connection.options.type === 'sqlite') { + if (['sqlite', 'better-sqlite3'].includes(queryRunner.connection.options.type)) { await this.sqliteDownQueryRunner(queryRunner); } else { await this.postgresDownQueryRunner(queryRunner); diff --git a/packages/core/src/database/migrations/1666007548644-AlterEmployeeTable.ts b/packages/core/src/database/migrations/1666007548644-AlterEmployeeTable.ts index 21c4e1e0411..a5f46134a96 100644 --- a/packages/core/src/database/migrations/1666007548644-AlterEmployeeTable.ts +++ b/packages/core/src/database/migrations/1666007548644-AlterEmployeeTable.ts @@ -11,7 +11,7 @@ export class AlterEmployeeTable1666007548644 implements MigrationInterface { * @param queryRunner */ public async up(queryRunner: QueryRunner): Promise { - if (queryRunner.connection.options.type === 'sqlite') { + if (['sqlite', 'better-sqlite3'].includes(queryRunner.connection.options.type)) { await this.sqliteUpQueryRunner(queryRunner); } else { await this.postgresUpQueryRunner(queryRunner); @@ -24,7 +24,7 @@ export class AlterEmployeeTable1666007548644 implements MigrationInterface { * @param queryRunner */ public async down(queryRunner: QueryRunner): Promise { - if (queryRunner.connection.options.type === 'sqlite') { + if (['sqlite', 'better-sqlite3'].includes(queryRunner.connection.options.type)) { await this.sqliteDownQueryRunner(queryRunner); } else { await this.postgresDownQueryRunner(queryRunner); @@ -98,4 +98,4 @@ export class AlterEmployeeTable1666007548644 implements MigrationInterface { await queryRunner.query(`CREATE INDEX "IDX_c34e79a3aa682bbd3f0e8cf4c4" ON "organization_department_employee" ("organizationDepartmentId") `); await queryRunner.query(`CREATE INDEX "IDX_0d4f83695591ae3c98a0544ac8" ON "organization_department_employee" ("employeeId") `); } -} \ No newline at end of file +} diff --git a/packages/core/src/database/migrations/1666181221327-AlterOrganizationTable.ts b/packages/core/src/database/migrations/1666181221327-AlterOrganizationTable.ts index ed7888d3ca0..161df4c1e72 100644 --- a/packages/core/src/database/migrations/1666181221327-AlterOrganizationTable.ts +++ b/packages/core/src/database/migrations/1666181221327-AlterOrganizationTable.ts @@ -11,7 +11,7 @@ export class AlterOrganizationTable1666181221327 implements MigrationInterface { * @param queryRunner */ public async up(queryRunner: QueryRunner): Promise { - if (queryRunner.connection.options.type === 'sqlite') { + if (['sqlite', 'better-sqlite3'].includes(queryRunner.connection.options.type)) { await this.sqliteUpQueryRunner(queryRunner); } else { await this.postgresUpQueryRunner(queryRunner); @@ -24,7 +24,7 @@ export class AlterOrganizationTable1666181221327 implements MigrationInterface { * @param queryRunner */ public async down(queryRunner: QueryRunner): Promise { - if (queryRunner.connection.options.type === 'sqlite') { + if (['sqlite', 'better-sqlite3'].includes(queryRunner.connection.options.type)) { await this.sqliteDownQueryRunner(queryRunner); } else { await this.postgresDownQueryRunner(queryRunner); diff --git a/packages/core/src/database/migrations/1666780716428-AlterEmployeeTable.ts b/packages/core/src/database/migrations/1666780716428-AlterEmployeeTable.ts index a9b6109cff2..45a6e55c0ca 100644 --- a/packages/core/src/database/migrations/1666780716428-AlterEmployeeTable.ts +++ b/packages/core/src/database/migrations/1666780716428-AlterEmployeeTable.ts @@ -11,7 +11,7 @@ export class AlterEmployeeTable1666780716428 implements MigrationInterface { * @param queryRunner */ public async up(queryRunner: QueryRunner): Promise { - if (queryRunner.connection.options.type === 'sqlite') { + if (['sqlite', 'better-sqlite3'].includes(queryRunner.connection.options.type)) { await this.sqliteUpQueryRunner(queryRunner); } else { await this.postgresUpQueryRunner(queryRunner); @@ -24,7 +24,7 @@ export class AlterEmployeeTable1666780716428 implements MigrationInterface { * @param queryRunner */ public async down(queryRunner: QueryRunner): Promise { - if (queryRunner.connection.options.type === 'sqlite') { + if (['sqlite', 'better-sqlite3'].includes(queryRunner.connection.options.type)) { await this.sqliteDownQueryRunner(queryRunner); } else { await this.postgresDownQueryRunner(queryRunner); @@ -94,6 +94,6 @@ export class AlterEmployeeTable1666780716428 implements MigrationInterface { await queryRunner.query(`CREATE INDEX "IDX_f4b0d329c4a3cf79ffe9d56504" ON "employee" ("userId") `); await queryRunner.query(`CREATE INDEX "IDX_96dfbcaa2990df01fe5bb39ccc" ON "employee" ("profile_link") `); await queryRunner.query(`CREATE INDEX "IDX_c6a48286f3aa8ae903bee0d1e7" ON "employee" ("organizationId") `); - await queryRunner.query(`CREATE INDEX "IDX_4b3303a6b7eb92d237a4379734" ON "employee" ("tenantId") `); + await queryRunner.query(`CREATE INDEX "IDX_4b3303a6b7eb92d237a4379734" ON "employee" ("tenantId") `); } } diff --git a/packages/core/src/database/migrations/1668064327561-AlterOrganizationTable.ts b/packages/core/src/database/migrations/1668064327561-AlterOrganizationTable.ts index 9d5c4d5c6e7..cc641c39406 100644 --- a/packages/core/src/database/migrations/1668064327561-AlterOrganizationTable.ts +++ b/packages/core/src/database/migrations/1668064327561-AlterOrganizationTable.ts @@ -11,7 +11,7 @@ export class AlterOrganizationTable1668064327561 implements MigrationInterface { * @param queryRunner */ public async up(queryRunner: QueryRunner): Promise { - if (queryRunner.connection.options.type === 'sqlite') { + if (['sqlite', 'better-sqlite3'].includes(queryRunner.connection.options.type)) { await this.sqliteUpQueryRunner(queryRunner); } else { await this.postgresUpQueryRunner(queryRunner); @@ -24,7 +24,7 @@ export class AlterOrganizationTable1668064327561 implements MigrationInterface { * @param queryRunner */ public async down(queryRunner: QueryRunner): Promise { - if (queryRunner.connection.options.type === 'sqlite') { + if (['sqlite', 'better-sqlite3'].includes(queryRunner.connection.options.type)) { await this.sqliteDownQueryRunner(queryRunner); } else { await this.postgresDownQueryRunner(queryRunner); diff --git a/packages/core/src/database/migrations/1668084518509-AlterEmployeeTableColumns.ts b/packages/core/src/database/migrations/1668084518509-AlterEmployeeTableColumns.ts index 8f817b7ff7b..20cb17ab3f6 100644 --- a/packages/core/src/database/migrations/1668084518509-AlterEmployeeTableColumns.ts +++ b/packages/core/src/database/migrations/1668084518509-AlterEmployeeTableColumns.ts @@ -11,7 +11,7 @@ export class AlterEmployeeTableColumns1668084518509 implements MigrationInterfac * @param queryRunner */ public async up(queryRunner: QueryRunner): Promise { - if (queryRunner.connection.options.type === 'sqlite') { + if (['sqlite', 'better-sqlite3'].includes(queryRunner.connection.options.type)) { await this.sqliteUpQueryRunner(queryRunner); } else { await this.postgresUpQueryRunner(queryRunner); @@ -24,7 +24,7 @@ export class AlterEmployeeTableColumns1668084518509 implements MigrationInterfac * @param queryRunner */ public async down(queryRunner: QueryRunner): Promise { - if (queryRunner.connection.options.type === 'sqlite') { + if (['sqlite', 'better-sqlite3'].includes(queryRunner.connection.options.type)) { await this.sqliteDownQueryRunner(queryRunner); } else { await this.postgresDownQueryRunner(queryRunner); diff --git a/packages/core/src/database/migrations/1668256889786-AlterCustomSmtpTable.ts b/packages/core/src/database/migrations/1668256889786-AlterCustomSmtpTable.ts index 4aa5e61a9bd..d46d0cb7fc5 100644 --- a/packages/core/src/database/migrations/1668256889786-AlterCustomSmtpTable.ts +++ b/packages/core/src/database/migrations/1668256889786-AlterCustomSmtpTable.ts @@ -11,7 +11,7 @@ export class AlterCustomSmtpTable1668256889786 implements MigrationInterface { * @param queryRunner */ public async up(queryRunner: QueryRunner): Promise { - if (queryRunner.connection.options.type === 'sqlite') { + if (['sqlite', 'better-sqlite3'].includes(queryRunner.connection.options.type)) { await this.sqliteUpQueryRunner(queryRunner); } else { await this.postgresUpQueryRunner(queryRunner); @@ -24,7 +24,7 @@ export class AlterCustomSmtpTable1668256889786 implements MigrationInterface { * @param queryRunner */ public async down(queryRunner: QueryRunner): Promise { - if (queryRunner.connection.options.type === 'sqlite') { + if (['sqlite', 'better-sqlite3'].includes(queryRunner.connection.options.type)) { await this.sqliteDownQueryRunner(queryRunner); } else { await this.postgresDownQueryRunner(queryRunner); diff --git a/packages/core/src/database/migrations/1668446646237-AlterTableRelationCascading.ts b/packages/core/src/database/migrations/1668446646237-AlterTableRelationCascading.ts index 3bd02ce872b..81dee5ec6ab 100644 --- a/packages/core/src/database/migrations/1668446646237-AlterTableRelationCascading.ts +++ b/packages/core/src/database/migrations/1668446646237-AlterTableRelationCascading.ts @@ -11,7 +11,7 @@ export class AlterTableRelationCascading1668446646237 implements MigrationInterf * @param queryRunner */ public async up(queryRunner: QueryRunner): Promise { - if (queryRunner.connection.options.type === 'sqlite') { + if (['sqlite', 'better-sqlite3'].includes(queryRunner.connection.options.type)) { await this.sqliteUpQueryRunner(queryRunner); } else { await this.postgresUpQueryRunner(queryRunner); @@ -24,7 +24,7 @@ export class AlterTableRelationCascading1668446646237 implements MigrationInterf * @param queryRunner */ public async down(queryRunner: QueryRunner): Promise { - if (queryRunner.connection.options.type === 'sqlite') { + if (['sqlite', 'better-sqlite3'].includes(queryRunner.connection.options.type)) { await this.sqliteDownQueryRunner(queryRunner); } else { await this.postgresDownQueryRunner(queryRunner); diff --git a/packages/core/src/database/migrations/1668502997873-AlterUserTable.ts b/packages/core/src/database/migrations/1668502997873-AlterUserTable.ts index cf5a471a4ad..6a8c2f8e75d 100644 --- a/packages/core/src/database/migrations/1668502997873-AlterUserTable.ts +++ b/packages/core/src/database/migrations/1668502997873-AlterUserTable.ts @@ -11,7 +11,7 @@ export class AlterUserTable1668502997873 implements MigrationInterface { * @param queryRunner */ public async up(queryRunner: QueryRunner): Promise { - if (queryRunner.connection.options.type === 'sqlite') { + if (['sqlite', 'better-sqlite3'].includes(queryRunner.connection.options.type)) { await this.sqliteUpQueryRunner(queryRunner); } else { await this.postgresUpQueryRunner(queryRunner); @@ -24,7 +24,7 @@ export class AlterUserTable1668502997873 implements MigrationInterface { * @param queryRunner */ public async down(queryRunner: QueryRunner): Promise { - if (queryRunner.connection.options.type === 'sqlite') { + if (['sqlite', 'better-sqlite3'].includes(queryRunner.connection.options.type)) { await this.sqliteDownQueryRunner(queryRunner); } else { await this.postgresDownQueryRunner(queryRunner); diff --git a/packages/core/src/database/migrations/1668504932478-AlterTableRelationCascading.ts b/packages/core/src/database/migrations/1668504932478-AlterTableRelationCascading.ts index 16402e35be2..fe8ae9de9f9 100644 --- a/packages/core/src/database/migrations/1668504932478-AlterTableRelationCascading.ts +++ b/packages/core/src/database/migrations/1668504932478-AlterTableRelationCascading.ts @@ -11,7 +11,7 @@ export class AlterTableRelationCascading1668504932478 implements MigrationInterf * @param queryRunner */ public async up(queryRunner: QueryRunner): Promise { - if (queryRunner.connection.options.type === 'sqlite') { + if (['sqlite', 'better-sqlite3'].includes(queryRunner.connection.options.type)) { await this.sqliteUpQueryRunner(queryRunner); } else { await this.postgresUpQueryRunner(queryRunner); @@ -24,7 +24,7 @@ export class AlterTableRelationCascading1668504932478 implements MigrationInterf * @param queryRunner */ public async down(queryRunner: QueryRunner): Promise { - if (queryRunner.connection.options.type === 'sqlite') { + if (['sqlite', 'better-sqlite3'].includes(queryRunner.connection.options.type)) { await this.sqliteDownQueryRunner(queryRunner); } else { await this.postgresDownQueryRunner(queryRunner); diff --git a/packages/core/src/database/migrations/1669033406667-AlterUserTableEmailVerificationColumns.ts b/packages/core/src/database/migrations/1669033406667-AlterUserTableEmailVerificationColumns.ts index 4b0beb5ec0d..1885755bee0 100644 --- a/packages/core/src/database/migrations/1669033406667-AlterUserTableEmailVerificationColumns.ts +++ b/packages/core/src/database/migrations/1669033406667-AlterUserTableEmailVerificationColumns.ts @@ -11,7 +11,7 @@ export class AlterUserTableEmailVerificationColumns1669033406667 implements Migr * @param queryRunner */ public async up(queryRunner: QueryRunner): Promise { - if (queryRunner.connection.options.type === 'sqlite') { + if (['sqlite', 'better-sqlite3'].includes(queryRunner.connection.options.type)) { await this.sqliteUpQueryRunner(queryRunner); } else { await this.postgresUpQueryRunner(queryRunner); @@ -24,7 +24,7 @@ export class AlterUserTableEmailVerificationColumns1669033406667 implements Migr * @param queryRunner */ public async down(queryRunner: QueryRunner): Promise { - if (queryRunner.connection.options.type === 'sqlite') { + if (['sqlite', 'better-sqlite3'].includes(queryRunner.connection.options.type)) { await this.sqliteDownQueryRunner(queryRunner); } else { await this.postgresDownQueryRunner(queryRunner); diff --git a/packages/core/src/database/migrations/1669280426592-AlterInviteTable.ts b/packages/core/src/database/migrations/1669280426592-AlterInviteTable.ts index 12a5dc396fc..a33b70906c7 100644 --- a/packages/core/src/database/migrations/1669280426592-AlterInviteTable.ts +++ b/packages/core/src/database/migrations/1669280426592-AlterInviteTable.ts @@ -11,7 +11,7 @@ export class AlterInviteTable1669280426592 implements MigrationInterface { * @param queryRunner */ public async up(queryRunner: QueryRunner): Promise { - if (queryRunner.connection.options.type === 'sqlite') { + if (['sqlite', 'better-sqlite3'].includes(queryRunner.connection.options.type)) { await this.sqliteUpQueryRunner(queryRunner); } else { await this.postgresUpQueryRunner(queryRunner); @@ -24,7 +24,7 @@ export class AlterInviteTable1669280426592 implements MigrationInterface { * @param queryRunner */ public async down(queryRunner: QueryRunner): Promise { - if (queryRunner.connection.options.type === 'sqlite') { + if (['sqlite', 'better-sqlite3'].includes(queryRunner.connection.options.type)) { await this.sqliteDownQueryRunner(queryRunner); } else { await this.postgresDownQueryRunner(queryRunner); diff --git a/packages/core/src/database/migrations/1669453028914-AlterUserInviteTable.ts b/packages/core/src/database/migrations/1669453028914-AlterUserInviteTable.ts index 8efd59212e0..3747f255539 100644 --- a/packages/core/src/database/migrations/1669453028914-AlterUserInviteTable.ts +++ b/packages/core/src/database/migrations/1669453028914-AlterUserInviteTable.ts @@ -11,7 +11,7 @@ export class AlterUserInviteTable1669453028914 implements MigrationInterface { * @param queryRunner */ public async up(queryRunner: QueryRunner): Promise { - if (queryRunner.connection.options.type === 'sqlite') { + if (['sqlite', 'better-sqlite3'].includes(queryRunner.connection.options.type)) { await this.sqliteUpQueryRunner(queryRunner); } else { await this.postgresUpQueryRunner(queryRunner); @@ -24,7 +24,7 @@ export class AlterUserInviteTable1669453028914 implements MigrationInterface { * @param queryRunner */ public async down(queryRunner: QueryRunner): Promise { - if (queryRunner.connection.options.type === 'sqlite') { + if (['sqlite', 'better-sqlite3'].includes(queryRunner.connection.options.type)) { await this.sqliteDownQueryRunner(queryRunner); } else { await this.postgresDownQueryRunner(queryRunner); diff --git a/packages/core/src/database/migrations/1670313962263-AlterOrganizationTeamTable.ts b/packages/core/src/database/migrations/1670313962263-AlterOrganizationTeamTable.ts index a49cd9bbbe3..a0a2a66f0c2 100644 --- a/packages/core/src/database/migrations/1670313962263-AlterOrganizationTeamTable.ts +++ b/packages/core/src/database/migrations/1670313962263-AlterOrganizationTeamTable.ts @@ -11,7 +11,7 @@ export class AlterOrganizationTeamTable1670313962263 implements MigrationInterfa * @param queryRunner */ public async up(queryRunner: QueryRunner): Promise { - if (queryRunner.connection.options.type === 'sqlite') { + if (['sqlite', 'better-sqlite3'].includes(queryRunner.connection.options.type)) { await this.sqliteUpQueryRunner(queryRunner); } else { await this.postgresUpQueryRunner(queryRunner); @@ -24,7 +24,7 @@ export class AlterOrganizationTeamTable1670313962263 implements MigrationInterfa * @param queryRunner */ public async down(queryRunner: QueryRunner): Promise { - if (queryRunner.connection.options.type === 'sqlite') { + if (['sqlite', 'better-sqlite3'].includes(queryRunner.connection.options.type)) { await this.sqliteDownQueryRunner(queryRunner); } else { await this.postgresDownQueryRunner(queryRunner); diff --git a/packages/core/src/database/migrations/1671107860058-AlterInviteAllowedOrganizationTable.ts b/packages/core/src/database/migrations/1671107860058-AlterInviteAllowedOrganizationTable.ts index 497bb0ca11e..c2a75400495 100644 --- a/packages/core/src/database/migrations/1671107860058-AlterInviteAllowedOrganizationTable.ts +++ b/packages/core/src/database/migrations/1671107860058-AlterInviteAllowedOrganizationTable.ts @@ -11,7 +11,7 @@ export class AlterInviteAllowedOrganizationTable1671107860058 implements Migrati * @param queryRunner */ public async up(queryRunner: QueryRunner): Promise { - if (queryRunner.connection.options.type === 'sqlite') { + if (['sqlite', 'better-sqlite3'].includes(queryRunner.connection.options.type)) { await this.sqliteUpQueryRunner(queryRunner); } else { await this.postgresUpQueryRunner(queryRunner); @@ -24,7 +24,7 @@ export class AlterInviteAllowedOrganizationTable1671107860058 implements Migrati * @param queryRunner */ public async down(queryRunner: QueryRunner): Promise { - if (queryRunner.connection.options.type === 'sqlite') { + if (['sqlite', 'better-sqlite3'].includes(queryRunner.connection.options.type)) { await this.sqliteDownQueryRunner(queryRunner); } else { await this.postgresDownQueryRunner(queryRunner); diff --git a/packages/core/src/database/migrations/1671706727549-AlterOrganizationTeamTable.ts b/packages/core/src/database/migrations/1671706727549-AlterOrganizationTeamTable.ts index 93a90c4626c..6b6d051c36e 100644 --- a/packages/core/src/database/migrations/1671706727549-AlterOrganizationTeamTable.ts +++ b/packages/core/src/database/migrations/1671706727549-AlterOrganizationTeamTable.ts @@ -11,7 +11,7 @@ export class AlterOrganizationTeamTable1671706727549 implements MigrationInterfa * @param queryRunner */ public async up(queryRunner: QueryRunner): Promise { - if (queryRunner.connection.options.type === 'sqlite') { + if (['sqlite', 'better-sqlite3'].includes(queryRunner.connection.options.type)) { await this.sqliteUpQueryRunner(queryRunner); } else { await this.postgresUpQueryRunner(queryRunner); @@ -24,7 +24,7 @@ export class AlterOrganizationTeamTable1671706727549 implements MigrationInterfa * @param queryRunner */ public async down(queryRunner: QueryRunner): Promise { - if (queryRunner.connection.options.type === 'sqlite') { + if (['sqlite', 'better-sqlite3'].includes(queryRunner.connection.options.type)) { await this.sqliteDownQueryRunner(queryRunner); } else { await this.postgresDownQueryRunner(queryRunner); diff --git a/packages/core/src/database/migrations/1672211594766-AlterCandidateTable.ts b/packages/core/src/database/migrations/1672211594766-AlterCandidateTable.ts index 0ecd8fbb33f..67ce8269da8 100644 --- a/packages/core/src/database/migrations/1672211594766-AlterCandidateTable.ts +++ b/packages/core/src/database/migrations/1672211594766-AlterCandidateTable.ts @@ -11,7 +11,7 @@ export class AlterCandidateTable1672211594766 implements MigrationInterface { * @param queryRunner */ public async up(queryRunner: QueryRunner): Promise { - if (queryRunner.connection.options.type === 'sqlite') { + if (['sqlite', 'better-sqlite3'].includes(queryRunner.connection.options.type)) { await this.sqliteUpQueryRunner(queryRunner); } else { await this.postgresUpQueryRunner(queryRunner); @@ -24,7 +24,7 @@ export class AlterCandidateTable1672211594766 implements MigrationInterface { * @param queryRunner */ public async down(queryRunner: QueryRunner): Promise { - if (queryRunner.connection.options.type === 'sqlite') { + if (['sqlite', 'better-sqlite3'].includes(queryRunner.connection.options.type)) { await this.sqliteDownQueryRunner(queryRunner); } else { await this.postgresDownQueryRunner(queryRunner); diff --git a/packages/core/src/database/migrations/1673005639130-AlterTimeLogTable.ts b/packages/core/src/database/migrations/1673005639130-AlterTimeLogTable.ts index b187fc3ee74..43bbcf8741f 100644 --- a/packages/core/src/database/migrations/1673005639130-AlterTimeLogTable.ts +++ b/packages/core/src/database/migrations/1673005639130-AlterTimeLogTable.ts @@ -11,7 +11,7 @@ export class AlterTimeLogTable1673005639130 implements MigrationInterface { * @param queryRunner */ public async up(queryRunner: QueryRunner): Promise { - if (queryRunner.connection.options.type === 'sqlite') { + if (['sqlite', 'better-sqlite3'].includes(queryRunner.connection.options.type)) { await this.sqliteUpQueryRunner(queryRunner); } else { await this.postgresUpQueryRunner(queryRunner); @@ -24,7 +24,7 @@ export class AlterTimeLogTable1673005639130 implements MigrationInterface { * @param queryRunner */ public async down(queryRunner: QueryRunner): Promise { - if (queryRunner.connection.options.type === 'sqlite') { + if (['sqlite', 'better-sqlite3'].includes(queryRunner.connection.options.type)) { await this.sqliteDownQueryRunner(queryRunner); } else { await this.postgresDownQueryRunner(queryRunner); diff --git a/packages/core/src/database/migrations/1673423542165-AlterTaskTable.ts b/packages/core/src/database/migrations/1673423542165-AlterTaskTable.ts index a5e3ae4473c..9f04d53f641 100644 --- a/packages/core/src/database/migrations/1673423542165-AlterTaskTable.ts +++ b/packages/core/src/database/migrations/1673423542165-AlterTaskTable.ts @@ -11,7 +11,7 @@ export class AlterTaskTable1673423542165 implements MigrationInterface { * @param queryRunner */ public async up(queryRunner: QueryRunner): Promise { - if (queryRunner.connection.options.type === 'sqlite') { + if (['sqlite', 'better-sqlite3'].includes(queryRunner.connection.options.type)) { await this.sqliteUpQueryRunner(queryRunner); } else { await this.postgresUpQueryRunner(queryRunner); @@ -24,7 +24,7 @@ export class AlterTaskTable1673423542165 implements MigrationInterface { * @param queryRunner */ public async down(queryRunner: QueryRunner): Promise { - if (queryRunner.connection.options.type === 'sqlite') { + if (['sqlite', 'better-sqlite3'].includes(queryRunner.connection.options.type)) { await this.sqliteDownQueryRunner(queryRunner); } else { await this.postgresDownQueryRunner(queryRunner); diff --git a/packages/core/src/database/migrations/1673589923548-CreateStatusTable.ts b/packages/core/src/database/migrations/1673589923548-CreateStatusTable.ts index 922796db43c..67b58301692 100644 --- a/packages/core/src/database/migrations/1673589923548-CreateStatusTable.ts +++ b/packages/core/src/database/migrations/1673589923548-CreateStatusTable.ts @@ -9,7 +9,7 @@ export class CreateStatusTable1673589923548 implements MigrationInterface { * @param queryRunner */ public async up(queryRunner: QueryRunner): Promise { - if (queryRunner.connection.options.type === 'sqlite') { + if (['sqlite', 'better-sqlite3'].includes(queryRunner.connection.options.type)) { await this.sqliteUpQueryRunner(queryRunner); } else { await this.postgresUpQueryRunner(queryRunner); @@ -22,7 +22,7 @@ export class CreateStatusTable1673589923548 implements MigrationInterface { * @param queryRunner */ public async down(queryRunner: QueryRunner): Promise { - if (queryRunner.connection.options.type === 'sqlite') { + if (['sqlite', 'better-sqlite3'].includes(queryRunner.connection.options.type)) { await this.sqliteDownQueryRunner(queryRunner); } else { await this.postgresDownQueryRunner(queryRunner); diff --git a/packages/core/src/database/migrations/1673946248066-AlterTaskTable.ts b/packages/core/src/database/migrations/1673946248066-AlterTaskTable.ts index 8acfbf8df63..f29d2c84a60 100644 --- a/packages/core/src/database/migrations/1673946248066-AlterTaskTable.ts +++ b/packages/core/src/database/migrations/1673946248066-AlterTaskTable.ts @@ -11,7 +11,7 @@ export class AlterTaskTable1673946248066 implements MigrationInterface { * @param queryRunner */ public async up(queryRunner: QueryRunner): Promise { - if (queryRunner.connection.options.type === 'sqlite') { + if (['sqlite', 'better-sqlite3'].includes(queryRunner.connection.options.type)) { await this.sqliteUpQueryRunner(queryRunner); } else { await this.postgresUpQueryRunner(queryRunner); @@ -24,7 +24,7 @@ export class AlterTaskTable1673946248066 implements MigrationInterface { * @param queryRunner */ public async down(queryRunner: QueryRunner): Promise { - if (queryRunner.connection.options.type === 'sqlite') { + if (['sqlite', 'better-sqlite3'].includes(queryRunner.connection.options.type)) { await this.sqliteDownQueryRunner(queryRunner); } else { await this.postgresDownQueryRunner(queryRunner); diff --git a/packages/core/src/database/migrations/1674044473393-SeedDefaultGlobalTaskStatus.ts b/packages/core/src/database/migrations/1674044473393-SeedDefaultGlobalTaskStatus.ts index adcf2e34940..6531f438f6e 100644 --- a/packages/core/src/database/migrations/1674044473393-SeedDefaultGlobalTaskStatus.ts +++ b/packages/core/src/database/migrations/1674044473393-SeedDefaultGlobalTaskStatus.ts @@ -16,7 +16,7 @@ export class SeedDefaultGlobalTaskStatus1674044473393 implements MigrationInterf try { for await (const status of DEFAULT_GLOBAL_STATUSES) { const payload = Object.values(status); - if (queryRunner.connection.options.type === 'sqlite') { + if (['sqlite', 'better-sqlite3'].includes(queryRunner.connection.options.type)) { payload.push(uuidV4()); const query = `INSERT INTO "status" ("name", "value", "description", "icon", "color", "isSystem", "id") VALUES($1, $2, $3, $4, $5, $6, $7)`; await queryRunner.connection.manager.query(query, payload); diff --git a/packages/core/src/database/migrations/1674109138954-AlterEmailSentTable.ts b/packages/core/src/database/migrations/1674109138954-AlterEmailSentTable.ts index 6178cd820e0..1cd078988be 100644 --- a/packages/core/src/database/migrations/1674109138954-AlterEmailSentTable.ts +++ b/packages/core/src/database/migrations/1674109138954-AlterEmailSentTable.ts @@ -11,7 +11,7 @@ export class AlterEmailSentTable1674109138954 implements MigrationInterface { * @param queryRunner */ public async up(queryRunner: QueryRunner): Promise { - if (queryRunner.connection.options.type === 'sqlite') { + if (['sqlite', 'better-sqlite3'].includes(queryRunner.connection.options.type)) { await this.sqliteUpQueryRunner(queryRunner); } else { await this.postgresUpQueryRunner(queryRunner); @@ -24,7 +24,7 @@ export class AlterEmailSentTable1674109138954 implements MigrationInterface { * @param queryRunner */ public async down(queryRunner: QueryRunner): Promise { - if (queryRunner.connection.options.type === 'sqlite') { + if (['sqlite', 'better-sqlite3'].includes(queryRunner.connection.options.type)) { await this.sqliteDownQueryRunner(queryRunner); } else { await this.postgresDownQueryRunner(queryRunner); diff --git a/packages/core/src/database/migrations/1674535367176-CreateTaskPriorityTable.ts b/packages/core/src/database/migrations/1674535367176-CreateTaskPriorityTable.ts index 9517f63625a..7f459e0664c 100644 --- a/packages/core/src/database/migrations/1674535367176-CreateTaskPriorityTable.ts +++ b/packages/core/src/database/migrations/1674535367176-CreateTaskPriorityTable.ts @@ -11,7 +11,7 @@ export class CreateTaskPriorityTable1674535367176 implements MigrationInterface * @param queryRunner */ public async up(queryRunner: QueryRunner): Promise { - if (queryRunner.connection.options.type === 'sqlite') { + if (['sqlite', 'better-sqlite3'].includes(queryRunner.connection.options.type)) { await this.sqliteUpQueryRunner(queryRunner); } else { await this.postgresUpQueryRunner(queryRunner); @@ -24,7 +24,7 @@ export class CreateTaskPriorityTable1674535367176 implements MigrationInterface * @param queryRunner */ public async down(queryRunner: QueryRunner): Promise { - if (queryRunner.connection.options.type === 'sqlite') { + if (['sqlite', 'better-sqlite3'].includes(queryRunner.connection.options.type)) { await this.sqliteDownQueryRunner(queryRunner); } else { await this.postgresDownQueryRunner(queryRunner); diff --git a/packages/core/src/database/migrations/1674538040466-CreateTaskSizeTable.ts b/packages/core/src/database/migrations/1674538040466-CreateTaskSizeTable.ts index 0f5c2eab970..44842f206c4 100644 --- a/packages/core/src/database/migrations/1674538040466-CreateTaskSizeTable.ts +++ b/packages/core/src/database/migrations/1674538040466-CreateTaskSizeTable.ts @@ -11,7 +11,7 @@ export class CreateTaskSizeTable1674538040466 implements MigrationInterface { * @param queryRunner */ public async up(queryRunner: QueryRunner): Promise { - if (queryRunner.connection.options.type === 'sqlite') { + if (['sqlite', 'better-sqlite3'].includes(queryRunner.connection.options.type)) { await this.sqliteUpQueryRunner(queryRunner); } else { await this.postgresUpQueryRunner(queryRunner); @@ -24,7 +24,7 @@ export class CreateTaskSizeTable1674538040466 implements MigrationInterface { * @param queryRunner */ public async down(queryRunner: QueryRunner): Promise { - if (queryRunner.connection.options.type === 'sqlite') { + if (['sqlite', 'better-sqlite3'].includes(queryRunner.connection.options.type)) { await this.sqliteDownQueryRunner(queryRunner); } else { await this.postgresDownQueryRunner(queryRunner); diff --git a/packages/core/src/database/migrations/1674638501088-SeedDefaultGlobalTaskPriorityAndSize.ts b/packages/core/src/database/migrations/1674638501088-SeedDefaultGlobalTaskPriorityAndSize.ts index 702a73889a3..987edeff4ef 100644 --- a/packages/core/src/database/migrations/1674638501088-SeedDefaultGlobalTaskPriorityAndSize.ts +++ b/packages/core/src/database/migrations/1674638501088-SeedDefaultGlobalTaskPriorityAndSize.ts @@ -34,7 +34,7 @@ export class SeedDefaultGlobalTaskPriorityAndSize1674638501088 implements Migrat try { for await (const priority of DEFAULT_GLOBAL_PRIORITIES) { const payload = Object.values(priority); - if (queryRunner.connection.options.type === 'sqlite') { + if (['sqlite', 'better-sqlite3'].includes(queryRunner.connection.options.type)) { payload.push(uuidV4()); const query = `INSERT INTO "task_priority" ("name", "value", "description", "icon", "color", "isSystem", "id") VALUES($1, $2, $3, $4, $5, $6, $7)`; await queryRunner.connection.manager.query(query, payload); @@ -58,7 +58,7 @@ export class SeedDefaultGlobalTaskPriorityAndSize1674638501088 implements Migrat try { for await (const size of DEFAULT_GLOBAL_SIZES) { const payload = Object.values(size); - if (queryRunner.connection.options.type === 'sqlite') { + if (['sqlite', 'better-sqlite3'].includes(queryRunner.connection.options.type)) { payload.push(uuidV4()); const query = `INSERT INTO "task_size" ("name", "value", "description", "icon", "color", "isSystem", "id") VALUES($1, $2, $3, $4, $5, $6, $7)`; await queryRunner.connection.manager.query(query, payload); diff --git a/packages/core/src/database/migrations/1675186090641-AlterTaskStatusTable.ts b/packages/core/src/database/migrations/1675186090641-AlterTaskStatusTable.ts index 1d9c8f6ab43..03b5fe29254 100644 --- a/packages/core/src/database/migrations/1675186090641-AlterTaskStatusTable.ts +++ b/packages/core/src/database/migrations/1675186090641-AlterTaskStatusTable.ts @@ -11,7 +11,7 @@ export class AlterTaskStatusTable1675186090641 implements MigrationInterface { * @param queryRunner */ public async up(queryRunner: QueryRunner): Promise { - if (queryRunner.connection.options.type === 'sqlite') { + if (['sqlite', 'better-sqlite3'].includes(queryRunner.connection.options.type)) { await this.sqliteUpQueryRunner(queryRunner); } else { await this.postgresUpQueryRunner(queryRunner); @@ -24,7 +24,7 @@ export class AlterTaskStatusTable1675186090641 implements MigrationInterface { * @param queryRunner */ public async down(queryRunner: QueryRunner): Promise { - if (queryRunner.connection.options.type === 'sqlite') { + if (['sqlite', 'better-sqlite3'].includes(queryRunner.connection.options.type)) { await this.sqliteDownQueryRunner(queryRunner); } else { await this.postgresDownQueryRunner(queryRunner); diff --git a/packages/core/src/database/migrations/1675240711524-CreateEmployeePhoneTable.ts b/packages/core/src/database/migrations/1675240711524-CreateEmployeePhoneTable.ts index 3307ee651cc..da29021d053 100644 --- a/packages/core/src/database/migrations/1675240711524-CreateEmployeePhoneTable.ts +++ b/packages/core/src/database/migrations/1675240711524-CreateEmployeePhoneTable.ts @@ -9,7 +9,7 @@ export class CreateEmployeePhoneTable1675240711524 implements MigrationInterface * @param queryRunner */ public async up(queryRunner: QueryRunner): Promise { - if (queryRunner.connection.options.type === 'sqlite') { + if (['sqlite', 'better-sqlite3'].includes(queryRunner.connection.options.type)) { await this.sqliteUpQueryRunner(queryRunner); } else { await this.postgresUpQueryRunner(queryRunner); @@ -22,7 +22,7 @@ export class CreateEmployeePhoneTable1675240711524 implements MigrationInterface * @param queryRunner */ public async down(queryRunner: QueryRunner): Promise { - if (queryRunner.connection.options.type === 'sqlite') { + if (['sqlite', 'better-sqlite3'].includes(queryRunner.connection.options.type)) { await this.sqliteDownQueryRunner(queryRunner); } else { await this.postgresDownQueryRunner(queryRunner); diff --git a/packages/core/src/database/migrations/1675241589518-AlterUserTable.ts b/packages/core/src/database/migrations/1675241589518-AlterUserTable.ts index 08b5a038ece..ab701043850 100644 --- a/packages/core/src/database/migrations/1675241589518-AlterUserTable.ts +++ b/packages/core/src/database/migrations/1675241589518-AlterUserTable.ts @@ -9,7 +9,7 @@ export class AlterUserTable1675241589518 implements MigrationInterface { * @param queryRunner */ public async up(queryRunner: QueryRunner): Promise { - if (queryRunner.connection.options.type === 'sqlite') { + if (['sqlite', 'better-sqlite3'].includes(queryRunner.connection.options.type)) { await this.sqliteUpQueryRunner(queryRunner); } else { await this.postgresUpQueryRunner(queryRunner); @@ -22,7 +22,7 @@ export class AlterUserTable1675241589518 implements MigrationInterface { * @param queryRunner */ public async down(queryRunner: QueryRunner): Promise { - if (queryRunner.connection.options.type === 'sqlite') { + if (['sqlite', 'better-sqlite3'].includes(queryRunner.connection.options.type)) { await this.sqliteDownQueryRunner(queryRunner); } else { await this.postgresDownQueryRunner(queryRunner); diff --git a/packages/core/src/database/migrations/1675410785835-AlterTaskTable.ts b/packages/core/src/database/migrations/1675410785835-AlterTaskTable.ts index 9bc741248d1..684217e8cc8 100644 --- a/packages/core/src/database/migrations/1675410785835-AlterTaskTable.ts +++ b/packages/core/src/database/migrations/1675410785835-AlterTaskTable.ts @@ -11,7 +11,7 @@ export class AlterTaskTable1675410785835 implements MigrationInterface { * @param queryRunner */ public async up(queryRunner: QueryRunner): Promise { - if (queryRunner.connection.options.type === 'sqlite') { + if (['sqlite', 'better-sqlite3'].includes(queryRunner.connection.options.type)) { await this.sqliteUpQueryRunner(queryRunner); } else { await this.postgresUpQueryRunner(queryRunner); @@ -24,7 +24,7 @@ export class AlterTaskTable1675410785835 implements MigrationInterface { * @param queryRunner */ public async down(queryRunner: QueryRunner): Promise { - if (queryRunner.connection.options.type === 'sqlite') { + if (['sqlite', 'better-sqlite3'].includes(queryRunner.connection.options.type)) { await this.sqliteDownQueryRunner(queryRunner); } else { await this.postgresDownQueryRunner(queryRunner); diff --git a/packages/core/src/database/migrations/1675687502784-AddTimeZoneColumnToUserTable.ts b/packages/core/src/database/migrations/1675687502784-AddTimeZoneColumnToUserTable.ts index 6c1266b4783..a47d9a50f4f 100644 --- a/packages/core/src/database/migrations/1675687502784-AddTimeZoneColumnToUserTable.ts +++ b/packages/core/src/database/migrations/1675687502784-AddTimeZoneColumnToUserTable.ts @@ -11,7 +11,7 @@ export class AddTimeZoneColumnToUserTable1675687502784 implements MigrationInter * @param queryRunner */ public async up(queryRunner: QueryRunner): Promise { - if (queryRunner.connection.options.type === 'sqlite') { + if (['sqlite', 'better-sqlite3'].includes(queryRunner.connection.options.type)) { await this.sqliteUpQueryRunner(queryRunner); } else { await this.postgresUpQueryRunner(queryRunner); @@ -24,7 +24,7 @@ export class AddTimeZoneColumnToUserTable1675687502784 implements MigrationInter * @param queryRunner */ public async down(queryRunner: QueryRunner): Promise { - if (queryRunner.connection.options.type === 'sqlite') { + if (['sqlite', 'better-sqlite3'].includes(queryRunner.connection.options.type)) { await this.sqliteDownQueryRunner(queryRunner); } else { await this.postgresDownQueryRunner(queryRunner); diff --git a/packages/core/src/database/migrations/1676351186923-AlterOrganizationTeamTable.ts b/packages/core/src/database/migrations/1676351186923-AlterOrganizationTeamTable.ts index 1907978d3eb..65e9f518e0f 100644 --- a/packages/core/src/database/migrations/1676351186923-AlterOrganizationTeamTable.ts +++ b/packages/core/src/database/migrations/1676351186923-AlterOrganizationTeamTable.ts @@ -11,7 +11,7 @@ export class AlterOrganizationTeamTable1676351186923 implements MigrationInterfa * @param queryRunner */ public async up(queryRunner: QueryRunner): Promise { - if (queryRunner.connection.options.type === 'sqlite') { + if (['sqlite', 'better-sqlite3'].includes(queryRunner.connection.options.type)) { await this.sqliteUpQueryRunner(queryRunner); } else { await this.postgresUpQueryRunner(queryRunner); @@ -24,7 +24,7 @@ export class AlterOrganizationTeamTable1676351186923 implements MigrationInterfa * @param queryRunner */ public async down(queryRunner: QueryRunner): Promise { - if (queryRunner.connection.options.type === 'sqlite') { + if (['sqlite', 'better-sqlite3'].includes(queryRunner.connection.options.type)) { await this.sqliteDownQueryRunner(queryRunner); } else { await this.postgresDownQueryRunner(queryRunner); diff --git a/packages/core/src/database/migrations/1676477607906-AddTimeTrackingColumnToOrganizationTeamEmployeeTable.ts b/packages/core/src/database/migrations/1676477607906-AddTimeTrackingColumnToOrganizationTeamEmployeeTable.ts index d35f3764a46..90ccca59881 100644 --- a/packages/core/src/database/migrations/1676477607906-AddTimeTrackingColumnToOrganizationTeamEmployeeTable.ts +++ b/packages/core/src/database/migrations/1676477607906-AddTimeTrackingColumnToOrganizationTeamEmployeeTable.ts @@ -11,7 +11,7 @@ export class AddTimeTrackingColumnToOrganizationTeamEmployeeTable1676477607906 i * @param queryRunner */ public async up(queryRunner: QueryRunner): Promise { - if (queryRunner.connection.options.type === 'sqlite') { + if (['sqlite', 'better-sqlite3'].includes(queryRunner.connection.options.type)) { await this.sqliteUpQueryRunner(queryRunner); } else { await this.postgresUpQueryRunner(queryRunner); @@ -24,7 +24,7 @@ export class AddTimeTrackingColumnToOrganizationTeamEmployeeTable1676477607906 i * @param queryRunner */ public async down(queryRunner: QueryRunner): Promise { - if (queryRunner.connection.options.type === 'sqlite') { + if (['sqlite', 'better-sqlite3'].includes(queryRunner.connection.options.type)) { await this.sqliteDownQueryRunner(queryRunner); } else { await this.postgresDownQueryRunner(queryRunner); diff --git a/packages/core/src/database/migrations/1676630369336-AddLogoToOrganizationTeamTable.ts b/packages/core/src/database/migrations/1676630369336-AddLogoToOrganizationTeamTable.ts index 362a8bd2fa9..ccb6c80db2f 100644 --- a/packages/core/src/database/migrations/1676630369336-AddLogoToOrganizationTeamTable.ts +++ b/packages/core/src/database/migrations/1676630369336-AddLogoToOrganizationTeamTable.ts @@ -11,7 +11,7 @@ export class AddLogoToOrganizationTeamTable1676630369336 implements MigrationInt * @param queryRunner */ public async up(queryRunner: QueryRunner): Promise { - if (queryRunner.connection.options.type === 'sqlite') { + if (['sqlite', 'better-sqlite3'].includes(queryRunner.connection.options.type)) { await this.sqliteUpQueryRunner(queryRunner); } else { await this.postgresUpQueryRunner(queryRunner); @@ -24,7 +24,7 @@ export class AddLogoToOrganizationTeamTable1676630369336 implements MigrationInt * @param queryRunner */ public async down(queryRunner: QueryRunner): Promise { - if (queryRunner.connection.options.type === 'sqlite') { + if (['sqlite', 'better-sqlite3'].includes(queryRunner.connection.options.type)) { await this.sqliteDownQueryRunner(queryRunner); } else { await this.postgresDownQueryRunner(queryRunner); diff --git a/packages/core/src/database/migrations/1676827319035-AlterEmployeeTable.ts b/packages/core/src/database/migrations/1676827319035-AlterEmployeeTable.ts index 277c9e5d683..1e0df6cbd52 100644 --- a/packages/core/src/database/migrations/1676827319035-AlterEmployeeTable.ts +++ b/packages/core/src/database/migrations/1676827319035-AlterEmployeeTable.ts @@ -11,7 +11,7 @@ export class AlterEmployeeTable1676827319035 implements MigrationInterface { * @param queryRunner */ public async up(queryRunner: QueryRunner): Promise { - if (queryRunner.connection.options.type === 'sqlite') { + if (['sqlite', 'better-sqlite3'].includes(queryRunner.connection.options.type)) { await this.sqliteUpQueryRunner(queryRunner); } else { await this.postgresUpQueryRunner(queryRunner); @@ -24,7 +24,7 @@ export class AlterEmployeeTable1676827319035 implements MigrationInterface { * @param queryRunner */ public async down(queryRunner: QueryRunner): Promise { - if (queryRunner.connection.options.type === 'sqlite') { + if (['sqlite', 'better-sqlite3'].includes(queryRunner.connection.options.type)) { await this.sqliteDownQueryRunner(queryRunner); } else { await this.postgresDownQueryRunner(queryRunner); diff --git a/packages/core/src/database/migrations/1676978573552-AlterOrganizationTable.ts b/packages/core/src/database/migrations/1676978573552-AlterOrganizationTable.ts index 1d6c9a102da..3924b61f0d3 100644 --- a/packages/core/src/database/migrations/1676978573552-AlterOrganizationTable.ts +++ b/packages/core/src/database/migrations/1676978573552-AlterOrganizationTable.ts @@ -11,7 +11,7 @@ export class AlterOrganizationTable1676828580883 implements MigrationInterface { * @param queryRunner */ public async up(queryRunner: QueryRunner): Promise { - if (queryRunner.connection.options.type === 'sqlite') { + if (['sqlite', 'better-sqlite3'].includes(queryRunner.connection.options.type)) { await this.sqliteUpQueryRunner(queryRunner); } else { await this.postgresUpQueryRunner(queryRunner); @@ -24,7 +24,7 @@ export class AlterOrganizationTable1676828580883 implements MigrationInterface { * @param queryRunner */ public async down(queryRunner: QueryRunner): Promise { - if (queryRunner.connection.options.type === 'sqlite') { + if (['sqlite', 'better-sqlite3'].includes(queryRunner.connection.options.type)) { await this.sqliteDownQueryRunner(queryRunner); } else { await this.postgresDownQueryRunner(queryRunner); diff --git a/packages/core/src/database/migrations/1677063195155-AlterOrganizationTeamTable.ts b/packages/core/src/database/migrations/1677063195155-AlterOrganizationTeamTable.ts index f0f50958b14..23e78aca41a 100644 --- a/packages/core/src/database/migrations/1677063195155-AlterOrganizationTeamTable.ts +++ b/packages/core/src/database/migrations/1677063195155-AlterOrganizationTeamTable.ts @@ -11,7 +11,7 @@ export class AlterOrganizationTeamTable1677063195155 implements MigrationInterfa * @param queryRunner */ public async up(queryRunner: QueryRunner): Promise { - if (queryRunner.connection.options.type === 'sqlite') { + if (['sqlite', 'better-sqlite3'].includes(queryRunner.connection.options.type)) { await this.sqliteUpQueryRunner(queryRunner); } else { await this.postgresUpQueryRunner(queryRunner); @@ -24,7 +24,7 @@ export class AlterOrganizationTeamTable1677063195155 implements MigrationInterfa * @param queryRunner */ public async down(queryRunner: QueryRunner): Promise { - if (queryRunner.connection.options.type === 'sqlite') { + if (['sqlite', 'better-sqlite3'].includes(queryRunner.connection.options.type)) { await this.sqliteDownQueryRunner(queryRunner); } else { await this.postgresDownQueryRunner(queryRunner); diff --git a/packages/core/src/database/migrations/1677142065591-AlterTagTable.ts b/packages/core/src/database/migrations/1677142065591-AlterTagTable.ts index 96b9bb6833c..1f385dd25f3 100644 --- a/packages/core/src/database/migrations/1677142065591-AlterTagTable.ts +++ b/packages/core/src/database/migrations/1677142065591-AlterTagTable.ts @@ -11,7 +11,7 @@ export class AlterTagTable1677142065591 implements MigrationInterface { * @param queryRunner */ public async up(queryRunner: QueryRunner): Promise { - if (queryRunner.connection.options.type === 'sqlite') { + if (['sqlite', 'better-sqlite3'].includes(queryRunner.connection.options.type)) { await this.sqliteUpQueryRunner(queryRunner); } else { await this.postgresUpQueryRunner(queryRunner); @@ -24,7 +24,7 @@ export class AlterTagTable1677142065591 implements MigrationInterface { * @param queryRunner */ public async down(queryRunner: QueryRunner): Promise { - if (queryRunner.connection.options.type === 'sqlite') { + if (['sqlite', 'better-sqlite3'].includes(queryRunner.connection.options.type)) { await this.sqliteDownQueryRunner(queryRunner); } else { await this.postgresDownQueryRunner(queryRunner); diff --git a/packages/core/src/database/migrations/1677156446733-AlterTaskTable.ts b/packages/core/src/database/migrations/1677156446733-AlterTaskTable.ts index f6bf75c500a..4e276a35a81 100644 --- a/packages/core/src/database/migrations/1677156446733-AlterTaskTable.ts +++ b/packages/core/src/database/migrations/1677156446733-AlterTaskTable.ts @@ -11,7 +11,7 @@ export class AlterTaskTable1677156446733 implements MigrationInterface { * @param queryRunner */ public async up(queryRunner: QueryRunner): Promise { - if (queryRunner.connection.options.type === 'sqlite') { + if (['sqlite', 'better-sqlite3'].includes(queryRunner.connection.options.type)) { await this.sqliteUpQueryRunner(queryRunner); } else { await this.postgresUpQueryRunner(queryRunner); @@ -24,7 +24,7 @@ export class AlterTaskTable1677156446733 implements MigrationInterface { * @param queryRunner */ public async down(queryRunner: QueryRunner): Promise { - if (queryRunner.connection.options.type === 'sqlite') { + if (['sqlite', 'better-sqlite3'].includes(queryRunner.connection.options.type)) { await this.sqliteDownQueryRunner(queryRunner); } else { await this.postgresDownQueryRunner(queryRunner); diff --git a/packages/core/src/database/migrations/1677313663312-AlterEmployeeTable.ts b/packages/core/src/database/migrations/1677313663312-AlterEmployeeTable.ts index f63db7e9b49..1efa8e45eb9 100644 --- a/packages/core/src/database/migrations/1677313663312-AlterEmployeeTable.ts +++ b/packages/core/src/database/migrations/1677313663312-AlterEmployeeTable.ts @@ -11,7 +11,7 @@ export class AlterEmployeeTable1677313663312 implements MigrationInterface { * @param queryRunner */ public async up(queryRunner: QueryRunner): Promise { - if (queryRunner.connection.options.type === 'sqlite') { + if (['sqlite', 'better-sqlite3'].includes(queryRunner.connection.options.type)) { await this.sqliteUpQueryRunner(queryRunner); } else { await this.postgresUpQueryRunner(queryRunner); @@ -24,7 +24,7 @@ export class AlterEmployeeTable1677313663312 implements MigrationInterface { * @param queryRunner */ public async down(queryRunner: QueryRunner): Promise { - if (queryRunner.connection.options.type === 'sqlite') { + if (['sqlite', 'better-sqlite3'].includes(queryRunner.connection.options.type)) { await this.sqliteDownQueryRunner(queryRunner); } else { await this.postgresDownQueryRunner(queryRunner); diff --git a/packages/core/src/database/migrations/1677508195152-AlterScreenshotTable.ts b/packages/core/src/database/migrations/1677508195152-AlterScreenshotTable.ts index 4cc3ecaadbb..87784ff768f 100644 --- a/packages/core/src/database/migrations/1677508195152-AlterScreenshotTable.ts +++ b/packages/core/src/database/migrations/1677508195152-AlterScreenshotTable.ts @@ -11,7 +11,7 @@ export class AlterScreenshotTable1677508195152 implements MigrationInterface { * @param queryRunner */ public async up(queryRunner: QueryRunner): Promise { - if (queryRunner.connection.options.type === 'sqlite') { + if (['sqlite', 'better-sqlite3'].includes(queryRunner.connection.options.type)) { await this.sqliteUpQueryRunner(queryRunner); } else { await this.postgresUpQueryRunner(queryRunner); @@ -24,7 +24,7 @@ export class AlterScreenshotTable1677508195152 implements MigrationInterface { * @param queryRunner */ public async down(queryRunner: QueryRunner): Promise { - if (queryRunner.connection.options.type === 'sqlite') { + if (['sqlite', 'better-sqlite3'].includes(queryRunner.connection.options.type)) { await this.sqliteDownQueryRunner(queryRunner); } else { await this.postgresDownQueryRunner(queryRunner); diff --git a/packages/core/src/database/migrations/1678187685289-CreateOrganizationTeamJoinRequestTable.ts b/packages/core/src/database/migrations/1678187685289-CreateOrganizationTeamJoinRequestTable.ts index 2b116a2ed59..6b3a99dfcc2 100644 --- a/packages/core/src/database/migrations/1678187685289-CreateOrganizationTeamJoinRequestTable.ts +++ b/packages/core/src/database/migrations/1678187685289-CreateOrganizationTeamJoinRequestTable.ts @@ -9,7 +9,7 @@ export class CreateOrganizationTeamJoinRequestTable1678187685289 implements Migr * @param queryRunner */ public async up(queryRunner: QueryRunner): Promise { - if (queryRunner.connection.options.type === 'sqlite') { + if (['sqlite', 'better-sqlite3'].includes(queryRunner.connection.options.type)) { await this.sqliteUpQueryRunner(queryRunner); } else { await this.postgresUpQueryRunner(queryRunner); @@ -22,7 +22,7 @@ export class CreateOrganizationTeamJoinRequestTable1678187685289 implements Migr * @param queryRunner */ public async down(queryRunner: QueryRunner): Promise { - if (queryRunner.connection.options.type === 'sqlite') { + if (['sqlite', 'better-sqlite3'].includes(queryRunner.connection.options.type)) { await this.sqliteDownQueryRunner(queryRunner); } else { await this.postgresDownQueryRunner(queryRunner); diff --git a/packages/core/src/database/migrations/1678190791247-CreateEmailResetTable.ts b/packages/core/src/database/migrations/1678190791247-CreateEmailResetTable.ts index df7097ff5ca..cb536e26438 100644 --- a/packages/core/src/database/migrations/1678190791247-CreateEmailResetTable.ts +++ b/packages/core/src/database/migrations/1678190791247-CreateEmailResetTable.ts @@ -11,7 +11,7 @@ export class CreateEmailResetTable1678190791247 implements MigrationInterface { * @param queryRunner */ public async up(queryRunner: QueryRunner): Promise { - if (queryRunner.connection.options.type === 'sqlite') { + if (['sqlite', 'better-sqlite3'].includes(queryRunner.connection.options.type)) { await this.sqliteUpQueryRunner(queryRunner); } else { await this.postgresUpQueryRunner(queryRunner); @@ -24,7 +24,7 @@ export class CreateEmailResetTable1678190791247 implements MigrationInterface { * @param queryRunner */ public async down(queryRunner: QueryRunner): Promise { - if (queryRunner.connection.options.type === 'sqlite') { + if (['sqlite', 'better-sqlite3'].includes(queryRunner.connection.options.type)) { await this.sqliteDownQueryRunner(queryRunner); } else { await this.postgresDownQueryRunner(queryRunner); diff --git a/packages/core/src/database/migrations/1678436030249-AlterOrganizationTeamTable.ts b/packages/core/src/database/migrations/1678436030249-AlterOrganizationTeamTable.ts index e8df876f478..cfba65adc22 100644 --- a/packages/core/src/database/migrations/1678436030249-AlterOrganizationTeamTable.ts +++ b/packages/core/src/database/migrations/1678436030249-AlterOrganizationTeamTable.ts @@ -11,7 +11,7 @@ export class AlterOrganizationTeamTable1678436030249 implements MigrationInterfa * @param queryRunner */ public async up(queryRunner: QueryRunner): Promise { - if (queryRunner.connection.options.type === 'sqlite') { + if (['sqlite', 'better-sqlite3'].includes(queryRunner.connection.options.type)) { await this.sqliteUpQueryRunner(queryRunner); } else { await this.postgresUpQueryRunner(queryRunner); @@ -24,7 +24,7 @@ export class AlterOrganizationTeamTable1678436030249 implements MigrationInterfa * @param queryRunner */ public async down(queryRunner: QueryRunner): Promise { - if (queryRunner.connection.options.type === 'sqlite') { + if (['sqlite', 'better-sqlite3'].includes(queryRunner.connection.options.type)) { await this.sqliteDownQueryRunner(queryRunner); } else { await this.postgresDownQueryRunner(queryRunner); diff --git a/packages/core/src/database/migrations/1678461100447-AlterEmailResetTable.ts b/packages/core/src/database/migrations/1678461100447-AlterEmailResetTable.ts index 1b37c9de3ae..19b0238aa18 100644 --- a/packages/core/src/database/migrations/1678461100447-AlterEmailResetTable.ts +++ b/packages/core/src/database/migrations/1678461100447-AlterEmailResetTable.ts @@ -11,7 +11,7 @@ export class AlterEmailResetTable1678461100447 implements MigrationInterface { * @param queryRunner */ public async up(queryRunner: QueryRunner): Promise { - if (queryRunner.connection.options.type === 'sqlite') { + if (['sqlite', 'better-sqlite3'].includes(queryRunner.connection.options.type)) { await this.sqliteUpQueryRunner(queryRunner); } else { await this.postgresUpQueryRunner(queryRunner); @@ -24,7 +24,7 @@ export class AlterEmailResetTable1678461100447 implements MigrationInterface { * @param queryRunner */ public async down(queryRunner: QueryRunner): Promise { - if (queryRunner.connection.options.type === 'sqlite') { + if (['sqlite', 'better-sqlite3'].includes(queryRunner.connection.options.type)) { await this.sqliteDownQueryRunner(queryRunner); } else { await this.postgresDownQueryRunner(queryRunner); diff --git a/packages/core/src/database/migrations/1679055440296-AlterTaskStatusTableTaskSizeTableTaskPriorityTable.ts b/packages/core/src/database/migrations/1679055440296-AlterTaskStatusTableTaskSizeTableTaskPriorityTable.ts index f6d62617af1..9e113c4bae1 100644 --- a/packages/core/src/database/migrations/1679055440296-AlterTaskStatusTableTaskSizeTableTaskPriorityTable.ts +++ b/packages/core/src/database/migrations/1679055440296-AlterTaskStatusTableTaskSizeTableTaskPriorityTable.ts @@ -11,7 +11,7 @@ export class AlterTaskStatusTableTaskSizeTableTaskPriorityTable1679055440296 imp * @param queryRunner */ public async up(queryRunner: QueryRunner): Promise { - if (queryRunner.connection.options.type === 'sqlite') { + if (['sqlite', 'better-sqlite3'].includes(queryRunner.connection.options.type)) { await this.sqliteUpQueryRunner(queryRunner); } else { await this.postgresUpQueryRunner(queryRunner); @@ -24,7 +24,7 @@ export class AlterTaskStatusTableTaskSizeTableTaskPriorityTable1679055440296 imp * @param queryRunner */ public async down(queryRunner: QueryRunner): Promise { - if (queryRunner.connection.options.type === 'sqlite') { + if (['sqlite', 'better-sqlite3'].includes(queryRunner.connection.options.type)) { await this.sqliteDownQueryRunner(queryRunner); } else { await this.postgresDownQueryRunner(queryRunner); diff --git a/packages/core/src/database/migrations/1679119603264-AlterOrganizationTeamJoinRequestTable.ts b/packages/core/src/database/migrations/1679119603264-AlterOrganizationTeamJoinRequestTable.ts index 007e2bfcc10..0d129fba1f0 100644 --- a/packages/core/src/database/migrations/1679119603264-AlterOrganizationTeamJoinRequestTable.ts +++ b/packages/core/src/database/migrations/1679119603264-AlterOrganizationTeamJoinRequestTable.ts @@ -11,7 +11,7 @@ export class AlterOrganizationTeamJoinRequestTable1679119603264 implements Migra * @param queryRunner */ public async up(queryRunner: QueryRunner): Promise { - if (queryRunner.connection.options.type === 'sqlite') { + if (['sqlite', 'better-sqlite3'].includes(queryRunner.connection.options.type)) { await this.sqliteUpQueryRunner(queryRunner); } else { await this.postgresUpQueryRunner(queryRunner); @@ -24,7 +24,7 @@ export class AlterOrganizationTeamJoinRequestTable1679119603264 implements Migra * @param queryRunner */ public async down(queryRunner: QueryRunner): Promise { - if (queryRunner.connection.options.type === 'sqlite') { + if (['sqlite', 'better-sqlite3'].includes(queryRunner.connection.options.type)) { await this.sqliteDownQueryRunner(queryRunner); } else { await this.postgresDownQueryRunner(queryRunner); diff --git a/packages/core/src/database/migrations/1679308324164-AlterImageAssetTable.ts b/packages/core/src/database/migrations/1679308324164-AlterImageAssetTable.ts index 7aa48a61afb..316c4c6070c 100644 --- a/packages/core/src/database/migrations/1679308324164-AlterImageAssetTable.ts +++ b/packages/core/src/database/migrations/1679308324164-AlterImageAssetTable.ts @@ -11,7 +11,7 @@ export class AlterImageAssetTable1679308324164 implements MigrationInterface { * @param queryRunner */ public async up(queryRunner: QueryRunner): Promise { - if (queryRunner.connection.options.type === 'sqlite') { + if (['sqlite', 'better-sqlite3'].includes(queryRunner.connection.options.type)) { await this.sqliteUpQueryRunner(queryRunner); } else { await this.postgresUpQueryRunner(queryRunner); @@ -24,7 +24,7 @@ export class AlterImageAssetTable1679308324164 implements MigrationInterface { * @param queryRunner */ public async down(queryRunner: QueryRunner): Promise { - if (queryRunner.connection.options.type === 'sqlite') { + if (['sqlite', 'better-sqlite3'].includes(queryRunner.connection.options.type)) { await this.sqliteDownQueryRunner(queryRunner); } else { await this.postgresDownQueryRunner(queryRunner); diff --git a/packages/core/src/database/migrations/1679406665415-AddImageAssetColumnToTables.ts b/packages/core/src/database/migrations/1679406665415-AddImageAssetColumnToTables.ts index 46398ee6b45..fe53b2e80b8 100644 --- a/packages/core/src/database/migrations/1679406665415-AddImageAssetColumnToTables.ts +++ b/packages/core/src/database/migrations/1679406665415-AddImageAssetColumnToTables.ts @@ -11,7 +11,7 @@ export class AddImageAssetColumnToTables1679406665415 implements MigrationInterf * @param queryRunner */ public async up(queryRunner: QueryRunner): Promise { - if (queryRunner.connection.options.type === 'sqlite') { + if (['sqlite', 'better-sqlite3'].includes(queryRunner.connection.options.type)) { await this.sqliteUpQueryRunner(queryRunner); } else { await this.postgresUpQueryRunner(queryRunner); @@ -24,7 +24,7 @@ export class AddImageAssetColumnToTables1679406665415 implements MigrationInterf * @param queryRunner */ public async down(queryRunner: QueryRunner): Promise { - if (queryRunner.connection.options.type === 'sqlite') { + if (['sqlite', 'better-sqlite3'].includes(queryRunner.connection.options.type)) { await this.sqliteDownQueryRunner(queryRunner); } else { await this.postgresDownQueryRunner(queryRunner); diff --git a/packages/core/src/database/migrations/1679676292810-AddImageAssetColumnToTheOrganizationTable.ts b/packages/core/src/database/migrations/1679676292810-AddImageAssetColumnToTheOrganizationTable.ts index 12765f15f34..5de65ba3377 100644 --- a/packages/core/src/database/migrations/1679676292810-AddImageAssetColumnToTheOrganizationTable.ts +++ b/packages/core/src/database/migrations/1679676292810-AddImageAssetColumnToTheOrganizationTable.ts @@ -11,7 +11,7 @@ export class AddImageAssetColumnToTheOrganizationTable1679676292810 implements M * @param queryRunner */ public async up(queryRunner: QueryRunner): Promise { - if (queryRunner.connection.options.type === 'sqlite') { + if (['sqlite', 'better-sqlite3'].includes(queryRunner.connection.options.type)) { await this.sqliteUpQueryRunner(queryRunner); } else { await this.postgresUpQueryRunner(queryRunner); @@ -24,7 +24,7 @@ export class AddImageAssetColumnToTheOrganizationTable1679676292810 implements M * @param queryRunner */ public async down(queryRunner: QueryRunner): Promise { - if (queryRunner.connection.options.type === 'sqlite') { + if (['sqlite', 'better-sqlite3'].includes(queryRunner.connection.options.type)) { await this.sqliteDownQueryRunner(queryRunner); } else { await this.postgresDownQueryRunner(queryRunner); diff --git a/packages/core/src/database/migrations/1679724221071-AddImageAssetColumnToTheProductCategoryTable.ts b/packages/core/src/database/migrations/1679724221071-AddImageAssetColumnToTheProductCategoryTable.ts index 3102aae466a..a081d93539a 100644 --- a/packages/core/src/database/migrations/1679724221071-AddImageAssetColumnToTheProductCategoryTable.ts +++ b/packages/core/src/database/migrations/1679724221071-AddImageAssetColumnToTheProductCategoryTable.ts @@ -11,7 +11,7 @@ export class AddImageAssetColumnToTheProductCategoryTable1679724221071 implement * @param queryRunner */ public async up(queryRunner: QueryRunner): Promise { - if (queryRunner.connection.options.type === 'sqlite') { + if (['sqlite', 'better-sqlite3'].includes(queryRunner.connection.options.type)) { await this.sqliteUpQueryRunner(queryRunner); } else { await this.postgresUpQueryRunner(queryRunner); @@ -24,7 +24,7 @@ export class AddImageAssetColumnToTheProductCategoryTable1679724221071 implement * @param queryRunner */ public async down(queryRunner: QueryRunner): Promise { - if (queryRunner.connection.options.type === 'sqlite') { + if (['sqlite', 'better-sqlite3'].includes(queryRunner.connection.options.type)) { await this.sqliteDownQueryRunner(queryRunner); } else { await this.postgresDownQueryRunner(queryRunner); diff --git a/packages/core/src/database/migrations/1680071714132-CreateIssueTypeTable.ts b/packages/core/src/database/migrations/1680071714132-CreateIssueTypeTable.ts index c66844fc288..eac3e717d95 100644 --- a/packages/core/src/database/migrations/1680071714132-CreateIssueTypeTable.ts +++ b/packages/core/src/database/migrations/1680071714132-CreateIssueTypeTable.ts @@ -11,7 +11,7 @@ export class CreateIssueTypeTable1680071714132 implements MigrationInterface { * @param queryRunner */ public async up(queryRunner: QueryRunner): Promise { - if (queryRunner.connection.options.type === 'sqlite') { + if (['sqlite', 'better-sqlite3'].includes(queryRunner.connection.options.type)) { await this.sqliteUpQueryRunner(queryRunner); } else { await this.postgresUpQueryRunner(queryRunner); @@ -24,7 +24,7 @@ export class CreateIssueTypeTable1680071714132 implements MigrationInterface { * @param queryRunner */ public async down(queryRunner: QueryRunner): Promise { - if (queryRunner.connection.options.type === 'sqlite') { + if (['sqlite', 'better-sqlite3'].includes(queryRunner.connection.options.type)) { await this.sqliteDownQueryRunner(queryRunner); } else { await this.postgresDownQueryRunner(queryRunner); diff --git a/packages/core/src/database/migrations/1680082411434-AddIssueTypeColumnToTheTaskTable.ts b/packages/core/src/database/migrations/1680082411434-AddIssueTypeColumnToTheTaskTable.ts index 548859d0df0..23ed7ac16fa 100644 --- a/packages/core/src/database/migrations/1680082411434-AddIssueTypeColumnToTheTaskTable.ts +++ b/packages/core/src/database/migrations/1680082411434-AddIssueTypeColumnToTheTaskTable.ts @@ -11,7 +11,7 @@ export class AddIssueTypeColumnToTheTaskTable1680082411434 implements MigrationI * @param queryRunner */ public async up(queryRunner: QueryRunner): Promise { - if (queryRunner.connection.options.type === 'sqlite') { + if (['sqlite', 'better-sqlite3'].includes(queryRunner.connection.options.type)) { await this.sqliteUpQueryRunner(queryRunner); } else { await this.postgresUpQueryRunner(queryRunner); @@ -24,7 +24,7 @@ export class AddIssueTypeColumnToTheTaskTable1680082411434 implements MigrationI * @param queryRunner */ public async down(queryRunner: QueryRunner): Promise { - if (queryRunner.connection.options.type === 'sqlite') { + if (['sqlite', 'better-sqlite3'].includes(queryRunner.connection.options.type)) { await this.sqliteDownQueryRunner(queryRunner); } else { await this.postgresDownQueryRunner(queryRunner); diff --git a/packages/core/src/database/migrations/1680108987586-AddIndexesColumnsToTheTimeSlotTable.ts b/packages/core/src/database/migrations/1680108987586-AddIndexesColumnsToTheTimeSlotTable.ts index 58c04bc3b56..21e0e3073ba 100644 --- a/packages/core/src/database/migrations/1680108987586-AddIndexesColumnsToTheTimeSlotTable.ts +++ b/packages/core/src/database/migrations/1680108987586-AddIndexesColumnsToTheTimeSlotTable.ts @@ -11,7 +11,7 @@ export class AddIndexesColumnsToTheTimeSlotTable1680108987586 implements Migrati * @param queryRunner */ public async up(queryRunner: QueryRunner): Promise { - if (queryRunner.connection.options.type === 'sqlite') { + if (['sqlite', 'better-sqlite3'].includes(queryRunner.connection.options.type)) { await this.sqliteUpQueryRunner(queryRunner); } else { await this.postgresUpQueryRunner(queryRunner); @@ -24,7 +24,7 @@ export class AddIndexesColumnsToTheTimeSlotTable1680108987586 implements Migrati * @param queryRunner */ public async down(queryRunner: QueryRunner): Promise { - if (queryRunner.connection.options.type === 'sqlite') { + if (['sqlite', 'better-sqlite3'].includes(queryRunner.connection.options.type)) { await this.sqliteDownQueryRunner(queryRunner); } else { await this.postgresDownQueryRunner(queryRunner); diff --git a/packages/core/src/database/migrations/1680110810109-AddIndexesColumnsToTheScreenshotTable.ts b/packages/core/src/database/migrations/1680110810109-AddIndexesColumnsToTheScreenshotTable.ts index e65c1ebe9e5..42b1978824f 100644 --- a/packages/core/src/database/migrations/1680110810109-AddIndexesColumnsToTheScreenshotTable.ts +++ b/packages/core/src/database/migrations/1680110810109-AddIndexesColumnsToTheScreenshotTable.ts @@ -11,7 +11,7 @@ export class AddIndexesColumnsToTheScreenshotTable1680110810109 implements Migra * @param queryRunner */ public async up(queryRunner: QueryRunner): Promise { - if (queryRunner.connection.options.type === 'sqlite') { + if (['sqlite', 'better-sqlite3'].includes(queryRunner.connection.options.type)) { await this.sqliteUpQueryRunner(queryRunner); } else { await this.postgresUpQueryRunner(queryRunner); @@ -24,7 +24,7 @@ export class AddIndexesColumnsToTheScreenshotTable1680110810109 implements Migra * @param queryRunner */ public async down(queryRunner: QueryRunner): Promise { - if (queryRunner.connection.options.type === 'sqlite') { + if (['sqlite', 'better-sqlite3'].includes(queryRunner.connection.options.type)) { await this.sqliteDownQueryRunner(queryRunner); } else { await this.postgresDownQueryRunner(queryRunner); diff --git a/packages/core/src/database/migrations/1680154573492-AddIndexesColumnsToTheActivityTable.ts b/packages/core/src/database/migrations/1680154573492-AddIndexesColumnsToTheActivityTable.ts index 08c560737f0..234fe73a2fc 100644 --- a/packages/core/src/database/migrations/1680154573492-AddIndexesColumnsToTheActivityTable.ts +++ b/packages/core/src/database/migrations/1680154573492-AddIndexesColumnsToTheActivityTable.ts @@ -11,7 +11,7 @@ export class AddIndexesColumnsToTheActivityTable1680154573492 implements Migrati * @param queryRunner */ public async up(queryRunner: QueryRunner): Promise { - if (queryRunner.connection.options.type === 'sqlite') { + if (['sqlite', 'better-sqlite3'].includes(queryRunner.connection.options.type)) { await this.sqliteUpQueryRunner(queryRunner); } else { await this.postgresUpQueryRunner(queryRunner); @@ -24,7 +24,7 @@ export class AddIndexesColumnsToTheActivityTable1680154573492 implements Migrati * @param queryRunner */ public async down(queryRunner: QueryRunner): Promise { - if (queryRunner.connection.options.type === 'sqlite') { + if (['sqlite', 'better-sqlite3'].includes(queryRunner.connection.options.type)) { await this.sqliteDownQueryRunner(queryRunner); } else { await this.postgresDownQueryRunner(queryRunner); diff --git a/packages/core/src/database/migrations/1680164421193-AddIndexesColumnsToTheTimesheetTable.ts b/packages/core/src/database/migrations/1680164421193-AddIndexesColumnsToTheTimesheetTable.ts index a447752fa19..49f58e5300d 100644 --- a/packages/core/src/database/migrations/1680164421193-AddIndexesColumnsToTheTimesheetTable.ts +++ b/packages/core/src/database/migrations/1680164421193-AddIndexesColumnsToTheTimesheetTable.ts @@ -11,7 +11,7 @@ export class AddIndexesColumnsToTheTimesheetTable1680164421193 implements Migrat * @param queryRunner */ public async up(queryRunner: QueryRunner): Promise { - if (queryRunner.connection.options.type === 'sqlite') { + if (['sqlite', 'better-sqlite3'].includes(queryRunner.connection.options.type)) { await this.sqliteUpQueryRunner(queryRunner); } else { await this.postgresUpQueryRunner(queryRunner); @@ -24,7 +24,7 @@ export class AddIndexesColumnsToTheTimesheetTable1680164421193 implements Migrat * @param queryRunner */ public async down(queryRunner: QueryRunner): Promise { - if (queryRunner.connection.options.type === 'sqlite') { + if (['sqlite', 'better-sqlite3'].includes(queryRunner.connection.options.type)) { await this.sqliteDownQueryRunner(queryRunner); } else { await this.postgresDownQueryRunner(queryRunner); diff --git a/packages/core/src/database/migrations/1680172332764-AddIndexesColumnsToTheTimeLogTable.ts b/packages/core/src/database/migrations/1680172332764-AddIndexesColumnsToTheTimeLogTable.ts index 2fd8b4adf8c..2ecb630367c 100644 --- a/packages/core/src/database/migrations/1680172332764-AddIndexesColumnsToTheTimeLogTable.ts +++ b/packages/core/src/database/migrations/1680172332764-AddIndexesColumnsToTheTimeLogTable.ts @@ -9,7 +9,7 @@ export class AddIndexesColumnsToTheTimeLogTable1680172332764 implements Migratio * @param queryRunner */ public async up(queryRunner: QueryRunner): Promise { - if (queryRunner.connection.options.type === 'sqlite') { + if (['sqlite', 'better-sqlite3'].includes(queryRunner.connection.options.type)) { await this.sqliteUpQueryRunner(queryRunner); } else { await this.postgresUpQueryRunner(queryRunner); @@ -22,7 +22,7 @@ export class AddIndexesColumnsToTheTimeLogTable1680172332764 implements Migratio * @param queryRunner */ public async down(queryRunner: QueryRunner): Promise { - if (queryRunner.connection.options.type === 'sqlite') { + if (['sqlite', 'better-sqlite3'].includes(queryRunner.connection.options.type)) { await this.sqliteDownQueryRunner(queryRunner); } else { await this.postgresDownQueryRunner(queryRunner); diff --git a/packages/core/src/database/migrations/1680530165590-AlterJobSearchRelationalTables.ts b/packages/core/src/database/migrations/1680530165590-AlterJobSearchRelationalTables.ts index 2be5332f602..26f8c1ec58d 100644 --- a/packages/core/src/database/migrations/1680530165590-AlterJobSearchRelationalTables.ts +++ b/packages/core/src/database/migrations/1680530165590-AlterJobSearchRelationalTables.ts @@ -11,7 +11,7 @@ export class AlterJobSearchRelationalTables1680530165590 implements MigrationInt * @param queryRunner */ public async up(queryRunner: QueryRunner): Promise { - if (queryRunner.connection.options.type === 'sqlite') { + if (['sqlite', 'better-sqlite3'].includes(queryRunner.connection.options.type)) { await this.sqliteUpQueryRunner(queryRunner); } else { await this.postgresUpQueryRunner(queryRunner); @@ -24,7 +24,7 @@ export class AlterJobSearchRelationalTables1680530165590 implements MigrationInt * @param queryRunner */ public async down(queryRunner: QueryRunner): Promise { - if (queryRunner.connection.options.type === 'sqlite') { + if (['sqlite', 'better-sqlite3'].includes(queryRunner.connection.options.type)) { await this.sqliteDownQueryRunner(queryRunner); } else { await this.postgresDownQueryRunner(queryRunner); diff --git a/packages/core/src/database/migrations/1680622389221-SeedDafaultGlobalIssueType.ts b/packages/core/src/database/migrations/1680622389221-SeedDafaultGlobalIssueType.ts index 667fab17d0f..aec35f1cfe2 100644 --- a/packages/core/src/database/migrations/1680622389221-SeedDafaultGlobalIssueType.ts +++ b/packages/core/src/database/migrations/1680622389221-SeedDafaultGlobalIssueType.ts @@ -65,7 +65,7 @@ export class SeedDafaultGlobalIssueType1680622389221 implements MigrationInterfa isSystem ]; - if (queryRunner.connection.options.type === 'sqlite') { + if (['sqlite', 'better-sqlite3'].includes(queryRunner.connection.options.type)) { const imageAssetId = uuidv4(); imageAsset.push(imageAssetId); diff --git a/packages/core/src/database/migrations/1680688280325-AddUpworkOrganizationIdToTheOrganizationTable.ts b/packages/core/src/database/migrations/1680688280325-AddUpworkOrganizationIdToTheOrganizationTable.ts index 91dd404d8e3..15644143c3a 100644 --- a/packages/core/src/database/migrations/1680688280325-AddUpworkOrganizationIdToTheOrganizationTable.ts +++ b/packages/core/src/database/migrations/1680688280325-AddUpworkOrganizationIdToTheOrganizationTable.ts @@ -11,7 +11,7 @@ export class AddUpworkOrganizationIdToTheOrganizationTable1680688280325 implemen * @param queryRunner */ public async up(queryRunner: QueryRunner): Promise { - if (queryRunner.connection.options.type === 'sqlite') { + if (['sqlite', 'better-sqlite3'].includes(queryRunner.connection.options.type)) { await this.sqliteUpQueryRunner(queryRunner); } else { await this.postgresUpQueryRunner(queryRunner); @@ -24,7 +24,7 @@ export class AddUpworkOrganizationIdToTheOrganizationTable1680688280325 implemen * @param queryRunner */ public async down(queryRunner: QueryRunner): Promise { - if (queryRunner.connection.options.type === 'sqlite') { + if (['sqlite', 'better-sqlite3'].includes(queryRunner.connection.options.type)) { await this.sqliteDownQueryRunner(queryRunner); } else { await this.postgresDownQueryRunner(queryRunner); diff --git a/packages/core/src/database/migrations/1680692867660-AlterEmployeeTable.ts b/packages/core/src/database/migrations/1680692867660-AlterEmployeeTable.ts index ee5c2c9abe2..ab374b9d996 100644 --- a/packages/core/src/database/migrations/1680692867660-AlterEmployeeTable.ts +++ b/packages/core/src/database/migrations/1680692867660-AlterEmployeeTable.ts @@ -11,7 +11,7 @@ export class AlterEmployeeTable1680692867660 implements MigrationInterface { * @param queryRunner */ public async up(queryRunner: QueryRunner): Promise { - if (queryRunner.connection.options.type === 'sqlite') { + if (['sqlite', 'better-sqlite3'].includes(queryRunner.connection.options.type)) { await this.sqliteUpQueryRunner(queryRunner); } else { await this.postgresUpQueryRunner(queryRunner); @@ -24,7 +24,7 @@ export class AlterEmployeeTable1680692867660 implements MigrationInterface { * @param queryRunner */ public async down(queryRunner: QueryRunner): Promise { - if (queryRunner.connection.options.type === 'sqlite') { + if (['sqlite', 'better-sqlite3'].includes(queryRunner.connection.options.type)) { await this.sqliteDownQueryRunner(queryRunner); } else { await this.postgresDownQueryRunner(queryRunner); diff --git a/packages/core/src/database/migrations/1680866279166-AddDocumentAssetColumnToTheOrganizationDocumentTable.ts b/packages/core/src/database/migrations/1680866279166-AddDocumentAssetColumnToTheOrganizationDocumentTable.ts index 20308a9c419..46764826600 100644 --- a/packages/core/src/database/migrations/1680866279166-AddDocumentAssetColumnToTheOrganizationDocumentTable.ts +++ b/packages/core/src/database/migrations/1680866279166-AddDocumentAssetColumnToTheOrganizationDocumentTable.ts @@ -11,7 +11,7 @@ export class AddDocumentAssetColumnToTheOrganizationDocumentTable1680866279166 i * @param queryRunner */ public async up(queryRunner: QueryRunner): Promise { - if (queryRunner.connection.options.type === 'sqlite') { + if (['sqlite', 'better-sqlite3'].includes(queryRunner.connection.options.type)) { await this.sqliteUpQueryRunner(queryRunner); } else { await this.postgresUpQueryRunner(queryRunner); @@ -24,7 +24,7 @@ export class AddDocumentAssetColumnToTheOrganizationDocumentTable1680866279166 i * @param queryRunner */ public async down(queryRunner: QueryRunner): Promise { - if (queryRunner.connection.options.type === 'sqlite') { + if (['sqlite', 'better-sqlite3'].includes(queryRunner.connection.options.type)) { await this.sqliteDownQueryRunner(queryRunner); } else { await this.postgresDownQueryRunner(queryRunner); diff --git a/packages/core/src/database/migrations/1680871419966-AddDocumentAssetColumnToTheTimeOffRequestTable.ts b/packages/core/src/database/migrations/1680871419966-AddDocumentAssetColumnToTheTimeOffRequestTable.ts index 1625d7194b0..ed6ea27b611 100644 --- a/packages/core/src/database/migrations/1680871419966-AddDocumentAssetColumnToTheTimeOffRequestTable.ts +++ b/packages/core/src/database/migrations/1680871419966-AddDocumentAssetColumnToTheTimeOffRequestTable.ts @@ -11,7 +11,7 @@ export class AddDocumentAssetColumnToTheTimeOffRequestTable1680871419966 impleme * @param queryRunner */ public async up(queryRunner: QueryRunner): Promise { - if (queryRunner.connection.options.type === 'sqlite') { + if (['sqlite', 'better-sqlite3'].includes(queryRunner.connection.options.type)) { await this.sqliteUpQueryRunner(queryRunner); } else { await this.postgresUpQueryRunner(queryRunner); @@ -24,7 +24,7 @@ export class AddDocumentAssetColumnToTheTimeOffRequestTable1680871419966 impleme * @param queryRunner */ public async down(queryRunner: QueryRunner): Promise { - if (queryRunner.connection.options.type === 'sqlite') { + if (['sqlite', 'better-sqlite3'].includes(queryRunner.connection.options.type)) { await this.sqliteDownQueryRunner(queryRunner); } else { await this.postgresDownQueryRunner(queryRunner); diff --git a/packages/core/src/database/migrations/1681132031905-AddEmployeeStatusColumnsToTheEmployeeTable.ts b/packages/core/src/database/migrations/1681132031905-AddEmployeeStatusColumnsToTheEmployeeTable.ts index 46109877cd6..36f50d3ff46 100644 --- a/packages/core/src/database/migrations/1681132031905-AddEmployeeStatusColumnsToTheEmployeeTable.ts +++ b/packages/core/src/database/migrations/1681132031905-AddEmployeeStatusColumnsToTheEmployeeTable.ts @@ -10,7 +10,7 @@ export class AddEmployeeStatusColumnsToTheEmployeeTable1681132031905 implements * @param queryRunner */ public async up(queryRunner: QueryRunner): Promise { - if (queryRunner.connection.options.type === 'sqlite') { + if (['sqlite', 'better-sqlite3'].includes(queryRunner.connection.options.type)) { await this.sqliteUpQueryRunner(queryRunner); } else { await this.postgresUpQueryRunner(queryRunner); @@ -23,7 +23,7 @@ export class AddEmployeeStatusColumnsToTheEmployeeTable1681132031905 implements * @param queryRunner */ public async down(queryRunner: QueryRunner): Promise { - if (queryRunner.connection.options.type === 'sqlite') { + if (['sqlite', 'better-sqlite3'].includes(queryRunner.connection.options.type)) { await this.sqliteDownQueryRunner(queryRunner); } else { await this.postgresDownQueryRunner(queryRunner); diff --git a/packages/core/src/database/migrations/1681455351186-AddOrganizationTeamIdColumnToTheTimeLogTable.ts b/packages/core/src/database/migrations/1681455351186-AddOrganizationTeamIdColumnToTheTimeLogTable.ts index a4da56ed0aa..552cff5af94 100644 --- a/packages/core/src/database/migrations/1681455351186-AddOrganizationTeamIdColumnToTheTimeLogTable.ts +++ b/packages/core/src/database/migrations/1681455351186-AddOrganizationTeamIdColumnToTheTimeLogTable.ts @@ -11,7 +11,7 @@ export class AddOrganizationTeamIdColumnToTheTimeLogTable1681455351186 implement * @param queryRunner */ public async up(queryRunner: QueryRunner): Promise { - if (queryRunner.connection.options.type === 'sqlite') { + if (['sqlite', 'better-sqlite3'].includes(queryRunner.connection.options.type)) { await this.sqliteUpQueryRunner(queryRunner); } else { await this.postgresUpQueryRunner(queryRunner); @@ -24,7 +24,7 @@ export class AddOrganizationTeamIdColumnToTheTimeLogTable1681455351186 implement * @param queryRunner */ public async down(queryRunner: QueryRunner): Promise { - if (queryRunner.connection.options.type === 'sqlite') { + if (['sqlite', 'better-sqlite3'].includes(queryRunner.connection.options.type)) { await this.sqliteDownQueryRunner(queryRunner); } else { await this.postgresDownQueryRunner(queryRunner); diff --git a/packages/core/src/database/migrations/1686195290990-AlterOrganizationTeamTable.ts b/packages/core/src/database/migrations/1686195290990-AlterOrganizationTeamTable.ts index 8fc66b73f91..00024302f2b 100644 --- a/packages/core/src/database/migrations/1686195290990-AlterOrganizationTeamTable.ts +++ b/packages/core/src/database/migrations/1686195290990-AlterOrganizationTeamTable.ts @@ -9,7 +9,7 @@ export class AlterOrganizationTeamTable1686195290990 implements MigrationInterfa * @param queryRunner */ public async up(queryRunner: QueryRunner): Promise { - if (queryRunner.connection.options.type === 'sqlite') { + if (['sqlite', 'better-sqlite3'].includes(queryRunner.connection.options.type)) { await this.sqliteUpQueryRunner(queryRunner); } else { await this.postgresUpQueryRunner(queryRunner); @@ -22,7 +22,7 @@ export class AlterOrganizationTeamTable1686195290990 implements MigrationInterfa * @param queryRunner */ public async down(queryRunner: QueryRunner): Promise { - if (queryRunner.connection.options.type === 'sqlite') { + if (['sqlite', 'better-sqlite3'].includes(queryRunner.connection.options.type)) { await this.sqliteDownQueryRunner(queryRunner); } else { await this.postgresDownQueryRunner(queryRunner); diff --git a/packages/core/src/database/migrations/1687967010243-AddMinimumBillingRateColumnToEmployeeTable.ts b/packages/core/src/database/migrations/1687967010243-AddMinimumBillingRateColumnToEmployeeTable.ts index 6c6eccdc06a..8bbcd1eb663 100644 --- a/packages/core/src/database/migrations/1687967010243-AddMinimumBillingRateColumnToEmployeeTable.ts +++ b/packages/core/src/database/migrations/1687967010243-AddMinimumBillingRateColumnToEmployeeTable.ts @@ -9,7 +9,7 @@ export class AddMinimumBillingRateColumnToEmployeeTable1687967010243 implements * @param queryRunner */ public async up(queryRunner: QueryRunner): Promise { - if (queryRunner.connection.options.type === 'sqlite') { + if (['sqlite', 'better-sqlite3'].includes(queryRunner.connection.options.type)) { await this.sqliteUpQueryRunner(queryRunner); } else { await this.postgresUpQueryRunner(queryRunner); @@ -22,7 +22,7 @@ export class AddMinimumBillingRateColumnToEmployeeTable1687967010243 implements * @param queryRunner */ public async down(queryRunner: QueryRunner): Promise { - if (queryRunner.connection.options.type === 'sqlite') { + if (['sqlite', 'better-sqlite3'].includes(queryRunner.connection.options.type)) { await this.sqliteDownQueryRunner(queryRunner); } else { await this.postgresDownQueryRunner(queryRunner); diff --git a/packages/core/src/database/migrations/1687967919076-AddMinimumBillingRateColumnToCandidateTable.ts b/packages/core/src/database/migrations/1687967919076-AddMinimumBillingRateColumnToCandidateTable.ts index 87be7d863ed..401b71d46f6 100644 --- a/packages/core/src/database/migrations/1687967919076-AddMinimumBillingRateColumnToCandidateTable.ts +++ b/packages/core/src/database/migrations/1687967919076-AddMinimumBillingRateColumnToCandidateTable.ts @@ -11,7 +11,7 @@ export class AddMinimumBillingRateColumnToCandidateTable1687967919076 implements * @param queryRunner */ public async up(queryRunner: QueryRunner): Promise { - if (queryRunner.connection.options.type === 'sqlite') { + if (['sqlite', 'better-sqlite3'].includes(queryRunner.connection.options.type)) { await this.sqliteUpQueryRunner(queryRunner); } else { await this.postgresUpQueryRunner(queryRunner); @@ -24,7 +24,7 @@ export class AddMinimumBillingRateColumnToCandidateTable1687967919076 implements * @param queryRunner */ public async down(queryRunner: QueryRunner): Promise { - if (queryRunner.connection.options.type === 'sqlite') { + if (['sqlite', 'better-sqlite3'].includes(queryRunner.connection.options.type)) { await this.sqliteDownQueryRunner(queryRunner); } else { await this.postgresDownQueryRunner(queryRunner); diff --git a/packages/core/src/database/migrations/1687974863736-CreateTaskVersionTable.ts b/packages/core/src/database/migrations/1687974863736-CreateTaskVersionTable.ts index c773fb41ead..3b40219b27a 100644 --- a/packages/core/src/database/migrations/1687974863736-CreateTaskVersionTable.ts +++ b/packages/core/src/database/migrations/1687974863736-CreateTaskVersionTable.ts @@ -9,7 +9,7 @@ export class CreateTaskVersionTable1687974863736 implements MigrationInterface { * @param queryRunner */ public async up(queryRunner: QueryRunner): Promise { - if (queryRunner.connection.options.type === 'sqlite') { + if (['sqlite', 'better-sqlite3'].includes(queryRunner.connection.options.type)) { await this.sqliteUpQueryRunner(queryRunner); } else { await this.postgresUpQueryRunner(queryRunner); @@ -22,7 +22,7 @@ export class CreateTaskVersionTable1687974863736 implements MigrationInterface { * @param queryRunner */ public async down(queryRunner: QueryRunner): Promise { - if (queryRunner.connection.options.type === 'sqlite') { + if (['sqlite', 'better-sqlite3'].includes(queryRunner.connection.options.type)) { await this.sqliteDownQueryRunner(queryRunner); } else { await this.postgresDownQueryRunner(queryRunner); diff --git a/packages/core/src/database/migrations/1688122296981-AlterTableEmployee.ts b/packages/core/src/database/migrations/1688122296981-AlterTableEmployee.ts index 44a42df30bf..7111d4f8205 100644 --- a/packages/core/src/database/migrations/1688122296981-AlterTableEmployee.ts +++ b/packages/core/src/database/migrations/1688122296981-AlterTableEmployee.ts @@ -11,7 +11,7 @@ export class AlterTableEmployee1688122296981 implements MigrationInterface { * @param queryRunner */ public async up(queryRunner: QueryRunner): Promise { - if (queryRunner.connection.options.type === 'sqlite') { + if (['sqlite', 'better-sqlite3'].includes(queryRunner.connection.options.type)) { await this.sqliteUpQueryRunner(queryRunner); } else { await this.postgresUpQueryRunner(queryRunner); @@ -24,7 +24,7 @@ export class AlterTableEmployee1688122296981 implements MigrationInterface { * @param queryRunner */ public async down(queryRunner: QueryRunner): Promise { - if (queryRunner.connection.options.type === 'sqlite') { + if (['sqlite', 'better-sqlite3'].includes(queryRunner.connection.options.type)) { await this.sqliteDownQueryRunner(queryRunner); } else { await this.postgresDownQueryRunner(queryRunner); diff --git a/packages/core/src/database/migrations/1688168798377-CreateRelatedIssueTypeTable.ts b/packages/core/src/database/migrations/1688168798377-CreateRelatedIssueTypeTable.ts index 029e2febd9f..3f2fba0efa6 100644 --- a/packages/core/src/database/migrations/1688168798377-CreateRelatedIssueTypeTable.ts +++ b/packages/core/src/database/migrations/1688168798377-CreateRelatedIssueTypeTable.ts @@ -11,7 +11,7 @@ export class CreateRelatedIssueTypeTable1688168798377 * @param queryRunner */ public async up(queryRunner: QueryRunner): Promise { - if (queryRunner.connection.options.type === 'sqlite') { + if (['sqlite', 'better-sqlite3'].includes(queryRunner.connection.options.type)) { await this.sqliteUpQueryRunner(queryRunner); } else { await this.postgresUpQueryRunner(queryRunner); @@ -24,7 +24,7 @@ export class CreateRelatedIssueTypeTable1688168798377 * @param queryRunner */ public async down(queryRunner: QueryRunner): Promise { - if (queryRunner.connection.options.type === 'sqlite') { + if (['sqlite', 'better-sqlite3'].includes(queryRunner.connection.options.type)) { await this.sqliteDownQueryRunner(queryRunner); } else { await this.postgresDownQueryRunner(queryRunner); diff --git a/packages/core/src/database/migrations/1688886388219-AddParentIdColumnToTaskTable.ts b/packages/core/src/database/migrations/1688886388219-AddParentIdColumnToTaskTable.ts index 56612ca47cc..bd3da2a89c4 100644 --- a/packages/core/src/database/migrations/1688886388219-AddParentIdColumnToTaskTable.ts +++ b/packages/core/src/database/migrations/1688886388219-AddParentIdColumnToTaskTable.ts @@ -11,7 +11,7 @@ export class AddParentIdColumnToTaskTable1688886388219 implements MigrationInter * @param queryRunner */ public async up(queryRunner: QueryRunner): Promise { - if (queryRunner.connection.options.type === 'sqlite') { + if (['sqlite', 'better-sqlite3'].includes(queryRunner.connection.options.type)) { await this.sqliteUpQueryRunner(queryRunner); } else { await this.postgresUpQueryRunner(queryRunner); @@ -24,7 +24,7 @@ export class AddParentIdColumnToTaskTable1688886388219 implements MigrationInter * @param queryRunner */ public async down(queryRunner: QueryRunner): Promise { - if (queryRunner.connection.options.type === 'sqlite') { + if (['sqlite', 'better-sqlite3'].includes(queryRunner.connection.options.type)) { await this.sqliteDownQueryRunner(queryRunner); } else { await this.postgresDownQueryRunner(queryRunner); diff --git a/packages/core/src/database/migrations/1688966032457-AddRelatedIssueRelationToTaskTable.ts b/packages/core/src/database/migrations/1688966032457-AddRelatedIssueRelationToTaskTable.ts index 67b723a1ceb..1c9c4ff1372 100644 --- a/packages/core/src/database/migrations/1688966032457-AddRelatedIssueRelationToTaskTable.ts +++ b/packages/core/src/database/migrations/1688966032457-AddRelatedIssueRelationToTaskTable.ts @@ -9,7 +9,7 @@ export class AddRelatedIssueRelationToTaskTable1688966032457 implements Migratio * @param queryRunner */ public async up(queryRunner: QueryRunner): Promise { - if (queryRunner.connection.options.type === 'sqlite') { + if (['sqlite', 'better-sqlite3'].includes(queryRunner.connection.options.type)) { await this.sqliteUpQueryRunner(queryRunner); } else { await this.postgresUpQueryRunner(queryRunner); @@ -22,7 +22,7 @@ export class AddRelatedIssueRelationToTaskTable1688966032457 implements Migratio * @param queryRunner */ public async down(queryRunner: QueryRunner): Promise { - if (queryRunner.connection.options.type === 'sqlite') { + if (['sqlite', 'better-sqlite3'].includes(queryRunner.connection.options.type)) { await this.sqliteDownQueryRunner(queryRunner); } else { await this.postgresDownQueryRunner(queryRunner); diff --git a/packages/core/src/database/migrations/1689150247379-CreateTaskLinkedIssueTable.ts b/packages/core/src/database/migrations/1689150247379-CreateTaskLinkedIssueTable.ts index d6bb87d13bf..b39e0150e92 100644 --- a/packages/core/src/database/migrations/1689150247379-CreateTaskLinkedIssueTable.ts +++ b/packages/core/src/database/migrations/1689150247379-CreateTaskLinkedIssueTable.ts @@ -11,7 +11,7 @@ export class CreateTaskLinkedIssueTable1689150247379 implements MigrationInterfa * @param queryRunner */ public async up(queryRunner: QueryRunner): Promise { - if (queryRunner.connection.options.type === 'sqlite') { + if (['sqlite', 'better-sqlite3'].includes(queryRunner.connection.options.type)) { await this.sqliteUpQueryRunner(queryRunner); } else { await this.postgresUpQueryRunner(queryRunner); @@ -24,7 +24,7 @@ export class CreateTaskLinkedIssueTable1689150247379 implements MigrationInterfa * @param queryRunner */ public async down(queryRunner: QueryRunner): Promise { - if (queryRunner.connection.options.type === 'sqlite') { + if (['sqlite', 'better-sqlite3'].includes(queryRunner.connection.options.type)) { await this.sqliteDownQueryRunner(queryRunner); } else { await this.postgresDownQueryRunner(queryRunner); diff --git a/packages/core/src/database/migrations/1689181881441-CreateOrganizationTaskSettingTable.ts b/packages/core/src/database/migrations/1689181881441-CreateOrganizationTaskSettingTable.ts index 4c0f836acac..b600e5e81f3 100644 --- a/packages/core/src/database/migrations/1689181881441-CreateOrganizationTaskSettingTable.ts +++ b/packages/core/src/database/migrations/1689181881441-CreateOrganizationTaskSettingTable.ts @@ -11,7 +11,7 @@ export class CreateOrganizationTaskSettingTable1689181881441 implements Migratio * @param queryRunner */ public async up(queryRunner: QueryRunner): Promise { - if (queryRunner.connection.options.type === 'sqlite') { + if (['sqlite', 'better-sqlite3'].includes(queryRunner.connection.options.type)) { await this.sqliteUpQueryRunner(queryRunner); } else { await this.postgresUpQueryRunner(queryRunner); @@ -24,7 +24,7 @@ export class CreateOrganizationTaskSettingTable1689181881441 implements Migratio * @param queryRunner */ public async down(queryRunner: QueryRunner): Promise { - if (queryRunner.connection.options.type === 'sqlite') { + if (['sqlite', 'better-sqlite3'].includes(queryRunner.connection.options.type)) { await this.sqliteDownQueryRunner(queryRunner); } else { await this.postgresDownQueryRunner(queryRunner); diff --git a/packages/core/src/database/migrations/1689611487195-DropTaskRelatedIssuesTable.ts b/packages/core/src/database/migrations/1689611487195-DropTaskRelatedIssuesTable.ts index 536270b9220..d616a34c67d 100644 --- a/packages/core/src/database/migrations/1689611487195-DropTaskRelatedIssuesTable.ts +++ b/packages/core/src/database/migrations/1689611487195-DropTaskRelatedIssuesTable.ts @@ -11,7 +11,7 @@ export class DropTaskRelatedIssuesTable1689611487195 implements MigrationInterfa * @param queryRunner */ public async up(queryRunner: QueryRunner): Promise { - if (queryRunner.connection.options.type === 'sqlite') { + if (['sqlite', 'better-sqlite3'].includes(queryRunner.connection.options.type)) { await this.sqliteUpQueryRunner(queryRunner); } else { await this.postgresUpQueryRunner(queryRunner); @@ -24,7 +24,7 @@ export class DropTaskRelatedIssuesTable1689611487195 implements MigrationInterfa * @param queryRunner */ public async down(queryRunner: QueryRunner): Promise { - if (queryRunner.connection.options.type === 'sqlite') { + if (['sqlite', 'better-sqlite3'].includes(queryRunner.connection.options.type)) { await this.sqliteDownQueryRunner(queryRunner); } else { await this.postgresDownQueryRunner(queryRunner); diff --git a/packages/core/src/database/migrations/1689670799675-CreateTaskEstimationTable.ts b/packages/core/src/database/migrations/1689670799675-CreateTaskEstimationTable.ts index 5197fa86655..8becb60f917 100644 --- a/packages/core/src/database/migrations/1689670799675-CreateTaskEstimationTable.ts +++ b/packages/core/src/database/migrations/1689670799675-CreateTaskEstimationTable.ts @@ -11,7 +11,7 @@ export class CreateTaskEstimationTable1689670799675 * @param queryRunner */ public async up(queryRunner: QueryRunner): Promise { - if (queryRunner.connection.options.type === 'sqlite') { + if (['sqlite', 'better-sqlite3'].includes(queryRunner.connection.options.type)) { await this.sqliteUpQueryRunner(queryRunner); } else { await this.postgresUpQueryRunner(queryRunner); @@ -24,7 +24,7 @@ export class CreateTaskEstimationTable1689670799675 * @param queryRunner */ public async down(queryRunner: QueryRunner): Promise { - if (queryRunner.connection.options.type === 'sqlite') { + if (['sqlite', 'better-sqlite3'].includes(queryRunner.connection.options.type)) { await this.sqliteDownQueryRunner(queryRunner); } else { await this.postgresDownQueryRunner(queryRunner); diff --git a/packages/core/src/database/migrations/1690040638765-AlterReportTable.ts b/packages/core/src/database/migrations/1690040638765-AlterReportTable.ts index a8ee24bf289..84ec429ba70 100644 --- a/packages/core/src/database/migrations/1690040638765-AlterReportTable.ts +++ b/packages/core/src/database/migrations/1690040638765-AlterReportTable.ts @@ -11,7 +11,7 @@ export class AlterReportTable1690040638765 implements MigrationInterface { * @param queryRunner */ public async up(queryRunner: QueryRunner): Promise { - if (queryRunner.connection.options.type === 'sqlite') { + if (['sqlite', 'better-sqlite3'].includes(queryRunner.connection.options.type)) { await this.sqliteUpQueryRunner(queryRunner); } else { await this.postgresUpQueryRunner(queryRunner); @@ -24,7 +24,7 @@ export class AlterReportTable1690040638765 implements MigrationInterface { * @param queryRunner */ public async down(queryRunner: QueryRunner): Promise { - if (queryRunner.connection.options.type === 'sqlite') { + if (['sqlite', 'better-sqlite3'].includes(queryRunner.connection.options.type)) { await this.sqliteDownQueryRunner(queryRunner); } else { await this.postgresDownQueryRunner(queryRunner); diff --git a/packages/core/src/database/migrations/1690167501143-AddActiveTaskColumnToOrganizationTeamEmployee.ts b/packages/core/src/database/migrations/1690167501143-AddActiveTaskColumnToOrganizationTeamEmployee.ts index 1ee2f106ab3..f704f302695 100644 --- a/packages/core/src/database/migrations/1690167501143-AddActiveTaskColumnToOrganizationTeamEmployee.ts +++ b/packages/core/src/database/migrations/1690167501143-AddActiveTaskColumnToOrganizationTeamEmployee.ts @@ -11,7 +11,7 @@ export class AddActiveTaskColumnToOrganizationTeamEmployee1690167501143 * @param queryRunner */ public async up(queryRunner: QueryRunner): Promise { - if (queryRunner.connection.options.type === 'sqlite') { + if (['sqlite', 'better-sqlite3'].includes(queryRunner.connection.options.type)) { await this.sqliteUpQueryRunner(queryRunner); } else { await this.postgresUpQueryRunner(queryRunner); @@ -24,7 +24,7 @@ export class AddActiveTaskColumnToOrganizationTeamEmployee1690167501143 * @param queryRunner */ public async down(queryRunner: QueryRunner): Promise { - if (queryRunner.connection.options.type === 'sqlite') { + if (['sqlite', 'better-sqlite3'].includes(queryRunner.connection.options.type)) { await this.sqliteDownQueryRunner(queryRunner); } else { await this.postgresDownQueryRunner(queryRunner); diff --git a/packages/core/src/database/migrations/1690527506095-AddUpworkOrganizationNameToTheOrganizationTable.ts b/packages/core/src/database/migrations/1690527506095-AddUpworkOrganizationNameToTheOrganizationTable.ts index 11a07ba16a6..5776077e30a 100644 --- a/packages/core/src/database/migrations/1690527506095-AddUpworkOrganizationNameToTheOrganizationTable.ts +++ b/packages/core/src/database/migrations/1690527506095-AddUpworkOrganizationNameToTheOrganizationTable.ts @@ -11,7 +11,7 @@ export class AddUpworkOrganizationNameToTheOrganizationTable1690527506095 implem * @param queryRunner */ public async up(queryRunner: QueryRunner): Promise { - if (queryRunner.connection.options.type === 'sqlite') { + if (['sqlite', 'better-sqlite3'].includes(queryRunner.connection.options.type)) { await this.sqliteUpQueryRunner(queryRunner); } else { await this.postgresUpQueryRunner(queryRunner); @@ -24,7 +24,7 @@ export class AddUpworkOrganizationNameToTheOrganizationTable1690527506095 implem * @param queryRunner */ public async down(queryRunner: QueryRunner): Promise { - if (queryRunner.connection.options.type === 'sqlite') { + if (['sqlite', 'better-sqlite3'].includes(queryRunner.connection.options.type)) { await this.sqliteDownQueryRunner(queryRunner); } else { await this.postgresDownQueryRunner(queryRunner); diff --git a/packages/core/src/database/migrations/1691493358068-AlterIntegrationTable.ts b/packages/core/src/database/migrations/1691493358068-AlterIntegrationTable.ts index b0e188f17b6..45760e5913b 100644 --- a/packages/core/src/database/migrations/1691493358068-AlterIntegrationTable.ts +++ b/packages/core/src/database/migrations/1691493358068-AlterIntegrationTable.ts @@ -14,7 +14,7 @@ export class AlterIntegrationTable1691493358068 implements MigrationInterface { public async up(queryRunner: QueryRunner): Promise { console.log(chalk.yellow(`AlterIntegrationTable1691493358068 start running!`)); - if (queryRunner.connection.options.type === 'sqlite') { + if (['sqlite', 'better-sqlite3'].includes(queryRunner.connection.options.type)) { await this.sqliteUpQueryRunner(queryRunner); } else { await this.postgresUpQueryRunner(queryRunner); @@ -27,7 +27,7 @@ export class AlterIntegrationTable1691493358068 implements MigrationInterface { * @param queryRunner */ public async down(queryRunner: QueryRunner): Promise { - if (queryRunner.connection.options.type === 'sqlite') { + if (['sqlite', 'better-sqlite3'].includes(queryRunner.connection.options.type)) { await this.sqliteDownQueryRunner(queryRunner); } else { await this.postgresDownQueryRunner(queryRunner); diff --git a/packages/core/src/database/migrations/1691494801748-SeedIntegrationTable.ts b/packages/core/src/database/migrations/1691494801748-SeedIntegrationTable.ts index 1d26c6f6a60..af334681996 100644 --- a/packages/core/src/database/migrations/1691494801748-SeedIntegrationTable.ts +++ b/packages/core/src/database/migrations/1691494801748-SeedIntegrationTable.ts @@ -43,7 +43,7 @@ export class SeedIntegrationTable1691494801748 implements MigrationInterface { let upsertQuery = ``; const payload = [name, filepath, isComingSoon, order]; - if (queryRunner.connection.options.type === 'sqlite') { + if (['sqlite', 'better-sqlite3'].includes(queryRunner.connection.options.type)) { // For SQLite, manually generate a UUID using uuidv4() const generatedId = uuidv4(); payload.push(generatedId); diff --git a/packages/core/src/database/migrations/1691756595248-AddUserIdColumnToUserTable.ts b/packages/core/src/database/migrations/1691756595248-AddUserIdColumnToUserTable.ts index caa0aaab553..1c76ea6abaf 100644 --- a/packages/core/src/database/migrations/1691756595248-AddUserIdColumnToUserTable.ts +++ b/packages/core/src/database/migrations/1691756595248-AddUserIdColumnToUserTable.ts @@ -14,7 +14,7 @@ export class AddUserIdColumnToUserTable1691756595248 implements MigrationInterfa public async up(queryRunner: QueryRunner): Promise { console.log(chalk.yellow(`AddUserIdColumnToUserTable1691756595248 start running!`)); - if (queryRunner.connection.options.type === 'sqlite') { + if (['sqlite', 'better-sqlite3'].includes(queryRunner.connection.options.type)) { await this.sqliteUpQueryRunner(queryRunner); } else { await this.postgresUpQueryRunner(queryRunner); @@ -27,7 +27,7 @@ export class AddUserIdColumnToUserTable1691756595248 implements MigrationInterfa * @param queryRunner */ public async down(queryRunner: QueryRunner): Promise { - if (queryRunner.connection.options.type === 'sqlite') { + if (['sqlite', 'better-sqlite3'].includes(queryRunner.connection.options.type)) { await this.sqliteDownQueryRunner(queryRunner); } else { await this.postgresDownQueryRunner(queryRunner); diff --git a/packages/core/src/database/migrations/1692171665427-SeedIntegrationTable.ts b/packages/core/src/database/migrations/1692171665427-SeedIntegrationTable.ts index 9a478d06311..c12dfb54a40 100644 --- a/packages/core/src/database/migrations/1692171665427-SeedIntegrationTable.ts +++ b/packages/core/src/database/migrations/1692171665427-SeedIntegrationTable.ts @@ -43,7 +43,7 @@ export class SeedIntegrationTable1692171665427 implements MigrationInterface { let upsertQuery = ``; const payload = [name, filepath, isComingSoon, order]; - if (queryRunner.connection.options.type === 'sqlite') { + if (['sqlite', 'better-sqlite3'].includes(queryRunner.connection.options.type)) { // For SQLite, manually generate a UUID using uuidv4() const generatedId = uuidv4(); payload.push(generatedId); diff --git a/packages/core/src/database/migrations/1692256031607-AddOrganizationProjectTeamRelation.ts b/packages/core/src/database/migrations/1692256031607-AddOrganizationProjectTeamRelation.ts index 6903b918085..60bf2ac038a 100644 --- a/packages/core/src/database/migrations/1692256031607-AddOrganizationProjectTeamRelation.ts +++ b/packages/core/src/database/migrations/1692256031607-AddOrganizationProjectTeamRelation.ts @@ -14,7 +14,7 @@ export class AddOrganizationProjectTeamRelation1692256031607 implements Migratio public async up(queryRunner: QueryRunner): Promise { console.log(chalk.yellow(`AddOrganizationProjectTeamRelation1692256031607 start running!`)); - if (queryRunner.connection.options.type === 'sqlite') { + if (['sqlite', 'better-sqlite3'].includes(queryRunner.connection.options.type)) { await this.sqliteUpQueryRunner(queryRunner); } else { await this.postgresUpQueryRunner(queryRunner); @@ -27,7 +27,7 @@ export class AddOrganizationProjectTeamRelation1692256031607 implements Migratio * @param queryRunner */ public async down(queryRunner: QueryRunner): Promise { - if (queryRunner.connection.options.type === 'sqlite') { + if (['sqlite', 'better-sqlite3'].includes(queryRunner.connection.options.type)) { await this.sqliteDownQueryRunner(queryRunner); } else { await this.postgresDownQueryRunner(queryRunner); diff --git a/packages/core/src/database/migrations/1692275997367-AlterIntegrationTableRelationCascading.ts b/packages/core/src/database/migrations/1692275997367-AlterIntegrationTableRelationCascading.ts index 8f02670dd62..ca042bea7cd 100644 --- a/packages/core/src/database/migrations/1692275997367-AlterIntegrationTableRelationCascading.ts +++ b/packages/core/src/database/migrations/1692275997367-AlterIntegrationTableRelationCascading.ts @@ -14,7 +14,7 @@ export class AlterIntegrationTableRelationCascading1692275997367 implements Migr public async up(queryRunner: QueryRunner): Promise { console.log(chalk.yellow(`AlterIntegrationTableRelationCascading1692275997367 start running!`)); - if (queryRunner.connection.options.type === 'sqlite') { + if (['sqlite', 'better-sqlite3'].includes(queryRunner.connection.options.type)) { await this.sqliteUpQueryRunner(queryRunner); } else { await this.postgresUpQueryRunner(queryRunner); @@ -27,7 +27,7 @@ export class AlterIntegrationTableRelationCascading1692275997367 implements Migr * @param queryRunner */ public async down(queryRunner: QueryRunner): Promise { - if (queryRunner.connection.options.type === 'sqlite') { + if (['sqlite', 'better-sqlite3'].includes(queryRunner.connection.options.type)) { await this.sqliteDownQueryRunner(queryRunner); } else { await this.postgresDownQueryRunner(queryRunner); diff --git a/packages/core/src/database/migrations/1692433732267-AlterIntegrationTenantTable.ts b/packages/core/src/database/migrations/1692433732267-AlterIntegrationTenantTable.ts index af8f9a3c835..342b7f7e8a9 100644 --- a/packages/core/src/database/migrations/1692433732267-AlterIntegrationTenantTable.ts +++ b/packages/core/src/database/migrations/1692433732267-AlterIntegrationTenantTable.ts @@ -14,7 +14,7 @@ export class AlterIntegrationTenantTable1692433732267 implements MigrationInterf public async up(queryRunner: QueryRunner): Promise { console.log(chalk.yellow(`AlterIntegrationTenantTable1692433732267 start running!`)); - if (queryRunner.connection.options.type === 'sqlite') { + if (['sqlite', 'better-sqlite3'].includes(queryRunner.connection.options.type)) { await this.sqliteUpQueryRunner(queryRunner); } else { await this.postgresUpQueryRunner(queryRunner); @@ -27,7 +27,7 @@ export class AlterIntegrationTenantTable1692433732267 implements MigrationInterf * @param queryRunner */ public async down(queryRunner: QueryRunner): Promise { - if (queryRunner.connection.options.type === 'sqlite') { + if (['sqlite', 'better-sqlite3'].includes(queryRunner.connection.options.type)) { await this.sqliteDownQueryRunner(queryRunner); } else { await this.postgresDownQueryRunner(queryRunner); diff --git a/packages/core/src/database/migrations/1693547294428-AlterCodeToAlphaNumericFormat.ts b/packages/core/src/database/migrations/1693547294428-AlterCodeToAlphaNumericFormat.ts index 1aecad79d3a..af3feaa67c4 100644 --- a/packages/core/src/database/migrations/1693547294428-AlterCodeToAlphaNumericFormat.ts +++ b/packages/core/src/database/migrations/1693547294428-AlterCodeToAlphaNumericFormat.ts @@ -14,7 +14,7 @@ export class AlterCodeToAlphaNumericFormat1693547294428 implements MigrationInte public async up(queryRunner: QueryRunner): Promise { console.log(chalk.yellow(`AlterCodeToAlphaNumericFormat1693547294428 start running!`)); - if (queryRunner.connection.options.type === 'sqlite') { + if (['sqlite', 'better-sqlite3'].includes(queryRunner.connection.options.type)) { await this.sqliteUpQueryRunner(queryRunner); } else { await this.postgresUpQueryRunner(queryRunner); @@ -27,7 +27,7 @@ export class AlterCodeToAlphaNumericFormat1693547294428 implements MigrationInte * @param queryRunner */ public async down(queryRunner: QueryRunner): Promise { - if (queryRunner.connection.options.type === 'sqlite') { + if (['sqlite', 'better-sqlite3'].includes(queryRunner.connection.options.type)) { await this.sqliteDownQueryRunner(queryRunner); } else { await this.postgresDownQueryRunner(queryRunner); diff --git a/packages/core/src/database/migrations/1694427247661-AlterOrganizationTeamJoinRequestTable.ts b/packages/core/src/database/migrations/1694427247661-AlterOrganizationTeamJoinRequestTable.ts index fe157b3de49..4fa010dfc27 100644 --- a/packages/core/src/database/migrations/1694427247661-AlterOrganizationTeamJoinRequestTable.ts +++ b/packages/core/src/database/migrations/1694427247661-AlterOrganizationTeamJoinRequestTable.ts @@ -11,7 +11,7 @@ export class AlterOrganizationTeamJoinRequestTable1694427247661 implements Migra * @param queryRunner */ public async up(queryRunner: QueryRunner): Promise { - if (queryRunner.connection.options.type === 'sqlite') { + if (['sqlite', 'better-sqlite3'].includes(queryRunner.connection.options.type)) { await this.sqliteUpQueryRunner(queryRunner); } else { await this.postgresUpQueryRunner(queryRunner); @@ -24,7 +24,7 @@ export class AlterOrganizationTeamJoinRequestTable1694427247661 implements Migra * @param queryRunner */ public async down(queryRunner: QueryRunner): Promise { - if (queryRunner.connection.options.type === 'sqlite') { + if (['sqlite', 'better-sqlite3'].includes(queryRunner.connection.options.type)) { await this.sqliteDownQueryRunner(queryRunner); } else { await this.postgresDownQueryRunner(queryRunner); diff --git a/packages/core/src/database/migrations/1695023907817-AddColumnsToTheIntegrationTable.ts b/packages/core/src/database/migrations/1695023907817-AddColumnsToTheIntegrationTable.ts index d59fcfa7969..de7e00a133a 100644 --- a/packages/core/src/database/migrations/1695023907817-AddColumnsToTheIntegrationTable.ts +++ b/packages/core/src/database/migrations/1695023907817-AddColumnsToTheIntegrationTable.ts @@ -13,7 +13,7 @@ export class AddColumnsToTheIntegrationTable1695023907817 implements MigrationIn public async up(queryRunner: QueryRunner): Promise { console.log(chalk.yellow(`AddColumnsToTheIntegrationTable1695023907817 start running!`)); - if (queryRunner.connection.options.type === 'sqlite') { + if (['sqlite', 'better-sqlite3'].includes(queryRunner.connection.options.type)) { await this.sqliteUpQueryRunner(queryRunner); } else { await this.postgresUpQueryRunner(queryRunner); @@ -26,7 +26,7 @@ export class AddColumnsToTheIntegrationTable1695023907817 implements MigrationIn * @param queryRunner */ public async down(queryRunner: QueryRunner): Promise { - if (queryRunner.connection.options.type === 'sqlite') { + if (['sqlite', 'better-sqlite3'].includes(queryRunner.connection.options.type)) { await this.sqliteDownQueryRunner(queryRunner); } else { await this.postgresDownQueryRunner(queryRunner); diff --git a/packages/core/src/database/migrations/1695111838783-AddColumnsToTheIntegrationTypeTable.ts b/packages/core/src/database/migrations/1695111838783-AddColumnsToTheIntegrationTypeTable.ts index 2b4613ba97e..6bfacf945f8 100644 --- a/packages/core/src/database/migrations/1695111838783-AddColumnsToTheIntegrationTypeTable.ts +++ b/packages/core/src/database/migrations/1695111838783-AddColumnsToTheIntegrationTypeTable.ts @@ -14,7 +14,7 @@ export class AddColumnsToTheIntegrationTypeTable1695111838783 implements Migrati public async up(queryRunner: QueryRunner): Promise { console.log(chalk.yellow(`AddColumnsToTheIntegrationTypeTable1695111838783 start running!`)); - if (queryRunner.connection.options.type === 'sqlite') { + if (['sqlite', 'better-sqlite3'].includes(queryRunner.connection.options.type)) { await this.sqliteUpQueryRunner(queryRunner); } else { await this.postgresUpQueryRunner(queryRunner); @@ -27,7 +27,7 @@ export class AddColumnsToTheIntegrationTypeTable1695111838783 implements Migrati * @param queryRunner */ public async down(queryRunner: QueryRunner): Promise { - if (queryRunner.connection.options.type === 'sqlite') { + if (['sqlite', 'better-sqlite3'].includes(queryRunner.connection.options.type)) { await this.sqliteDownQueryRunner(queryRunner); } else { await this.postgresDownQueryRunner(queryRunner); diff --git a/packages/core/src/database/migrations/1695570009125-AlterTableTask.ts b/packages/core/src/database/migrations/1695570009125-AlterTableTask.ts index 64d176c8948..bfcdfcd09ec 100644 --- a/packages/core/src/database/migrations/1695570009125-AlterTableTask.ts +++ b/packages/core/src/database/migrations/1695570009125-AlterTableTask.ts @@ -9,7 +9,7 @@ export class AlterTableTask1695570009125 implements MigrationInterface { * @param queryRunner */ public async up(queryRunner: QueryRunner): Promise { - if (queryRunner.connection.options.type === 'sqlite') { + if (['sqlite', 'better-sqlite3'].includes(queryRunner.connection.options.type)) { await this.sqliteUpQueryRunner(queryRunner); } else { await this.postgresUpQueryRunner(queryRunner); @@ -22,7 +22,7 @@ export class AlterTableTask1695570009125 implements MigrationInterface { * @param queryRunner */ public async down(queryRunner: QueryRunner): Promise { - if (queryRunner.connection.options.type === 'sqlite') { + if (['sqlite', 'better-sqlite3'].includes(queryRunner.connection.options.type)) { await this.sqliteDownQueryRunner(queryRunner); } else { await this.postgresDownQueryRunner(queryRunner); diff --git a/packages/core/src/database/migrations/1695958130201-AddedArchivedColumnToUser.ts b/packages/core/src/database/migrations/1695958130201-AddedArchivedColumnToUser.ts index a620f0e9323..d0fe4155b9b 100644 --- a/packages/core/src/database/migrations/1695958130201-AddedArchivedColumnToUser.ts +++ b/packages/core/src/database/migrations/1695958130201-AddedArchivedColumnToUser.ts @@ -11,7 +11,7 @@ export class AddedArchivedColumnToUser1695958130201 implements MigrationInterfac * @param queryRunner */ public async up(queryRunner: QueryRunner): Promise { - if (queryRunner.connection.options.type === 'sqlite') { + if (['sqlite', 'better-sqlite3'].includes(queryRunner.connection.options.type)) { await this.sqliteUpQueryRunner(queryRunner); } else { await this.postgresUpQueryRunner(queryRunner); @@ -24,7 +24,7 @@ export class AddedArchivedColumnToUser1695958130201 implements MigrationInterfac * @param queryRunner */ public async down(queryRunner: QueryRunner): Promise { - if (queryRunner.connection.options.type === 'sqlite') { + if (['sqlite', 'better-sqlite3'].includes(queryRunner.connection.options.type)) { await this.sqliteDownQueryRunner(queryRunner); } else { await this.postgresDownQueryRunner(queryRunner); diff --git a/packages/core/src/database/migrations/1696413384868-AddedActiveArchivedColumnsToBaseEntity.ts b/packages/core/src/database/migrations/1696413384868-AddedActiveArchivedColumnsToBaseEntity.ts index 57e32453d3f..3b17efa43f5 100644 --- a/packages/core/src/database/migrations/1696413384868-AddedActiveArchivedColumnsToBaseEntity.ts +++ b/packages/core/src/database/migrations/1696413384868-AddedActiveArchivedColumnsToBaseEntity.ts @@ -11,7 +11,7 @@ export class AddedActiveArchivedColumnsToBaseEntity1696413384868 implements Migr * @param queryRunner */ public async up(queryRunner: QueryRunner): Promise { - if (queryRunner.connection.options.type === 'sqlite') { + if (['sqlite', 'better-sqlite3'].includes(queryRunner.connection.options.type)) { await this.sqliteUpQueryRunner(queryRunner); } else { await this.postgresUpQueryRunner(queryRunner); @@ -24,7 +24,7 @@ export class AddedActiveArchivedColumnsToBaseEntity1696413384868 implements Migr * @param queryRunner */ public async down(queryRunner: QueryRunner): Promise { - if (queryRunner.connection.options.type === 'sqlite') { + if (['sqlite', 'better-sqlite3'].includes(queryRunner.connection.options.type)) { await this.sqliteDownQueryRunner(queryRunner); } else { await this.postgresDownQueryRunner(queryRunner); From a576c66416a84974d16846ef003e757ecb42eba3 Mon Sep 17 00:00:00 2001 From: Adolphe Kifungo <45813955+adkif@users.noreply.github.com> Date: Sat, 7 Oct 2023 06:26:46 +0200 Subject: [PATCH 14/30] feat: combine sqlite migration template with better-sqlite3 --- packages/core/src/database/migration-executor.ts | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/packages/core/src/database/migration-executor.ts b/packages/core/src/database/migration-executor.ts index 2912d1ab148..974eb17808d 100644 --- a/packages/core/src/database/migration-executor.ts +++ b/packages/core/src/database/migration-executor.ts @@ -275,7 +275,7 @@ export class ${camelCase(name, true)}${timestamp} implements MigrationInterface * @param queryRunner */ public async up(queryRunner: QueryRunner): Promise { - if (queryRunner.connection.options.type === 'sqlite') { + if (['sqlite', 'better-sqlite3'].includes(queryRunner.connection.options.type)) { await this.sqliteUpQueryRunner(queryRunner); } else { await this.postgresUpQueryRunner(queryRunner); @@ -288,7 +288,7 @@ export class ${camelCase(name, true)}${timestamp} implements MigrationInterface * @param queryRunner */ public async down(queryRunner: QueryRunner): Promise { - if (queryRunner.connection.options.type === 'sqlite') { + if (['sqlite', 'better-sqlite3'].includes(queryRunner.connection.options.type)) { await this.sqliteDownQueryRunner(queryRunner); } else { await this.postgresDownQueryRunner(queryRunner); @@ -318,23 +318,23 @@ export class ${camelCase(name, true)}${timestamp} implements MigrationInterface } /** - * SqliteDB Up Migration + * SqliteDB and BetterSQlite3DB Up Migration * * @param queryRunner */ public async sqliteUpQueryRunner(queryRunner: QueryRunner): Promise { - ${(connection.options.type === 'sqlite') ? upSqls.join(` + ${(['sqlite', 'better-sqlite3'].includes(connection.options.type)) ? upSqls.join(` `) : [].join(` `)} } /** - * SqliteDB Down Migration + * SqliteDB and BetterSQlite3DB Down Migration * * @param queryRunner */ public async sqliteDownQueryRunner(queryRunner: QueryRunner): Promise { - ${(connection.options.type === 'sqlite') ? downSqls.join(` + ${(['sqlite', 'better-sqlite3'].includes(connection.options.type)) ? downSqls.join(` `) : [].join(` `)} } From dc81bbc01814c5a9bba75d6a3ee369cb1811fd7e Mon Sep 17 00:00:00 2001 From: Adolphe Kifungo <45813955+adkif@users.noreply.github.com> Date: Sat, 7 Oct 2023 12:08:13 +0200 Subject: [PATCH 15/30] fix: use same file than sqlite db --- apps/api/src/plugin-config.ts | 8 +++++--- apps/desktop-timer/src/index.ts | 2 +- apps/desktop/src/index.ts | 7 ++----- packages/config/src/database.ts | 8 +++++--- .../src/lib/offline/databases/better-sqlite-provider.ts | 2 +- 5 files changed, 14 insertions(+), 13 deletions(-) diff --git a/apps/api/src/plugin-config.ts b/apps/api/src/plugin-config.ts index d2a86323465..e8e41d6c54b 100644 --- a/apps/api/src/plugin-config.ts +++ b/apps/api/src/plugin-config.ts @@ -134,7 +134,7 @@ function getDbConfig(): DataSourceOptions { process.env.DB_PATH || path.join( path.resolve('.', ...['apps', 'api', 'data']), - 'gauzy.better-sqlite3' + 'gauzy.sqlite3' ); return { @@ -144,8 +144,10 @@ function getDbConfig(): DataSourceOptions { logger: 'file', // Removes console logging, instead logs all queries in a file ormlogs.log synchronize: process.env.DB_SYNCHRONIZE === 'true', // We are using migrations, synchronize should be set to false. prepareDatabase: (db) => { - // Enhance performance - db.pragma('journal_mode = WAL'); + if (!process.env.IS_ELECTRON) { + // Enhance performance + db.pragma('journal_mode = WAL'); + } } }; } diff --git a/apps/desktop-timer/src/index.ts b/apps/desktop-timer/src/index.ts index 1f120b4f003..f8e20fffb69 100644 --- a/apps/desktop-timer/src/index.ts +++ b/apps/desktop-timer/src/index.ts @@ -392,7 +392,7 @@ app.on('ready', async () => { if (!settings) { launchAtStartup(true, false); } - if (provider.dialect === 'sqlite' || provider.dialect === 'better-sqlite') { + if (['sqlite', 'better-sqlite'].includes(provider.dialect)) { try { const res = await knex.raw(`pragma journal_mode = WAL;`); console.log(res); diff --git a/apps/desktop/src/index.ts b/apps/desktop/src/index.ts index ddf62e146b4..47161e5ebed 100644 --- a/apps/desktop/src/index.ts +++ b/apps/desktop/src/index.ts @@ -66,9 +66,6 @@ log.info(`GAUZY_USER_PATH: ${process.env.GAUZY_USER_PATH}`); const sqlite3filename = `${process.env.GAUZY_USER_PATH}/gauzy.sqlite3`; log.info(`Sqlite DB path: ${sqlite3filename}`); -const betterSqlite3filename = `${process.env.GAUZY_USER_PATH}/gauzy.better-sqlite3`; -log.info(`Better Sqlite DB path: ${betterSqlite3filename}`); - const provider = ProviderFactory.instance; const knex = provider.connection; @@ -237,7 +234,7 @@ async function startServer(value, restart = false) { process.env.DB_PATH = sqlite3filename; process.env.DB_TYPE = 'sqlite'; }else if(value.db === 'better-sqlite') { - process.env.DB_PATH = betterSqlite3filename; + process.env.DB_PATH = sqlite3filename; process.env.DB_TYPE = 'better-sqlite3'; }else { process.env.DB_TYPE = 'postgres'; @@ -468,7 +465,7 @@ app.on('ready', async () => { splashScreen = new SplashScreen(pathWindow.timeTrackerUi); await splashScreen.loadURL(); splashScreen.show(); - if (provider.dialect === 'sqlite' || provider.dialect === 'better-sqlite') { + if (['sqlite', 'better-sqlite'].includes(provider.dialect)) { try { const res = await knex.raw(`pragma journal_mode = WAL;`) console.log(res); diff --git a/packages/config/src/database.ts b/packages/config/src/database.ts index c9a12f54d66..0dfc86267df 100644 --- a/packages/config/src/database.ts +++ b/packages/config/src/database.ts @@ -89,7 +89,7 @@ switch (dbType) { path.join( process.cwd(), ...['apps', 'api', 'data'], - 'gauzy.better-sqlite3' + 'gauzy.sqlite3' ); console.log('Better Sqlite DB Path: ' + betterSqlitePath); @@ -101,8 +101,10 @@ switch (dbType) { logger: 'file', // Removes console logging, instead logs all queries in a file ormlogs.log synchronize: process.env.DB_SYNCHRONIZE === 'true', // We are using migrations, synchronize should be set to false. prepareDatabase: (db) => { - // Enhance performance - db.pragma('journal_mode = WAL'); + if (!process.env.IS_ELECTRON) { + // Enhance performance + db.pragma('journal_mode = WAL'); + } } }; diff --git a/packages/desktop-libs/src/lib/offline/databases/better-sqlite-provider.ts b/packages/desktop-libs/src/lib/offline/databases/better-sqlite-provider.ts index 8be450e64d2..5b12387eeb9 100644 --- a/packages/desktop-libs/src/lib/offline/databases/better-sqlite-provider.ts +++ b/packages/desktop-libs/src/lib/offline/databases/better-sqlite-provider.ts @@ -29,7 +29,7 @@ export class BetterSqliteProvider implements IServerLessProvider { connection: { filename: path.resolve( app?.getPath('userData') || __dirname, - 'gauzy.better-sqlite3' + 'gauzy.sqlite3' ), timezone: 'utc', }, From e16d8ff088762742d5d75e2621c186498bf6d3c5 Mon Sep 17 00:00:00 2001 From: Adolphe Kifungo <45813955+adkif@users.noreply.github.com> Date: Sat, 7 Oct 2023 14:08:55 +0200 Subject: [PATCH 16/30] fix: use same queries as sqlite db --- .../get-conflict-availability-slots.handler.ts | 6 +++--- packages/core/src/core/utils.ts | 8 +++++--- ...date-employee-total-worked-hours.handler.ts | 2 +- .../equipment-sharing.service.ts | 4 ++-- packages/core/src/feature/feature.seed.ts | 3 ++- packages/core/src/reports/report.seed.ts | 2 +- .../request-approval.service.ts | 2 +- .../time-tracking/activity/activity.entity.ts | 13 ++++++++++--- .../time-tracking/activity/activity.service.ts | 6 +++--- .../activity/activity.subscriber.ts | 4 ++-- .../statistic/statistic.service.ts | 18 +++++++++--------- .../handlers/get-conflict-time-log.handler.ts | 2 +- .../schedule-time-log-entries.handler.ts | 2 +- 13 files changed, 41 insertions(+), 31 deletions(-) diff --git a/packages/core/src/availability-slots/commands/handlers/get-conflict-availability-slots.handler.ts b/packages/core/src/availability-slots/commands/handlers/get-conflict-availability-slots.handler.ts index cb1abbcec6b..8ba1f410282 100644 --- a/packages/core/src/availability-slots/commands/handlers/get-conflict-availability-slots.handler.ts +++ b/packages/core/src/availability-slots/commands/handlers/get-conflict-availability-slots.handler.ts @@ -21,7 +21,7 @@ export class GetConflictAvailabilitySlotsHandler public async execute( command: GetConflictAvailabilitySlotsCommand ): Promise { - + const { input } = command; const { startTime, endTime, employeeId, organizationId } = input; const tenantId = RequestContext.currentTenantId() || input.tenantId; @@ -38,7 +38,7 @@ export class GetConflictAvailabilitySlotsHandler }); query.andWhere( - this.configService.dbConnectionOptions.type === 'sqlite' + ['sqlite', 'better-sqlite3'].includes(this.configService.dbConnectionOptions.type) ? `'${startedAt}' >= "${query.alias}"."startTime" AND '${startedAt}' <= "${query.alias}"."endTime"` : `("${query.alias}"."startTime", "${query.alias}"."endTime") OVERLAPS (timestamptz '${startedAt}', timestamptz '${stoppedAt}')` ); @@ -52,7 +52,7 @@ export class GetConflictAvailabilitySlotsHandler if (input.type) { query.andWhere(`${query.alias}.type = :type`, { - type: input.type + type: input.type }); } diff --git a/packages/core/src/core/utils.ts b/packages/core/src/core/utils.ts index d6b61cf4482..64e110d8c81 100644 --- a/packages/core/src/core/utils.ts +++ b/packages/core/src/core/utils.ts @@ -78,7 +78,8 @@ export function unixTimestampToDate( export function convertToDatetime(datetime) { if (moment(new Date(datetime)).isValid()) { const dbType = getConfig().dbConnectionOptions.type || 'sqlite'; - if (dbType === 'sqlite') { + const allowedDbTypes = ['sqlite', 'better-sqlite3']; + if (allowedDbTypes.includes(dbType)) { return moment(new Date(datetime)).format('YYYY-MM-DD HH:mm:ss'); } else { return moment(new Date(datetime)).toDate(); @@ -132,7 +133,7 @@ export function getDateRange( } const dbType = getConfig().dbConnectionOptions.type || 'sqlite'; - if (dbType === 'sqlite') { + if (['sqlite', 'better-sqlite3'].includes(dbType)) { start = start.format('YYYY-MM-DD HH:mm:ss'); end = end.format('YYYY-MM-DD HH:mm:ss'); } else { @@ -224,7 +225,8 @@ export function getDateRangeFormat( } const dbType = getConfig().dbConnectionOptions.type || 'sqlite'; - if (dbType === 'sqlite') { + const allowedDbTypes = ['sqlite', 'better-sqlite3']; + if (allowedDbTypes.includes(dbType)) { return { start: start.format('YYYY-MM-DD HH:mm:ss'), end: end.format('YYYY-MM-DD HH:mm:ss'), diff --git a/packages/core/src/employee/commands/handlers/update-employee-total-worked-hours.handler.ts b/packages/core/src/employee/commands/handlers/update-employee-total-worked-hours.handler.ts index e8a678980fe..a7d7be1da50 100644 --- a/packages/core/src/employee/commands/handlers/update-employee-total-worked-hours.handler.ts +++ b/packages/core/src/employee/commands/handlers/update-employee-total-worked-hours.handler.ts @@ -30,7 +30,7 @@ export class UpdateEmployeeTotalWorkedHoursHandler .createQueryBuilder() .select( `${ - config.dbConnectionOptions.type === 'sqlite' + ['sqlite', 'better-sqlite3'].includes(config.dbConnectionOptions.type) ? 'SUM((julianday("stoppedAt") - julianday("startedAt")) * 86400)' : 'SUM(extract(epoch from ("stoppedAt" - "startedAt")))' }`, diff --git a/packages/core/src/equipment-sharing/equipment-sharing.service.ts b/packages/core/src/equipment-sharing/equipment-sharing.service.ts index a38e63f6723..1cede961d8b 100644 --- a/packages/core/src/equipment-sharing/equipment-sharing.service.ts +++ b/packages/core/src/equipment-sharing/equipment-sharing.service.ts @@ -38,7 +38,7 @@ export class EquipmentSharingService extends TenantAwareCrudService options.type === 'sqlite' ? 'text' : 'json' }) + @ApiPropertyOptional({ + type: () => + ['sqlite', 'better-sqlite3'].includes(options.type) + ? 'text' + : 'json', + }) @IsOptional() @IsString() @Column({ nullable: true, - type: options.type === 'sqlite' ? 'text' : 'json' + type: ['sqlite', 'better-sqlite3'].includes(options.type) + ? 'text' + : 'json', }) metaData?: string | IURLMetaData; @@ -94,7 +101,7 @@ export class Activity extends TenantOrganizationBaseEntity implements IActivity @ApiPropertyOptional({ type: () => String, enum: TimeLogSourceEnum, - default: TimeLogSourceEnum.WEB_TIMER + default: TimeLogSourceEnum.WEB_TIMER, }) @IsOptional() @IsEnum(TimeLogSourceEnum) diff --git a/packages/core/src/time-tracking/activity/activity.service.ts b/packages/core/src/time-tracking/activity/activity.service.ts index 4f3fc0069fd..129f1283665 100644 --- a/packages/core/src/time-tracking/activity/activity.service.ts +++ b/packages/core/src/time-tracking/activity/activity.service.ts @@ -45,7 +45,7 @@ export class ActivityService extends TenantAwareCrudService { query.addSelect(`"${query.alias}"."employeeId"`, `employeeId`); query.addSelect(`"${query.alias}"."date"`, `date`); - if (config.dbConnectionOptions.type === 'sqlite') { + if (['sqlite', 'better-sqlite3'].includes(config.dbConnectionOptions.type)) { query.addSelect(`time("${query.alias}"."time")`, `time`); } else { query.addSelect( @@ -56,7 +56,7 @@ export class ActivityService extends TenantAwareCrudService { query.addSelect(`"${query.alias}"."title"`, `title`); query.groupBy(`"${query.alias}"."date"`); - if (config.dbConnectionOptions.type === 'sqlite') { + if (['sqlite', 'better-sqlite3'].includes(config.dbConnectionOptions.type)) { query.addGroupBy(`time("${query.alias}"."time")`); } else { query.addGroupBy( @@ -206,7 +206,7 @@ export class ActivityService extends TenantAwareCrudService { ); query.andWhere( new Brackets((qb: WhereExpressionBuilder) => { - if (config.dbConnectionOptions.type === 'sqlite') { + if (['sqlite', 'better-sqlite3'].includes(config.dbConnectionOptions.type)) { qb.andWhere(`datetime("${query.alias}"."date" || ' ' || "${query.alias}"."time") Between :startDate AND :endDate`, { startDate, endDate diff --git a/packages/core/src/time-tracking/activity/activity.subscriber.ts b/packages/core/src/time-tracking/activity/activity.subscriber.ts index 0768a674af0..f9ae5799f3e 100644 --- a/packages/core/src/time-tracking/activity/activity.subscriber.ts +++ b/packages/core/src/time-tracking/activity/activity.subscriber.ts @@ -27,7 +27,7 @@ export class ActivitySubscriber implements EntitySubscriberInterface { try { if (event) { const options: Partial = event.connection.options || getConfig().dbConnectionOptions; - if (options.type === 'sqlite') { + if (['sqlite', 'better-sqlite3'].includes(options.type)) { const { entity } = event; try { if (isJsObject(entity.metaData)) { @@ -43,4 +43,4 @@ export class ActivitySubscriber implements EntitySubscriberInterface { console.log(error); } } -} \ No newline at end of file +} diff --git a/packages/core/src/time-tracking/statistic/statistic.service.ts b/packages/core/src/time-tracking/statistic/statistic.service.ts index 0b894ace8b8..70821ebe1de 100644 --- a/packages/core/src/time-tracking/statistic/statistic.service.ts +++ b/packages/core/src/time-tracking/statistic/statistic.service.ts @@ -122,7 +122,7 @@ export class StatisticService { const weekTimeStatistics = await weekQuery .innerJoin(`${weekQuery.alias}.timeLogs`, 'timeLogs') .select( - `${this.configService.dbConnectionOptions.type === 'sqlite' + `${['sqlite', 'better-sqlite3'].includes(this.configService.dbConnectionOptions.type) ? `COALESCE(ROUND(SUM((julianday(COALESCE("timeLogs"."stoppedAt", datetime('now'))) - julianday("timeLogs"."startedAt")) * 86400) / COUNT("${weekQuery.alias}"."id")), 0)` : `COALESCE(ROUND(SUM(extract(epoch from (COALESCE("timeLogs"."stoppedAt", NOW()) - "timeLogs"."startedAt"))) / COUNT("${weekQuery.alias}"."id")), 0)` }`, @@ -237,7 +237,7 @@ export class StatisticService { const todayTimeStatistics = await todayQuery .innerJoin(`${todayQuery.alias}.timeLogs`, 'timeLogs') .select( - `${this.configService.dbConnectionOptions.type === 'sqlite' + `${['sqlite', 'better-sqlite3'].includes(this.configService.dbConnectionOptions.type) ? `COALESCE(ROUND(SUM((julianday(COALESCE("timeLogs"."stoppedAt", datetime('now'))) - julianday("timeLogs"."startedAt")) * 86400) / COUNT("${todayQuery.alias}"."id")), 0)` : `COALESCE(ROUND(SUM(extract(epoch from (COALESCE("timeLogs"."stoppedAt", NOW()) - "timeLogs"."startedAt"))) / COUNT("${todayQuery.alias}"."id")), 0)` }`, @@ -405,7 +405,7 @@ export class StatisticService { .addSelect(`("user"."firstName" || ' ' || "user"."lastName")`, 'user_name') .addSelect(`"user"."imageUrl"`, 'user_image_url') .addSelect( - `${this.configService.dbConnectionOptions.type === 'sqlite' + `${['sqlite', 'better-sqlite3'].includes(this.configService.dbConnectionOptions.type) ? `COALESCE(ROUND(SUM((julianday(COALESCE("timeLogs"."stoppedAt", datetime('now'))) - julianday("timeLogs"."startedAt")) * 86400)), 0)` : `COALESCE(ROUND(SUM(extract(epoch from (COALESCE("timeLogs"."stoppedAt", NOW()) - "timeLogs"."startedAt")))), 0)` }`, @@ -468,7 +468,7 @@ export class StatisticService { const weekTimeQuery = this.timeSlotRepository.createQueryBuilder('time_slot'); weekTimeQuery .select( - `${this.configService.dbConnectionOptions.type === 'sqlite' + `${['sqlite', 'better-sqlite3'].includes(this.configService.dbConnectionOptions.type) ? `COALESCE(ROUND(SUM((julianday(COALESCE("timeLogs"."stoppedAt", datetime('now'))) - julianday("timeLogs"."startedAt")) * 86400) / COUNT("${weekTimeQuery.alias}"."id")), 0)` : `COALESCE(ROUND(SUM(extract(epoch from (COALESCE("timeLogs"."stoppedAt", NOW()) - "timeLogs"."startedAt"))) / COUNT("${weekTimeQuery.alias}"."id")), 0)` }`, @@ -554,7 +554,7 @@ export class StatisticService { let dayTimeQuery = this.timeSlotRepository.createQueryBuilder('time_slot'); dayTimeQuery .select( - `${this.configService.dbConnectionOptions.type === 'sqlite' + `${['sqlite', 'better-sqlite3'].includes(this.configService.dbConnectionOptions.type) ? `COALESCE(ROUND(SUM((julianday(COALESCE("timeLogs"."stoppedAt", datetime('now'))) - julianday("timeLogs"."startedAt")) * 86400) / COUNT("${dayTimeQuery.alias}"."id")), 0)` : `COALESCE(ROUND(SUM(extract(epoch from (COALESCE("timeLogs"."stoppedAt", NOW()) - "timeLogs"."startedAt"))) / COUNT("${dayTimeQuery.alias}"."id")), 0)` }`, @@ -774,7 +774,7 @@ export class StatisticService { .select(`"project"."name"`, "name") .addSelect(`"project"."id"`, "projectId") .addSelect( - `${this.configService.dbConnectionOptions.type === 'sqlite' + `${['sqlite', 'better-sqlite3'].includes(this.configService.dbConnectionOptions.type) ? `COALESCE(ROUND(SUM((julianday(COALESCE("${query.alias}"."stoppedAt", datetime('now'))) - julianday("${query.alias}"."startedAt")) * 86400) / COUNT("time_slot"."id")), 0)` : `COALESCE(ROUND(SUM(extract(epoch from (COALESCE("${query.alias}"."stoppedAt", NOW()) - "${query.alias}"."startedAt"))) / COUNT("time_slot"."id")), 0)` }`, @@ -848,7 +848,7 @@ export class StatisticService { const totalDurationQuery = this.timeLogRepository.createQueryBuilder('time_log'); totalDurationQuery .select( - `${this.configService.dbConnectionOptions.type === 'sqlite' + `${['sqlite', 'better-sqlite3'].includes(this.configService.dbConnectionOptions.type) ? `COALESCE(ROUND(SUM((julianday(COALESCE("${totalDurationQuery.alias}"."stoppedAt", datetime('now'))) - julianday("${totalDurationQuery.alias}"."startedAt")) * 86400)), 0)` : `COALESCE(ROUND(SUM(extract(epoch from (COALESCE("${totalDurationQuery.alias}"."stoppedAt", NOW()) - "${totalDurationQuery.alias}"."startedAt")))), 0)` }`, @@ -956,7 +956,7 @@ export class StatisticService { .select(`"task"."title"`, "title") .addSelect(`"task"."id"`, "taskId") .addSelect( - `${this.configService.dbConnectionOptions.type === 'sqlite' + `${['sqlite', 'better-sqlite3'].includes(this.configService.dbConnectionOptions.type) ? `COALESCE(ROUND(SUM((julianday(COALESCE("${query.alias}"."stoppedAt", datetime('now'))) - julianday("${query.alias}"."startedAt")) * 86400) / COUNT("time_slot"."id")), 0)` : `COALESCE(ROUND(SUM(extract(epoch from (COALESCE("${query.alias}"."stoppedAt", NOW()) - "${query.alias}"."startedAt"))) / COUNT("time_slot"."id")), 0)` }`, @@ -1039,7 +1039,7 @@ export class StatisticService { const totalDurationQuery = this.timeLogRepository.createQueryBuilder(); totalDurationQuery .select( - `${this.configService.dbConnectionOptions.type === 'sqlite' + `${['sqlite', 'better-sqlite3'].includes(this.configService.dbConnectionOptions.type) ? `COALESCE(ROUND(SUM((julianday(COALESCE("${totalDurationQuery.alias}"."stoppedAt", datetime('now'))) - julianday("${totalDurationQuery.alias}"."startedAt")) * 86400)), 0)` : `COALESCE(ROUND(SUM(extract(epoch from (COALESCE("${totalDurationQuery.alias}"."stoppedAt", NOW()) - "${totalDurationQuery.alias}"."startedAt")))), 0)` }`, diff --git a/packages/core/src/time-tracking/time-log/commands/handlers/get-conflict-time-log.handler.ts b/packages/core/src/time-tracking/time-log/commands/handlers/get-conflict-time-log.handler.ts index 98cb23b7b62..1d9711005ac 100644 --- a/packages/core/src/time-tracking/time-log/commands/handlers/get-conflict-time-log.handler.ts +++ b/packages/core/src/time-tracking/time-log/commands/handlers/get-conflict-time-log.handler.ts @@ -36,7 +36,7 @@ export class GetConflictTimeLogHandler .andWhere(`"${conflictQuery.alias}"."organizationId" = :organizationId`, { organizationId }) .andWhere(`"${conflictQuery.alias}"."deletedAt" IS null`) .andWhere( - this.configService.dbConnectionOptions.type === 'sqlite' + ['sqlite', 'better-sqlite3'].includes(this.configService.dbConnectionOptions.type) ? `'${startedAt}' >= "${conflictQuery.alias}"."startedAt" and '${startedAt}' <= "${conflictQuery.alias}"."stoppedAt"` : `("${conflictQuery.alias}"."startedAt", "${conflictQuery.alias}"."stoppedAt") OVERLAPS (timestamptz '${startedAt}', timestamptz '${stoppedAt}')` ); diff --git a/packages/core/src/time-tracking/time-log/commands/handlers/schedule-time-log-entries.handler.ts b/packages/core/src/time-tracking/time-log/commands/handlers/schedule-time-log-entries.handler.ts index a66dbeb89fe..c3a1f01ede8 100644 --- a/packages/core/src/time-tracking/time-log/commands/handlers/schedule-time-log-entries.handler.ts +++ b/packages/core/src/time-tracking/time-log/commands/handlers/schedule-time-log-entries.handler.ts @@ -103,7 +103,7 @@ export class ScheduleTimeLogEntriesHandler /** * Adjust stopped date as per database selection */ - if (getConfig().dbConnectionOptions.type === 'sqlite') { + if (['sqlite', 'better-sqlite3'].includes(getConfig().dbConnectionOptions.type)) { stoppedAt = moment.utc(timeLog.startedAt).add(duration, 'seconds').format('YYYY-MM-DD HH:mm:ss.SSS'); slotDifference = moment.utc(moment()).diff(stoppedAt, 'minutes'); } else { From ed7c93579a62ec0a821ad358b585e4fe889f9ff5 Mon Sep 17 00:00:00 2001 From: CoderNadir Date: Sat, 7 Oct 2023 17:21:24 +0100 Subject: [PATCH 17/30] create directive to prevent from typing spaces and use it in email input of login and register forms, add RegEx patter to password input in both forms (login, register) to warn user not to start his password with space, add new login validation message and translate it to the other langs, trim the email value in (login, register, rememberMe) Nebular strategy functions --- .../app/@core/auth/auth-strategy.service.ts | 9 ++++---- .../src/app/@core/services/auth.service.ts | 22 ++++++++++--------- .../gauzy/src/app/@shared/directives/index.ts | 4 +++- .../directives/no-space-edges.directive.ts | 13 +++++++++++ .../app/@shared/regex/regex-patterns.const.ts | 3 ++- apps/gauzy/src/app/auth/auth.module.ts | 12 +++++----- .../src/app/auth/login/login.component.html | 5 +++++ .../src/app/auth/login/login.component.ts | 2 ++ .../app/auth/register/register.component.html | 6 ++++- .../app/auth/register/register.component.ts | 15 ++++++------- apps/gauzy/src/assets/i18n/ar.json | 3 ++- apps/gauzy/src/assets/i18n/bg.json | 3 ++- apps/gauzy/src/assets/i18n/de.json | 3 ++- apps/gauzy/src/assets/i18n/en.json | 3 ++- apps/gauzy/src/assets/i18n/es.json | 3 ++- apps/gauzy/src/assets/i18n/fr.json | 3 ++- apps/gauzy/src/assets/i18n/he.json | 3 ++- apps/gauzy/src/assets/i18n/it.json | 3 ++- apps/gauzy/src/assets/i18n/nl.json | 3 ++- apps/gauzy/src/assets/i18n/pl.json | 3 ++- apps/gauzy/src/assets/i18n/pt.json | 3 ++- apps/gauzy/src/assets/i18n/ru.json | 3 ++- apps/gauzy/src/assets/i18n/zh.json | 3 ++- 23 files changed, 87 insertions(+), 43 deletions(-) create mode 100644 apps/gauzy/src/app/@shared/directives/no-space-edges.directive.ts diff --git a/apps/gauzy/src/app/@core/auth/auth-strategy.service.ts b/apps/gauzy/src/app/@core/auth/auth-strategy.service.ts index 60aa48f9ee0..0e7b0c3b0c5 100644 --- a/apps/gauzy/src/app/@core/auth/auth-strategy.service.ts +++ b/apps/gauzy/src/app/@core/auth/auth-strategy.service.ts @@ -3,7 +3,7 @@ import { NbAuthResult, NbAuthStrategy } from '@nebular/auth'; import { ActivatedRoute } from '@angular/router'; import { catchError, filter, map, switchMap } from 'rxjs/operators'; import { Injectable } from '@angular/core'; -import { IUser, IAuthResponse } from '@gauzy/contracts'; +import { IUser, IAuthResponse, IUserLoginInput } from '@gauzy/contracts'; import { distinctUntilChange, isNotEmpty } from '@gauzy/common-angular'; import { NbAuthStrategyClass } from '@nebular/auth/auth.options'; import { AuthService } from '../services/auth.service'; @@ -102,7 +102,7 @@ export class AuthStrategy extends NbAuthStrategy { rememberMe(data?: any) { const rememberMe = !!data.rememberMe; if (rememberMe) { - this.cookieService.set('email', data.email); + this.cookieService.set('email', data.email?.trim()); this.cookieService.set('rememberMe', 'true'); } else { this.cookieService.delete('rememberMe'); @@ -130,7 +130,7 @@ export class AuthStrategy extends NbAuthStrategy { lastName: fullName ? fullName.split(' ').slice(-1).join(' ') : null, - email, + email: email?.trim(), tenant, tags, }, @@ -296,7 +296,8 @@ export class AuthStrategy extends NbAuthStrategy { } } - public login(loginInput): Observable { + public login(loginInput: IUserLoginInput): Observable { + loginInput.email = loginInput.email?.trim(); return this.authService.login(loginInput).pipe( map((res: IAuthResponse) => { let user, token, refresh_token; diff --git a/apps/gauzy/src/app/@core/services/auth.service.ts b/apps/gauzy/src/app/@core/services/auth.service.ts index daeda500f7e..86e5534a90d 100644 --- a/apps/gauzy/src/app/@core/services/auth.service.ts +++ b/apps/gauzy/src/app/@core/services/auth.service.ts @@ -18,10 +18,7 @@ import { API_PREFIX } from '../constants/app.constants'; @Injectable() export class AuthService { - - constructor( - private readonly http: HttpClient - ) { } + constructor(private readonly http: HttpClient) {} isAuthenticated(): Promise { return firstValueFrom( @@ -33,7 +30,7 @@ export class AuthService { return this.http.post(`${API_PREFIX}/auth/email/verify`, body); } - login(loginInput): Observable { + login(loginInput: IUserLoginInput): Observable { return this.http.post( `${API_PREFIX}/auth/login`, loginInput @@ -45,9 +42,14 @@ export class AuthService { * @param input - IUserLoginInput containing email and password. * @returns Promise representing the response from the server. */ - signinWorkspaces(input: IUserLoginInput): Observable { + signinWorkspaces( + input: IUserLoginInput + ): Observable { try { - return this.http.post(`${API_PREFIX}/auth/signin.workspaces`, input); + return this.http.post( + `${API_PREFIX}/auth/signin.workspaces`, + input + ); } catch (error) { console.log('Error while signin workspaces: %s', error?.message); // Handle errors appropriately (e.g., log, throw, etc.) @@ -89,13 +91,13 @@ export class AuthService { hasRole(roles: RolesEnum[]): Observable { return this.http.get(`${API_PREFIX}/auth/role`, { - params: toParams({ roles }) + params: toParams({ roles }), }); } hasPermissions(...permissions: PermissionsEnum[]): Observable { return this.http.get(`${API_PREFIX}/auth/permissions`, { - params: toParams({ permissions }) + params: toParams({ permissions }), }); } @@ -108,7 +110,7 @@ export class AuthService { refreshToken(refresh_token: string): Promise { return firstValueFrom( this.http.post(`${API_PREFIX}/auth/refresh-token`, { - refresh_token: refresh_token + refresh_token: refresh_token, }) ); } diff --git a/apps/gauzy/src/app/@shared/directives/index.ts b/apps/gauzy/src/app/@shared/directives/index.ts index 919035cfd5c..bddabe95279 100755 --- a/apps/gauzy/src/app/@shared/directives/index.ts +++ b/apps/gauzy/src/app/@shared/directives/index.ts @@ -5,6 +5,7 @@ import { OutsideDirective } from './outside.directive'; import { UnderConstructionDirective } from './under-construction.directive'; import { ReadMoreDirective } from './read-more'; import { TimeTrackingAuthorizedDirective } from './time-tracking-authorized-directive'; +import { NoSpaceEdgesDirective } from './no-space-edges.directive'; export const DIRECTIVES = [ AutocompleteOffDirective, @@ -13,5 +14,6 @@ export const DIRECTIVES = [ ReadMoreDirective, TimeTrackingAuthorizedDirective, OutsideDirective, - UnderConstructionDirective + UnderConstructionDirective, + NoSpaceEdgesDirective, ]; diff --git a/apps/gauzy/src/app/@shared/directives/no-space-edges.directive.ts b/apps/gauzy/src/app/@shared/directives/no-space-edges.directive.ts new file mode 100644 index 00000000000..deceba0bbc9 --- /dev/null +++ b/apps/gauzy/src/app/@shared/directives/no-space-edges.directive.ts @@ -0,0 +1,13 @@ +import { Directive, ElementRef, HostListener } from '@angular/core'; + +@Directive({ + selector: '[noSpaceEdges]', +}) +export class NoSpaceEdgesDirective { + constructor(private el: ElementRef) {} + + @HostListener('input', ['$event.target.value']) + onInput(value: string) { + this.el.nativeElement.value = value.trim(); + } +} diff --git a/apps/gauzy/src/app/@shared/regex/regex-patterns.const.ts b/apps/gauzy/src/app/@shared/regex/regex-patterns.const.ts index 403661f554b..eeafa71ca2f 100644 --- a/apps/gauzy/src/app/@shared/regex/regex-patterns.const.ts +++ b/apps/gauzy/src/app/@shared/regex/regex-patterns.const.ts @@ -2,5 +2,6 @@ export const patterns = { websiteUrl: /^((?:https?:\/\/)[^./]+(?:\.[^./]+)+(?:\/.*)?)$/, imageUrl: /^(http)?s?:?(\/\/[^"']*\.(?:png|jpg|jpeg|gif|png|svg))/, email: /^[a-zA-Z0-9.!#$%&’*+/=?^_`{|}~-]+@[a-zA-Z0-9-]+(?:\.[a-zA-Z0-9-]+)*$/, - host: /^(([a-zA-Z0-9]|[a-zA-Z0-9][a-zA-Z0-9-]*[a-zA-Z0-9]).)*([A-Za-z0-9]|[A-Za-z0-9][A-Za-z0-9-]*[A-Za-z0-9])$/ + host: /^(([a-zA-Z0-9]|[a-zA-Z0-9][a-zA-Z0-9-]*[a-zA-Z0-9]).)*([A-Za-z0-9]|[A-Za-z0-9][A-Za-z0-9-]*[A-Za-z0-9])$/, + passwordNoSpaceEdges: /^(?!\s).*[^\s]$/, }; diff --git a/apps/gauzy/src/app/auth/auth.module.ts b/apps/gauzy/src/app/auth/auth.module.ts index e9343ee4c9e..a294af9415a 100644 --- a/apps/gauzy/src/app/auth/auth.module.ts +++ b/apps/gauzy/src/app/auth/auth.module.ts @@ -29,6 +29,7 @@ import { NgxResetPasswordComponent } from "./reset-password/reset-password.compo import { NgxFaqModule } from '../@shared/faq'; import { ConfirmEmailModule } from './confirm-email'; import { ElectronService } from '../@core/auth/electron.service'; +import { SharedModule } from '../@shared/shared.module'; @NgModule({ imports: [ @@ -48,10 +49,11 @@ import { ElectronService } from '../@core/auth/electron.service'; NbFormFieldModule, NbSelectModule, NbLayoutModule, - ThemeModule, - ThemeSelectorModule, + ThemeModule, + ThemeSelectorModule, NgxFaqModule, - ConfirmEmailModule + ConfirmEmailModule, + SharedModule, ], declarations: [ NgxLoginComponent, @@ -61,8 +63,8 @@ import { ElectronService } from '../@core/auth/electron.service'; NgxRegisterSideSingleFeatureComponent, NgxAuthComponent, NgxRegisterComponent, - NgxResetPasswordComponent + NgxResetPasswordComponent, ], - providers: [ElectronService] + providers: [ElectronService], }) export class NgxAuthModule {} diff --git a/apps/gauzy/src/app/auth/login/login.component.html b/apps/gauzy/src/app/auth/login/login.component.html index 363a06649c3..1acd870ad55 100644 --- a/apps/gauzy/src/app/auth/login/login.component.html +++ b/apps/gauzy/src/app/auth/login/login.component.html @@ -71,6 +71,7 @@

{{ 'LOGIN_PAGE.TITLE' | translate }}

[(ngModel)]="user.email" #email="ngModel" name="email" + noSpaceEdges id="input-email" pattern=".+@.+\..+" [placeholder]="'LOGIN_PAGE.PLACEHOLDERS.EMAIL' | translate" @@ -112,6 +113,7 @@

{{ 'LOGIN_PAGE.TITLE' | translate }}

fullWidth [(ngModel)]="user.password" #password="ngModel" + [pattern]="passwordNoSpaceEdges" name="password" [type]="showPassword ? 'text' : 'password'" id="input-password" @@ -154,6 +156,9 @@

{{ 'LOGIN_PAGE.TITLE' | translate }}

+

+ {{ 'LOGIN_PAGE.VALIDATION.PASSWORD_NO_SPACE_EDGES' | translate }} +

Register id="input-email" name="email" pattern=".+@.+..+" + noSpaceEdges placeholder="Email address" fullWidth fieldSize="large" @@ -112,6 +113,7 @@

Register

[(ngModel)]="user.password" [type]="showPassword ? 'text' : 'password'" #password="ngModel" + [pattern]="passwordNoSpaceEdges" type="password" id="input-password" name="password" @@ -148,6 +150,9 @@

Register

+

+ Passwords must not begin or end with spaces. +

Password is required!

@@ -293,4 +298,3 @@

Register

- diff --git a/apps/gauzy/src/app/auth/register/register.component.ts b/apps/gauzy/src/app/auth/register/register.component.ts index 143a68e39b5..309a17d38b5 100644 --- a/apps/gauzy/src/app/auth/register/register.component.ts +++ b/apps/gauzy/src/app/auth/register/register.component.ts @@ -1,15 +1,14 @@ import { Component } from '@angular/core'; import { NbRegisterComponent } from '@nebular/auth'; - - +import { patterns } from '../../@shared/regex/regex-patterns.const'; @Component({ - selector: 'ngx-register', - templateUrl: './register.component.html', - styleUrls: ['./register.component.scss'], + selector: 'ngx-register', + templateUrl: './register.component.html', + styleUrls: ['./register.component.scss'], }) export class NgxRegisterComponent extends NbRegisterComponent { - - showPassword: boolean = false; - showConfirmPassword: boolean = false; + showPassword: boolean = false; + showConfirmPassword: boolean = false; + passwordNoSpaceEdges = patterns.passwordNoSpaceEdges; } diff --git a/apps/gauzy/src/assets/i18n/ar.json b/apps/gauzy/src/assets/i18n/ar.json index bc7c6a39583..2ff99c4efa3 100644 --- a/apps/gauzy/src/assets/i18n/ar.json +++ b/apps/gauzy/src/assets/i18n/ar.json @@ -4356,7 +4356,8 @@ "EMAIL_REQUIRED": "البريد الإلكتروني مطلوب!", "EMAIL_REAL_REQUIRED": "يجب أن يكون البريد الإلكتروني الحقيقي!", "PASSWORD_REQUIRED": "كلمة المرور مطلوبة!", - "PASSWORD_SHOULD_CONTAIN": "يجب أن تحتوي كلمة المرور على عدد الأحرف المسموح به من {{ minLength }} إلى {{ maxLength }}!" + "PASSWORD_SHOULD_CONTAIN": "يجب أن تحتوي كلمة المرور على عدد الأحرف المسموح به من {{ minLength }} إلى {{ maxLength }}!", + "PASSWORD_NO_SPACE_EDGES": "يجب ألا تبدأ كلمات المرور أو تنتهي بمسافات." }, "DEMO": { "TITLE": "تسجيل الدخول تلقائيًا إلى حسابات التجريبية", diff --git a/apps/gauzy/src/assets/i18n/bg.json b/apps/gauzy/src/assets/i18n/bg.json index 19575490929..d61ac2f3f9b 100644 --- a/apps/gauzy/src/assets/i18n/bg.json +++ b/apps/gauzy/src/assets/i18n/bg.json @@ -4282,7 +4282,8 @@ "EMAIL_REQUIRED": "Email is required!", "EMAIL_REAL_REQUIRED": "Email should be the real one!", "PASSWORD_REQUIRED": "Password is required!", - "PASSWORD_SHOULD_CONTAIN": "Password should contain from {{ minLength }} to {{ maxLength }} characters!" + "PASSWORD_SHOULD_CONTAIN": "Password should contain from {{ minLength }} to {{ maxLength }} characters!", + "PASSWORD_NO_SPACE_EDGES": "Passwords must not begin or end with spaces." }, "DEMO": { "TITLE": "Login Automatically into Demo accounts", diff --git a/apps/gauzy/src/assets/i18n/de.json b/apps/gauzy/src/assets/i18n/de.json index 8594514322d..6a43095903c 100644 --- a/apps/gauzy/src/assets/i18n/de.json +++ b/apps/gauzy/src/assets/i18n/de.json @@ -4356,7 +4356,8 @@ "EMAIL_REQUIRED": "E-Mail ist erforderlich!", "EMAIL_REAL_REQUIRED": "Die E-Mail sollte die echte sein!", "PASSWORD_REQUIRED": "Passwort wird benötigt!", - "PASSWORD_SHOULD_CONTAIN": "Das Passwort sollte aus {{ minLength }} bis {{ maxLength }} Zeichen bestehen!" + "PASSWORD_SHOULD_CONTAIN": "Das Passwort sollte aus {{ minLength }} bis {{ maxLength }} Zeichen bestehen!", + "PASSWORD_NO_SPACE_EDGES": "Passwörter dürfen nicht mit Leerzeichen beginnen oder enden." }, "DEMO": { "TITLE": "Automatisch in Demo-Konten einloggen", diff --git a/apps/gauzy/src/assets/i18n/en.json b/apps/gauzy/src/assets/i18n/en.json index 6fa68ca8920..e92d257e862 100644 --- a/apps/gauzy/src/assets/i18n/en.json +++ b/apps/gauzy/src/assets/i18n/en.json @@ -4366,7 +4366,8 @@ "EMAIL_REQUIRED": "Email is required!", "EMAIL_REAL_REQUIRED": "Email should be the real one!", "PASSWORD_REQUIRED": "Password is required!", - "PASSWORD_SHOULD_CONTAIN": "Password should contain from {{ minLength }} to {{ maxLength }} characters!" + "PASSWORD_SHOULD_CONTAIN": "Password should contain from {{ minLength }} to {{ maxLength }} characters!", + "PASSWORD_NO_SPACE_EDGES": "Passwords must not begin or end with spaces." }, "DEMO": { "TITLE": "Login Automatically into Demo accounts", diff --git a/apps/gauzy/src/assets/i18n/es.json b/apps/gauzy/src/assets/i18n/es.json index 2301d6a408b..7707c047372 100644 --- a/apps/gauzy/src/assets/i18n/es.json +++ b/apps/gauzy/src/assets/i18n/es.json @@ -4358,7 +4358,8 @@ "EMAIL_REQUIRED": "¡El correo electrónico es obligatorio!", "EMAIL_REAL_REQUIRED": "¡El correo electrónico debería ser el auténtico!", "PASSWORD_REQUIRED": "¡Se requiere contraseña!", - "PASSWORD_SHOULD_CONTAIN": "¡La contraseña debe contener de {{ minLength }} a {{ maxLength }} caracteres!" + "PASSWORD_SHOULD_CONTAIN": "¡La contraseña debe contener de {{ minLength }} a {{ maxLength }} caracteres!", + "PASSWORD_NO_SPACE_EDGES": "Las contraseñas no deben comenzar ni terminar con espacios." }, "DEMO": { "TITLE": "Iniciar sesión automáticamente en cuentas de demostración", diff --git a/apps/gauzy/src/assets/i18n/fr.json b/apps/gauzy/src/assets/i18n/fr.json index d9ef03de37a..13cca7c097f 100644 --- a/apps/gauzy/src/assets/i18n/fr.json +++ b/apps/gauzy/src/assets/i18n/fr.json @@ -4357,7 +4357,8 @@ "EMAIL_REQUIRED": "L'e-mail est requis !", "EMAIL_REAL_REQUIRED": "L'email devrait être le vrai !", "PASSWORD_REQUIRED": "Le mot de passe est requis !", - "PASSWORD_SHOULD_CONTAIN": "Le mot de passe doit contenir de {{ minLength }} à {{ maxLength }} caractères!" + "PASSWORD_SHOULD_CONTAIN": "Le mot de passe doit contenir de {{ minLength }} à {{ maxLength }} caractères!", + "PASSWORD_NO_SPACE_EDGES": "Les mots de passe ne doivent ni commencer ni se terminer par des espaces." }, "DEMO": { "TITLE": "Connectez-vous automatiquement aux comptes de démonstration", diff --git a/apps/gauzy/src/assets/i18n/he.json b/apps/gauzy/src/assets/i18n/he.json index 8df79a844c5..83d5cb87be7 100644 --- a/apps/gauzy/src/assets/i18n/he.json +++ b/apps/gauzy/src/assets/i18n/he.json @@ -4280,7 +4280,8 @@ "EMAIL_REQUIRED": "Email is required!", "EMAIL_REAL_REQUIRED": "Email should be the real one!", "PASSWORD_REQUIRED": "Password is required!", - "PASSWORD_SHOULD_CONTAIN": "Password should contain from {{ minLength }} to {{ maxLength }} characters!" + "PASSWORD_SHOULD_CONTAIN": "Password should contain from {{ minLength }} to {{ maxLength }} characters!", + "PASSWORD_NO_SPACE_EDGES": "Passwords must not begin or end with spaces." }, "DEMO": { "TITLE": "Login Automatically into Demo accounts", diff --git a/apps/gauzy/src/assets/i18n/it.json b/apps/gauzy/src/assets/i18n/it.json index 8b3a167919c..bcf9b727687 100644 --- a/apps/gauzy/src/assets/i18n/it.json +++ b/apps/gauzy/src/assets/i18n/it.json @@ -4356,7 +4356,8 @@ "EMAIL_REQUIRED": "L'email è richiesta!", "EMAIL_REAL_REQUIRED": "L'email deve essere quella reale!", "PASSWORD_REQUIRED": "Password è richiesta!", - "PASSWORD_SHOULD_CONTAIN": "La password deve contenere da {{ minLength }} a {{ maxLength }} caratteri!" + "PASSWORD_SHOULD_CONTAIN": "La password deve contenere da {{ minLength }} a {{ maxLength }} caratteri!", + "PASSWORD_NO_SPACE_EDGES": "Le password non devono iniziare o terminare con spazi." }, "DEMO": { "TITLE": "Accedi automaticamente agli account di prova", diff --git a/apps/gauzy/src/assets/i18n/nl.json b/apps/gauzy/src/assets/i18n/nl.json index 4447e2700e5..6bf1215b2a1 100644 --- a/apps/gauzy/src/assets/i18n/nl.json +++ b/apps/gauzy/src/assets/i18n/nl.json @@ -4356,7 +4356,8 @@ "EMAIL_REQUIRED": "E-mail is verplicht!", "EMAIL_REAL_REQUIRED": "De e-mail moet echt zijn!", "PASSWORD_REQUIRED": "Wachtwoord is verplicht!", - "PASSWORD_SHOULD_CONTAIN": "Het wachtwoord moet bestaan uit {{ minLength }} tot {{ maxLength }} tekens!" + "PASSWORD_SHOULD_CONTAIN": "Het wachtwoord moet bestaan uit {{ minLength }} tot {{ maxLength }} tekens!", + "PASSWORD_NO_SPACE_EDGES": "Wachtwoorden mogen niet beginnen of eindigen met spaties." }, "DEMO": { "TITLE": "Automatisch inloggen op demorekeningen", diff --git a/apps/gauzy/src/assets/i18n/pl.json b/apps/gauzy/src/assets/i18n/pl.json index 3bb87c8a0a0..82398586341 100644 --- a/apps/gauzy/src/assets/i18n/pl.json +++ b/apps/gauzy/src/assets/i18n/pl.json @@ -4356,7 +4356,8 @@ "EMAIL_REQUIRED": "Wymagany jest adres e-mail!", "EMAIL_REAL_REQUIRED": "Email powinien być prawdziwy!", "PASSWORD_REQUIRED": "Hasło jest wymagane!", - "PASSWORD_SHOULD_CONTAIN": "Hasło powinno zawierać od {{ minLength }} do {{ maxLength }} znaków!" + "PASSWORD_SHOULD_CONTAIN": "Hasło powinno zawierać od {{ minLength }} do {{ maxLength }} znaków!", + "PASSWORD_NO_SPACE_EDGES": "Hasła nie mogą zaczynać się ani kończyć spacjami." }, "DEMO": { "TITLE": "Logowanie automatyczne do kont demo", diff --git a/apps/gauzy/src/assets/i18n/pt.json b/apps/gauzy/src/assets/i18n/pt.json index 27b6331d1ea..04592a4bf10 100644 --- a/apps/gauzy/src/assets/i18n/pt.json +++ b/apps/gauzy/src/assets/i18n/pt.json @@ -4356,7 +4356,8 @@ "EMAIL_REQUIRED": "O email é obrigatório!", "EMAIL_REAL_REQUIRED": "O email deve ser o verdadeiro!", "PASSWORD_REQUIRED": "Senha é obrigatória!", - "PASSWORD_SHOULD_CONTAIN": "A senha deve conter de {{ minLength }} a {{ maxLength }} caracteres!" + "PASSWORD_SHOULD_CONTAIN": "A senha deve conter de {{ minLength }} a {{ maxLength }} caracteres!", + "PASSWORD_NO_SPACE_EDGES": "As senhas não devem começar ou terminar com espaços." }, "DEMO": { "TITLE": "Faça login automaticamente nas contas de demonstração.", diff --git a/apps/gauzy/src/assets/i18n/ru.json b/apps/gauzy/src/assets/i18n/ru.json index 830fd393ea2..2af2d5f7033 100644 --- a/apps/gauzy/src/assets/i18n/ru.json +++ b/apps/gauzy/src/assets/i18n/ru.json @@ -4281,7 +4281,8 @@ "EMAIL_REQUIRED": "Требуется адрес электронной почты!", "EMAIL_REAL_REQUIRED": "Email должен быть реальным!", "PASSWORD_REQUIRED": "Требуется пароль!", - "PASSWORD_SHOULD_CONTAIN": "Пароль должен содержать от {{ minLength }} до {{ maxLength }} символов!" + "PASSWORD_SHOULD_CONTAIN": "Пароль должен содержать от {{ minLength }} до {{ maxLength }} символов!", + "PASSWORD_NO_SPACE_EDGES": "Пароли не должны начинаться или заканчиваться пробелами." }, "DEMO": { "TITLE": "Автоматически входить в демо-аккаунты", diff --git a/apps/gauzy/src/assets/i18n/zh.json b/apps/gauzy/src/assets/i18n/zh.json index 3b44bfa7d92..c8a2554bbb1 100644 --- a/apps/gauzy/src/assets/i18n/zh.json +++ b/apps/gauzy/src/assets/i18n/zh.json @@ -4356,7 +4356,8 @@ "EMAIL_REQUIRED": "电子邮件是必需的!", "EMAIL_REAL_REQUIRED": "电子邮件应该是真实的!", "PASSWORD_REQUIRED": "密码是必需的!", - "PASSWORD_SHOULD_CONTAIN": "密码应包含{{ minLength }}到{{ maxLength }}个字符!" + "PASSWORD_SHOULD_CONTAIN": "密码应包含{{ minLength }}到{{ maxLength }}个字符!", + "PASSWORD_NO_SPACE_EDGES": "密码不得以空格开头或结尾。" }, "DEMO": { "TITLE": "自动登录到演示账户。", From 5dd935865913b1141511458321b3ce2cff253313 Mon Sep 17 00:00:00 2001 From: Govindram Date: Sun, 8 Oct 2023 12:10:14 +0530 Subject: [PATCH 18/30] Permission added for Edit Active Task Id --- apps/gauzy/src/assets/i18n/ar.json | 1 + apps/gauzy/src/assets/i18n/bg.json | 1 + apps/gauzy/src/assets/i18n/de.json | 1 + apps/gauzy/src/assets/i18n/en.json | 1 + apps/gauzy/src/assets/i18n/es.json | 1 + apps/gauzy/src/assets/i18n/fr.json | 1 + apps/gauzy/src/assets/i18n/he.json | 1 + apps/gauzy/src/assets/i18n/it.json | 1 + apps/gauzy/src/assets/i18n/nl.json | 1 + apps/gauzy/src/assets/i18n/pl.json | 1 + apps/gauzy/src/assets/i18n/pt.json | 1 + apps/gauzy/src/assets/i18n/ru.json | 1 + apps/gauzy/src/assets/i18n/zh.json | 1 + packages/contracts/src/role-permission.model.ts | 1 + .../organization-team-employee.controller.ts | 1 + packages/core/src/role-permission/default-role-permissions.ts | 3 +++ 16 files changed, 18 insertions(+) diff --git a/apps/gauzy/src/assets/i18n/ar.json b/apps/gauzy/src/assets/i18n/ar.json index bc7c6a39583..b31b6a404b9 100644 --- a/apps/gauzy/src/assets/i18n/ar.json +++ b/apps/gauzy/src/assets/i18n/ar.json @@ -2056,6 +2056,7 @@ "ORG_CONTACT_VIEW": "عرض جهات الاتصال", "ORG_TEAM_ADD": "إضافة فِرَق", "ORG_TEAM_VIEW": "عرض الفرق", + "ORG_TEAM_EDIT_ACTIVE_TASK": "تحرير المهام النشطة", "ORG_TEAM_EDIT": "تحرير الفرق", "ORG_TEAM_DELETE": "حذف الفِرَق", "ORG_TEAM_JOIN_REQUEST_VIEW": "عرض طلبات الانضمام للفِرَق", diff --git a/apps/gauzy/src/assets/i18n/bg.json b/apps/gauzy/src/assets/i18n/bg.json index 19575490929..f8859348714 100644 --- a/apps/gauzy/src/assets/i18n/bg.json +++ b/apps/gauzy/src/assets/i18n/bg.json @@ -2019,6 +2019,7 @@ "ORG_CONTACT_VIEW": "View Contacts", "ORG_TEAM_ADD": "Add Teams", "ORG_TEAM_VIEW": "View Teams", + "ORG_TEAM_EDIT_ACTIVE_TASK": "Редактиране на активни задачи", "ORG_TEAM_EDIT": "Edit Teams", "ORG_TEAM_DELETE": "Delete Teams", "ORG_TEAM_JOIN_REQUEST_VIEW": "Преглед на заявките за присъединяване към екипи", diff --git a/apps/gauzy/src/assets/i18n/de.json b/apps/gauzy/src/assets/i18n/de.json index 8594514322d..7523f2ec940 100644 --- a/apps/gauzy/src/assets/i18n/de.json +++ b/apps/gauzy/src/assets/i18n/de.json @@ -2056,6 +2056,7 @@ "ORG_CONTACT_VIEW": "Kontakte anzeigen", "ORG_TEAM_ADD": "Teams hinzufügen", "ORG_TEAM_VIEW": "Teams anzeigen", + "ORG_TEAM_EDIT_ACTIVE_TASK": "Aktive Aufgaben bearbeiten", "ORG_TEAM_EDIT": "Teams bearbeiten", "ORG_TEAM_DELETE": "Lösche Teams", "ORG_TEAM_JOIN_REQUEST_VIEW": "Ansicht Teams Beitrittsanfragen", diff --git a/apps/gauzy/src/assets/i18n/en.json b/apps/gauzy/src/assets/i18n/en.json index 6fa68ca8920..5f980b6ae82 100644 --- a/apps/gauzy/src/assets/i18n/en.json +++ b/apps/gauzy/src/assets/i18n/en.json @@ -2063,6 +2063,7 @@ "ORG_CONTACT_VIEW": "View Contacts", "ORG_TEAM_ADD": "Add Teams", "ORG_TEAM_VIEW": "View Teams", + "ORG_TEAM_EDIT_ACTIVE_TASK": "Edit Active Tasks", "ORG_TEAM_EDIT": "Edit Teams", "ORG_TEAM_DELETE": "Delete Teams", "ORG_TEAM_REMOVE_ACCOUNT_AS_MEMBER": "Remove Account As Team Member", diff --git a/apps/gauzy/src/assets/i18n/es.json b/apps/gauzy/src/assets/i18n/es.json index 2301d6a408b..53f7afe0b20 100644 --- a/apps/gauzy/src/assets/i18n/es.json +++ b/apps/gauzy/src/assets/i18n/es.json @@ -2058,6 +2058,7 @@ "ORG_CONTACT_VIEW": "Ver contactos", "ORG_TEAM_ADD": "Agregar equipos", "ORG_TEAM_VIEW": "Ver Equipos", + "ORG_TEAM_EDIT_ACTIVE_TASK": "Editar tareas activas", "ORG_TEAM_EDIT": "Editar Equipos", "ORG_TEAM_DELETE": "Eliminar equipos", "ORG_TEAM_JOIN_REQUEST_VIEW": "Ver solicitudes de unirse a los equipos", diff --git a/apps/gauzy/src/assets/i18n/fr.json b/apps/gauzy/src/assets/i18n/fr.json index d9ef03de37a..39e0728f720 100644 --- a/apps/gauzy/src/assets/i18n/fr.json +++ b/apps/gauzy/src/assets/i18n/fr.json @@ -2057,6 +2057,7 @@ "ORG_CONTACT_VIEW": "Voir les contacts", "ORG_TEAM_ADD": "Ajouter des équipes", "ORG_TEAM_VIEW": "Voir les équipes", + "ORG_TEAM_EDIT_ACTIVE_TASK": "Modifier les tâches actives", "ORG_TEAM_EDIT": "Modifier les équipes", "ORG_TEAM_DELETE": "Supprimer les équipes", "ORG_TEAM_JOIN_REQUEST_VIEW": "Voir les demandes de rejoindre des équipes", diff --git a/apps/gauzy/src/assets/i18n/he.json b/apps/gauzy/src/assets/i18n/he.json index 8df79a844c5..6e5b434c281 100644 --- a/apps/gauzy/src/assets/i18n/he.json +++ b/apps/gauzy/src/assets/i18n/he.json @@ -2019,6 +2019,7 @@ "ORG_CONTACT_VIEW": "View Contacts", "ORG_TEAM_ADD": "Add Teams", "ORG_TEAM_VIEW": "View Teams", + "ORG_TEAM_EDIT_ACTIVE_TASK": "ערוך משימות פעילות", "ORG_TEAM_EDIT": "Edit Teams", "ORG_TEAM_DELETE": "Delete Teams", "ORG_TEAM_JOIN_REQUEST_VIEW": "הצג בקשות הצטרפות לצוותים", diff --git a/apps/gauzy/src/assets/i18n/it.json b/apps/gauzy/src/assets/i18n/it.json index 8b3a167919c..25a15176150 100644 --- a/apps/gauzy/src/assets/i18n/it.json +++ b/apps/gauzy/src/assets/i18n/it.json @@ -2056,6 +2056,7 @@ "ORG_CONTACT_VIEW": "Visualizza contatti", "ORG_TEAM_ADD": "Aggiungi Teams", "ORG_TEAM_VIEW": "Visualizza squadre", + "ORG_TEAM_EDIT_ACTIVE_TASK": "Modifica attività attive", "ORG_TEAM_EDIT": "Modifica squadre", "ORG_TEAM_DELETE": "Elimina Teams", "ORG_TEAM_JOIN_REQUEST_VIEW": "Visualizza le richieste di unione ai team", diff --git a/apps/gauzy/src/assets/i18n/nl.json b/apps/gauzy/src/assets/i18n/nl.json index 4447e2700e5..c21955a1cd1 100644 --- a/apps/gauzy/src/assets/i18n/nl.json +++ b/apps/gauzy/src/assets/i18n/nl.json @@ -2056,6 +2056,7 @@ "ORG_CONTACT_VIEW": "Bekijk contacten", "ORG_TEAM_ADD": "Voeg Teams toe", "ORG_TEAM_VIEW": "Bekijk Teams", + "ORG_TEAM_EDIT_ACTIVE_TASK": "Bewerk actieve taken", "ORG_TEAM_EDIT": "Teams bewerken.", "ORG_TEAM_DELETE": "Verwijder Teams", "ORG_TEAM_JOIN_REQUEST_VIEW": "Bekijk de verzoeken om lid te worden van teams", diff --git a/apps/gauzy/src/assets/i18n/pl.json b/apps/gauzy/src/assets/i18n/pl.json index 3bb87c8a0a0..3aa8e2d4a4e 100644 --- a/apps/gauzy/src/assets/i18n/pl.json +++ b/apps/gauzy/src/assets/i18n/pl.json @@ -2056,6 +2056,7 @@ "ORG_CONTACT_VIEW": "Wyświetl kontakty", "ORG_TEAM_ADD": "Dodaj zespoły", "ORG_TEAM_VIEW": "Wyświetl zespoły", + "ORG_TEAM_EDIT_ACTIVE_TASK": "Edytuj aktywne zadania", "ORG_TEAM_EDIT": "Edytuj zespoły", "ORG_TEAM_DELETE": "Usuń zespoły", "ORG_TEAM_JOIN_REQUEST_VIEW": "Wyświetl prośby dołączenia do zespołów", diff --git a/apps/gauzy/src/assets/i18n/pt.json b/apps/gauzy/src/assets/i18n/pt.json index 27b6331d1ea..37b3c67bed5 100644 --- a/apps/gauzy/src/assets/i18n/pt.json +++ b/apps/gauzy/src/assets/i18n/pt.json @@ -2056,6 +2056,7 @@ "ORG_CONTACT_VIEW": "Visualizar contatos", "ORG_TEAM_ADD": "Adicionar equipes", "ORG_TEAM_VIEW": "Ver Equipes", + "ORG_TEAM_EDIT_ACTIVE_TASK": "Editar tarefas ativas", "ORG_TEAM_EDIT": "Editar Equipes", "ORG_TEAM_DELETE": "Eliminar Equipes", "ORG_TEAM_JOIN_REQUEST_VIEW": "Ver solicitações de participação das equipes.", diff --git a/apps/gauzy/src/assets/i18n/ru.json b/apps/gauzy/src/assets/i18n/ru.json index 830fd393ea2..c84bb32f492 100644 --- a/apps/gauzy/src/assets/i18n/ru.json +++ b/apps/gauzy/src/assets/i18n/ru.json @@ -2019,6 +2019,7 @@ "ORG_CONTACT_VIEW": "Контакты", "ORG_TEAM_ADD": "Добавить команды", "ORG_TEAM_VIEW": "Посмотреть команды", + "ORG_TEAM_EDIT_ACTIVE_TASK": "Редактировать активные задачи", "ORG_TEAM_EDIT": "Редактировать команды", "ORG_TEAM_DELETE": "Удалить команды", "ORG_TEAM_JOIN_REQUEST_VIEW": "Просмотр запросов на присоединение к командам", diff --git a/apps/gauzy/src/assets/i18n/zh.json b/apps/gauzy/src/assets/i18n/zh.json index 3b44bfa7d92..df8c584456d 100644 --- a/apps/gauzy/src/assets/i18n/zh.json +++ b/apps/gauzy/src/assets/i18n/zh.json @@ -2056,6 +2056,7 @@ "ORG_CONTACT_VIEW": "查看联系人", "ORG_TEAM_ADD": "添加团队", "ORG_TEAM_VIEW": "查看团队", + "ORG_TEAM_EDIT_ACTIVE_TASK": "编辑活动任务", "ORG_TEAM_EDIT": "编辑团队", "ORG_TEAM_DELETE": "删除团队", "ORG_TEAM_JOIN_REQUEST_VIEW": "查看团队加入请求", diff --git a/packages/contracts/src/role-permission.model.ts b/packages/contracts/src/role-permission.model.ts index 031b31bee26..e162eb17ad4 100644 --- a/packages/contracts/src/role-permission.model.ts +++ b/packages/contracts/src/role-permission.model.ts @@ -114,6 +114,7 @@ export enum PermissionsEnum { ORG_TEAM_ADD = 'ORG_TEAM_ADD', ORG_TEAM_VIEW = 'ORG_TEAM_VIEW', ORG_TEAM_EDIT = 'ORG_TEAM_EDIT', + ORG_TEAM_EDIT_ACTIVE_TASK = 'ORG_TEAM_EDIT_ACTIVE_TASK', ORG_TEAM_DELETE = 'ORG_TEAM_DELETE', ORG_TEAM_REMOVE_ACCOUNT_AS_MEMBER = 'ORG_TEAM_REMOVE_ACCOUNT_AS_MEMBER', /** Organization Team Join Request Permissions */ diff --git a/packages/core/src/organization-team-employee/organization-team-employee.controller.ts b/packages/core/src/organization-team-employee/organization-team-employee.controller.ts index 54a564cb357..9c5b2441e09 100644 --- a/packages/core/src/organization-team-employee/organization-team-employee.controller.ts +++ b/packages/core/src/organization-team-employee/organization-team-employee.controller.ts @@ -46,6 +46,7 @@ export class OrganizationTeamEmployeeController { * @returns */ @HttpCode(HttpStatus.ACCEPTED) + @Permissions(PermissionsEnum.ORG_TEAM_EDIT_ACTIVE_TASK) @UsePipes(new ValidationPipe({ whitelist: true })) @Put(':id/active-task') async updateActiveTask( diff --git a/packages/core/src/role-permission/default-role-permissions.ts b/packages/core/src/role-permission/default-role-permissions.ts index 00d0f273094..4d1a4ed5466 100644 --- a/packages/core/src/role-permission/default-role-permissions.ts +++ b/packages/core/src/role-permission/default-role-permissions.ts @@ -90,6 +90,7 @@ export const DEFAULT_ROLE_PERMISSIONS = [ PermissionsEnum.ORG_TEAM_VIEW, PermissionsEnum.ORG_TEAM_EDIT, PermissionsEnum.ORG_TEAM_DELETE, + PermissionsEnum.ORG_TEAM_EDIT_ACTIVE_TASK, PermissionsEnum.ORG_TEAM_REMOVE_ACCOUNT_AS_MEMBER, PermissionsEnum.ORG_TEAM_JOIN_REQUEST_VIEW, PermissionsEnum.ORG_TEAM_JOIN_REQUEST_EDIT, @@ -223,6 +224,7 @@ export const DEFAULT_ROLE_PERMISSIONS = [ PermissionsEnum.ORG_TEAM_ADD, PermissionsEnum.ORG_TEAM_VIEW, PermissionsEnum.ORG_TEAM_EDIT, + PermissionsEnum.ORG_TEAM_EDIT_ACTIVE_TASK, PermissionsEnum.ORG_TEAM_DELETE, PermissionsEnum.ORG_TEAM_REMOVE_ACCOUNT_AS_MEMBER, PermissionsEnum.ORG_TEAM_JOIN_REQUEST_VIEW, @@ -336,6 +338,7 @@ export const DEFAULT_ROLE_PERMISSIONS = [ PermissionsEnum.ORG_TEAM_VIEW, PermissionsEnum.ORG_TEAM_EDIT, PermissionsEnum.ORG_TEAM_DELETE, + PermissionsEnum.ORG_TEAM_EDIT_ACTIVE_TASK, PermissionsEnum.ORG_TEAM_REMOVE_ACCOUNT_AS_MEMBER, PermissionsEnum.ORG_TEAM_JOIN_REQUEST_VIEW, PermissionsEnum.ORG_TAGS_ADD, From 454e6ae7c61bcb1db98ca12dcb17ab888b95c51f Mon Sep 17 00:00:00 2001 From: Govindram Date: Sun, 8 Oct 2023 18:51:22 +0530 Subject: [PATCH 19/30] Fixes for updating & role added to General option --- packages/contracts/src/role-permission.model.ts | 1 + .../organization-team-employee.service.ts | 3 +-- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/packages/contracts/src/role-permission.model.ts b/packages/contracts/src/role-permission.model.ts index e162eb17ad4..5732c5b9e22 100644 --- a/packages/contracts/src/role-permission.model.ts +++ b/packages/contracts/src/role-permission.model.ts @@ -241,6 +241,7 @@ export const PermissionGroups = { PermissionsEnum.ORG_TEAM_VIEW, PermissionsEnum.ORG_TEAM_EDIT, PermissionsEnum.ORG_TEAM_DELETE, + PermissionsEnum.ORG_TEAM_EDIT_ACTIVE_TASK, PermissionsEnum.ORG_TEAM_REMOVE_ACCOUNT_AS_MEMBER, PermissionsEnum.ORG_TASK_SETTING, PermissionsEnum.ORG_TEAM_JOIN_REQUEST_VIEW, diff --git a/packages/core/src/organization-team-employee/organization-team-employee.service.ts b/packages/core/src/organization-team-employee/organization-team-employee.service.ts index 3d8f4d16e39..40ad4c1ee89 100644 --- a/packages/core/src/organization-team-employee/organization-team-employee.service.ts +++ b/packages/core/src/organization-team-employee/organization-team-employee.service.ts @@ -213,8 +213,7 @@ export class OrganizationTeamEmployeeService extends TenantAwareCrudService Date: Sun, 8 Oct 2023 19:04:45 +0200 Subject: [PATCH 20/30] fix: migrations queries for betterSqlite3 --- .../1644491785525-AdjustTimeLogStopDate.ts | 88 +++++++++------ .../1645087150917-AlterEmailTable.ts | 2 +- .../1652936174625-ReportTableIconSeed.ts | 76 +++++++++---- .../1654675304373-SeedChangeLogFeature.ts | 9 +- ...74044473393-SeedDefaultGlobalTaskStatus.ts | 2 +- ...88-SeedDefaultGlobalTaskPriorityAndSize.ts | 4 +- ...41-SeedTaskPriorityAndSizeAndStatusIcon.ts | 18 ++- ...680622389221-SeedDafaultGlobalIssueType.ts | 4 +- .../1691494801748-SeedIntegrationTable.ts | 19 ++-- .../1692171665427-SeedIntegrationTable.ts | 19 ++-- packages/core/src/email-template/utils.ts | 21 ++-- packages/core/src/integration/utils.ts | 103 +++++++++++------- 12 files changed, 225 insertions(+), 140 deletions(-) diff --git a/packages/core/src/database/migrations/1644491785525-AdjustTimeLogStopDate.ts b/packages/core/src/database/migrations/1644491785525-AdjustTimeLogStopDate.ts index 4b6453d0935..3e84113ca8b 100644 --- a/packages/core/src/database/migrations/1644491785525-AdjustTimeLogStopDate.ts +++ b/packages/core/src/database/migrations/1644491785525-AdjustTimeLogStopDate.ts @@ -8,21 +8,45 @@ export class AdjustTimeLogStopDate1644491785525 implements MigrationInterface { name = 'AdjustTimeLogStopDate1644491785525'; public async up(queryRunner: QueryRunner): Promise { - const timeSlots = await queryRunner.connection.manager.query(` + const isSqlite = ['sqlite', 'better-sqlite3'].includes(queryRunner.connection.options.type); + const timeSlots = await queryRunner.connection.manager.query( + isSqlite + ? ` + SELECT * FROM + "time_slot" + WHERE + "time_slot"."overall" < ? OR + "time_slot"."keyboard" < ? OR + "time_slot"."mouse" < ? OR + "time_slot"."duration" > ?; + ` + : ` SELECT * FROM "time_slot" WHERE "time_slot"."overall" < $1 OR "time_slot"."keyboard" < $2 OR "time_slot"."mouse" < $3 OR - "time_slot"."duration" > $4 - `, [0, 0, 0, 600]); + "time_slot"."duration" > $4; + `, + [0, 0, 0, 600] + ); for await (const timeSlot of timeSlots) { const duration = (timeSlot.duration < 0) ? 0 : (timeSlot.duration > 600) ? 600 : timeSlot.duration; const overall = (timeSlot.overall < 0) ? 0 : (timeSlot.overall > 600) ? 600 : timeSlot.overall; const keyboard = (timeSlot.keyboard < 0) ? 0 : (timeSlot.keyboard > 600) ? 600 : timeSlot.keyboard; const mouse = (timeSlot.mouse < 0) ? 0 : (timeSlot.mouse > 600) ? 600 : timeSlot.mouse; - await queryRunner.connection.manager.query(` + await queryRunner.connection.manager.query( + isSqlite + ? ` + UPDATE "time_slot" SET + "duration" = ?, + "overall" = ?, + "keyboard" = ?, + "mouse" = ? + WHERE + "id" IN(?)` + : ` UPDATE "time_slot" SET "duration" = $1, "overall" = $2, @@ -30,14 +54,8 @@ export class AdjustTimeLogStopDate1644491785525 implements MigrationInterface { "mouse" = $4 WHERE "id" IN($5)`, - [ - duration, - overall, - keyboard, - mouse, - timeSlot.id - ] - ); + [duration, overall, keyboard, mouse, timeSlot.id] + ); } const timelogs = await queryRunner.connection.manager.query(` @@ -59,28 +77,32 @@ export class AdjustTimeLogStopDate1644491785525 implements MigrationInterface { (timeSlot: any) => timeSlot.time_slot_id ) .filter(Boolean); - const [timeLog] = await queryRunner.connection.manager.query(` - SELECT * FROM "time_log" WHERE "time_log"."id" = $1 LIMIT 1`, - [ - timeLogId - ] - ); + const [timeLog] = await queryRunner.connection.manager.query( + isSqlite + ? `SELECT * FROM "time_log" WHERE "time_log"."id" = ? LIMIT 1` + : `SELECT * FROM "time_log" WHERE "time_log"."id" = $1 LIMIT 1`, + [timeLogId] + ); const logDifference = moment().diff(moment.utc(timeLog.startedAt), 'minutes'); if ( isEmpty(timeSlotsIds) && logDifference > 10 ) { - await queryRunner.connection.manager.query(` + await queryRunner.connection.manager.query( + isSqlite + ? ` + UPDATE "time_log" SET + "stoppedAt" = ? + WHERE + "id" IN(?)` + : ` UPDATE "time_log" SET "stoppedAt" = $1 WHERE "id" IN($2)`, - [ - timeLog.startedAt, - timeLog.id - ] - ); + [timeLog.startedAt, timeLog.id] + ); } else if (isNotEmpty(timeSlotsIds)) { const timeSlots = await queryRunner.connection.manager.query(` SELECT * FROM @@ -98,7 +120,7 @@ export class AdjustTimeLogStopDate1644491785525 implements MigrationInterface { /** * Adjust stopped date as per database selection */ - if (['sqlite', 'better-sqlite3'].includes(queryRunner.connection.options.type)) { + if (isSqlite) { stoppedAt = moment.utc(lastTimeSlot.startedAt) .add(duration, 'seconds') .format('YYYY-MM-DD HH:mm:ss.SSS'); @@ -110,16 +132,20 @@ export class AdjustTimeLogStopDate1644491785525 implements MigrationInterface { slotDifference = moment().diff(moment.utc(stoppedAt), 'minutes'); } if (slotDifference > 10) { - await queryRunner.connection.manager.query(` + await queryRunner.connection.manager.query( + isSqlite + ? ` + UPDATE "time_log" SET + "stoppedAt" = ? + WHERE + "id" IN(?)` + : ` UPDATE "time_log" SET "stoppedAt" = $1 WHERE "id" IN($2)`, - [ - stoppedAt, - timeLog.id - ] - ); + [stoppedAt, timeLog.id] + ); } } } diff --git a/packages/core/src/database/migrations/1645087150917-AlterEmailTable.ts b/packages/core/src/database/migrations/1645087150917-AlterEmailTable.ts index c37a9499211..3fe921e3b16 100644 --- a/packages/core/src/database/migrations/1645087150917-AlterEmailTable.ts +++ b/packages/core/src/database/migrations/1645087150917-AlterEmailTable.ts @@ -65,7 +65,7 @@ export class AlterEmailTable1645087150917 implements MigrationInterface { /** * SET isArchived = 0, if database has already NULL rows */ - await queryRunner.query(`UPDATE "email_sent" SET "isArchived" = $1 WHERE "isArchived" IS NULL`, [0]); + await queryRunner.query(`UPDATE "email_sent" SET "isArchived" = ? WHERE "isArchived" IS NULL`, [0]); } /** diff --git a/packages/core/src/database/migrations/1652936174625-ReportTableIconSeed.ts b/packages/core/src/database/migrations/1652936174625-ReportTableIconSeed.ts index c5645c58f8a..0b4b1240f48 100644 --- a/packages/core/src/database/migrations/1652936174625-ReportTableIconSeed.ts +++ b/packages/core/src/database/migrations/1652936174625-ReportTableIconSeed.ts @@ -5,30 +5,60 @@ export class ReportTableIconSeed1652936174625 implements MigrationInterface { name = 'ReportTableIconSeed1652936174625'; public async up(queryRunner: QueryRunner): Promise { - await queryRunner.connection.query(`UPDATE "report" SET "iconClass" = $1 WHERE "slug" = $2`, ['far fa-clock', 'time-activity']); - await queryRunner.connection.query(`UPDATE "report" SET "iconClass" = $1 WHERE "slug" = $2`, ['fas fa-calendar-alt', 'weekly']); - await queryRunner.connection.query(`UPDATE "report" SET "iconClass" = $1 WHERE "slug" = $2`, ['far fa-window-maximize', 'apps-urls']); - await queryRunner.connection.query(`UPDATE "report" SET "iconClass" = $1 WHERE "slug" = $2`, ['far fa-window-maximize', 'manual-time-edits']); - await queryRunner.connection.query(`UPDATE "report" SET "iconClass" = $1 WHERE "slug" = $2`, ['far fa-credit-card', 'expense']); - await queryRunner.connection.query(`UPDATE "report" SET "iconClass" = $1 WHERE "slug" = $2`, ['far fa-credit-card', 'amounts-owed']); - await queryRunner.connection.query(`UPDATE "report" SET "iconClass" = $1 WHERE "slug" = $2`, ['far fa-credit-card', 'payments']); - await queryRunner.connection.query(`UPDATE "report" SET "iconClass" = $1 WHERE "slug" = $2`, ['far fa-clock', 'weekly-limits']); - await queryRunner.connection.query(`UPDATE "report" SET "iconClass" = $1 WHERE "slug" = $2`, ['far fa-clock', 'daily-limits']); - await queryRunner.connection.query(`UPDATE "report" SET "iconClass" = $1 WHERE "slug" = $2`, ['far fa-credit-card', 'project-budgets']); - await queryRunner.connection.query(`UPDATE "report" SET "iconClass" = $1 WHERE "slug" = $2`, ['far fa-credit-card', 'client-budgets']); + const isSqlite = ['sqlite', 'better-sqlite3'].includes(queryRunner.connection.options.type); + if (isSqlite) { + await queryRunner.connection.query(`UPDATE "report" SET "iconClass" = ? WHERE "slug" = ?`, ['far fa-clock', 'time-activity']); + await queryRunner.connection.query(`UPDATE "report" SET "iconClass" = ? WHERE "slug" = ?`, ['fas fa-calendar-alt', 'weekly']); + await queryRunner.connection.query(`UPDATE "report" SET "iconClass" = ? WHERE "slug" = ?`, ['far fa-window-maximize', 'apps-urls']); + await queryRunner.connection.query(`UPDATE "report" SET "iconClass" = ? WHERE "slug" = ?`, ['far fa-window-maximize', 'manual-time-edits']); + await queryRunner.connection.query(`UPDATE "report" SET "iconClass" = ? WHERE "slug" = ?`, ['far fa-credit-card', 'expense']); + await queryRunner.connection.query(`UPDATE "report" SET "iconClass" = ? WHERE "slug" = ?`, ['far fa-credit-card', 'amounts-owed']); + await queryRunner.connection.query(`UPDATE "report" SET "iconClass" = ? WHERE "slug" = ?`, ['far fa-credit-card', 'payments']); + await queryRunner.connection.query(`UPDATE "report" SET "iconClass" = ? WHERE "slug" = ?`, ['far fa-clock', 'weekly-limits']); + await queryRunner.connection.query(`UPDATE "report" SET "iconClass" = ? WHERE "slug" = ?`, ['far fa-clock', 'daily-limits']); + await queryRunner.connection.query(`UPDATE "report" SET "iconClass" = ? WHERE "slug" = ?`, ['far fa-credit-card', 'project-budgets']); + await queryRunner.connection.query(`UPDATE "report" SET "iconClass" = ? WHERE "slug" = ?`, ['far fa-credit-card', 'client-budgets']); + } else { + await queryRunner.connection.query(`UPDATE "report" SET "iconClass" = $1 WHERE "slug" = $2`, ['far fa-clock', 'time-activity']); + await queryRunner.connection.query(`UPDATE "report" SET "iconClass" = $1 WHERE "slug" = $2`, ['fas fa-calendar-alt', 'weekly']); + await queryRunner.connection.query(`UPDATE "report" SET "iconClass" = $1 WHERE "slug" = $2`, ['far fa-window-maximize', 'apps-urls']); + await queryRunner.connection.query(`UPDATE "report" SET "iconClass" = $1 WHERE "slug" = $2`, ['far fa-window-maximize', 'manual-time-edits']); + await queryRunner.connection.query(`UPDATE "report" SET "iconClass" = $1 WHERE "slug" = $2`, ['far fa-credit-card', 'expense']); + await queryRunner.connection.query(`UPDATE "report" SET "iconClass" = $1 WHERE "slug" = $2`, ['far fa-credit-card', 'amounts-owed']); + await queryRunner.connection.query(`UPDATE "report" SET "iconClass" = $1 WHERE "slug" = $2`, ['far fa-credit-card', 'payments']); + await queryRunner.connection.query(`UPDATE "report" SET "iconClass" = $1 WHERE "slug" = $2`, ['far fa-clock', 'weekly-limits']); + await queryRunner.connection.query(`UPDATE "report" SET "iconClass" = $1 WHERE "slug" = $2`, ['far fa-clock', 'daily-limits']); + await queryRunner.connection.query(`UPDATE "report" SET "iconClass" = $1 WHERE "slug" = $2`, ['far fa-credit-card', 'project-budgets']); + await queryRunner.connection.query(`UPDATE "report" SET "iconClass" = $1 WHERE "slug" = $2`, ['far fa-credit-card', 'client-budgets']); + } } public async down(queryRunner: QueryRunner): Promise { - await queryRunner.connection.query(`UPDATE "report" SET "iconClass" = $1 WHERE "slug" = $2`, ['clock-outline', 'time-activity']); - await queryRunner.connection.query(`UPDATE "report" SET "iconClass" = $1 WHERE "slug" = $2`, ['calendar-outline', 'weekly']); - await queryRunner.connection.query(`UPDATE "report" SET "iconClass" = $1 WHERE "slug" = $2`, ['browser-outline', 'apps-urls']); - await queryRunner.connection.query(`UPDATE "report" SET "iconClass" = $1 WHERE "slug" = $2`, ['browser-outline', 'manual-time-edits']); - await queryRunner.connection.query(`UPDATE "report" SET "iconClass" = $1 WHERE "slug" = $2`, ['credit-card-outline', 'expense']); - await queryRunner.connection.query(`UPDATE "report" SET "iconClass" = $1 WHERE "slug" = $2`, ['credit-card-outline', 'amounts-owed']); - await queryRunner.connection.query(`UPDATE "report" SET "iconClass" = $1 WHERE "slug" = $2`, ['credit-card-outline', 'payments']); - await queryRunner.connection.query(`UPDATE "report" SET "iconClass" = $1 WHERE "slug" = $2`, ['clock-outline', 'weekly-limits']); - await queryRunner.connection.query(`UPDATE "report" SET "iconClass" = $1 WHERE "slug" = $2`, ['clock-outline', 'daily-limits']); - await queryRunner.connection.query(`UPDATE "report" SET "iconClass" = $1 WHERE "slug" = $2`, ['credit-card-outline', 'project-budgets']); - await queryRunner.connection.query(`UPDATE "report" SET "iconClass" = $1 WHERE "slug" = $2`, ['credit-card-outline', 'client-budgets']); + const isSqlite = ['sqlite', 'better-sqlite3'].includes(queryRunner.connection.options.type); + if (isSqlite) { + await queryRunner.connection.query(`UPDATE "report" SET "iconClass" = ? WHERE "slug" = ?`, ['clock-outline', 'time-activity']); + await queryRunner.connection.query(`UPDATE "report" SET "iconClass" = ? WHERE "slug" = ?`, ['calendar-outline', 'weekly']); + await queryRunner.connection.query(`UPDATE "report" SET "iconClass" = ? WHERE "slug" = ?`, ['browser-outline', 'apps-urls']); + await queryRunner.connection.query(`UPDATE "report" SET "iconClass" = ? WHERE "slug" = ?`, ['browser-outline', 'manual-time-edits']); + await queryRunner.connection.query(`UPDATE "report" SET "iconClass" = ? WHERE "slug" = ?`, ['credit-card-outline', 'expense']); + await queryRunner.connection.query(`UPDATE "report" SET "iconClass" = ? WHERE "slug" = ?`, ['credit-card-outline', 'amounts-owed']); + await queryRunner.connection.query(`UPDATE "report" SET "iconClass" = ? WHERE "slug" = ?`, ['credit-card-outline', 'payments']); + await queryRunner.connection.query(`UPDATE "report" SET "iconClass" = ? WHERE "slug" = ?`, ['clock-outline', 'weekly-limits']); + await queryRunner.connection.query(`UPDATE "report" SET "iconClass" = ? WHERE "slug" = ?`, ['clock-outline', 'daily-limits']); + await queryRunner.connection.query(`UPDATE "report" SET "iconClass" = ? WHERE "slug" = ?`, ['credit-card-outline', 'project-budgets']); + await queryRunner.connection.query(`UPDATE "report" SET "iconClass" = ? WHERE "slug" = ?`, ['credit-card-outline', 'client-budgets']); + } else { + await queryRunner.connection.query(`UPDATE "report" SET "iconClass" = $1 WHERE "slug" = $2`, ['clock-outline', 'time-activity']); + await queryRunner.connection.query(`UPDATE "report" SET "iconClass" = $1 WHERE "slug" = $2`, ['calendar-outline', 'weekly']); + await queryRunner.connection.query(`UPDATE "report" SET "iconClass" = $1 WHERE "slug" = $2`, ['browser-outline', 'apps-urls']); + await queryRunner.connection.query(`UPDATE "report" SET "iconClass" = $1 WHERE "slug" = $2`, ['browser-outline', 'manual-time-edits']); + await queryRunner.connection.query(`UPDATE "report" SET "iconClass" = $1 WHERE "slug" = $2`, ['credit-card-outline', 'expense']); + await queryRunner.connection.query(`UPDATE "report" SET "iconClass" = $1 WHERE "slug" = $2`, ['credit-card-outline', 'amounts-owed']); + await queryRunner.connection.query(`UPDATE "report" SET "iconClass" = $1 WHERE "slug" = $2`, ['credit-card-outline', 'payments']); + await queryRunner.connection.query(`UPDATE "report" SET "iconClass" = $1 WHERE "slug" = $2`, ['clock-outline', 'weekly-limits']); + await queryRunner.connection.query(`UPDATE "report" SET "iconClass" = $1 WHERE "slug" = $2`, ['clock-outline', 'daily-limits']); + await queryRunner.connection.query(`UPDATE "report" SET "iconClass" = $1 WHERE "slug" = $2`, ['credit-card-outline', 'project-budgets']); + await queryRunner.connection.query(`UPDATE "report" SET "iconClass" = $1 WHERE "slug" = $2`, ['credit-card-outline', 'client-budgets']); + } } -} \ No newline at end of file +} diff --git a/packages/core/src/database/migrations/1654675304373-SeedChangeLogFeature.ts b/packages/core/src/database/migrations/1654675304373-SeedChangeLogFeature.ts index 687a9b16c0c..2d1818b1e73 100644 --- a/packages/core/src/database/migrations/1654675304373-SeedChangeLogFeature.ts +++ b/packages/core/src/database/migrations/1654675304373-SeedChangeLogFeature.ts @@ -6,11 +6,12 @@ export class SeedChangeLogFeature1654675304373 implements MigrationInterface { name = 'SeedChangeLogFeature1654675304373'; public async up(queryRunner: QueryRunner): Promise { + const date = ['sqlite', 'better-sqlite3'].includes(queryRunner.connection.options.type) ? Date.now() : new Date(); const features = [ { icon: 'cube-outline', title: 'New CRM', - date: new Date(), + date, isFeature: true, content: 'Now you can read latest features changelog directly in Gauzy', learnMoreUrl: '', @@ -19,7 +20,7 @@ export class SeedChangeLogFeature1654675304373 implements MigrationInterface { { icon: 'globe-outline', title: 'Most popular in 20 countries', - date: new Date(), + date, isFeature: true, content: 'Europe, Americas and Asia get choise', learnMoreUrl: '', @@ -28,7 +29,7 @@ export class SeedChangeLogFeature1654675304373 implements MigrationInterface { { icon: 'flash-outline', title: 'Visit our website', - date: new Date(), + date, isFeature: true, content: 'You are welcome to check more information about the platform at our official website.', learnMoreUrl: '', @@ -41,7 +42,7 @@ export class SeedChangeLogFeature1654675304373 implements MigrationInterface { if (['sqlite', 'better-sqlite3'].includes(queryRunner.connection.options.type)) { payload.push(uuidV4()); await queryRunner.connection.manager.query(` - INSERT INTO "changelog" ("icon", "title", "date", "isFeature", "content", "learnMoreUrl", "imageUrl", "id") VALUES($1, $2, $3, $4, $5, $6, $7, $8)`, + INSERT INTO "changelog" ("icon", "title", "date", "isFeature", "content", "learnMoreUrl", "imageUrl", "id") VALUES(?, ?, ?, ?, ?, ?, ?, ?)`, payload ); } else { diff --git a/packages/core/src/database/migrations/1674044473393-SeedDefaultGlobalTaskStatus.ts b/packages/core/src/database/migrations/1674044473393-SeedDefaultGlobalTaskStatus.ts index 6531f438f6e..8e901d0d3e3 100644 --- a/packages/core/src/database/migrations/1674044473393-SeedDefaultGlobalTaskStatus.ts +++ b/packages/core/src/database/migrations/1674044473393-SeedDefaultGlobalTaskStatus.ts @@ -18,7 +18,7 @@ export class SeedDefaultGlobalTaskStatus1674044473393 implements MigrationInterf const payload = Object.values(status); if (['sqlite', 'better-sqlite3'].includes(queryRunner.connection.options.type)) { payload.push(uuidV4()); - const query = `INSERT INTO "status" ("name", "value", "description", "icon", "color", "isSystem", "id") VALUES($1, $2, $3, $4, $5, $6, $7)`; + const query = `INSERT INTO "status" ("name", "value", "description", "icon", "color", "isSystem", "id") VALUES(?, ?, ?, ?, ?, ?, ?)`; await queryRunner.connection.manager.query(query, payload); } else { const query = `INSERT INTO "status" ("name", "value", "description", "icon", "color", "isSystem") VALUES($1, $2, $3, $4, $5, $6)`; diff --git a/packages/core/src/database/migrations/1674638501088-SeedDefaultGlobalTaskPriorityAndSize.ts b/packages/core/src/database/migrations/1674638501088-SeedDefaultGlobalTaskPriorityAndSize.ts index 987edeff4ef..1cfb0475e90 100644 --- a/packages/core/src/database/migrations/1674638501088-SeedDefaultGlobalTaskPriorityAndSize.ts +++ b/packages/core/src/database/migrations/1674638501088-SeedDefaultGlobalTaskPriorityAndSize.ts @@ -36,7 +36,7 @@ export class SeedDefaultGlobalTaskPriorityAndSize1674638501088 implements Migrat const payload = Object.values(priority); if (['sqlite', 'better-sqlite3'].includes(queryRunner.connection.options.type)) { payload.push(uuidV4()); - const query = `INSERT INTO "task_priority" ("name", "value", "description", "icon", "color", "isSystem", "id") VALUES($1, $2, $3, $4, $5, $6, $7)`; + const query = `INSERT INTO "task_priority" ("name", "value", "description", "icon", "color", "isSystem", "id") VALUES(?, ?, ?, ?, ?, ?, ?)`; await queryRunner.connection.manager.query(query, payload); } else { const query = `INSERT INTO "task_priority" ("name", "value", "description", "icon", "color", "isSystem") VALUES($1, $2, $3, $4, $5, $6)`; @@ -60,7 +60,7 @@ export class SeedDefaultGlobalTaskPriorityAndSize1674638501088 implements Migrat const payload = Object.values(size); if (['sqlite', 'better-sqlite3'].includes(queryRunner.connection.options.type)) { payload.push(uuidV4()); - const query = `INSERT INTO "task_size" ("name", "value", "description", "icon", "color", "isSystem", "id") VALUES($1, $2, $3, $4, $5, $6, $7)`; + const query = `INSERT INTO "task_size" ("name", "value", "description", "icon", "color", "isSystem", "id") VALUES(?, ?, ?, ?, ?, ?, ?)`; await queryRunner.connection.manager.query(query, payload); } else { const query = `INSERT INTO "task_size" ("name", "value", "description", "icon", "color", "isSystem") VALUES($1, $2, $3, $4, $5, $6)`; diff --git a/packages/core/src/database/migrations/1676870424741-SeedTaskPriorityAndSizeAndStatusIcon.ts b/packages/core/src/database/migrations/1676870424741-SeedTaskPriorityAndSizeAndStatusIcon.ts index 29c3fd36745..34883581ceb 100644 --- a/packages/core/src/database/migrations/1676870424741-SeedTaskPriorityAndSizeAndStatusIcon.ts +++ b/packages/core/src/database/migrations/1676870424741-SeedTaskPriorityAndSizeAndStatusIcon.ts @@ -38,8 +38,10 @@ export class SeedTaskPriorityAndSizeAndStatusIcon1676870424741 implements Migrat for await (const status of DEFAULT_GLOBAL_STATUSES) { const { name, value, icon, color } = status; const filepath = `ever-icons/${icon}`; - - const query = `UPDATE "task_status" SET "icon" = '${filepath}', "color" = '${color}' WHERE ("name" = $1 AND "value" = $2) AND ("tenantId" IS NULL AND "organizationId" IS NULL)`; + let query = `UPDATE "task_status" SET "icon" = '${filepath}', "color" = '${color}' WHERE ("name" = $1 AND "value" = $2) AND ("tenantId" IS NULL AND "organizationId" IS NULL)`; + if(['sqlite', 'better-sqlite3'].includes(queryRunner.connection.options.type)) { + query = `UPDATE "task_status" SET "icon" = '${filepath}', "color" = '${color}' WHERE ("name" = ? AND "value" = ?) AND ("tenantId" IS NULL AND "organizationId" IS NULL)`; + } await queryRunner.connection.manager.query(query, [name, value]); copyAssets(status.icon, this.config); } @@ -58,8 +60,10 @@ export class SeedTaskPriorityAndSizeAndStatusIcon1676870424741 implements Migrat for await (const priority of DEFAULT_GLOBAL_PRIORITIES) { const { name, value, icon, color } = priority; const filepath = `ever-icons/${icon}`; - - const query = `UPDATE "task_priority" SET "icon" = '${filepath}', "color" = '${color}' WHERE ("name" = $1 AND "value" = $2) AND ("tenantId" IS NULL AND "organizationId" IS NULL)`; + let query = `UPDATE "task_priority" SET "icon" = '${filepath}', "color" = '${color}' WHERE ("name" = $1 AND "value" = $2) AND ("tenantId" IS NULL AND "organizationId" IS NULL)`; + if(['sqlite', 'better-sqlite3'].includes(queryRunner.connection.options.type)) { + query = `UPDATE "task_priority" SET "icon" = '${filepath}', "color" = '${color}' WHERE ("name" = ? AND "value" = ?) AND ("tenantId" IS NULL AND "organizationId" IS NULL)`; + } await queryRunner.connection.manager.query(query, [name, value]); copyAssets(priority.icon, this.config); } @@ -78,8 +82,10 @@ export class SeedTaskPriorityAndSizeAndStatusIcon1676870424741 implements Migrat for await (const size of DEFAULT_GLOBAL_SIZES) { const { name, value, icon, color } = size; const filepath = `ever-icons/${icon}`; - - const query = `UPDATE "task_size" SET "icon" = '${filepath}', "color" = '${color}' WHERE ("name" = $1 AND "value" = $2) AND ("tenantId" IS NULL AND "organizationId" IS NULL)`; + let query = `UPDATE "task_size" SET "icon" = '${filepath}', "color" = '${color}' WHERE ("name" = $1 AND "value" = $2) AND ("tenantId" IS NULL AND "organizationId" IS NULL)`; + if(['sqlite', 'better-sqlite3'].includes(queryRunner.connection.options.type)) { + query = `UPDATE "task_size" SET "icon" = '${filepath}', "color" = '${color}' WHERE ("name" = ? AND "value" = ?) AND ("tenantId" IS NULL AND "organizationId" IS NULL)`; + } await queryRunner.connection.manager.query(query, [name, value]); copyAssets(size.icon, this.config); } diff --git a/packages/core/src/database/migrations/1680622389221-SeedDafaultGlobalIssueType.ts b/packages/core/src/database/migrations/1680622389221-SeedDafaultGlobalIssueType.ts index aec35f1cfe2..74f82019ad7 100644 --- a/packages/core/src/database/migrations/1680622389221-SeedDafaultGlobalIssueType.ts +++ b/packages/core/src/database/migrations/1680622389221-SeedDafaultGlobalIssueType.ts @@ -74,7 +74,7 @@ export class SeedDafaultGlobalIssueType1680622389221 implements MigrationInterfa "name", "url", "storageProvider", "height", "width", "size", "id" ) VALUES ( - $1, $2, $3, $4, $5, $6, $7 + ?, ?, ?, ?, ?, ?, ? ); `; await queryRunner.connection.manager.query(insertQuery, imageAsset); @@ -84,7 +84,7 @@ export class SeedDafaultGlobalIssueType1680622389221 implements MigrationInterfa INSERT INTO "issue_type" ( "name", "value", "description", "icon", "color", "isSystem", "id", "imageId" ) VALUES ( - $1, $2, $3, $4, $5, $6, $7, $8); + ?, ?, ?, ?, ?, ?, ?, ?); `, payload); } else { const insertQuery = ` diff --git a/packages/core/src/database/migrations/1691494801748-SeedIntegrationTable.ts b/packages/core/src/database/migrations/1691494801748-SeedIntegrationTable.ts index af334681996..e50600d9718 100644 --- a/packages/core/src/database/migrations/1691494801748-SeedIntegrationTable.ts +++ b/packages/core/src/database/migrations/1691494801748-SeedIntegrationTable.ts @@ -48,18 +48,13 @@ export class SeedIntegrationTable1691494801748 implements MigrationInterface { const generatedId = uuidv4(); payload.push(generatedId); upsertQuery = ` - INSERT INTO integration ( - "name", "imgSrc", "isComingSoon", "order", "id" - ) - VALUES ( - $1, $2, $3, $4, $5 - ) - ON CONFLICT(name) DO UPDATE - SET - "imgSrc" = $2, - "isComingSoon" = $3, - "order" = $4 - RETURNING id; + INSERT INTO "integration" ("name", "imgSrc", "isComingSoon", "order", "id") + VALUES (?, ?, ?, ?, ?) + ON CONFLICT ("name") + DO UPDATE SET "imgSrc" = EXCLUDED."imgSrc", + "isComingSoon" = EXCLUDED."isComingSoon", + "order" = EXCLUDED."order" + RETURNING "id"; `; } else { upsertQuery = ` diff --git a/packages/core/src/database/migrations/1692171665427-SeedIntegrationTable.ts b/packages/core/src/database/migrations/1692171665427-SeedIntegrationTable.ts index c12dfb54a40..65b5db6c5f9 100644 --- a/packages/core/src/database/migrations/1692171665427-SeedIntegrationTable.ts +++ b/packages/core/src/database/migrations/1692171665427-SeedIntegrationTable.ts @@ -48,18 +48,13 @@ export class SeedIntegrationTable1692171665427 implements MigrationInterface { const generatedId = uuidv4(); payload.push(generatedId); upsertQuery = ` - INSERT INTO integration ( - "name", "imgSrc", "isComingSoon", "order", "id" - ) - VALUES ( - $1, $2, $3, $4, $5 - ) - ON CONFLICT(name) DO UPDATE - SET - "imgSrc" = $2, - "isComingSoon" = $3, - "order" = $4 - RETURNING id; + INSERT INTO "integration" ("name", "imgSrc", "isComingSoon", "order", "id") + VALUES (?, ?, ?, ?, ?) + ON CONFLICT ("name") + DO UPDATE SET "imgSrc" = EXCLUDED."imgSrc", + "isComingSoon" = EXCLUDED."isComingSoon", + "order" = EXCLUDED."order" + RETURNING "id"; `; } else { upsertQuery = ` diff --git a/packages/core/src/email-template/utils.ts b/packages/core/src/email-template/utils.ts index 49c878a18b5..a635588f31f 100644 --- a/packages/core/src/email-template/utils.ts +++ b/packages/core/src/email-template/utils.ts @@ -161,16 +161,23 @@ export class EmailTemplateUtils { hbs, mjml ]; - const query = `SELECT COUNT(*) FROM "email_template" WHERE ("name" = $1 AND "languageCode" = $2) AND ("tenantId" IS NULL AND "organizationId" IS NULL)`; - const [template] = await queryRunner.connection.manager.query(query, [name, languageCode]); - - if (parseInt(template.count) > 0) { - const update = `UPDATE "email_template" SET "hbs" = $1, "mjml" = $2 WHERE ("name" = $3 AND "languageCode" = $4) AND ("tenantId" IS NULL AND "organizationId" IS NULL)`; + const isSqlite = ['sqlite', 'better-sqlite3'].includes(queryRunner.connection.options.type); + let query = `SELECT COUNT(*) FROM "email_template" WHERE ("name" = $1 AND "languageCode" = $2) AND ("tenantId" IS NULL AND "organizationId" IS NULL)`; + if (isSqlite) { + query = `SELECT COUNT(*) FROM "email_template" WHERE ("name" = ? AND "languageCode" = ?) AND ("tenantId" IS NULL AND "organizationId" IS NULL)`; + } + const [template] = await queryRunner.connection.manager.query(query, [name, languageCode]); + + if (parseInt(template.count, 10) > 0) { + let update = `UPDATE "email_template" SET "hbs" = $1, "mjml" = $2 WHERE ("name" = $3 AND "languageCode" = $4) AND ("tenantId" IS NULL AND "organizationId" IS NULL)`; + if (isSqlite) { + update = `UPDATE "email_template" SET "hbs" = ?, "mjml" = ? WHERE ("name" = ? AND "languageCode" = ?) AND ("tenantId" IS NULL AND "organizationId" IS NULL)`; + } await queryRunner.connection.manager.query(update, [hbs, mjml, name, languageCode]); } else { - if (queryRunner.connection.options.type === 'sqlite') { + if (isSqlite) { payload.push(uuidV4()); - const insert = `INSERT INTO "email_template" ("name", "languageCode", "hbs", mjml, "id") VALUES($1, $2, $3, $4, $5)`; + const insert = `INSERT INTO "email_template" ("name", "languageCode", "hbs", "mjml", "id") VALUES(?, ?, ?, ?, ?)`; await queryRunner.connection.manager.query(insert, payload); } else { const insert = `INSERT INTO "email_template" ("name", "languageCode", "hbs", mjml) VALUES($1, $2, $3, $4)`; diff --git a/packages/core/src/integration/utils.ts b/packages/core/src/integration/utils.ts index 0d6aa156a99..6ff5d7c2aef 100644 --- a/packages/core/src/integration/utils.ts +++ b/packages/core/src/integration/utils.ts @@ -17,30 +17,41 @@ export class IntegrationsUtils { try { const filepath = `integrations/${imgSrc}`; - let upsertQuery = ``; - const payload = [name, filepath, isComingSoon, order, redirectUrl, provider]; + let upsertQuery = ``; + const payload = [ + name, + filepath, + isComingSoon, + order, + redirectUrl, + provider, + ]; - if (queryRunner.connection.options.type === 'sqlite') { - // For SQLite, manually generate a UUID using uuidv4() - const generatedId = uuidv4(); payload.push(generatedId); - upsertQuery = ` + if ( + ['sqlite', 'better-sqlite3'].includes( + queryRunner.connection.options.type + ) + ) { + // For SQLite, manually generate a UUID using uuidv4() + const generatedId = uuidv4(); + payload.push(generatedId); + upsertQuery = ` INSERT INTO integration ( "name", "imgSrc", "isComingSoon", "order", "redirectUrl", "provider", "id" ) VALUES ( - $1, $2, $3, $4, $5, $6, $7 + ?, ?, ?, ?, ?, ?, ? ) - ON CONFLICT(name) DO UPDATE - SET - "imgSrc" = $2, - "isComingSoon" = $3, - "order" = $4, - "redirectUrl" = $5, - "provider" = $6 + ON CONFLICT("name") + DO UPDATE SET "imgSrc" = EXCLUDED."imgSrc", + "isComingSoon" = EXCLUDED."isComingSoon", + "order" = EXCLUDED."order", + "redirectUrl" = EXCLUDED."redirectUrl", + "provider" = EXCLUDED."provider" RETURNING id; `; - } else { - upsertQuery = ` + } else { + upsertQuery = ` INSERT INTO "integration" ( "name", "imgSrc", "isComingSoon", "order", "redirectUrl", "provider" ) @@ -107,27 +118,31 @@ export class IntegrationsUtils { ); const payload = [name, description, icon, groupName, order]; - let upsertQuery = ``; - if (queryRunner.connection.options.type === 'sqlite') { - // For SQLite, manually generate a UUID using uuidv4() - const generatedId = uuidv4(); payload.push(generatedId); - upsertQuery = ` + let upsertQuery = ``; + if ( + ['sqlite', 'better-sqlite3'].includes( + queryRunner.connection.options.type + ) + ) { + // For SQLite, manually generate a UUID using uuidv4() + const generatedId = uuidv4(); + payload.push(generatedId); + upsertQuery = ` INSERT INTO "integration_type" ( "name", "description", "icon", "groupName", "order", "id" ) VALUES ( - $1, $2, $3, $4, $5, $6 + ?, ?, ?, ?, ?, ? ) - ON CONFLICT(name) DO UPDATE - SET - "description" = $2, - "icon" = $3, - "groupName" = $4, - "order" = $5 + ON CONFLICT("name") + DO UPDATE SET "description" = EXCLUDED."description", + "icon" = EXCLUDED."icon", + "groupName" = EXCLUDED."groupName", + "order" = EXCLUDED."order" RETURNING id; `; - } else { - upsertQuery = ` + } else { + upsertQuery = ` INSERT INTO "integration_type" ( "name", "description", "icon", "groupName", "order" ) @@ -142,10 +157,10 @@ export class IntegrationsUtils { "order" = $5 RETURNING id; `; - } - await queryRunner.query(upsertQuery, payload); - } - } + } + await queryRunner.query(upsertQuery, payload); + } + } /** * @@ -162,7 +177,7 @@ export class IntegrationsUtils { if (integration) { const integrationId = integration.id; for await (const integrationType of integrationTypes) { - const insertPivotQuery = ` + let insertPivotQuery = ` INSERT INTO "integration_integration_type" ( "integrationId", "integrationTypeId" @@ -177,8 +192,18 @@ export class IntegrationsUtils { "integrationTypeId" = $2 ) `; - await queryRunner.query(insertPivotQuery, [integrationId, integrationType.id]); - } - } - } + if (queryRunner.connection.options.type === 'better-sqlite3') { + insertPivotQuery = ` + INSERT OR IGNORE INTO integration_integration_type (integrationId, integrationTypeId) + VALUES (?, ?); + `; + } + + await queryRunner.query(insertPivotQuery, [ + integrationId, + integrationType.id, + ]); + } + } + } } From 26693120c1846b383fd37a8402bcb0fbc4f5f9c0 Mon Sep 17 00:00:00 2001 From: CoderNadir Date: Sun, 8 Oct 2023 22:51:22 +0100 Subject: [PATCH 21/30] fix alignment of (forget-password link with login button), reduce the space between captions input by overiding the theme default value, fix display warning of (create new project) name input on load page --- apps/gauzy/src/app/@theme/styles/_overrides.scss | 5 +++++ apps/gauzy/src/app/auth/login/login.component.scss | 6 +++++- .../projects-mutation/projects-mutation.component.html | 8 ++++---- 3 files changed, 14 insertions(+), 5 deletions(-) diff --git a/apps/gauzy/src/app/@theme/styles/_overrides.scss b/apps/gauzy/src/app/@theme/styles/_overrides.scss index 9eb32455bc6..a2736a37323 100644 --- a/apps/gauzy/src/app/@theme/styles/_overrides.scss +++ b/apps/gauzy/src/app/@theme/styles/_overrides.scss @@ -39,6 +39,11 @@ body { } @mixin nb-overrides() { + p.caption.status-danger { + margin-bottom: 0; + margin-top: 0.3rem; + } + nb-route-tabset .route-tab.active .tab-link { background: var(--gauzy-card-2); margin-bottom: 1px; diff --git a/apps/gauzy/src/app/auth/login/login.component.scss b/apps/gauzy/src/app/auth/login/login.component.scss index 3393bf9f2dd..d27b454494b 100644 --- a/apps/gauzy/src/app/auth/login/login.component.scss +++ b/apps/gauzy/src/app/auth/login/login.component.scss @@ -67,7 +67,8 @@ justify-content: space-between; align-items: center; & .forgot-password { - color: $button-color; + text-decoration-line: underline; + margin-bottom: 0; font-family: Inter; font-size: 14px; font-style: normal; @@ -79,6 +80,9 @@ display: none; } } + & .forgot-password:hover { + color: $button-color; + } & .forgot-password-big { display: block; @include mobile-screen { diff --git a/apps/gauzy/src/app/pages/projects/projects-mutation/projects-mutation.component.html b/apps/gauzy/src/app/pages/projects/projects-mutation/projects-mutation.component.html index d2b62122d42..a5a46ad034a 100644 --- a/apps/gauzy/src/app/pages/projects/projects-mutation/projects-mutation.component.html +++ b/apps/gauzy/src/app/pages/projects/projects-mutation/projects-mutation.component.html @@ -100,12 +100,12 @@ : 'basic' " /> -
{{ 'FORM.ERROR.PROJECT_NAME' | translate }} -
+