Skip to content

Commit

Permalink
Fix pgroll migration definition (#216)
Browse files Browse the repository at this point in the history
- Split `PgRollMigration` so that we can properly use it in the frontend
- Fix operation keys not being included in the schema
  • Loading branch information
SferaDev authored Jan 2, 2024
1 parent 66ccf91 commit c10dabf
Showing 1 changed file with 132 additions and 49 deletions.
181 changes: 132 additions & 49 deletions schema.json
Original file line number Diff line number Diff line change
Expand Up @@ -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",
Expand All @@ -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"],
Expand Down

0 comments on commit c10dabf

Please sign in to comment.