2023-12-01 19:01:40 +03:00
|
|
|
{
|
|
|
|
"$id": "https://raw.githubusercontent.com/xataio/pgroll/main/schema.json",
|
|
|
|
"$schema": "https://json-schema.org/draft/2020-12/schema",
|
|
|
|
"title": "JSON Schema for pgroll migrations",
|
|
|
|
"description": "This JSON schema defines the structure and properties of pgroll migrations.",
|
|
|
|
"allOf": [{ "$ref": "#/$defs/PgRollMigration" }],
|
|
|
|
"$defs": {
|
|
|
|
"CheckConstraint": {
|
|
|
|
"additionalProperties": false,
|
|
|
|
"description": "Check constraint definition",
|
|
|
|
"properties": {
|
|
|
|
"constraint": {
|
|
|
|
"description": "Constraint expression",
|
|
|
|
"type": "string"
|
|
|
|
},
|
|
|
|
"name": {
|
|
|
|
"description": "Name of check constraint",
|
|
|
|
"type": "string"
|
|
|
|
}
|
|
|
|
},
|
|
|
|
"required": ["constraint", "name"],
|
|
|
|
"type": "object"
|
|
|
|
},
|
|
|
|
"Column": {
|
|
|
|
"additionalProperties": false,
|
|
|
|
"description": "Column definition",
|
|
|
|
"properties": {
|
|
|
|
"check": {
|
|
|
|
"$ref": "#/$defs/CheckConstraint",
|
|
|
|
"description": "Check constraint for the column"
|
|
|
|
},
|
|
|
|
"default": {
|
|
|
|
"description": "Default value for the column",
|
|
|
|
"type": "string"
|
|
|
|
},
|
|
|
|
"name": {
|
|
|
|
"description": "Name of the column",
|
|
|
|
"type": "string"
|
|
|
|
},
|
|
|
|
"nullable": {
|
|
|
|
"description": "Indicates if the column is nullable",
|
|
|
|
"type": "boolean"
|
|
|
|
},
|
|
|
|
"pk": {
|
|
|
|
"description": "Indicates if the column is part of the primary key",
|
|
|
|
"type": "boolean"
|
|
|
|
},
|
|
|
|
"references": {
|
|
|
|
"$ref": "#/$defs/ForeignKeyReference",
|
|
|
|
"description": "Foreign key constraint for the column"
|
|
|
|
},
|
|
|
|
"type": {
|
|
|
|
"description": "Postgres type of the column",
|
|
|
|
"type": "string"
|
|
|
|
},
|
|
|
|
"unique": {
|
|
|
|
"description": "Indicates if the column values must be unique",
|
|
|
|
"type": "boolean"
|
Add support for creating tables and columns with comments (#224)
Update the **create table** and **add column** operations so that they
support adding [Postgres
comments](https://www.postgresql.org/docs/current/sql-comment.html):
* **create table**: comments can be added to the table itself and to
each of its columns.
* **add column**: a comment can be added to the column.
A **create table** migration that includes a comment on the table itself
and on one of its columns looks like this:
```json
{
"name": "12_create_employees_table",
"operations": [
{
"create_table": {
"name": "employees",
"comment": "This is a comment for the employees table",
"columns": [
{
"name": "id",
"type": "serial",
"pk": true
},
{
"name": "role",
"type": "varchar(255)",
"comment": "This is a comment for the role column"
}
]
}
}
]
}
```
and an **add column** migration that includes a comment looks like this:
```json
{
"name": "30_add_column_simple_up",
"operations": [
{
"add_column": {
"table": "people",
"up": "'temporary-description'",
"column": {
"name": "description",
"type": "varchar(255)",
"nullable": false,
"comment": "This is a comment for the description column"
}
}
}
]
}
```
This allows new tables and columns to be created with comments.
Deletion and modification of comments should still be performed with a
raw SQL migration. Until we see a use case that requires versioned
modification/removal of comments, these operations are best performed
directly on the base table with raw SQL.
2024-01-10 18:58:57 +03:00
|
|
|
},
|
|
|
|
"comment": {
|
|
|
|
"description": "Postgres comment for the column",
|
|
|
|
"type": "string"
|
2023-12-01 19:01:40 +03:00
|
|
|
}
|
|
|
|
},
|
2024-02-02 15:44:37 +03:00
|
|
|
"required": ["name", "type"],
|
2023-12-01 19:01:40 +03:00
|
|
|
"type": "object"
|
|
|
|
},
|
|
|
|
"ForeignKeyReference": {
|
|
|
|
"additionalProperties": false,
|
|
|
|
"description": "Foreign key reference definition",
|
|
|
|
"properties": {
|
|
|
|
"column": {
|
|
|
|
"description": "Name of the referenced column",
|
|
|
|
"type": "string"
|
|
|
|
},
|
|
|
|
"name": {
|
|
|
|
"description": "Name of the foreign key constraint",
|
|
|
|
"type": "string"
|
|
|
|
},
|
|
|
|
"table": {
|
|
|
|
"description": "Name of the referenced table",
|
|
|
|
"type": "string"
|
Allow setting the `ON DELETE` behaviour of foreign key constraints (#297)
Add support for setting the `ON DELETE` behaviour of a foreign key
constraint.
An example migration that uses the behaviour is:
```json
{
"name": "21_add_foreign_key_constraint",
"operations": [
{
"alter_column": {
"table": "posts",
"column": "user_id",
"references": {
"name": "fk_users_id",
"table": "users",
"column": "id",
"on_delete": "CASCADE"
},
"up": "(SELECT CASE WHEN EXISTS (SELECT 1 FROM users WHERE users.id = user_id) THEN user_id ELSE NULL END)",
"down": "user_id"
}
}
]
}
```
The valid options for `on_delete` are `CASCADE`, `SET NULL`, `RESTRICT`,
or `NO ACTION`. If the field is omitted, the default is `NO ACTION`,
Fixes #221
2024-03-01 12:26:50 +03:00
|
|
|
},
|
|
|
|
"on_delete": {
|
|
|
|
"description": "On delete behavior of the foreign key constraint",
|
|
|
|
"type": "string",
|
|
|
|
"enum": ["NO ACTION", "RESTRICT", "CASCADE", "SET NULL", "SET DEFAULT"],
|
|
|
|
"default": "NO ACTION"
|
2023-12-01 19:01:40 +03:00
|
|
|
}
|
|
|
|
},
|
|
|
|
"required": ["column", "name", "table"],
|
|
|
|
"type": "object"
|
|
|
|
},
|
|
|
|
"OpAddColumn": {
|
|
|
|
"additionalProperties": false,
|
|
|
|
"description": "Add column operation",
|
|
|
|
"properties": {
|
|
|
|
"column": {
|
|
|
|
"$ref": "#/$defs/Column",
|
|
|
|
"description": "Column to add"
|
|
|
|
},
|
|
|
|
"table": {
|
|
|
|
"description": "Name of the table",
|
|
|
|
"type": "string"
|
|
|
|
},
|
|
|
|
"up": {
|
|
|
|
"description": "SQL expression for up migration",
|
|
|
|
"type": "string"
|
|
|
|
}
|
|
|
|
},
|
|
|
|
"required": ["column", "table"],
|
|
|
|
"type": "object"
|
|
|
|
},
|
|
|
|
"OpAlterColumn": {
|
|
|
|
"additionalProperties": false,
|
|
|
|
"description": "Alter column operation",
|
|
|
|
"properties": {
|
|
|
|
"check": {
|
|
|
|
"$ref": "#/$defs/CheckConstraint",
|
|
|
|
"description": "Add check constraint to the column"
|
|
|
|
},
|
|
|
|
"column": {
|
|
|
|
"description": "Name of the column",
|
|
|
|
"type": "string"
|
|
|
|
},
|
|
|
|
"down": {
|
|
|
|
"description": "SQL expression for down migration",
|
|
|
|
"type": "string"
|
|
|
|
},
|
|
|
|
"name": {
|
|
|
|
"description": "New name of the column (for rename column operation)",
|
|
|
|
"type": "string"
|
|
|
|
},
|
|
|
|
"nullable": {
|
Add drop `NOT NULL` operation to remove `NOT NULL` from a column (#258)
Add a new sub-operation to the 'alter column' operation to drop `NOT
NULL` constraints from columns.
Currently, it is only possible to **set** `NOT NULL` constraints on
columns but not remove them. The syntax for doing this is:
```json
{
"name": "16_set_nullable",
"operations": [
{
"alter_column": {
"table": "reviews",
"column": "review",
"nullable": false,
"up": "(SELECT CASE WHEN review IS NULL THEN product || ' is good' ELSE review END)",
"down": "review"
}
}
]
}
```
Setting `nullable: true` in the above migration would result in a
validation error saying that removing `NOT NULL` constraints was not
supported. This PR removes this restriction and allows `nullable: true`
to remove an existing `NOT NULL` constraint.
A migration to remove a `NOT NULL` constraint looks like:
```json
{
"name": "31_unset_not_null",
"operations": [
{
"alter_column": {
"table": "posts",
"column": "title",
"nullable": true,
"up": "title",
"down": "(SELECT CASE WHEN title IS NULL THEN 'placeholder title' ELSE title END)"
}
}
]
}
```
The differences between adding and removing a `NOT NULL` constraint are:
* `nullable: true` vs `nullable: false`
* The roles of `up` and `down` SQL are reversed; `down` now needs to
rewrite any `NULL`s to meet the `NOT NULL` constraint on the old column.
`up` defaults to a simple copy of the data from the old column to the
new.
Fixes #223
2024-02-01 10:08:02 +03:00
|
|
|
"description": "Indicates if the column is nullable (for add/remove not null constraint operation)",
|
2023-12-01 19:01:40 +03:00
|
|
|
"type": "boolean"
|
|
|
|
},
|
|
|
|
"references": {
|
|
|
|
"$ref": "#/$defs/ForeignKeyReference",
|
|
|
|
"description": "Add foreign key constraint to the column"
|
|
|
|
},
|
|
|
|
"table": {
|
|
|
|
"description": "Name of the table",
|
|
|
|
"type": "string"
|
|
|
|
},
|
|
|
|
"type": {
|
|
|
|
"description": "New type of the column (for change type operation)",
|
|
|
|
"type": "string"
|
|
|
|
},
|
|
|
|
"unique": {
|
|
|
|
"$ref": "#/$defs/UniqueConstraint",
|
|
|
|
"description": "Add unique constraint to the column"
|
|
|
|
},
|
|
|
|
"up": {
|
|
|
|
"description": "SQL expression for up migration",
|
|
|
|
"type": "string"
|
|
|
|
}
|
|
|
|
},
|
2024-02-02 12:10:22 +03:00
|
|
|
"required": ["table", "column"],
|
|
|
|
"oneOf": [
|
|
|
|
{
|
|
|
|
"required": ["up", "down"],
|
|
|
|
"oneOf": [
|
2024-03-01 12:24:05 +03:00
|
|
|
{ "required": ["check"] },
|
|
|
|
{ "required": ["type"] },
|
|
|
|
{ "required": ["nullable"] },
|
|
|
|
{ "required": ["unique"] },
|
|
|
|
{ "required": ["references"] }
|
2024-02-02 12:10:22 +03:00
|
|
|
],
|
|
|
|
"not": {
|
|
|
|
"required": ["name"]
|
|
|
|
}
|
|
|
|
},
|
|
|
|
{
|
|
|
|
"required": ["name"],
|
|
|
|
"not": {
|
|
|
|
"anyOf": [
|
2024-03-01 12:24:05 +03:00
|
|
|
{ "required": ["up"] },
|
|
|
|
{ "required": ["down"] },
|
|
|
|
{ "required": ["check"] },
|
|
|
|
{ "required": ["type"] },
|
|
|
|
{ "required": ["nullable"] },
|
|
|
|
{ "required": ["unique"] },
|
|
|
|
{ "required": ["references"] }
|
2024-02-02 12:10:22 +03:00
|
|
|
]
|
|
|
|
}
|
|
|
|
}
|
|
|
|
],
|
2023-12-01 19:01:40 +03:00
|
|
|
"type": "object"
|
|
|
|
},
|
|
|
|
"OpCreateIndex": {
|
|
|
|
"additionalProperties": false,
|
|
|
|
"description": "Create index operation",
|
|
|
|
"properties": {
|
|
|
|
"columns": {
|
|
|
|
"description": "Names of columns on which to define the index",
|
|
|
|
"items": {
|
|
|
|
"type": "string"
|
|
|
|
},
|
|
|
|
"type": "array"
|
|
|
|
},
|
|
|
|
"name": {
|
|
|
|
"description": "Index name",
|
|
|
|
"type": "string"
|
|
|
|
},
|
|
|
|
"table": {
|
|
|
|
"description": "Name of table on which to define the index",
|
|
|
|
"type": "string"
|
|
|
|
}
|
|
|
|
},
|
|
|
|
"required": ["columns", "name", "table"],
|
|
|
|
"type": "object"
|
|
|
|
},
|
|
|
|
"OpCreateTable": {
|
|
|
|
"additionalProperties": false,
|
|
|
|
"description": "Create table operation",
|
|
|
|
"properties": {
|
|
|
|
"columns": {
|
|
|
|
"items": {
|
|
|
|
"$ref": "#/$defs/Column",
|
|
|
|
"description": "Columns to add to the table"
|
|
|
|
},
|
|
|
|
"type": "array"
|
|
|
|
},
|
|
|
|
"name": {
|
|
|
|
"description": "Name of the table",
|
|
|
|
"type": "string"
|
Add support for creating tables and columns with comments (#224)
Update the **create table** and **add column** operations so that they
support adding [Postgres
comments](https://www.postgresql.org/docs/current/sql-comment.html):
* **create table**: comments can be added to the table itself and to
each of its columns.
* **add column**: a comment can be added to the column.
A **create table** migration that includes a comment on the table itself
and on one of its columns looks like this:
```json
{
"name": "12_create_employees_table",
"operations": [
{
"create_table": {
"name": "employees",
"comment": "This is a comment for the employees table",
"columns": [
{
"name": "id",
"type": "serial",
"pk": true
},
{
"name": "role",
"type": "varchar(255)",
"comment": "This is a comment for the role column"
}
]
}
}
]
}
```
and an **add column** migration that includes a comment looks like this:
```json
{
"name": "30_add_column_simple_up",
"operations": [
{
"add_column": {
"table": "people",
"up": "'temporary-description'",
"column": {
"name": "description",
"type": "varchar(255)",
"nullable": false,
"comment": "This is a comment for the description column"
}
}
}
]
}
```
This allows new tables and columns to be created with comments.
Deletion and modification of comments should still be performed with a
raw SQL migration. Until we see a use case that requires versioned
modification/removal of comments, these operations are best performed
directly on the base table with raw SQL.
2024-01-10 18:58:57 +03:00
|
|
|
},
|
|
|
|
"comment": {
|
|
|
|
"description": "Postgres comment for the table",
|
|
|
|
"type": "string"
|
2023-12-01 19:01:40 +03:00
|
|
|
}
|
|
|
|
},
|
|
|
|
"required": ["columns", "name"],
|
|
|
|
"type": "object"
|
|
|
|
},
|
|
|
|
"OpDropColumn": {
|
|
|
|
"additionalProperties": false,
|
|
|
|
"description": "Drop column operation",
|
|
|
|
"properties": {
|
|
|
|
"column": {
|
|
|
|
"description": "Name of the column",
|
|
|
|
"type": "string"
|
|
|
|
},
|
|
|
|
"down": {
|
|
|
|
"description": "SQL expression for down migration",
|
|
|
|
"type": "string"
|
|
|
|
},
|
|
|
|
"table": {
|
|
|
|
"description": "Name of the table",
|
|
|
|
"type": "string"
|
|
|
|
}
|
|
|
|
},
|
|
|
|
"required": ["column", "table"],
|
|
|
|
"type": "object"
|
|
|
|
},
|
|
|
|
"OpDropConstraint": {
|
|
|
|
"additionalProperties": false,
|
|
|
|
"description": "Drop constraint operation",
|
|
|
|
"properties": {
|
|
|
|
"column": {
|
|
|
|
"description": "Name of the column",
|
|
|
|
"type": "string"
|
|
|
|
},
|
|
|
|
"down": {
|
|
|
|
"description": "SQL expression for down migration",
|
|
|
|
"type": "string"
|
|
|
|
},
|
|
|
|
"name": {
|
|
|
|
"description": "Name of the constraint",
|
|
|
|
"type": "string"
|
|
|
|
},
|
|
|
|
"table": {
|
|
|
|
"description": "Name of the table",
|
|
|
|
"type": "string"
|
|
|
|
},
|
|
|
|
"up": {
|
|
|
|
"description": "SQL expression for up migration",
|
|
|
|
"type": "string"
|
|
|
|
}
|
|
|
|
},
|
|
|
|
"required": ["column", "down", "name", "table", "up"],
|
|
|
|
"type": "object"
|
|
|
|
},
|
|
|
|
"OpDropIndex": {
|
|
|
|
"additionalProperties": false,
|
|
|
|
"description": "Drop index operation",
|
|
|
|
"properties": {
|
|
|
|
"name": {
|
|
|
|
"description": "Index name",
|
|
|
|
"type": "string"
|
|
|
|
}
|
|
|
|
},
|
|
|
|
"required": ["name"],
|
|
|
|
"type": "object"
|
|
|
|
},
|
|
|
|
"OpDropTable": {
|
|
|
|
"additionalProperties": false,
|
|
|
|
"description": "Drop table operation",
|
|
|
|
"properties": {
|
|
|
|
"name": {
|
|
|
|
"description": "Name of the table",
|
|
|
|
"type": "string"
|
|
|
|
}
|
|
|
|
},
|
|
|
|
"required": ["name"],
|
|
|
|
"type": "object"
|
|
|
|
},
|
|
|
|
"OpRawSQL": {
|
|
|
|
"additionalProperties": false,
|
|
|
|
"description": "Raw SQL operation",
|
|
|
|
"properties": {
|
|
|
|
"down": {
|
|
|
|
"default": "",
|
|
|
|
"description": "SQL expression for down migration",
|
|
|
|
"type": "string"
|
|
|
|
},
|
|
|
|
"up": {
|
|
|
|
"description": "SQL expression for up migration",
|
|
|
|
"type": "string"
|
2024-02-12 18:37:15 +03:00
|
|
|
},
|
|
|
|
"onComplete": {
|
|
|
|
"description": "SQL expression will run on complete step (rather than on start)",
|
|
|
|
"type": "boolean",
|
|
|
|
"default": false
|
2023-12-01 19:01:40 +03:00
|
|
|
}
|
|
|
|
},
|
|
|
|
"required": ["up"],
|
2024-02-12 18:37:15 +03:00
|
|
|
"oneOf": [
|
|
|
|
{
|
|
|
|
"required": ["down"]
|
|
|
|
},
|
|
|
|
{
|
|
|
|
"required": ["onComplete"]
|
|
|
|
},
|
|
|
|
{
|
|
|
|
"not": {
|
|
|
|
"anyOf": [
|
|
|
|
{
|
|
|
|
"required": ["down"]
|
|
|
|
},
|
|
|
|
{
|
|
|
|
"required": ["onComplete"]
|
|
|
|
}
|
|
|
|
]
|
|
|
|
}
|
|
|
|
}
|
|
|
|
],
|
2023-12-01 19:01:40 +03:00
|
|
|
"type": "object"
|
|
|
|
},
|
2024-03-01 14:30:09 +03:00
|
|
|
"OpRenameConstraint": {
|
|
|
|
"additionalProperties": false,
|
|
|
|
"description": "Rename constraint operation",
|
|
|
|
"properties": {
|
|
|
|
"from": {
|
|
|
|
"description": "Name of the constraint",
|
|
|
|
"type": "string"
|
|
|
|
},
|
|
|
|
"to": {
|
|
|
|
"description": "New name of the constraint",
|
|
|
|
"type": "string"
|
|
|
|
},
|
|
|
|
"table": {
|
|
|
|
"description": "Name of the table",
|
|
|
|
"type": "string"
|
|
|
|
}
|
|
|
|
},
|
|
|
|
"required": ["from", "to", "table"],
|
|
|
|
"type": "object"
|
|
|
|
},
|
2023-12-01 19:01:40 +03:00
|
|
|
"OpRenameTable": {
|
|
|
|
"additionalProperties": false,
|
|
|
|
"description": "Rename table operation",
|
|
|
|
"properties": {
|
|
|
|
"from": {
|
|
|
|
"description": "Old name of the table",
|
|
|
|
"type": "string"
|
|
|
|
},
|
|
|
|
"to": {
|
|
|
|
"description": "New name of the table",
|
|
|
|
"type": "string"
|
|
|
|
}
|
|
|
|
},
|
|
|
|
"required": ["from", "to"],
|
|
|
|
"type": "object"
|
|
|
|
},
|
|
|
|
"OpSetReplicaIdentity": {
|
|
|
|
"additionalProperties": false,
|
|
|
|
"description": "Set replica identity operation",
|
|
|
|
"properties": {
|
|
|
|
"identity": {
|
|
|
|
"$ref": "#/$defs/ReplicaIdentity",
|
|
|
|
"description": "Replica identity to set"
|
|
|
|
},
|
|
|
|
"table": {
|
|
|
|
"description": "Name of the table",
|
|
|
|
"type": "string"
|
|
|
|
}
|
|
|
|
},
|
|
|
|
"required": ["identity", "table"],
|
|
|
|
"type": "object"
|
|
|
|
},
|
2024-01-02 21:15:14 +03:00
|
|
|
"PgRollOperation": {
|
|
|
|
"anyOf": [
|
|
|
|
{
|
|
|
|
"type": "object",
|
|
|
|
"description": "Add column operation",
|
|
|
|
"additionalProperties": false,
|
|
|
|
"properties": {
|
|
|
|
"add_column": {
|
|
|
|
"$ref": "#/$defs/OpAddColumn"
|
|
|
|
}
|
|
|
|
},
|
|
|
|
"required": ["add_column"]
|
|
|
|
},
|
|
|
|
{
|
|
|
|
"type": "object",
|
|
|
|
"description": "Alter column operation",
|
|
|
|
"additionalProperties": false,
|
|
|
|
"properties": {
|
|
|
|
"alter_column": {
|
|
|
|
"$ref": "#/$defs/OpAlterColumn"
|
|
|
|
}
|
|
|
|
},
|
|
|
|
"required": ["alter_column"]
|
|
|
|
},
|
|
|
|
{
|
|
|
|
"type": "object",
|
|
|
|
"description": "Create index operation",
|
|
|
|
"additionalProperties": false,
|
|
|
|
"properties": {
|
|
|
|
"create_index": {
|
|
|
|
"$ref": "#/$defs/OpCreateIndex"
|
|
|
|
}
|
|
|
|
},
|
|
|
|
"required": ["create_index"]
|
|
|
|
},
|
|
|
|
{
|
|
|
|
"type": "object",
|
|
|
|
"description": "Create table operation",
|
|
|
|
"additionalProperties": false,
|
|
|
|
"properties": {
|
|
|
|
"create_table": {
|
|
|
|
"$ref": "#/$defs/OpCreateTable"
|
|
|
|
}
|
|
|
|
},
|
|
|
|
"required": ["create_table"]
|
|
|
|
},
|
|
|
|
{
|
|
|
|
"type": "object",
|
|
|
|
"description": "Drop column operation",
|
|
|
|
"additionalProperties": false,
|
|
|
|
"properties": {
|
|
|
|
"drop_column": {
|
|
|
|
"$ref": "#/$defs/OpDropColumn"
|
|
|
|
}
|
|
|
|
},
|
|
|
|
"required": ["drop_column"]
|
|
|
|
},
|
|
|
|
{
|
|
|
|
"type": "object",
|
|
|
|
"description": "Drop constraint operation",
|
|
|
|
"additionalProperties": false,
|
|
|
|
"properties": {
|
|
|
|
"drop_constraint": {
|
|
|
|
"$ref": "#/$defs/OpDropConstraint"
|
|
|
|
}
|
|
|
|
},
|
|
|
|
"required": ["drop_constraint"]
|
|
|
|
},
|
|
|
|
{
|
|
|
|
"type": "object",
|
|
|
|
"description": "Drop index operation",
|
|
|
|
"additionalProperties": false,
|
|
|
|
"properties": {
|
|
|
|
"drop_index": {
|
|
|
|
"$ref": "#/$defs/OpDropIndex"
|
|
|
|
}
|
|
|
|
},
|
|
|
|
"required": ["drop_index"]
|
|
|
|
},
|
|
|
|
{
|
|
|
|
"type": "object",
|
|
|
|
"description": "Drop table operation",
|
|
|
|
"additionalProperties": false,
|
|
|
|
"properties": {
|
|
|
|
"drop_table": {
|
|
|
|
"$ref": "#/$defs/OpDropTable"
|
|
|
|
}
|
|
|
|
},
|
|
|
|
"required": ["drop_table"]
|
|
|
|
},
|
|
|
|
{
|
|
|
|
"type": "object",
|
|
|
|
"description": "Raw SQL operation",
|
|
|
|
"additionalProperties": false,
|
|
|
|
"properties": {
|
2024-02-02 11:59:09 +03:00
|
|
|
"sql": {
|
2024-01-02 21:15:14 +03:00
|
|
|
"$ref": "#/$defs/OpRawSQL"
|
|
|
|
}
|
|
|
|
},
|
2024-02-02 11:59:09 +03:00
|
|
|
"required": ["sql"]
|
2024-01-02 21:15:14 +03:00
|
|
|
},
|
|
|
|
{
|
|
|
|
"type": "object",
|
|
|
|
"description": "Rename table operation",
|
|
|
|
"additionalProperties": false,
|
|
|
|
"properties": {
|
|
|
|
"rename_table": {
|
|
|
|
"$ref": "#/$defs/OpRenameTable"
|
|
|
|
}
|
|
|
|
},
|
|
|
|
"required": ["rename_table"]
|
|
|
|
},
|
|
|
|
{
|
|
|
|
"type": "object",
|
|
|
|
"description": "Set replica identity operation",
|
|
|
|
"additionalProperties": false,
|
|
|
|
"properties": {
|
|
|
|
"set_replica_identity": {
|
|
|
|
"$ref": "#/$defs/OpSetReplicaIdentity"
|
|
|
|
}
|
|
|
|
},
|
|
|
|
"required": ["set_replica_identity"]
|
|
|
|
}
|
|
|
|
]
|
|
|
|
},
|
|
|
|
"PgRollOperations": {
|
|
|
|
"items": {
|
|
|
|
"$ref": "#/$defs/PgRollOperation"
|
|
|
|
},
|
|
|
|
"type": "array"
|
|
|
|
},
|
2023-12-01 19:01:40 +03:00
|
|
|
"PgRollMigration": {
|
|
|
|
"additionalProperties": false,
|
|
|
|
"description": "PgRoll migration definition",
|
|
|
|
"properties": {
|
|
|
|
"name": {
|
|
|
|
"description": "Name of the migration",
|
|
|
|
"type": "string"
|
|
|
|
},
|
|
|
|
"operations": {
|
2024-01-02 21:15:14 +03:00
|
|
|
"$ref": "#/$defs/PgRollOperations"
|
2023-12-01 19:01:40 +03:00
|
|
|
}
|
|
|
|
},
|
2024-02-19 19:43:26 +03:00
|
|
|
"required": ["operations"],
|
2023-12-01 19:01:40 +03:00
|
|
|
"type": "object"
|
|
|
|
},
|
|
|
|
"ReplicaIdentity": {
|
|
|
|
"additionalProperties": false,
|
|
|
|
"description": "Replica identity definition",
|
|
|
|
"properties": {
|
|
|
|
"index": {
|
|
|
|
"description": "Name of the index to use as replica identity",
|
|
|
|
"type": "string"
|
|
|
|
},
|
|
|
|
"type": {
|
|
|
|
"description": "Type of replica identity",
|
|
|
|
"type": "string"
|
|
|
|
}
|
|
|
|
},
|
|
|
|
"required": ["index", "type"],
|
|
|
|
"type": "object"
|
|
|
|
},
|
|
|
|
"UniqueConstraint": {
|
|
|
|
"additionalProperties": false,
|
|
|
|
"description": "Unique constraint definition",
|
|
|
|
"properties": {
|
|
|
|
"name": {
|
|
|
|
"description": "Name of unique constraint",
|
|
|
|
"type": "string"
|
|
|
|
}
|
|
|
|
},
|
|
|
|
"required": ["name"],
|
|
|
|
"type": "object"
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|