Skip to content

Commit 8e1485a

Browse files
Fix: Migrations are not Postgres compatible
With length field for "age" column, the resultant SQL is CREATE TABLE "pet" ("id" varchar(255) NOT NULL, "name" varchar(255) NOT NULL, "age" int(11) NOT NULL, "user_id" varchar(255), CONSTRAINT "PK_b1ac2e88e89b9480e0c5b53fa60" PRIMARY KEY ("id")) This will fail in postgres due to [int(11) being non standard](https://www.postgresql.org/message-id/18103.1013471731%40sss.pgh.pa.us) By removing "length" property, the resultant sql uses 'age int NOT NULL', which works in postgres and mysql both ( I have also verified it for oracle)
1 parent 98a342e commit 8e1485a

File tree

1 file changed

+0
-1
lines changed

1 file changed

+0
-1
lines changed

src/database/migrations/1512663524808-CreatePetTable.ts

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,6 @@ export class CreatePetTable1512663524808 implements MigrationInterface {
2121
}, {
2222
name: 'age',
2323
type: 'int',
24-
length: '11',
2524
isPrimary: false,
2625
isNullable: false,
2726
}, {

0 commit comments

Comments
 (0)