doing the table definition columns in add_table

This commit is contained in:
Priec
2026-08-06 15:24:04 +02:00
parent 3c6aa56e27
commit f13def52c1
7 changed files with 134 additions and 12 deletions

View File

@@ -362,18 +362,69 @@ message DeleteTableResponse {
string message = 2;
}
// Response listing every column type a table may declare.
// How a column type is spelled in ColumnDefinition.field_type.
enum ColumnTypeSpelling {
// The name is the whole spelling: "text", "money", "gtin_13".
COLUMN_TYPE_SPELLING_BARE = 0;
// The name takes a precision and a scale: "decimal(12,3)". Precision must be
// at least 1 and scale no greater than precision; neither may carry a sign,
// a decimal point, or leading zeros.
COLUMN_TYPE_SPELLING_DECIMAL = 1;
}
// Response describing the whole column-type vocabulary.
//
// This is the authority a client builds its column-type picker from: every rule
// a client would otherwise hardcode about what a type means is a field here. The
// list covers types clients may NOT declare as well (see `declarable`), so that
// the same call also explains the types GetProfileDetails reports back for
// server-generated companion columns.
message ListColumnTypesResponse {
// One declared column type and the SQL type it maps to.
// One column type and everything a client needs to know to offer it.
message ColumnType {
// Logical column type (e.g. "money", "instant"). Passed to the server as
// ColumnDefinition.field_type.
// ColumnDefinition.field_type — see `spelling`, which is what says whether
// this name is the whole spelling.
string name = 1;
// Underlying PostgreSQL type the logical type maps to (e.g. "NUMERIC").
// Empty when `compound` is true. For COLUMN_TYPE_SPELLING_DECIMAL this is
// the unparameterised type; the declared precision and scale are appended.
string sql_type = 2;
// False for types the server generates on its own and rejects when a client
// declares them: the phone and IBAN companions, and the accounting-transfer
// connectors. A column-type picker must offer only declarable types.
bool declarable = 3;
// True when the type is a definition row rather than a column: it expands
// into several schema-managed companion columns and no column of this name
// survives. A compound type can therefore never be indexed, never be a row
// display column, and has no single sql_type of its own.
bool compound = 4;
// Whether `name` is the whole spelling or takes arguments.
ColumnTypeSpelling spelling = 5;
// Whether ColumnDefinition.currency is required. Currency is rejected on
// every type where this is false.
bool requires_currency = 6;
// True when the type may only be chosen while the table is being created.
// AddTableColumns rejects these, because they bring schema-managed columns
// that cannot be bolted onto a table that already exists.
bool creation_only = 7;
// Whether ColumnDefinition.quantity_ledger may be set on this type.
bool allows_quantity_ledger = 8;
// Optional name grouping several types a client offers behind one choice —
// "temporal" for the date and time types, "gtin" for the GTIN lengths.
// Empty when the type stands on its own.
string group = 9;
}
// All declared column types.
// Every column type, declarable or not, ordered by name.
repeated ColumnType column_types = 1;
}