Skip to content

Commit

Permalink
Add docs for the new operation type
Browse files Browse the repository at this point in the history
  • Loading branch information
andrew-farries committed Nov 26, 2024
1 parent 7bb0735 commit c47d1e8
Showing 1 changed file with 32 additions and 1 deletion.
33 changes: 32 additions & 1 deletion docs/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,7 @@
* [Create constraint](#create-constraint)
* [Drop column](#drop-column)
* [Drop constraint](#drop-constraint)
* [Drop multi-column constraint](#drop-multi-column-constraint)
* [Drop index](#drop-index)
* [Drop table](#drop-table)
* [Raw SQL](#raw-sql)
Expand Down Expand Up @@ -793,6 +794,7 @@ See the [examples](../examples) directory for examples of each kind of operation
* [Create constraint](#create-constraint)
* [Drop column](#drop-column)
* [Drop constraint](#drop-constraint)
* [Drop multi-column constraint](#drop-multi-column-constraint)
* [Drop index](#drop-index)
* [Drop table](#drop-table)
* [Raw SQL](#raw-sql)
Expand Down Expand Up @@ -1208,7 +1210,7 @@ Example **drop column** migrations:

### Drop constraint

A drop constraint operation drops a constraint from an existing table.
A drop constraint operation drops a single-column constraint from an existing table.

Only `CHECK`, `FOREIGN KEY`, and `UNIQUE` constraints can be dropped.

Expand All @@ -1231,6 +1233,35 @@ Example **drop constraint** migrations:
* [24_drop_foreign_key_constraint.json](../examples/24_drop_foreign_key_constraint.json)
* [27_drop_unique_constraint.json](../examples/27_drop_unique_constraint.json)

### Drop multi-column constraint

A drop constraint operation drops a multi-column constraint from an existing table.

Only `CHECK`, `FOREIGN KEY`, and `UNIQUE` constraints can be dropped.

**drop multi-column constraint** operations have this structure:

```json
{
"drop_multicolumn_constraint": {
"table": "name of table",
"name": "name of constraint to drop",
"up": {
"column1": "up SQL expressions for each column covered by the constraint",
...
},
"down": {
"column1": "down SQL expressions for each column covered by the constraint",
...
}
}
}
```

Example **drop multi-column constraint** migrations:

* [48_drop_tickets_check.json](../examples/48_drop_tickets_check.json)

### Drop index

A drop index operation drops an index from a table.
Expand Down

0 comments on commit c47d1e8

Please sign in to comment.