money without backwards compatibility2
This commit is contained in:
@@ -169,10 +169,6 @@ fn main() -> Result<(), Box<dyn std::error::Error>> {
|
|||||||
".komp_ac.table_definition.AddTableColumnsRequest",
|
".komp_ac.table_definition.AddTableColumnsRequest",
|
||||||
"#[derive(serde::Serialize, serde::Deserialize)]",
|
"#[derive(serde::Serialize, serde::Deserialize)]",
|
||||||
)
|
)
|
||||||
.type_attribute(
|
|
||||||
".komp_ac.table_definition.MoneyColumnOptions",
|
|
||||||
"#[derive(serde::Serialize, serde::Deserialize)]",
|
|
||||||
)
|
|
||||||
.type_attribute(
|
.type_attribute(
|
||||||
".komp_ac.table_definition.TableDefinitionResponse",
|
".komp_ac.table_definition.TableDefinitionResponse",
|
||||||
"#[derive(serde::Serialize, serde::Deserialize)]"
|
"#[derive(serde::Serialize, serde::Deserialize)]"
|
||||||
|
|||||||
@@ -78,9 +78,8 @@ message PostTableDefinitionRequest {
|
|||||||
// like "public", "information_schema", or ones starting with "pg_".
|
// like "public", "information_schema", or ones starting with "pg_".
|
||||||
string profile_name = 5;
|
string profile_name = 5;
|
||||||
|
|
||||||
|
// ISO-4217 base currency used by every MONEY column in this table.
|
||||||
string base_currency = 6;
|
string base_currency = 6;
|
||||||
repeated MoneyColumnOptions money_columns = 7;
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// Defines append-only column additions for an existing table.
|
// Defines append-only column additions for an existing table.
|
||||||
@@ -97,8 +96,8 @@ message AddTableColumnsRequest {
|
|||||||
// Optional indexes for the new columns only.
|
// Optional indexes for the new columns only.
|
||||||
repeated string indexes = 4;
|
repeated string indexes = 4;
|
||||||
|
|
||||||
repeated MoneyColumnOptions money_columns = 5;
|
// Required when adding the first MONEY column to a table.
|
||||||
string base_currency = 6;
|
string base_currency = 5;
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -107,12 +106,6 @@ enum MoneyRounding {
|
|||||||
MONEY_ROUNDING_HALF_UP = 1;
|
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.
|
// Describes one user-defined column for a table.
|
||||||
message ColumnDefinition {
|
message ColumnDefinition {
|
||||||
// Column name that follows the same validation rules as table_name.
|
// 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);
|
// DECIMAL args must be integers (no sign, no dot, no leading zeros);
|
||||||
// s ≤ p and p ≥ 1.
|
// s ≤ p and p ≥ 1.
|
||||||
string field_type = 2;
|
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).
|
// Response after table creation (success + DDL preview).
|
||||||
@@ -229,7 +228,6 @@ message TableDetail {
|
|||||||
repeated ColumnDefinition columns = 3;
|
repeated ColumnDefinition columns = 3;
|
||||||
repeated ScriptInfo scripts = 4;
|
repeated ScriptInfo scripts = 4;
|
||||||
string base_currency = 5;
|
string base_currency = 5;
|
||||||
repeated MoneyColumnOptions money_columns = 6;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// A script that targets a specific column in a table.
|
// A script that targets a specific column in a table.
|
||||||
|
|||||||
Binary file not shown.
@@ -42,10 +42,9 @@ pub struct PostTableDefinitionRequest {
|
|||||||
/// like "public", "information_schema", or ones starting with "pg\_".
|
/// like "public", "information_schema", or ones starting with "pg\_".
|
||||||
#[prost(string, tag = "5")]
|
#[prost(string, tag = "5")]
|
||||||
pub profile_name: ::prost::alloc::string::String,
|
pub profile_name: ::prost::alloc::string::String,
|
||||||
|
/// ISO-4217 base currency used by every MONEY column in this table.
|
||||||
#[prost(string, tag = "6")]
|
#[prost(string, tag = "6")]
|
||||||
pub base_currency: ::prost::alloc::string::String,
|
pub base_currency: ::prost::alloc::string::String,
|
||||||
#[prost(message, repeated, tag = "7")]
|
|
||||||
pub money_columns: ::prost::alloc::vec::Vec<MoneyColumnOptions>,
|
|
||||||
}
|
}
|
||||||
/// Defines append-only column additions for an existing table.
|
/// Defines append-only column additions for an existing table.
|
||||||
#[derive(serde::Serialize, serde::Deserialize)]
|
#[derive(serde::Serialize, serde::Deserialize)]
|
||||||
@@ -63,21 +62,10 @@ pub struct AddTableColumnsRequest {
|
|||||||
/// Optional indexes for the new columns only.
|
/// Optional indexes for the new columns only.
|
||||||
#[prost(string, repeated, tag = "4")]
|
#[prost(string, repeated, tag = "4")]
|
||||||
pub indexes: ::prost::alloc::vec::Vec<::prost::alloc::string::String>,
|
pub indexes: ::prost::alloc::vec::Vec<::prost::alloc::string::String>,
|
||||||
#[prost(message, repeated, tag = "5")]
|
/// Required when adding the first MONEY column to a table.
|
||||||
pub money_columns: ::prost::alloc::vec::Vec<MoneyColumnOptions>,
|
#[prost(string, tag = "5")]
|
||||||
#[prost(string, tag = "6")]
|
|
||||||
pub base_currency: ::prost::alloc::string::String,
|
pub base_currency: ::prost::alloc::string::String,
|
||||||
}
|
}
|
||||||
#[derive(serde::Serialize, serde::Deserialize)]
|
|
||||||
#[derive(Clone, PartialEq, Eq, Hash, ::prost::Message)]
|
|
||||||
pub struct MoneyColumnOptions {
|
|
||||||
#[prost(string, tag = "1")]
|
|
||||||
pub column_name: ::prost::alloc::string::String,
|
|
||||||
#[prost(bool, tag = "2")]
|
|
||||||
pub immutable: bool,
|
|
||||||
#[prost(enumeration = "MoneyRounding", tag = "3")]
|
|
||||||
pub rounding: i32,
|
|
||||||
}
|
|
||||||
/// Describes one user-defined column for a table.
|
/// Describes one user-defined column for a table.
|
||||||
#[derive(serde::Serialize, serde::Deserialize)]
|
#[derive(serde::Serialize, serde::Deserialize)]
|
||||||
#[derive(Clone, PartialEq, Eq, Hash, ::prost::Message)]
|
#[derive(Clone, PartialEq, Eq, Hash, ::prost::Message)]
|
||||||
@@ -100,6 +88,12 @@ pub struct ColumnDefinition {
|
|||||||
/// s ≤ p and p ≥ 1.
|
/// s ≤ p and p ≥ 1.
|
||||||
#[prost(string, tag = "2")]
|
#[prost(string, tag = "2")]
|
||||||
pub field_type: ::prost::alloc::string::String,
|
pub field_type: ::prost::alloc::string::String,
|
||||||
|
/// Once initially stored, this column can never be changed.
|
||||||
|
#[prost(bool, tag = "3")]
|
||||||
|
pub immutable: bool,
|
||||||
|
/// MONEY rounding applied before an immutable value is initially stored.
|
||||||
|
#[prost(enumeration = "MoneyRounding", tag = "4")]
|
||||||
|
pub rounding: i32,
|
||||||
}
|
}
|
||||||
/// Response after table creation (success + DDL preview).
|
/// Response after table creation (success + DDL preview).
|
||||||
#[derive(serde::Serialize, serde::Deserialize)]
|
#[derive(serde::Serialize, serde::Deserialize)]
|
||||||
@@ -235,8 +229,6 @@ pub struct TableDetail {
|
|||||||
pub scripts: ::prost::alloc::vec::Vec<ScriptInfo>,
|
pub scripts: ::prost::alloc::vec::Vec<ScriptInfo>,
|
||||||
#[prost(string, tag = "5")]
|
#[prost(string, tag = "5")]
|
||||||
pub base_currency: ::prost::alloc::string::String,
|
pub base_currency: ::prost::alloc::string::String,
|
||||||
#[prost(message, repeated, tag = "6")]
|
|
||||||
pub money_columns: ::prost::alloc::vec::Vec<MoneyColumnOptions>,
|
|
||||||
}
|
}
|
||||||
/// A script that targets a specific column in a table.
|
/// A script that targets a specific column in a table.
|
||||||
#[derive(Clone, PartialEq, Eq, Hash, ::prost::Message)]
|
#[derive(Clone, PartialEq, Eq, Hash, ::prost::Message)]
|
||||||
|
|||||||
Reference in New Issue
Block a user