Created
November 1, 2019 13:25
-
-
Save gmr/1e6a0825f8285157c204d5f8fd5f014c to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
{ | |
"$schema": "http://json-schema.org/schema#", | |
"$id": "https://pglifecycle.readthedocs.io/en/stable/schemata/table.html", | |
"title": "Table", | |
"description": "Defines a table", | |
"type": "object", | |
"properties": { | |
"name": { | |
"title": "Name", | |
"description": "The table name", | |
"type": "string" | |
}, | |
"schema": { | |
"title": "Schema", | |
"description": "The schema to create the table in", | |
"type": "string" | |
}, | |
"owner": { | |
"title": "Owner", | |
"description": "The role name that owns the table", | |
"type": "string" | |
}, | |
"sql": { | |
"title": "SQL Statement", | |
"description": "User-provided raw SQL snippet", | |
"type": "string" | |
}, | |
"unlogged": { | |
"title": "Unlogged", | |
"description": "If specified, the table is created as an unlogged table. Data written to unlogged tables is not written to the write-ahead log, which makes them considerably faster than ordinary tables. However, they are not crash-safe: an unlogged table is automatically truncated after a crash or unclean shutdown.\n", | |
"type": "boolean" | |
}, | |
"from_type": { | |
"title": "From Type (OF)", | |
"description": "Creates a typed table, which takes its structure from the specified composite type (name optionally schema-qualified).\n", | |
"type": "string" | |
}, | |
"parents": { | |
"title": "Parent Tables (INHERITS)", | |
"description": "A list of tables from which the new table automatically inherits all columns. Parent tables can be plain tables or foreign tables.\n", | |
"type": "array", | |
"items": { | |
"type": "string" | |
} | |
}, | |
"like_table": { | |
"title": "Like Table", | |
"description": "Specifies a table from which the new table automatically copies all column names, their data types, and their not-null constraints.\n", | |
"type": "object", | |
"properties": { | |
"name": { | |
"title": "Table Name", | |
"description": "The table to copy", | |
"type": "string" | |
}, | |
"include_comments": { | |
"title": "Include comments when creating the new table.", | |
"type": "boolean" | |
}, | |
"include_constraints": { | |
"title": "Include constraints", | |
"type": "boolean" | |
}, | |
"include_defaults": { | |
"title": "Include defaults", | |
"type": "boolean" | |
}, | |
"include_generated": { | |
"title": "Include generated expressions", | |
"type": "boolean" | |
}, | |
"include_identity": { | |
"title": "Include identity specifications", | |
"type": "boolean" | |
}, | |
"include_indexes": { | |
"title": "Include indexes", | |
"type": "boolean" | |
}, | |
"include_statistics": { | |
"title": "Include extended statistics", | |
"type": "boolean" | |
}, | |
"include_storage": { | |
"title": "Include storage settings", | |
"type": "boolean" | |
}, | |
"include_all": { | |
"title": "Include all", | |
"description": "Include all options (comments, constraints, defaults, generated, identity, indexes, statistics, and storage).\n", | |
"type": "boolean" | |
} | |
}, | |
"required": [ | |
"name" | |
], | |
"additionalProperties": false, | |
"oneOf": [ | |
{ | |
"required": [ | |
"include_comments" | |
], | |
"not": { | |
"required": [ | |
"include_all" | |
] | |
} | |
}, | |
{ | |
"required": [ | |
"include_constraints" | |
], | |
"not": { | |
"required": [ | |
"include_all" | |
] | |
} | |
}, | |
{ | |
"required": [ | |
"include_defaults" | |
], | |
"not": { | |
"required": [ | |
"include_all" | |
] | |
} | |
}, | |
{ | |
"required": [ | |
"include_generated" | |
], | |
"not": { | |
"required": [ | |
"include_all" | |
] | |
} | |
}, | |
{ | |
"required": [ | |
"include_identity" | |
], | |
"not": { | |
"required": [ | |
"include_all" | |
] | |
} | |
}, | |
{ | |
"required": [ | |
"include_indexes" | |
], | |
"not": { | |
"required": [ | |
"include_all" | |
] | |
} | |
}, | |
{ | |
"required": [ | |
"include_statistics" | |
], | |
"not": { | |
"required": [ | |
"include_all" | |
] | |
} | |
}, | |
{ | |
"required": [ | |
"include_storage" | |
], | |
"not": { | |
"required": [ | |
"include_all" | |
] | |
} | |
}, | |
{ | |
"required": [ | |
"include_all" | |
], | |
"not": { | |
"required": [ | |
"include_comments", | |
"include_constraints", | |
"include_defaults", | |
"include_generated", | |
"include_identity", | |
"include_indexes", | |
"include_statistics", | |
"include_storage" | |
] | |
} | |
} | |
] | |
}, | |
"columns": { | |
"title": "Columns", | |
"description": "Defines the columns in the table", | |
"type": "array", | |
"items": { | |
"$schema": "http://json-schema.org/schema#", | |
"$id": "https://pglifecycle.readthedocs.io/en/stable/schemata/column.html", | |
"title": "Column", | |
"description": "Defines a column in a table", | |
"type": "object", | |
"properties": { | |
"name": { | |
"title": "Name", | |
"description": "The column name", | |
"type": "string" | |
}, | |
"data_type": { | |
"title": "Data Type", | |
"description": "The column data type", | |
"type": "string" | |
}, | |
"nullable": { | |
"title": "Nullable", | |
"description": "Column is NULLABLE when True. Defaults to True.", | |
"type": "boolean", | |
"default": true | |
}, | |
"default": { | |
"title": "Default Value", | |
"description": "Default value for the column.", | |
"oneOf": [ | |
{ | |
"type": "boolean" | |
}, | |
{ | |
"type": "integer" | |
}, | |
{ | |
"type": "number" | |
}, | |
{ | |
"type": "string" | |
} | |
] | |
}, | |
"collation": { | |
"title": "Column Collation", | |
"description": "Assigns a collation to the column (which must be of a collatable data type). If not specified, the column data type's default collation is used.\n", | |
"type": "string" | |
}, | |
"check_constraint": { | |
"title": "Check Constraint", | |
"description": "Specifies an expression producing a Boolean result which new or updated rows must satisfy for an insert or update operation to succeed.\n", | |
"type": "string" | |
}, | |
"generated": { | |
"title": "Generated Column", | |
"description": "Options for specifying a generated column", | |
"type": "object", | |
"properties": { | |
"expression": { | |
"title": "Expression", | |
"description": "The expression used to generate the column. Mutually exclusive with the sequence column.\n", | |
"type": "string" | |
}, | |
"sequence": { | |
"title": "Sequence Name", | |
"description": "Specifies that the generated column value is provided by a sequence. Mutually exclusive with the expression attribute.\n" | |
}, | |
"sequence_behavior": { | |
"title": "Sequence Behavior", | |
"description": "The clauses ALWAYS and BY DEFAULT determine how the sequence value is given precedence over a user-specified value in an INSERT statement. If ALWAYS is specified, a user-specified value is only accepted if the INSERT statement specifies OVERRIDING SYSTEM VALUE. If BY DEFAULT is specified, then the user-specified value takes precedence.\n", | |
"enum": [ | |
"ALWAYS", | |
"BY DEFAULT" | |
] | |
} | |
}, | |
"oneOf": [ | |
{ | |
"required": [ | |
"expression" | |
], | |
"not": { | |
"required": [ | |
"sequence", | |
"sequence_behavior" | |
] | |
} | |
}, | |
{ | |
"required": [ | |
"sequence" | |
], | |
"not": { | |
"required": [ | |
"expression" | |
] | |
} | |
} | |
], | |
"additionalProperties": false | |
}, | |
"comment": { | |
"title": "Comment", | |
"description": "An optional comment about the column", | |
"type": "string" | |
} | |
}, | |
"required": [ | |
"name", | |
"data_type" | |
], | |
"additionalProperties": false | |
} | |
}, | |
"primary_key": { | |
"title": "Primary Key", | |
"description": "The PRIMARY KEY constraint specifies that a column or columns of a table can contain only unique (non-duplicate), non-null values. Only one primary key can be specified for a table.\nFor primary keys without included columns, this value can be a list of column names. Otherwise it's an object with a columns and an include attribute.\n", | |
"anyOf": [ | |
{ | |
"type": "string" | |
}, | |
{ | |
"type": "array", | |
"items": { | |
"type": "string" | |
} | |
}, | |
{ | |
"type": "object", | |
"properties": { | |
"columns": { | |
"title": "Columns", | |
"description": "The list of columns that provide the uniqueness", | |
"type": "array", | |
"minItems": 1 | |
}, | |
"include": { | |
"title": "Include Columns", | |
"description": "Use to provide a list of non-key columns to provide in the primary key index.\n", | |
"type": "array", | |
"items": { | |
"title": "Column Name", | |
"type": "string" | |
} | |
} | |
}, | |
"required": [ | |
"columns" | |
], | |
"additionalProperties": false | |
} | |
] | |
}, | |
"indexes": { | |
"title": "Indexes", | |
"description": "An array of indexes on the table", | |
"type": "array", | |
"items": { | |
"$schema": "http://json-schema.org/schema#", | |
"$id": "https://pglifecycle.readthedocs.io/en/stable/schemata/index.html", | |
"title": "Index", | |
"description": "Defines an index on a table", | |
"type": "object", | |
"properties": { | |
"name": { | |
"title": "Name", | |
"description": "The index name", | |
"type": "string" | |
}, | |
"sql": { | |
"title": "SQL Statement", | |
"description": "User-provided raw SQL snippet", | |
"type": "string" | |
}, | |
"unique": { | |
"title": "Unique", | |
"description": "Specifies that the index is a unique index", | |
"type": "boolean", | |
"default": false | |
}, | |
"recurse": { | |
"title": "Recurse to Partitions", | |
"description": "Used to specify that the index should be created on partitions of the table.\n", | |
"type": "boolean" | |
}, | |
"tablespace": { | |
"title": "Tablespace", | |
"description": "Specifies the tablespace to use when creating the index", | |
"type": "string" | |
}, | |
"table_name": { | |
"title": "Table Name", | |
"description": "The table name the index is defined for", | |
"type": "string" | |
}, | |
"method": { | |
"title": "Index Method", | |
"description": "The name of the index method to be used", | |
"enum": [ | |
"brin", | |
"btree", | |
"gist", | |
"hash", | |
"spgist" | |
], | |
"default": "btree" | |
}, | |
"columns": { | |
"title": "Columns", | |
"description": "Defines the columns that are indexed", | |
"type": "array", | |
"items": { | |
"title": "Column", | |
"type": "object", | |
"properties": { | |
"name": { | |
"title": "Column Name", | |
"description": "Specify either the column name, mutally exclusive from expression.", | |
"type": "string" | |
}, | |
"expression": { | |
"title": "Expression", | |
"type": "string", | |
"description": "Specify an expression for the column, mutally exclusive from name." | |
}, | |
"collation": { | |
"title": "Column Collation", | |
"description": "Assigns a collation to the column (which must be of a collatable data type). If not specified, the column data type's default collation is used.\n", | |
"type": "string" | |
}, | |
"opclass": { | |
"title": "Operator Class", | |
"description": "The name of an operator class", | |
"type": "string" | |
}, | |
"direction": { | |
"title": "Sort Direction", | |
"description": "Specifies the sort direction in the index for the column", | |
"enum": [ | |
"ASC", | |
"DESC" | |
], | |
"default": "ASC" | |
}, | |
"null_placement": { | |
"title": "NULL value placement", | |
"description": "Specifies the placement of null values in the index.", | |
"enum": [ | |
"FIRST", | |
"LAST" | |
] | |
} | |
}, | |
"additionalProperties": false, | |
"oneOf": [ | |
{ | |
"required": [ | |
"name" | |
], | |
"not": { | |
"required": [ | |
"expression" | |
] | |
} | |
}, | |
{ | |
"required": [ | |
"expression" | |
], | |
"not": { | |
"required": [ | |
"name" | |
] | |
} | |
} | |
] | |
} | |
}, | |
"include": { | |
"title": "Include Columns", | |
"description": "Use to provide a list of non-key columns to provide in the index.", | |
"type": "array", | |
"items": { | |
"title": "Column Name", | |
"type": "string" | |
} | |
}, | |
"where": { | |
"title": "Where", | |
"description": "Use to provide an expression for creating a partial index", | |
"type": "string" | |
}, | |
"storage_parameters": { | |
"title": "Storage Parameters", | |
"description": "Storage parameter settings for the index", | |
"type": "object", | |
"propertyNames": { | |
"pattern": "^[A-Za-z0-9_]*$" | |
} | |
}, | |
"comment": { | |
"title": "Comment", | |
"description": "An optional comment about the table", | |
"type": "string" | |
}, | |
"dependencies": { | |
"title": "Dependencies", | |
"description": "Database objects this object is dependent upon", | |
"$schema": "http://json-schema.org/schema#", | |
"$id": "https://pglifecycle.readthedocs.io/en/stable/schemata/dependencies.html", | |
"type": "object", | |
"properties": { | |
"domains": { | |
"type": "array", | |
"propertyNames": { | |
"pattern": "^([A-Za-z0-9_\\-]+)\\.([A-Za-z0-9_\\-]+)$" | |
} | |
}, | |
"extensions": { | |
"type": "array", | |
"propertyNames": { | |
"pattern": "^([A-Za-z0-9_\\-]+)$" | |
} | |
}, | |
"foreign_data_wrappers": { | |
"type": "array", | |
"propertyNames": { | |
"pattern": "^([A-Za-z0-9_\\-]+)$" | |
} | |
}, | |
"functions": { | |
"type": "array", | |
"propertyNames": { | |
"pattern": "^([A-Za-z0-9_\\-]+).^([A-Za-z0-9_\\-]+)\\(^([A-Za-z0-9_\\-, ]+)\\)$" | |
} | |
}, | |
"languages": { | |
"type": "array", | |
"propertyNames": { | |
"pattern": "^([A-Za-z0-9_\\-]+)$" | |
} | |
}, | |
"sequences": { | |
"type": "array", | |
"propertyNames": { | |
"pattern": "^([A-Za-z0-9_\\-]+)\\.([A-Za-z0-9_\\-]+)$" | |
} | |
}, | |
"tables": { | |
"type": "array", | |
"propertyNames": { | |
"pattern": "^([A-Za-z0-9_\\-]+)\\.([A-Za-z0-9_\\-]+)$" | |
} | |
}, | |
"types": { | |
"type": "array", | |
"propertyNames": { | |
"pattern": "^([A-Za-z0-9_\\-]+)\\.([A-Za-z0-9_\\-]+)$" | |
} | |
} | |
}, | |
"additionalProperties": false | |
} | |
}, | |
"additionalProperties": false, | |
"oneOf": [ | |
{ | |
"required": [ | |
"sql" | |
], | |
"not": { | |
"required": [ | |
"name", | |
"table_name", | |
"method", | |
"columns", | |
"storage_parameters", | |
"unique", | |
"recurse", | |
"include", | |
"where" | |
] | |
} | |
}, | |
{ | |
"required": [ | |
"name", | |
"columns" | |
], | |
"not": { | |
"required": [ | |
"sql" | |
] | |
} | |
} | |
] | |
} | |
}, | |
"check_constraints": { | |
"title": "Table Check Constraints", | |
"type": "array", | |
"items": { | |
"title": "Check Constraint Expression", | |
"description": "Specifies an expression producing a Boolean result which new or updated rows must satisfy for an insert or update operation to succeed.\n", | |
"type": "object", | |
"properties": { | |
"name": { | |
"type": "string" | |
}, | |
"expression": { | |
"type": "string" | |
} | |
} | |
} | |
}, | |
"unique_constraints": { | |
"title": "Unique Constraints", | |
"description": "The UNIQUE constraint specifies that a group of one or more columns of a table can contain only unique values. The behavior of the unique table constraint is the same as that for column constraints, with the additional capability to span multiple columns.\nFor the purpose of a unique constraint, null values are not considered equal.\nEach unique table constraint must name a set of columns that is different from the set of columns named by any other unique or primary key constraint defined for the table. (Otherwise it would just be the same constraint listed twice.)\nWhen establishing a unique constraint for a multi-level partition hierarchy, all the columns in the partition key of the target partitioned table, as well as those of all its descendant partitioned tables, must be included in the constraint definition.\nAdding a unique constraint will automatically create a unique btree index on the column or group of columns used in the constraint. The optional clause INCLUDE adds to that index one or more columns on which the uniqueness is not enforced. Note that although the constraint is not enforced on the included columns, it still depends on them. Consequently, some operations on these columns (e.g. DROP COLUMN) can cause cascaded constraint and index deletion.\nFor unique constraints without included columns, this value can be a list of column names. Otherwise it's an object with a columns and an include attribute.\n", | |
"type": "array", | |
"items": { | |
"anyOf": [ | |
{ | |
"type": "array", | |
"items": { | |
"title": "Column Name", | |
"type": "string" | |
} | |
}, | |
{ | |
"title": "Column Name", | |
"type": "string" | |
}, | |
{ | |
"title": "Unique Constraint", | |
"type": "object", | |
"properties": { | |
"columns": { | |
"title": "Columns", | |
"description": "The list of columns that provide the uniqueness", | |
"type": "array", | |
"minItems": 1 | |
}, | |
"include": { | |
"title": "Include Columns", | |
"description": "Use to provide a list of non-key columns to provide in the index.", | |
"type": "array", | |
"items": { | |
"title": "Column Name", | |
"type": "string" | |
} | |
} | |
}, | |
"required": [ | |
"columns" | |
], | |
"additionalProperties": false | |
} | |
] | |
} | |
}, | |
"foreign_keys": { | |
"title": "Foreign Keys", | |
"description": "An array of foreign keys on the table", | |
"type": "array", | |
"items": { | |
"$schema": "http://json-schema.org/schema#", | |
"$id": "https://pglifecycle.readthedocs.io/en/stable/schemata/foreign_key.html", | |
"title": "Foreign Key", | |
"description": "Defines a foreign key on a table", | |
"type": "object", | |
"properties": { | |
"name": { | |
"title": "Name", | |
"description": "The foreign key name", | |
"type": "string" | |
}, | |
"sql": { | |
"title": "SQL Statement", | |
"description": "User-provided raw SQL snippet", | |
"type": "string" | |
}, | |
"columns": { | |
"title": "Columns", | |
"description": "The columns in the table that the foreign key enforces the value of", | |
"type": "array", | |
"items": { | |
"title": "Column Name", | |
"type": "string" | |
}, | |
"minItems": 1 | |
}, | |
"references": { | |
"title": "Referenced Table", | |
"description": "Defines the information about the foreign key table and columns", | |
"type": "object", | |
"properties": { | |
"name": { | |
"title": "Name", | |
"description": "The name of the foreign key table", | |
"type": "string" | |
}, | |
"columns": { | |
"title": "Columns", | |
"description": "The columns in the table in the foreign key table", | |
"type": "array", | |
"items": { | |
"title": "Column Name", | |
"type": "string" | |
}, | |
"minItems": 1 | |
} | |
}, | |
"additionalProperties": false, | |
"required": [ | |
"name", | |
"columns" | |
] | |
}, | |
"on_delete": { | |
"title": "On Delete", | |
"description": "Action to take on delete of the column value in the referenced table", | |
"enum": [ | |
"NO ACTION", | |
"RESTRICT", | |
"CASCADE", | |
"SET NULL", | |
"SET DEFAULT" | |
] | |
}, | |
"on_update": { | |
"title": "On Update", | |
"description": "Action to take on update of the column value in the referenced table", | |
"enum": [ | |
"NO ACTION", | |
"RESTRICT", | |
"CASCADE", | |
"SET NULL", | |
"SET DEFAULT" | |
] | |
}, | |
"deferrable": { | |
"title": "Deferrable", | |
"description": "This controls whether the constraint can be deferred. A constraint that is not deferrable will be checked immediately after every command.\n", | |
"type": "boolean" | |
}, | |
"initially_deferred": { | |
"title": "Initial Constraint Check Behavior", | |
"type": "boolean" | |
} | |
}, | |
"additionalProperties": false, | |
"oneOf": [ | |
{ | |
"required": [ | |
"sql" | |
], | |
"not": { | |
"required": [ | |
"columns", | |
"references", | |
"on_delete", | |
"on_update", | |
"deferrable", | |
"initially_deferred" | |
] | |
} | |
}, | |
{ | |
"required": [ | |
"columns" | |
], | |
"not": { | |
"required": [ | |
"sql" | |
] | |
} | |
} | |
] | |
} | |
}, | |
"triggers": { | |
"title": "Triggers", | |
"description": "An array of triggers on the table", | |
"type": "array", | |
"items": { | |
"$schema": "http://json-schema.org/schema#", | |
"$id": "https://pglifecycle.readthedocs.io/en/stable/schemata/trigger.html", | |
"title": "Trigger", | |
"description": "Defines an trigger on a table", | |
"type": "object", | |
"properties": { | |
"name": { | |
"title": "Name", | |
"description": "The index name", | |
"type": "string" | |
}, | |
"sql": { | |
"title": "SQL Statement", | |
"description": "User-provided raw SQL snippet", | |
"type": "string" | |
}, | |
"table_name": { | |
"title": "Table Name", | |
"description": "The table to create the trigger on", | |
"type": "string" | |
}, | |
"when": { | |
"title": "When to fire the trigger", | |
"enum": [ | |
"BEFORE", | |
"AFTER", | |
"INSTEAD OF" | |
] | |
}, | |
"events": { | |
"title": "The events that cause the fire to trigger", | |
"type": "array", | |
"items": { | |
"enum": [ | |
"INSERT", | |
"UPDATE", | |
"DELETE", | |
"TRUNCATE" | |
] | |
} | |
}, | |
"for_each": { | |
"title": "For Each Row or Statement", | |
"enum": [ | |
"ROW", | |
"STATEMENT" | |
], | |
"default": "STATEMENT" | |
}, | |
"condition": { | |
"title": "Trigger Condition", | |
"description": "A Boolean expression that determines whether the trigger function will actually be executed. If WHEN is specified, the function will only be called if the condition returns true.\n", | |
"type": "string" | |
}, | |
"function": { | |
"title": "Trigger Function", | |
"description": "The trigger function to execute", | |
"type": "string" | |
}, | |
"arguments": { | |
"title": "Funciton Arguments", | |
"description": "An optional comma-separated list of arguments to be provided to the function when the trigger is executed.\n", | |
"type": "array", | |
"items": { | |
"anyOf": [ | |
{ | |
"type": "boolean" | |
}, | |
{ | |
"type": "integer" | |
}, | |
{ | |
"type": "number" | |
}, | |
{ | |
"type": "string" | |
} | |
] | |
} | |
}, | |
"comment": { | |
"title": "Comment", | |
"description": "An optional comment about the table", | |
"type": "string" | |
}, | |
"dependencies": { | |
"title": "Dependencies", | |
"description": "Database objects this object is dependent upon", | |
"$schema": "http://json-schema.org/schema#", | |
"$id": "https://pglifecycle.readthedocs.io/en/stable/schemata/dependencies.html", | |
"type": "object", | |
"properties": { | |
"domains": { | |
"type": "array", | |
"propertyNames": { | |
"pattern": "^([A-Za-z0-9_\\-]+)\\.([A-Za-z0-9_\\-]+)$" | |
} | |
}, | |
"extensions": { | |
"type": "array", | |
"propertyNames": { | |
"pattern": "^([A-Za-z0-9_\\-]+)$" | |
} | |
}, | |
"foreign_data_wrappers": { | |
"type": "array", | |
"propertyNames": { | |
"pattern": "^([A-Za-z0-9_\\-]+)$" | |
} | |
}, | |
"functions": { | |
"type": "array", | |
"propertyNames": { | |
"pattern": "^([A-Za-z0-9_\\-]+).^([A-Za-z0-9_\\-]+)\\(^([A-Za-z0-9_\\-, ]+)\\)$" | |
} | |
}, | |
"languages": { | |
"type": "array", | |
"propertyNames": { | |
"pattern": "^([A-Za-z0-9_\\-]+)$" | |
} | |
}, | |
"sequences": { | |
"type": "array", | |
"propertyNames": { | |
"pattern": "^([A-Za-z0-9_\\-]+)\\.([A-Za-z0-9_\\-]+)$" | |
} | |
}, | |
"tables": { | |
"type": "array", | |
"propertyNames": { | |
"pattern": "^([A-Za-z0-9_\\-]+)\\.([A-Za-z0-9_\\-]+)$" | |
} | |
}, | |
"types": { | |
"type": "array", | |
"propertyNames": { | |
"pattern": "^([A-Za-z0-9_\\-]+)\\.([A-Za-z0-9_\\-]+)$" | |
} | |
} | |
}, | |
"additionalProperties": false | |
} | |
}, | |
"additionalProperties": false, | |
"oneOf": [ | |
{ | |
"required": [ | |
"sql" | |
], | |
"not": { | |
"required": [ | |
"columns", | |
"name", | |
"table_name", | |
"when", | |
"for_each", | |
"condition", | |
"function", | |
"arguments" | |
] | |
} | |
}, | |
{ | |
"required": [ | |
"name", | |
"when", | |
"events", | |
"function" | |
], | |
"not": { | |
"required": [ | |
"sql" | |
] | |
} | |
} | |
] | |
} | |
}, | |
"partition": { | |
"title": "Partition Table", | |
"description": "Defines table partitioning behavior", | |
"type": "object", | |
"properties": { | |
"type": { | |
"title": "Partition Type", | |
"enum": [ | |
"HASH", | |
"LIST", | |
"RANGE" | |
] | |
}, | |
"columns": { | |
"title": "Columns", | |
"description": "Defines the columns that are indexed", | |
"anyOf": [ | |
{ | |
"type": "string" | |
}, | |
{ | |
"type": "array", | |
"items": { | |
"type": "string" | |
} | |
}, | |
{ | |
"title": "Column", | |
"type": "object", | |
"properties": { | |
"name": { | |
"title": "Column Name", | |
"description": "Specify either the column name, mutally exclusive from expression.", | |
"type": "string" | |
}, | |
"expression": { | |
"title": "Expression", | |
"type": "string", | |
"description": "Specify an expression for the column, mutally exclusive from name." | |
}, | |
"collation": { | |
"title": "Column Collation", | |
"description": "Assigns a collation to the column (which must be of a collatable data type).\n", | |
"type": "string" | |
}, | |
"opclass": { | |
"title": "Operator Class", | |
"description": "The name of an operator class", | |
"type": "string" | |
} | |
}, | |
"additionalProperties": false | |
} | |
] | |
} | |
}, | |
"additionalProperties": false, | |
"required": [ | |
"type", | |
"columns" | |
] | |
}, | |
"partitions": { | |
"title": "Partitions", | |
"description": "Define partitions of the table", | |
"type": "array", | |
"items": { | |
"title": "Partition", | |
"description": "Defines a partition of the table", | |
"type": "object", | |
"properties": { | |
"schema": { | |
"title": "Schema", | |
"description": "The schema to create the table in", | |
"type": "string" | |
}, | |
"name": { | |
"title": "Name", | |
"description": "The table name", | |
"type": "string" | |
}, | |
"default": { | |
"title": "Default Partition", | |
"description": "Indicates that the partition is the default partition", | |
"type": "boolean" | |
}, | |
"for_values_in": { | |
"title": "Partition Values IN", | |
"description": "Used in LIST partitioning", | |
"type": "array", | |
"items": { | |
"anyOf": [ | |
{ | |
"type": "boolean" | |
}, | |
{ | |
"type": "integer" | |
}, | |
{ | |
"type": "number" | |
}, | |
{ | |
"type": "string" | |
} | |
] | |
} | |
}, | |
"for_values_from": { | |
"title": "Partition Values From", | |
"description": "Used in RANGE partitioning", | |
"onOf": [ | |
{ | |
"type": "integer" | |
}, | |
{ | |
"type": "number" | |
}, | |
{ | |
"type": "string" | |
} | |
] | |
}, | |
"for_values_to": { | |
"title": "Partition Values To", | |
"description": "Used in RANGE partitioning", | |
"onOf": [ | |
{ | |
"type": "integer" | |
}, | |
{ | |
"type": "number" | |
}, | |
{ | |
"type": "string" | |
} | |
] | |
}, | |
"for_values_with": { | |
"title": "Partition Values With Expression", | |
"description": "Used in HASH partitioning", | |
"type": "string" | |
}, | |
"comment": { | |
"title": "Comment", | |
"description": "An optional comment about the partition", | |
"type": "string" | |
} | |
}, | |
"required": [ | |
"schema", | |
"name" | |
], | |
"oneOf": [ | |
{ | |
"required": [ | |
"default" | |
], | |
"not": { | |
"required": [ | |
"for_values_in", | |
"for_values_from", | |
"for_values_to", | |
"for_values_when" | |
] | |
} | |
}, | |
{ | |
"required": [ | |
"for_values_in" | |
], | |
"not": { | |
"required": [ | |
"default", | |
"for_values_from", | |
"for_values_to", | |
"for_values_when" | |
] | |
} | |
}, | |
{ | |
"required": [ | |
"for_values_from", | |
"for_vlaues_to" | |
], | |
"not": { | |
"required": [ | |
"default", | |
"for_values_in", | |
"for_values_when" | |
] | |
} | |
}, | |
{ | |
"required": [ | |
"for_values_when" | |
], | |
"not": { | |
"required": [ | |
"default", | |
"for_values_in", | |
"for_values_from", | |
"for_values_to" | |
] | |
} | |
} | |
] | |
} | |
}, | |
"access_method": { | |
"title": "Storage Access Method", | |
"description": "Specifies the table access method to use to store the contents for the new table; the method needs be an access method of type TABLE.\n", | |
"type": "string" | |
}, | |
"storage_parameters": { | |
"title": "Storage Parameters", | |
"description": "Storage parameter settings for the table", | |
"type": "object", | |
"propertyNames": { | |
"pattern": "^[A-Za-z0-9_]*$" | |
} | |
}, | |
"tablespace": { | |
"title": "Tablespace", | |
"description": "Specifies the name of the tablespace in which the new table is to be created.\n", | |
"type": "string" | |
}, | |
"index_tablespace": { | |
"title": "Tablespace", | |
"description": "This clause allows selection of the tablespace in which the index associated with a UNIQUE, PRIMARY KEY, or EXCLUDE constraint will be created. If not specified, default_tablespace is consulted.\n", | |
"type": "string" | |
}, | |
"comment": { | |
"title": "Comment", | |
"description": "An optional comment about the table", | |
"type": "string" | |
}, | |
"dependencies": { | |
"title": "Dependencies", | |
"description": "Database objects this object is dependent upon", | |
"$schema": "http://json-schema.org/schema#", | |
"$id": "https://pglifecycle.readthedocs.io/en/stable/schemata/dependencies.html", | |
"type": "object", | |
"properties": { | |
"domains": { | |
"type": "array", | |
"propertyNames": { | |
"pattern": "^([A-Za-z0-9_\\-]+)\\.([A-Za-z0-9_\\-]+)$" | |
} | |
}, | |
"extensions": { | |
"type": "array", | |
"propertyNames": { | |
"pattern": "^([A-Za-z0-9_\\-]+)$" | |
} | |
}, | |
"foreign_data_wrappers": { | |
"type": "array", | |
"propertyNames": { | |
"pattern": "^([A-Za-z0-9_\\-]+)$" | |
} | |
}, | |
"functions": { | |
"type": "array", | |
"propertyNames": { | |
"pattern": "^([A-Za-z0-9_\\-]+).^([A-Za-z0-9_\\-]+)\\(^([A-Za-z0-9_\\-, ]+)\\)$" | |
} | |
}, | |
"languages": { | |
"type": "array", | |
"propertyNames": { | |
"pattern": "^([A-Za-z0-9_\\-]+)$" | |
} | |
}, | |
"sequences": { | |
"type": "array", | |
"propertyNames": { | |
"pattern": "^([A-Za-z0-9_\\-]+)\\.([A-Za-z0-9_\\-]+)$" | |
} | |
}, | |
"tables": { | |
"type": "array", | |
"propertyNames": { | |
"pattern": "^([A-Za-z0-9_\\-]+)\\.([A-Za-z0-9_\\-]+)$" | |
} | |
}, | |
"types": { | |
"type": "array", | |
"propertyNames": { | |
"pattern": "^([A-Za-z0-9_\\-]+)\\.([A-Za-z0-9_\\-]+)$" | |
} | |
} | |
}, | |
"additionalProperties": false | |
} | |
}, | |
"additionalProperties": false, | |
"required": [ | |
"schema", | |
"name" | |
], | |
"oneOf": [ | |
{ | |
"required": [ | |
"parents" | |
], | |
"not": { | |
"required": [ | |
"columns", | |
"sql" | |
] | |
} | |
}, | |
{ | |
"required": [ | |
"sql" | |
], | |
"not": { | |
"required": [ | |
"columns", | |
"parents" | |
] | |
} | |
}, | |
{ | |
"required": [ | |
"columns" | |
], | |
"not": { | |
"required": [ | |
"parents", | |
"sql" | |
] | |
} | |
} | |
] | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment