unable to execute start operation: pq: syntax error at or near ")"

I keep getting this error whenever I try to start a migration. This is my migration.json file: [ { "create_table": { "name": "org", "columns": [ { "name": "id", "type": "integer", "pk": true }, { "name": "clerk_id", "type": "integer", "unique": true, "nullable": false }, { "name": "slug", "type": "varchar(255)", "unique": true, "nullable": false }, { "name": "name", "type": "varchar(255)", "unique": false, "nullable": false, "default": "" } ] } } ] So clearly this CLI doesn't like the "varchar(255)" syntax. But the pgroll example all have this.
1 Reply
tsg
tsg2mo ago
hi, I think the issue is not with varchar(255) but with the default value for the name column. Try passing it like this: "default": "''" so something like:
[
{
"create_table": {
"name": "org",
"columns": [
{
"name": "id",
"type": "integer",
"pk": true
},
{
"name": "clerk_id",
"type": "integer",
"unique": true,
"nullable": false
},
{
"name": "slug",
"type": "varchar(255)",
"unique": true,
"nullable": false
},
{
"name": "name",
"type": "varchar(255)",
"unique": false,
"nullable": false,
"default": "''"
}
]
}
}
]
[
{
"create_table": {
"name": "org",
"columns": [
{
"name": "id",
"type": "integer",
"pk": true
},
{
"name": "clerk_id",
"type": "integer",
"unique": true,
"nullable": false
},
{
"name": "slug",
"type": "varchar(255)",
"unique": true,
"nullable": false
},
{
"name": "name",
"type": "varchar(255)",
"unique": false,
"nullable": false,
"default": "''"
}
]
}
}
]
Want results from more Discord servers?
Add your server