File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -206,7 +206,7 @@ export default class PostgresDatabaseService implements IDatabaseService {
206206 async #runMigrations( ) : Promise < void > {
207207 await this . #runMigration( "User soft delete" , async ( ) => {
208208 await this . #database. query (
209- "ALTER TABLE Users ADD IF NOT EXISTS isDeleted timestamp;" ,
209+ "ALTER TABLE Users ADD COLUMN IF NOT EXISTS isDeleted timestamp;" ,
210210 ) ;
211211 } ) ;
212212 }
@@ -216,12 +216,9 @@ export default class PostgresDatabaseService implements IDatabaseService {
216216 "SELECT * FROM Migrations WHERE name = $1" ,
217217 [ name ] ,
218218 ) ;
219- const migration = [ ...result ] . pop ( ) ;
220- if ( ! migration ) {
221- await this . #database. query (
222- "INSERT INTO Migrations (name) VALUES($1);" ,
223- [ name ] ,
224- ) ;
219+ this . #logger. verbose ( `Running migration "${ name } " with pre-query returning ${ JSON . stringify ( result ) } ` ) ;
220+ if ( result && result . rows . length === 0 ) {
221+ await this . #database. query ( 'INSERT INTO Migrations (name) VALUES($1);' , [ name ] ) ;
225222 await callback ( ) ;
226223 }
227224 }
You can’t perform that action at this time.
0 commit comments