multirow FK

This commit is contained in:
Priec
2026-08-07 22:39:59 +02:00
parent c47e236713
commit 0d78556428
10 changed files with 46 additions and 216 deletions

View File

@@ -48,19 +48,6 @@ service TableDefinition {
rpc DeleteTable(DeleteTableRequest) returns (DeleteTableResponse);
}
// A single link to another table within the same profile (schema).
message TableLink {
// Name of an existing table within the same profile to link to.
// For each link, a "<linked>_id" column is created on the new table.
// That column references "<linked>"(id) and adds an index automatically.
string linked_table_name = 1;
// If true, the generated foreign key column is NOT NULL.
// Otherwise the column allows NULL.
// Duplicate links to the same target table in one request are rejected.
bool required = 2;
}
// Defines the input for creating a new table definition.
message PostTableDefinitionRequest {
// Table name to create inside the target profile.
@@ -69,10 +56,6 @@ message PostTableDefinitionRequest {
// Forbidden names: "id", "deleted", "created_at", "row_revision", or ending in "_id".
string table_name = 1;
// List of links (foreign keys) to existing tables in the same profile.
// Each will automatically get a "<linked>_id" column and an index.
repeated TableLink links = 2;
// List of user-defined columns (adds to system/id/fk columns).
repeated ColumnDefinition columns = 3;
@@ -187,6 +170,9 @@ message ColumnDefinition {
// DURATION
// PERIOD
// DECIMAL(p,s) → NUMERIC(p,s)
// LINK(table) → BIGINT referencing that table in the same profile, indexed
// automatically. A table may hold several links to the same
// target as long as the columns are named differently.
// DECIMAL args must be integers (no sign, no dot, no leading zeros);
// s ≤ p and p ≥ 1.
string field_type = 2;
@@ -371,6 +357,12 @@ enum ColumnTypeSpelling {
// 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;
// The name takes the name of another table in the same profile:
// "link(adresar)". The column holds that table's id, and the server creates
// the foreign key and its index. A picker offers the profile's other tables
// as the argument.
COLUMN_TYPE_SPELLING_LINK = 2;
}
// Response describing the whole column-type vocabulary.