diff --git a/app/lib/dal/sqliteDAL/MetaDAL.ts b/app/lib/dal/sqliteDAL/MetaDAL.ts index 82dfe8b49194b65e6e31dc63005a3152b114f064..7784a17cf7b3022676c41db3b3d5bf499f7a50cd 100644 --- a/app/lib/dal/sqliteDAL/MetaDAL.ts +++ b/app/lib/dal/sqliteDAL/MetaDAL.ts @@ -219,11 +219,12 @@ export class MetaDAL extends AbstractSQLite<DBMeta> { // Add new columns 'issuer' and 'recipient' try { await txsDAL.exec( - "BEGIN;" + - "ALTER TABLE txs ADD COLUMN issuer VARCHAR(50) NULL;" + + "ALTER TABLE txs ADD COLUMN issuer VARCHAR(50) NULL;" + "ALTER TABLE txs ADD COLUMN recipient VARCHAR(50) NULL;" + - "UOPDATE txs SET issuer = SUBSTR(issuers, 2, LENGTH(issuers) - 4) WHERE issuer IS NULL AND issuers NOT LIKE '%,%';" + - "UOPDATE txs SET recipient = SUBSTR(recipients, 2, LENGTH(recipients) - 4) WHERE recipient IS NULL AND recipients NOT LIKE '%,%';" + + // SHOULD start transaction after ALTER TABLE, to avoid leaving a not closed transaction, if failed - close #1448 + "BEGIN;" + + "UPDATE txs SET issuer = SUBSTR(issuers, 2, LENGTH(issuers) - 4) WHERE issuer IS NULL AND issuers NOT LIKE '%,%';" + + "UPDATE txs SET recipient = SUBSTR(recipients, 2, LENGTH(recipients) - 4) WHERE recipient IS NULL AND recipients NOT LIKE '%,%';" + "COMMIT;" ); } catch (err) {