From b7b1c08b1689c33ea83e278158cbfc7706285545 Mon Sep 17 00:00:00 2001 From: Alexis Rico Date: Mon, 18 Dec 2023 18:29:22 +0100 Subject: [PATCH 1/5] Fix pgroll migration definition Signed-off-by: Alexis Rico --- schema.json | 110 +++++++++++++++++++++++++++++++++++++++++----------- 1 file changed, 88 insertions(+), 22 deletions(-) diff --git a/schema.json b/schema.json index cd988fab..9f0aaa35 100644 --- a/schema.json +++ b/schema.json @@ -324,48 +324,114 @@ "items": { "anyOf": [ { - "$ref": "#/$defs/OpAddColumn", - "description": "Add column operation" + "type": "object", + "additionalProperties": false, + "properties": { + "add_column": { + "$ref": "#/$defs/OpAddColumn", + "description": "Add column operation" + } + } }, { - "$ref": "#/$defs/OpAlterColumn", - "description": "Alter column operation" + "type": "object", + "additionalProperties": false, + "properties": { + "alter_column": { + "$ref": "#/$defs/OpAlterColumn", + "description": "Alter column operation" + } + } }, { - "$ref": "#/$defs/OpCreateIndex", - "description": "Create index operation" + "type": "object", + "additionalProperties": false, + "properties": { + "create_index": { + "$ref": "#/$defs/OpCreateIndex", + "description": "Create index operation" + } + } }, { - "$ref": "#/$defs/OpCreateTable", - "description": "Create table operation" + "type": "object", + "additionalProperties": false, + "properties": { + "create_table": { + "$ref": "#/$defs/OpCreateTable", + "description": "Create table operation" + } + } }, { - "$ref": "#/$defs/OpDropColumn", - "description": "Drop column operation" + "type": "object", + "additionalProperties": false, + "properties": { + "drop_column": { + "$ref": "#/$defs/OpDropColumn", + "description": "Drop column operation" + } + } }, { - "$ref": "#/$defs/OpDropConstraint", - "description": "Drop constraint operation" + "type": "object", + "additionalProperties": false, + "properties": { + "drop_constraint": { + "$ref": "#/$defs/OpDropConstraint", + "description": "Drop constraint operation" + } + } }, { - "$ref": "#/$defs/OpDropIndex", - "description": "Drop index operation" + "type": "object", + "additionalProperties": false, + "properties": { + "drop_index": { + "$ref": "#/$defs/OpDropIndex", + "description": "Drop index operation" + } + } }, { - "$ref": "#/$defs/OpDropTable", - "description": "Drop table operation" + "type": "object", + "additionalProperties": false, + "properties": { + "drop_table": { + "$ref": "#/$defs/OpDropTable", + "description": "Drop table operation" + } + } }, { - "$ref": "#/$defs/OpRawSQL", - "description": "Raw SQL operation" + "type": "object", + "additionalProperties": false, + "properties": { + "raw_sql": { + "$ref": "#/$defs/OpRawSQL", + "description": "Raw SQL operation" + } + } }, { - "$ref": "#/$defs/OpRenameTable", - "description": "Rename table operation" + "type": "object", + "additionalProperties": false, + "properties": { + "rename_table": { + "$ref": "#/$defs/OpRenameTable", + "description": "Rename table operation" + } + } }, { - "$ref": "#/$defs/OpSetReplicaIdentity", - "description": "Set replica identity operation" + "type": "object", + "additionalProperties": false, + "properties": { + "set_replica_identity": { + "$ref": "#/$defs/OpSetReplicaIdentity", + "description": "Set replica identity operation" + } + } } ] }, From c01ce36c3ac8262d797eba05b9395b4a24ada4c1 Mon Sep 17 00:00:00 2001 From: Alexis Rico Date: Mon, 18 Dec 2023 18:32:58 +0100 Subject: [PATCH 2/5] Move descriptions Signed-off-by: Alexis Rico --- schema.json | 44 ++++++++++++++++++++++---------------------- 1 file changed, 22 insertions(+), 22 deletions(-) diff --git a/schema.json b/schema.json index 9f0aaa35..7bb35e12 100644 --- a/schema.json +++ b/schema.json @@ -325,111 +325,111 @@ "anyOf": [ { "type": "object", + "description": "Add column operation", "additionalProperties": false, "properties": { "add_column": { - "$ref": "#/$defs/OpAddColumn", - "description": "Add column operation" + "$ref": "#/$defs/OpAddColumn" } } }, { "type": "object", + "description": "Alter column operation", "additionalProperties": false, "properties": { "alter_column": { - "$ref": "#/$defs/OpAlterColumn", - "description": "Alter column operation" + "$ref": "#/$defs/OpAlterColumn" } } }, { "type": "object", + "description": "Create index operation", "additionalProperties": false, "properties": { "create_index": { - "$ref": "#/$defs/OpCreateIndex", - "description": "Create index operation" + "$ref": "#/$defs/OpCreateIndex" } } }, { "type": "object", + "description": "Create table operation", "additionalProperties": false, "properties": { "create_table": { - "$ref": "#/$defs/OpCreateTable", - "description": "Create table operation" + "$ref": "#/$defs/OpCreateTable" } } }, { "type": "object", + "description": "Drop column operation", "additionalProperties": false, "properties": { "drop_column": { - "$ref": "#/$defs/OpDropColumn", - "description": "Drop column operation" + "$ref": "#/$defs/OpDropColumn" } } }, { "type": "object", + "description": "Drop constraint operation", "additionalProperties": false, "properties": { "drop_constraint": { - "$ref": "#/$defs/OpDropConstraint", - "description": "Drop constraint operation" + "$ref": "#/$defs/OpDropConstraint" } } }, { "type": "object", + "description": "Drop index operation", "additionalProperties": false, "properties": { "drop_index": { - "$ref": "#/$defs/OpDropIndex", - "description": "Drop index operation" + "$ref": "#/$defs/OpDropIndex" } } }, { "type": "object", + "description": "Drop table operation", "additionalProperties": false, "properties": { "drop_table": { - "$ref": "#/$defs/OpDropTable", - "description": "Drop table operation" + "$ref": "#/$defs/OpDropTable" } } }, { "type": "object", + "description": "Raw SQL operation", "additionalProperties": false, "properties": { "raw_sql": { - "$ref": "#/$defs/OpRawSQL", - "description": "Raw SQL operation" + "$ref": "#/$defs/OpRawSQL" } } }, { "type": "object", + "description": "Rename table operation", "additionalProperties": false, "properties": { "rename_table": { - "$ref": "#/$defs/OpRenameTable", - "description": "Rename table operation" + "$ref": "#/$defs/OpRenameTable" } } }, { "type": "object", + "description": "Set replica identity operation", "additionalProperties": false, "properties": { "set_replica_identity": { - "$ref": "#/$defs/OpSetReplicaIdentity", - "description": "Set replica identity operation" + "$ref": "#/$defs/OpSetReplicaIdentity" } } } From 4d74c3aaf180b8196656d7f6b595ab2205a0567e Mon Sep 17 00:00:00 2001 From: Alexis Rico Date: Mon, 18 Dec 2023 18:36:12 +0100 Subject: [PATCH 3/5] Make required Signed-off-by: Alexis Rico --- schema.json | 33 ++++++++++++++++++++++----------- 1 file changed, 22 insertions(+), 11 deletions(-) diff --git a/schema.json b/schema.json index 7bb35e12..0afdd372 100644 --- a/schema.json +++ b/schema.json @@ -331,7 +331,8 @@ "add_column": { "$ref": "#/$defs/OpAddColumn" } - } + }, + "required": ["add_column"] }, { "type": "object", @@ -341,7 +342,8 @@ "alter_column": { "$ref": "#/$defs/OpAlterColumn" } - } + }, + "required": ["alter_column"] }, { "type": "object", @@ -351,7 +353,8 @@ "create_index": { "$ref": "#/$defs/OpCreateIndex" } - } + }, + "required": ["create_index"] }, { "type": "object", @@ -361,7 +364,8 @@ "create_table": { "$ref": "#/$defs/OpCreateTable" } - } + }, + "required": ["create_table"] }, { "type": "object", @@ -371,7 +375,8 @@ "drop_column": { "$ref": "#/$defs/OpDropColumn" } - } + }, + "required": ["drop_column"] }, { "type": "object", @@ -381,7 +386,8 @@ "drop_constraint": { "$ref": "#/$defs/OpDropConstraint" } - } + }, + "required": ["drop_constraint"] }, { "type": "object", @@ -391,7 +397,8 @@ "drop_index": { "$ref": "#/$defs/OpDropIndex" } - } + }, + "required": ["drop_index"] }, { "type": "object", @@ -401,7 +408,8 @@ "drop_table": { "$ref": "#/$defs/OpDropTable" } - } + }, + "required": ["drop_table"] }, { "type": "object", @@ -411,7 +419,8 @@ "raw_sql": { "$ref": "#/$defs/OpRawSQL" } - } + }, + "required": ["raw_sql"] }, { "type": "object", @@ -421,7 +430,8 @@ "rename_table": { "$ref": "#/$defs/OpRenameTable" } - } + }, + "required": ["rename_table"] }, { "type": "object", @@ -431,7 +441,8 @@ "set_replica_identity": { "$ref": "#/$defs/OpSetReplicaIdentity" } - } + }, + "required": ["set_replica_identity"] } ] }, From 83d7b2879456a489d010e092f6171645415ea810 Mon Sep 17 00:00:00 2001 From: Alexis Rico Date: Mon, 18 Dec 2023 18:46:33 +0100 Subject: [PATCH 4/5] Split in 3 Signed-off-by: Alexis Rico --- schema.json | 258 +++++++++++++++++++++++++++------------------------- 1 file changed, 132 insertions(+), 126 deletions(-) diff --git a/schema.json b/schema.json index 0afdd372..8965134a 100644 --- a/schema.json +++ b/schema.json @@ -321,137 +321,143 @@ "type": "string" }, "operations": { - "items": { - "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"] - } - ] - }, - "type": "array" + "$ref": "#/$defs/PgRollOperations" } }, "required": ["name", "operations"], "type": "object" }, + "PgRollOperations": { + "items": { + "$ref": "#/$defs/PgRollOperation" + }, + "type": "array" + }, + "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"] + } + ] + }, "ReplicaIdentity": { "additionalProperties": false, "description": "Replica identity definition", From 1b531d6c94cb9d5d23a6b9d1396fb5fa2ea67c78 Mon Sep 17 00:00:00 2001 From: Alexis Rico Date: Mon, 18 Dec 2023 18:49:13 +0100 Subject: [PATCH 5/5] Switch order Signed-off-by: Alexis Rico --- schema.json | 42 +++++++++++++++++++++--------------------- 1 file changed, 21 insertions(+), 21 deletions(-) diff --git a/schema.json b/schema.json index 8965134a..ba3fa1b7 100644 --- a/schema.json +++ b/schema.json @@ -312,27 +312,6 @@ "required": ["identity", "table"], "type": "object" }, - "PgRollMigration": { - "additionalProperties": false, - "description": "PgRoll migration definition", - "properties": { - "name": { - "description": "Name of the migration", - "type": "string" - }, - "operations": { - "$ref": "#/$defs/PgRollOperations" - } - }, - "required": ["name", "operations"], - "type": "object" - }, - "PgRollOperations": { - "items": { - "$ref": "#/$defs/PgRollOperation" - }, - "type": "array" - }, "PgRollOperation": { "anyOf": [ { @@ -458,6 +437,27 @@ } ] }, + "PgRollOperations": { + "items": { + "$ref": "#/$defs/PgRollOperation" + }, + "type": "array" + }, + "PgRollMigration": { + "additionalProperties": false, + "description": "PgRoll migration definition", + "properties": { + "name": { + "description": "Name of the migration", + "type": "string" + }, + "operations": { + "$ref": "#/$defs/PgRollOperations" + } + }, + "required": ["name", "operations"], + "type": "object" + }, "ReplicaIdentity": { "additionalProperties": false, "description": "Replica identity definition",