migration of the profile from the previous year

This commit is contained in:
Priec
2026-07-09 16:38:25 +02:00
parent 6711165c75
commit 2f7d7dcdbc
7 changed files with 136 additions and 3 deletions

Binary file not shown.

View File

@@ -142,6 +142,30 @@ pub struct GetProfileDetailsResponse {
#[prost(message, repeated, tag = "2")]
pub tables: ::prost::alloc::vec::Vec<TableDetail>,
}
/// Request to copy one full profile into a new profile.
#[derive(serde::Serialize, serde::Deserialize)]
#[derive(Clone, PartialEq, Eq, Hash, ::prost::Message)]
pub struct CopyProfileRequest {
#[prost(string, tag = "1")]
pub source_profile_name: ::prost::alloc::string::String,
#[prost(string, tag = "2")]
pub target_profile_name: ::prost::alloc::string::String,
#[prost(string, repeated, tag = "3")]
pub table_names: ::prost::alloc::vec::Vec<::prost::alloc::string::String>,
}
/// Response after copying a profile.
#[derive(serde::Serialize, serde::Deserialize)]
#[derive(Clone, PartialEq, Eq, Hash, ::prost::Message)]
pub struct CopyProfileResponse {
#[prost(bool, tag = "1")]
pub success: bool,
#[prost(string, tag = "2")]
pub message: ::prost::alloc::string::String,
#[prost(int32, tag = "3")]
pub tables_copied: i32,
#[prost(int32, tag = "4")]
pub scripts_copied: i32,
}
/// Request to fetch recorded column alias rename history for one profile.
#[derive(serde::Serialize, serde::Deserialize)]
#[derive(Clone, PartialEq, Eq, Hash, ::prost::Message)]
@@ -469,6 +493,36 @@ pub mod table_definition_client {
);
self.inner.unary(req, path, codec).await
}
/// Copies one complete profile into a new profile without copying table data.
pub async fn copy_profile(
&mut self,
request: impl tonic::IntoRequest<super::CopyProfileRequest>,
) -> std::result::Result<
tonic::Response<super::CopyProfileResponse>,
tonic::Status,
> {
self.inner
.ready()
.await
.map_err(|e| {
tonic::Status::unknown(
format!("Service was not ready: {}", e.into()),
)
})?;
let codec = tonic_prost::ProstCodec::default();
let path = http::uri::PathAndQuery::from_static(
"/komp_ac.table_definition.TableDefinition/CopyProfile",
);
let mut req = request.into_request();
req.extensions_mut()
.insert(
GrpcMethod::new(
"komp_ac.table_definition.TableDefinition",
"CopyProfile",
),
);
self.inner.unary(req, path, codec).await
}
/// Returns the stored rename history for column aliases in one profile.
pub async fn get_column_alias_rename_history(
&mut self,
@@ -611,6 +665,14 @@ pub mod table_definition_server {
tonic::Response<super::GetProfileDetailsResponse>,
tonic::Status,
>;
/// Copies one complete profile into a new profile without copying table data.
async fn copy_profile(
&self,
request: tonic::Request<super::CopyProfileRequest>,
) -> std::result::Result<
tonic::Response<super::CopyProfileResponse>,
tonic::Status,
>;
/// Returns the stored rename history for column aliases in one profile.
async fn get_column_alias_rename_history(
&self,
@@ -903,6 +965,51 @@ pub mod table_definition_server {
};
Box::pin(fut)
}
"/komp_ac.table_definition.TableDefinition/CopyProfile" => {
#[allow(non_camel_case_types)]
struct CopyProfileSvc<T: TableDefinition>(pub Arc<T>);
impl<
T: TableDefinition,
> tonic::server::UnaryService<super::CopyProfileRequest>
for CopyProfileSvc<T> {
type Response = super::CopyProfileResponse;
type Future = BoxFuture<
tonic::Response<Self::Response>,
tonic::Status,
>;
fn call(
&mut self,
request: tonic::Request<super::CopyProfileRequest>,
) -> Self::Future {
let inner = Arc::clone(&self.0);
let fut = async move {
<T as TableDefinition>::copy_profile(&inner, request).await
};
Box::pin(fut)
}
}
let accept_compression_encodings = self.accept_compression_encodings;
let send_compression_encodings = self.send_compression_encodings;
let max_decoding_message_size = self.max_decoding_message_size;
let max_encoding_message_size = self.max_encoding_message_size;
let inner = self.inner.clone();
let fut = async move {
let method = CopyProfileSvc(inner);
let codec = tonic_prost::ProstCodec::default();
let mut grpc = tonic::server::Grpc::new(codec)
.apply_compression_config(
accept_compression_encodings,
send_compression_encodings,
)
.apply_max_message_size_config(
max_decoding_message_size,
max_encoding_message_size,
);
let res = grpc.unary(method, req).await;
Ok(res)
};
Box::pin(fut)
}
"/komp_ac.table_definition.TableDefinition/GetColumnAliasRenameHistory" => {
#[allow(non_camel_case_types)]
struct GetColumnAliasRenameHistorySvc<T: TableDefinition>(