money without backwards compatibility2

This commit is contained in:
Priec
2026-07-12 22:29:22 +02:00
parent 68f0dc7b24
commit ca1bbf84fb
4 changed files with 18 additions and 32 deletions

View File

@@ -78,9 +78,8 @@ 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;
repeated MoneyColumnOptions money_columns = 7;
}
// Defines append-only column additions for an existing table.
@@ -97,8 +96,8 @@ message AddTableColumnsRequest {
// Optional indexes for the new columns only.
repeated string indexes = 4;
repeated MoneyColumnOptions money_columns = 5;
string base_currency = 6;
// Required when adding the first MONEY column to a table.
string base_currency = 5;
}
@@ -107,12 +106,6 @@ enum MoneyRounding {
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.
message ColumnDefinition {
// Column name that follows the same validation rules as table_name.
@@ -132,6 +125,12 @@ message ColumnDefinition {
// DECIMAL args must be integers (no sign, no dot, no leading zeros);
// s ≤ p and p ≥ 1.
string field_type = 2;
// Once initially stored, this column can never be changed.
bool immutable = 3;
// MONEY rounding applied before an immutable value is initially stored.
MoneyRounding rounding = 4;
}
// Response after table creation (success + DDL preview).
@@ -229,7 +228,6 @@ message TableDetail {
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.