Skip to main content

Module rename_attribute

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. None for anything else.
rename_marker_from
The old name in a whole rename marker raw, as cratestack-migrate reads it: marker ("@rename" or "@@rename"), directly its (, arguments parse_rename_from takes, and a ) that ends the text. None for anything else — which the migrator treats as no marker.