aliasing now move column position also
This commit is contained in:
@@ -89,6 +89,7 @@ impl TableDetailView {
|
||||
/// Columns a rename may target. Provenance and renameability are separate:
|
||||
/// accounting companions remain renameable while protected generated
|
||||
/// columns do not.
|
||||
#[cfg(test)]
|
||||
pub(crate) fn renameable_columns(&self) -> Vec<&DetailColumn> {
|
||||
self.columns
|
||||
.iter()
|
||||
@@ -99,6 +100,7 @@ impl TableDetailView {
|
||||
|
||||
#[derive(Clone, Debug)]
|
||||
pub(crate) struct DetailColumn {
|
||||
pub column_id: i64,
|
||||
pub name: String,
|
||||
pub field_type: String,
|
||||
/// The PostgreSQL type the column is stored as, from the column-type
|
||||
@@ -173,15 +175,17 @@ pub(crate) struct GeneratedTableView {
|
||||
/// The rename panel's inputs, kept across a failed submit so the user does not
|
||||
/// retype them.
|
||||
#[derive(Clone, Debug, Default, serde::Deserialize)]
|
||||
pub(crate) struct RenameForm {
|
||||
pub(crate) struct PresentationForm {
|
||||
#[serde(default)]
|
||||
pub profile: String,
|
||||
#[serde(default)]
|
||||
pub table: String,
|
||||
#[serde(default)]
|
||||
pub old_column_name: String,
|
||||
pub column_ids: Vec<i64>,
|
||||
#[serde(default)]
|
||||
pub new_column_name: String,
|
||||
pub aliases: Vec<String>,
|
||||
#[serde(default)]
|
||||
pub action: String,
|
||||
}
|
||||
|
||||
/// The copy-profile panel. An empty `table_names` copies the whole profile,
|
||||
@@ -241,7 +245,7 @@ pub(crate) struct PageInputs {
|
||||
pub selection: Selection,
|
||||
/// The columns staged for `AddTableColumns`.
|
||||
pub columns: ColumnDraft,
|
||||
pub rename: RenameForm,
|
||||
pub presentation: PresentationForm,
|
||||
pub copy: CopyForm,
|
||||
pub invoice: InvoiceTemplateForm,
|
||||
pub status: Option<String>,
|
||||
@@ -278,7 +282,6 @@ pub(crate) struct TableDefinitionPageState {
|
||||
pub detail: Option<TableDetailView>,
|
||||
pub history: Vec<RenameEntry>,
|
||||
pub columns: ColumnDraft,
|
||||
pub rename: RenameForm,
|
||||
pub copy: CopyForm,
|
||||
pub invoice: InvoiceTemplateForm,
|
||||
pub status: Option<String>,
|
||||
@@ -388,6 +391,7 @@ mod tests {
|
||||
scripts: Vec::new(),
|
||||
columns: vec![
|
||||
DetailColumn {
|
||||
column_id: 1,
|
||||
name: "work_phone".to_string(),
|
||||
field_type: "phone".to_string(),
|
||||
sql_type: "TEXT".to_string(),
|
||||
@@ -400,6 +404,7 @@ mod tests {
|
||||
renameable: true,
|
||||
},
|
||||
DetailColumn {
|
||||
column_id: 2,
|
||||
name: "work_phone_country".to_string(),
|
||||
field_type: "phone_country".to_string(),
|
||||
sql_type: "TEXT".to_string(),
|
||||
@@ -412,6 +417,7 @@ mod tests {
|
||||
renameable: false,
|
||||
},
|
||||
DetailColumn {
|
||||
column_id: 3,
|
||||
name: "charge".to_string(),
|
||||
field_type: "money".to_string(),
|
||||
sql_type: "NUMERIC".to_string(),
|
||||
|
||||
Reference in New Issue
Block a user