Fix pgroll migration definition (#216)

- Split `PgRollMigration` so that we can properly use it in the frontend
- Fix operation keys not being included in the schema
This commit is contained in:
Alexis Rico 2024-01-02 19:15:14 +01:00 committed by GitHub
parent 66ccf91978
commit c10dabfc3c
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -312,6 +312,137 @@
"required": ["identity", "table"],
"type": "object"
},
"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": {
"raw_sql": {
"$ref": "#/$defs/OpRawSQL"
}
},
"required": ["raw_sql"]
},
{
"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"
},
"PgRollMigration": {
"additionalProperties": false,
"description": "PgRoll migration definition",
@ -321,55 +452,7 @@
"type": "string"
},
"operations": {
"items": {
"anyOf": [
{
"$ref": "#/$defs/OpAddColumn",
"description": "Add column operation"
},
{
"$ref": "#/$defs/OpAlterColumn",
"description": "Alter column operation"
},
{
"$ref": "#/$defs/OpCreateIndex",
"description": "Create index operation"
},
{
"$ref": "#/$defs/OpCreateTable",
"description": "Create table operation"
},
{
"$ref": "#/$defs/OpDropColumn",
"description": "Drop column operation"
},
{
"$ref": "#/$defs/OpDropConstraint",
"description": "Drop constraint operation"
},
{
"$ref": "#/$defs/OpDropIndex",
"description": "Drop index operation"
},
{
"$ref": "#/$defs/OpDropTable",
"description": "Drop table operation"
},
{
"$ref": "#/$defs/OpRawSQL",
"description": "Raw SQL operation"
},
{
"$ref": "#/$defs/OpRenameTable",
"description": "Rename table operation"
},
{
"$ref": "#/$defs/OpSetReplicaIdentity",
"description": "Set replica identity operation"
}
]
},
"type": "array"
"$ref": "#/$defs/PgRollOperations"
}
},
"required": ["name", "operations"],