Skip to content

Commit

Permalink
Extract SUFFIX in another branch
Browse files Browse the repository at this point in the history
  • Loading branch information
aqrln committed Nov 28, 2024
1 parent 198c863 commit f7c2f09
Showing 1 changed file with 10 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -269,14 +269,21 @@ fn push_relation_tables(ctx: &mut Context<'_>) {
const SUFFIX: &str = "_AB_pkey";
let constraint_name = format!(
"{}{SUFFIX}",
table_name.chars().take(max_identifier_length - SUFFIX.len()).collect::<String>()
table_name
.chars()
.take(max_identifier_length - SUFFIX.len())
.collect::<String>()
);
ctx.schema.describer_schema.push_primary_key(table_id, constraint_name)
}
JoinTableUniquenessConstraint::UniqueIndex => {
const SUFFIX: &str = "_AB_unique";
let index_name = format!(
"{}_AB_unique",
table_name.chars().take(max_identifier_length - 10).collect::<String>()
"{}{SUFFIX}",
table_name
.chars()
.take(max_identifier_length - SUFFIX.len())
.collect::<String>()
);
ctx.schema.describer_schema.push_unique_constraint(table_id, index_name)
}
Expand Down

0 comments on commit f7c2f09

Please sign in to comment.