joinsTableName static method

String joinsTableName(
  1. String columnName, {
  2. required String localTableName,
})

Compose the name for a joins table between two associations, for example

Every joins table includes _brick to signify it is a generated table and the column and table name. This is intentional to avoid collisions as Brick manages the migrations, and generates the adapter class. Adapter files are only concerned with their own adapters; therefore a shared adapter class (i.e. a many-to-many) will never exist. The downside of this pattern is the inevitable data duplication for such many-to-many relationships and the inability to query relationships without declaring them on parent/child models.

Implementation

static String joinsTableName(String columnName, {required String localTableName}) {
  return ['_brick', localTableName, columnName].join('_');
}