xataio / pgroll

PostgreSQL zero-downtime migrations made easy
https://www.xata.io
Apache License 2.0
3.56k stars 67 forks source link

Track foreign key `ON DELETE` setting in the internal schema representation #311

Closed andrew-farries closed 8 months ago

andrew-farries commented 8 months ago

Add the ON DELETE setting of a foreign key to the information stored about the key in the internal schema representation.

The schema representation for a foreign key now looks like:

{
  "some_table": {
    ...
    "foreignKeys": {
      "fk_users_id": {
        "name": "fk_users_id",
        "columns": [
          "user_id"
        ],
        "onDelete": "NO ACTION",
        "referencedTable": "users",
        "referencedColumns": [
          "id"
        ]
      }
    }
  }
}

Fixes https://github.com/xataio/pgroll/issues/309