diff --git a/client-gui2 b/client-gui2 index aa345299..140708f7 160000 --- a/client-gui2 +++ b/client-gui2 @@ -1 +1 @@ -Subproject commit aa345299911882a251cd5628087f1243a28ac194 +Subproject commit 140708f7574f9f1a1efae229dd031699485290b0 diff --git a/common/proto/table_definition.proto b/common/proto/table_definition.proto index 68513738..cb3b3264 100644 --- a/common/proto/table_definition.proto +++ b/common/proto/table_definition.proto @@ -387,6 +387,31 @@ message PutTableDefinitionRequest { // Required physical/catalog name. Use table_name to keep the current name. string new_table_name = 8; + + // Complete desired definition of an empty table, in catalog ordinal order. + // Aliases remain attached to their column IDs. Retained physical columns + // are not rebuilt or renamed; new columns use the existing append operation. + // Cannot be combined with remove_column_ids or add_columns. add_indexes and + // generated_aliases apply to the new columns in this definition. + optional EmptyTableDefinition replacement = 9; +} + +message EmptyTableDefinition { + // Omitted existing columns are removed, subject to dependency checks. + // Retained generated companions follow their parent automatically. + repeated EmptyTableColumn columns = 1; +} + +message EmptyTableColumn { + oneof column { + // Retains identity, configuration and dependencies. Generated companions + // must be retained through their parent, not listed separately. + int64 existing_column_id = 1; + + // Same input as table creation. To change an existing column's type, + // omit its ID and supply a new definition; removal guards still apply. + ColumnDefinition new_column = 2; + } } message PutTableDefinitionResponse { diff --git a/common/src/proto/descriptor.bin b/common/src/proto/descriptor.bin index d9a24ec1..d8e28487 100644 Binary files a/common/src/proto/descriptor.bin and b/common/src/proto/descriptor.bin differ diff --git a/common/src/proto/komp_ac.table_definition.rs b/common/src/proto/komp_ac.table_definition.rs index 68076449..c76ba5c6 100644 --- a/common/src/proto/komp_ac.table_definition.rs +++ b/common/src/proto/komp_ac.table_definition.rs @@ -352,6 +352,42 @@ pub struct PutTableDefinitionRequest { /// Required physical/catalog name. Use table_name to keep the current name. #[prost(string, tag = "8")] pub new_table_name: ::prost::alloc::string::String, + /// Complete desired definition of an empty table, in catalog ordinal order. + /// Aliases remain attached to their column IDs. Retained physical columns + /// are not rebuilt or renamed; new columns use the existing append operation. + /// Cannot be combined with remove_column_ids or add_columns. add_indexes and + /// generated_aliases apply to the new columns in this definition. + #[prost(message, optional, tag = "9")] + pub replacement: ::core::option::Option, +} +#[derive(serde::Serialize, serde::Deserialize)] +#[derive(Clone, PartialEq, ::prost::Message)] +pub struct EmptyTableDefinition { + /// Omitted existing columns are removed, subject to dependency checks. + /// Retained generated companions follow their parent automatically. + #[prost(message, repeated, tag = "1")] + pub columns: ::prost::alloc::vec::Vec, +} +#[derive(serde::Serialize, serde::Deserialize)] +#[derive(Clone, PartialEq, Eq, Hash, ::prost::Message)] +pub struct EmptyTableColumn { + #[prost(oneof = "empty_table_column::Column", tags = "1, 2")] + pub column: ::core::option::Option, +} +/// Nested message and enum types in `EmptyTableColumn`. +pub mod empty_table_column { + #[derive(serde::Serialize, serde::Deserialize)] + #[derive(Clone, PartialEq, Eq, Hash, ::prost::Oneof)] + pub enum Column { + /// Retains identity, configuration and dependencies. Generated companions + /// must be retained through their parent, not listed separately. + #[prost(int64, tag = "1")] + ExistingColumnId(i64), + /// Same input as table creation. To change an existing column's type, + /// omit its ID and supply a new definition; removal guards still apply. + #[prost(message, tag = "2")] + NewColumn(super::ColumnDefinition), + } } #[derive(serde::Serialize, serde::Deserialize)] #[derive(Clone, PartialEq, Eq, Hash, ::prost::Message)] diff --git a/server b/server index 5f677fb3..cc11a00a 160000 --- a/server +++ b/server @@ -1 +1 @@ -Subproject commit 5f677fb39281688ac0617cd41d08b2e46a6f5d3b +Subproject commit cc11a00a69975c6e505a0349c882c61ea327394c diff --git a/web/src/pages/admin/table_definition/logic.rs b/web/src/pages/admin/table_definition/logic.rs index 4c5746ef..7b9db2bb 100644 --- a/web/src/pages/admin/table_definition/logic.rs +++ b/web/src/pages/admin/table_definition/logic.rs @@ -331,6 +331,7 @@ pub(crate) async fn add_columns( generated_aliases: Vec::new(), expected_row_version: form.expected_row_version, new_table_name: requested_table_name.clone(), + replacement: None, }; let Ok(request) = authenticated_request(&headers, request) else { return Redirect::to("/login").into_response();