aliasing2

This commit is contained in:
Priec
2026-08-13 14:24:34 +02:00
parent 27d3e9af34
commit 5fe630fff7
6 changed files with 53 additions and 37 deletions

View File

@@ -13,10 +13,7 @@
use crate::schema::{ColumnCatalog, ColumnDraft, columns_from_rows};
use super::draft::{
ACCOUNT_API_COLUMN, ACCOUNTING_FIELD_TYPE, ACCOUNTING_TRANSFER_FIELD_TYPE, GeneratedAlias,
TableDraft,
};
use super::draft::{ACCOUNT_API_COLUMN, ACCOUNTING_FIELD_TYPE, GeneratedAlias, TableDraft};
/// The `profile_name` option meaning "create a new profile too".
pub(crate) const NEW_PROFILE: &str = "__new__";
@@ -227,10 +224,11 @@ impl AddTablePageState {
});
// A generated column is named by the backend, but the name is a
// display name: it can be aliased, and the alias is applied as a
// rename the moment the table exists. The connectors of an
// ACCOUNTING_TRANSFER are the exception the backend protects.
let aliasable = column.data_type != ACCOUNTING_TRANSFER_FIELD_TYPE;
// display name, and ACCOUNTING's columns can be given one of the
// user's own in the request that creates them. Only ACCOUNTING's:
// see `TableDraft::aliasable_generated_columns` for why the other
// generated columns cannot be renamed at all.
let aliasable = column.data_type == ACCOUNTING_FIELD_TYPE;
for generated in columns.generated_columns_of(index) {
let mut tags = vec![format!("generated by {}", column.data_type)];