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

@@ -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;