foreignKeyColumnName static method
Generate a column that references another table.
For example, if a Person has one Hat, the column generated on table Person
would be Hat_id.
If prefix is provided, it will be prepended to the normal convention with a _.
Implementation
// Do not change this function without changing the default value in the constructor
// for `foreignKeyColumn`; this function isn't `const` so it could not be recycled
static String foreignKeyColumnName(String foreignTableName, [String? prefix]) {
final defaultName = '$foreignTableName${InsertTable.PRIMARY_KEY_COLUMN}';
if (prefix != null) {
return '${prefix}_$defaultName';
}
return defaultName;
}