Damien
04/26/2021, 4:26 PMobject CategoriesCoins: Table("categories_coins") {
val category = reference("category_id", Categories)
val coin = reference("coin_id", Coins)
override val primaryKey = PrimaryKey(category, coin, name = "categories_coins_pkey")
}
Table def:
Indexes:
"categories_coins_pkey" PRIMARY KEY, btree (category_id, coin_id)
Foreign-key constraints:
"fk_categories_coins_categories" FOREIGN KEY (category_id) REFERENCES categories(id) ON DELETE CASCADE
"fk_categories_coins_coins" FOREIGN KEY (coin_id) REFERENCES coins(id) ON DELETE CASCADE
query:
Coins.innerJoin(Categories).selectAll().withDistinct()
EDIT: managed to construct based on this comment using multiple `innerJoin`: https://github.com/JetBrains/Exposed/issues/177#issuecomment-335939897