versioning of FK for archiving2

This commit is contained in:
Priec
2026-08-11 22:02:16 +02:00
parent dcc07ee708
commit d53c28c90a
7 changed files with 105 additions and 104 deletions

View File

@@ -44,6 +44,8 @@ pub const TRAILING_SYSTEM_COLUMNS: [SystemColumn; 1] = [SystemColumn {
/// profile is known rather than spelled out here.
pub const ACCOUNT_REFERENCE_COLUMN: &str = "account_id";
pub const ACCOUNT_API_COLUMN: &str = "account";
/// Internal version of a managed row. It is never exposed as editable data.
pub const ROW_VERSION_COLUMN: &str = "version";
/// The longest name any system column carries physically.
///
@@ -69,7 +71,14 @@ const fn longest_system_column_name() -> usize {
longest
}
let longest = longest_of(&LEADING_SYSTEM_COLUMNS, ACCOUNT_REFERENCE_COLUMN.len());
let longest = longest_of(
&LEADING_SYSTEM_COLUMNS,
if ACCOUNT_REFERENCE_COLUMN.len() > ROW_VERSION_COLUMN.len() {
ACCOUNT_REFERENCE_COLUMN.len()
} else {
ROW_VERSION_COLUMN.len()
},
);
longest_of(&TRAILING_SYSTEM_COLUMNS, longest)
}
@@ -83,6 +92,7 @@ pub fn system_column_names() -> impl Iterator<Item = &'static str> {
.chain(TRAILING_SYSTEM_COLUMNS.iter())
.map(|column| column.name)
.chain(std::iter::once(ACCOUNT_REFERENCE_COLUMN))
.chain(std::iter::once(ROW_VERSION_COLUMN))
}
/// Whether `name` belongs to the system column vocabulary and is safe to show
@@ -145,7 +155,7 @@ mod tests {
fn the_name_list_reads_as_a_sentence_fragment() {
assert_eq!(
system_column_name_list(),
"'id', 'deleted', 'row_revision', 'created_at', 'account_id', 'account'"
"'id', 'deleted', 'row_revision', 'created_at', 'account_id', 'version', 'account'"
);
}
}