Skip to content

Adding a serial column #193

@wister

Description

@wister

I tried adding a serial column.

{
  "name": "01_add_test_id",
  "operations": [
    {
      "add_column": {
        "table": "tests",
        "column": {
          "name": "test_id",
          "type": "serial",
          "nullable": false
        }
      }
    }
  ]
}

Which I thought would be equivalent to this sql query:

ALTER TABLE IF EXISTS tests ADD COLUMN test_id serial;

The error message is:
Failed to start migration: migration is invalid: field "up" is required

In this case, what would be the SQL expression for the up property? I have tried with:

...
"up": "",
...
Failed to start migration: unable to execute start operation: failed to create trigger: pq: missing expression at or near ";"
...
"up": "ROW_NUMBER() OVER(ORDER BY created_at ASC)",
...
Failed to start migration: unable to execute start operation: failed to create trigger: pq: syntax error at or near "TRIGGER"

Any suggestions? Thanks!

Metadata

Metadata

Assignees

Labels

bugSomething isn't working

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions