currency per column in table definition

This commit is contained in:
Priec
2026-08-03 15:48:21 +02:00
parent 023f8c9dcb
commit 050f93e1fd
16 changed files with 87 additions and 105 deletions

View File

@@ -30,7 +30,6 @@ message AnalyticsTable {
string name = 2;
repeated AnalyticsCatalogColumn columns = 3;
repeated AnalyticsTableLink links = 4;
string base_currency = 5;
}
message AnalyticsCatalogColumn {
@@ -39,6 +38,8 @@ message AnalyticsCatalogColumn {
string field_type = 2;
bool is_system = 3;
string rounding = 4;
// Canonical ISO-4217 code for MONEY; empty for every other type.
string currency = 5;
}
message AnalyticsTableLink {

View File

@@ -83,9 +83,6 @@ message PostTableDefinitionRequest {
// like "public", "information_schema", or ones starting with "pg_".
string profile_name = 5;
// ISO-4217 base currency used by every MONEY column in this table.
string base_currency = 6;
// Columns whose values identify a row to users in pickers, in the order
// they are shown. Each must name one of the user-defined columns above.
// Empty means the row is identified by its id alone.
@@ -94,7 +91,7 @@ message PostTableDefinitionRequest {
// ISO-4217 currency the profile keeps its accounting in. A profile is one
// accounting entity and keeps one set of books, so this is required only when
// the request creates the profile, and is ignored afterwards. It is unrelated
// to base_currency: tables may hold money in any currency, and amounts convert
// to individual MONEY-column currencies: tables may hold money in any currency, and amounts convert
// to this one when they reach the ledger.
string accounting_currency = 8;
}
@@ -116,7 +113,6 @@ message CreateInvoiceTemplateTableRequest {
string profile_name = 1;
string table_name = 2;
string typst_source = 3;
string base_currency = 4;
repeated string row_display_columns = 5;
}
@@ -150,9 +146,6 @@ message AddTableColumnsRequest {
// Optional indexes for the new columns only.
repeated string indexes = 4;
// Required when adding the first MONEY column to a table.
string base_currency = 5;
}
enum MoneyRounding {
@@ -176,7 +169,7 @@ message ColumnDefinition {
// RAW_DATETIME (timezone-free civil datetime)
// PHONE (international or national phone number; generates extension/type/country/calling-code companions)
// TIME (timezone-free time of day)
// MONEY (= unconstrained NUMERIC; currency comes from the table)
// MONEY (= unconstrained NUMERIC; currency is declared below)
// ACCOUNTING (creates schema-managed name, account, debit, and credit fields;
// account always selects a row from the profile's managed accounts table;
// name is limited to 10 characters and one stored row contributes
@@ -197,6 +190,10 @@ message ColumnDefinition {
// When true, this numeric column is server-owned and projected from the
// profile quantity ledger.
bool quantity_ledger = 4;
// Canonical uppercase ISO-4217 currency code. Required for MONEY and forbidden
// for every other field type.
string currency = 5;
}
// Response after table creation (success + DDL preview).
@@ -299,7 +296,6 @@ message TableDetail {
int64 id = 2;
repeated ColumnDefinition columns = 3;
repeated ScriptInfo scripts = 4;
string base_currency = 5;
repeated string row_display_columns = 6;
map<string, ColumnBehavior> column_behaviors = 7;
string table_kind = 8;

View File

@@ -210,8 +210,8 @@ message HydratedColumnValue {
string value = 4;
// Logical database type used to create a typed client ScriptValue.
string field_type = 5;
// Related table's base currency for MONEY values; otherwise empty.
string base_currency = 6;
// Related MONEY column's currency; otherwise empty.
string currency = 6;
}
// One declared related-collection aggregate input for the client Steel context.
@@ -229,8 +229,8 @@ message HydratedAggregateValue {
string value = 5;
// Logical source-column type; empty for row-only aggregates.
string field_type = 6;
// Aggregate table's base currency for MONEY values; otherwise empty.
string base_currency = 7;
// Aggregated MONEY column's currency; otherwise empty.
string currency = 7;
}
// Complete external dependency snapshot for client-side Steel execution.