Module rename_attribute
Expand description
The argument of a rename marker, @@rename(from = "<old_table>") on a
model and @rename(from = "<old_column>") on a field.
One reader for both sides of GHSA-69g4-xvcm-vm2j: cratestack-migrate
(convert/renames.rs) takes the old name from it, and
cratestack-parser refuses a @@rename or @rename it does not read.
Before, the migrator read from = "…" only and treated anything else
as no marker at all, so @@rename(from: "old") passed cratestack check and the next migration dropped the old table and created the new
one — its rows gone — instead of renaming it; title String @rename(from: "name") did the same to a column.
Constants§
- RENAME_
ARGUMENT_ FORM - The one argument shape a rename marker takes, for error messages.
Functions§
- parse_
rename_ from - The old name in
arguments, the text inside a rename marker’s parentheses:from,=, then one double-quoted, non-empty name with no"or\in it, whitespace allowed around each part.Nonefor anything else. - rename_
marker_ from - The old name in a whole rename marker
raw, ascratestack-migratereads it:marker("@rename"or"@@rename"), directly its(, argumentsparse_rename_fromtakes, and a)that ends the text.Nonefor anything else — which the migrator treats as no marker.