mirror of
https://github.com/tursodatabase/limbo.git
synced 2025-12-23 08:21:09 +00:00
Merge 'Simulator: fix alter table shadowing to modify index column name ' from Pedro Muniz
Forgot to modify the column name referenced in the indexes when shadowing Reviewed-by: bit-aloo (@Shourya742) Closes #3712
This commit is contained in:
commit
ebc4ddb2a2
1 changed files with 14 additions and 0 deletions
|
|
@ -579,10 +579,24 @@ impl Shadow for AlterTable {
|
|||
AlterTableType::AlterColumn { old, new } => {
|
||||
let col = table.columns.iter_mut().find(|c| c.name == *old).unwrap();
|
||||
*col = new.clone();
|
||||
table.indexes.iter_mut().for_each(|index| {
|
||||
index.columns.iter_mut().for_each(|(col_name, _)| {
|
||||
if col_name == old {
|
||||
*col_name = new.name.clone();
|
||||
}
|
||||
});
|
||||
});
|
||||
}
|
||||
AlterTableType::RenameColumn { old, new } => {
|
||||
let col = table.columns.iter_mut().find(|c| c.name == *old).unwrap();
|
||||
col.name = new.clone();
|
||||
table.indexes.iter_mut().for_each(|index| {
|
||||
index.columns.iter_mut().for_each(|(col_name, _)| {
|
||||
if col_name == old {
|
||||
*col_name = new.clone();
|
||||
}
|
||||
});
|
||||
});
|
||||
}
|
||||
AlterTableType::DropColumn { column_name } => {
|
||||
let col_idx = table
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue