put table definition

This commit is contained in:
Filipriec
2026-08-23 23:29:27 +02:00
parent 8dacb981bf
commit a44dccf84b
5 changed files with 158 additions and 2 deletions

View File

@@ -27,6 +27,11 @@ service TableDefinition {
// Existing columns, links, and table logic are never changed by this call.
rpc AddTableColumns(AddTableColumnsRequest) returns (TableDefinitionResponse);
// Atomically removes selected columns and appends new columns to an empty
// dynamic table. Column identities come from GetProfileDetails. The call is
// rejected after any row, including a soft-deleted row, has been stored.
rpc PutTableDefinition(PutTableDefinitionRequest) returns (PutTableDefinitionResponse);
// 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);
@@ -203,6 +208,31 @@ message AddTableColumnsRequest {
}
// One atomic structural edit to an existing empty table.
//
// Removals use stable column IDs rather than aliases. Generated companion
// columns must be removed together with their generating column. New columns
// follow the same contract as AddTableColumns.
message PutTableDefinitionRequest {
string profile_name = 1;
string table_name = 2;
repeated int64 remove_column_ids = 3;
repeated ColumnDefinition add_columns = 4;
repeated string add_indexes = 5;
repeated GeneratedColumnAlias generated_aliases = 6;
// Revision returned by GetProfileDetails. Prevents a stale editor from
// overwriting a newer structural or presentation change.
int64 expected_row_version = 7;
}
message PutTableDefinitionResponse {
bool success = 1;
string sql = 2;
int64 row_version = 3;
repeated int64 removed_column_ids = 4;
}
enum MoneyRounding {
MONEY_ROUNDING_NONE = 0;
MONEY_ROUNDING_HALF_UP = 1;