Skip to content

Commit 5dde344

Browse files
committed
1.2.1: Fix PGUpdate default value
1 parent b321fb1 commit 5dde344

2 files changed

Lines changed: 4 additions & 4 deletions

File tree

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "@grandlinex/bundle-postgresql",
3-
"version": "1.2.0",
3+
"version": "1.2.1",
44
"description": "",
55
"type": "module",
66
"exports": {

src/class/PGUpdate.ts

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,7 @@ export default abstract class PGUpdate extends CoreDBUpdate<PGCon> {
2626
columName: string,
2727
type: string,
2828
notNull: boolean,
29-
defaultValue?: any,
29+
defaultValue?: string,
3030
deleteDefault?: boolean,
3131
): Promise<boolean> {
3232
const db = this.getDb();
@@ -35,8 +35,8 @@ export default abstract class PGUpdate extends CoreDBUpdate<PGCon> {
3535

3636
if (notNull && defaultValue !== undefined) {
3737
query.push({
38-
exec: `ALTER TABLE ${db.schemaName}.${tableName} ADD ${columName} ${type} NOT NULL DEFAULT $1;`,
39-
param: [defaultValue],
38+
exec: `ALTER TABLE ${db.schemaName}.${tableName} ADD ${columName} ${type} NOT NULL DEFAULT ${defaultValue};`,
39+
param: [],
4040
});
4141
} else if (notNull) {
4242
query.push({

0 commit comments

Comments
 (0)