mirror of
https://github.com/t8y2/dbx.git
synced 2026-10-20 00:17:44 +00:00
fix(mysql): collapse storage warning guard and update generated draft expectation
This commit is contained in:
@@ -83,14 +83,15 @@ pub(super) fn build_column_sql(options: &TableStructureSqlOptions, warnings: &mu
|
||||
}
|
||||
}
|
||||
None => {}
|
||||
Some((_, original_storage)) => {
|
||||
if normalize_mysql_generated_storage(generated.storage.as_deref()) != original_storage {
|
||||
warnings.push(format!(
|
||||
"Column \"{}\": MySQL cannot switch a generated column between VIRTUAL and STORED in place; the column must be dropped and re-added.",
|
||||
column.name
|
||||
));
|
||||
}
|
||||
Some((_, original_storage))
|
||||
if normalize_mysql_generated_storage(generated.storage.as_deref()) != original_storage =>
|
||||
{
|
||||
warnings.push(format!(
|
||||
"Column \"{}\": MySQL cannot switch a generated column between VIRTUAL and STORED in place; the column must be dropped and re-added.",
|
||||
column.name
|
||||
));
|
||||
}
|
||||
Some(_) => {}
|
||||
}
|
||||
}
|
||||
} else if let Some((_, original_storage)) = original_generated {
|
||||
|
||||
+3
-1
@@ -136,7 +136,9 @@ test("preserves MySQL generated expressions in original column metadata", () =>
|
||||
"mysql",
|
||||
);
|
||||
|
||||
assert.deepEqual(draft.extra, {});
|
||||
assert.deepEqual(draft.extra, {
|
||||
generated: { expression: "`price` * `quantity`", storage: "STORED" },
|
||||
});
|
||||
assert.equal(draft.original?.extra, expression);
|
||||
});
|
||||
|
||||
|
||||
Reference in New Issue
Block a user