This commit is contained in:
Priec
2026-07-12 22:08:51 +02:00
parent 96c6ed6bec
commit b73105dbda
7 changed files with 303 additions and 12 deletions

View File

@@ -14,10 +14,16 @@ service TableDefinition {
// Also inserts metadata and default validation rules. Entirely transactional.
rpc PostTableDefinition(PostTableDefinitionRequest) returns (TableDefinitionResponse);
// Creates a table using the money-aware definition contract.
rpc PostMoneyTableDefinition(PostMoneyTableDefinitionRequest) returns (TableDefinitionResponse);
// Appends new user-defined columns to an existing table.
// Existing columns, links, and table logic are never changed by this call.
rpc AddTableColumns(AddTableColumnsRequest) returns (TableDefinitionResponse);
// Adds columns using the money-aware definition contract.
rpc AddMoneyTableColumns(AddMoneyTableColumnsRequest) returns (TableDefinitionResponse);
// Lists all profiles (schemas) and their tables with declared dependencies.
// This provides a tree-like overview of table relationships.
rpc GetProfileTree(komp_ac.common.Empty) returns (ProfileTreeResponse);
@@ -77,6 +83,13 @@ message PostTableDefinitionRequest {
// Same naming rules as table_name; cannot collide with reserved schemas
// like "public", "information_schema", or ones starting with "pg_".
string profile_name = 5;
}
message PostMoneyTableDefinitionRequest {
PostTableDefinitionRequest definition = 1;
string base_currency = 2;
repeated MoneyColumnOptions money_columns = 3;
}
// Defines append-only column additions for an existing table.
@@ -92,6 +105,24 @@ message AddTableColumnsRequest {
// Optional indexes for the new columns only.
repeated string indexes = 4;
}
message AddMoneyTableColumnsRequest {
AddTableColumnsRequest definition = 1;
repeated MoneyColumnOptions money_columns = 2;
string base_currency = 3;
}
enum MoneyRounding {
MONEY_ROUNDING_NONE = 0;
MONEY_ROUNDING_HALF_UP = 1;
}
message MoneyColumnOptions {
string column_name = 1;
bool immutable = 2;
MoneyRounding rounding = 3;
}
// Describes one user-defined column for a table.
@@ -102,12 +133,12 @@ message ColumnDefinition {
string name = 1;
// Logical column type. Supported values (case-insensitive):
// TEXT / STRING
// TEXT
// BOOLEAN
// TIMESTAMP / TIMESTAMPTZ / TIME
// MONEY (= NUMERIC(14,4))
// INTEGER / INT
// BIGINTEGER / BIGINT
// TIMESTAMPTZ
// MONEY (= unconstrained NUMERIC; currency comes from the table)
// INT
// BIGINT
// DATE
// DECIMAL(p,s) → NUMERIC(p,s)
// DECIMAL args must be integers (no sign, no dot, no leading zeros);
@@ -209,6 +240,8 @@ message TableDetail {
int64 id = 2;
repeated ColumnDefinition columns = 3;
repeated ScriptInfo scripts = 4;
string base_currency = 5;
repeated MoneyColumnOptions money_columns = 6;
}
// A script that targets a specific column in a table.