add-table
Create a new table in the Xano database by specifying its name, description, and schema configuration, including field types, validation rules, and access levels.
Instructions
Add a new table to the Xano database
Input Schema
Name | Required | Description | Default |
---|---|---|---|
description | No | Description of the table | |
name | Yes | Name of the table | |
schema | No | Schema configuration for the table. For foreign key relationships, use type 'int' with tableref_id. Example: { "name": "contact_id", "type": "int", "description": "Reference to contact table", "nullable": false, "required": false, "access": "public", "style": "single", "default": "0", "tableref_id": "100" // ID of the table to reference } |
Input Schema (JSON Schema)
{
"$schema": "http://json-schema.org/draft-07/schema#",
"additionalProperties": false,
"properties": {
"description": {
"description": "Description of the table",
"type": "string"
},
"name": {
"description": "Name of the table",
"type": "string"
},
"schema": {
"description": "Schema configuration for the table. For foreign key relationships, use type 'int' with tableref_id. Example:\n {\n \"name\": \"contact_id\",\n \"type\": \"int\",\n \"description\": \"Reference to contact table\",\n \"nullable\": false,\n \"required\": false,\n \"access\": \"public\",\n \"style\": \"single\",\n \"default\": \"0\",\n \"tableref_id\": \"100\" // ID of the table to reference\n }",
"items": {
"additionalProperties": false,
"properties": {
"access": {
"default": "public",
"description": "Access level for the field",
"enum": [
"public",
"private",
"internal"
],
"type": "string"
},
"children": {
"description": "Nested fields for object types",
"type": "array"
},
"config": {
"additionalProperties": {},
"description": "Additional configuration for specific field types",
"type": "object"
},
"default": {
"description": "Default value for the field",
"type": "string"
},
"description": {
"description": "Description of the schema element",
"type": "string"
},
"name": {
"description": "Name of the schema element",
"type": "string"
},
"nullable": {
"default": false,
"description": "Whether the field can be null",
"type": "boolean"
},
"required": {
"default": false,
"description": "Whether the field is required",
"type": "boolean"
},
"style": {
"default": "single",
"description": "Whether the field is a single value or a list",
"enum": [
"single",
"list"
],
"type": "string"
},
"tableref_id": {
"description": "ID of the referenced table (only valid when type is 'int')",
"type": "string"
},
"type": {
"description": "Type of the schema element",
"enum": [
"attachment",
"audio",
"bool",
"date",
"decimal",
"email",
"enum",
"geo_linestring",
"geo_multilinestring",
"geo_multipoint",
"geo_multipolygon",
"geo_point",
"geo_polygon",
"image",
"int",
"json",
"object",
"password",
"tablerefuuid",
"text",
"timestamp",
"uuid",
"vector",
"video"
],
"type": "string"
},
"validators": {
"additionalProperties": false,
"description": "Validation rules for the field",
"properties": {
"lower": {
"type": "boolean"
},
"max": {
"type": "number"
},
"maxLength": {
"type": "number"
},
"min": {
"type": "number"
},
"minLength": {
"type": "number"
},
"pattern": {
"type": "string"
},
"precision": {
"type": "number"
},
"scale": {
"type": "number"
},
"trim": {
"type": "boolean"
}
},
"type": "object"
},
"values": {
"description": "Array of allowed values (only for enum type)",
"items": {
"type": "string"
},
"type": "array"
}
},
"required": [
"name",
"type"
],
"type": "object"
},
"type": "array"
}
},
"required": [
"name"
],
"type": "object"
}