Discussed in #393
Originally posted by theelderbeever January 13, 2022
Is it possible to create a foreign key on a table that references a column other than the primary key on a table? The documentation seems to imply that you can only pass a table to ForeignKey and it picks up the pk. I would like to do something like the following...
class Contract(BaseTable):
address = Varchar(index=True, required=True, null=False, unique=True)
class Log(BaseTable):
contract_address = ForeignKey(Contract.address)
Is there a way to accomplish this?
Discussed in #393
Originally posted by theelderbeever January 13, 2022
Is it possible to create a foreign key on a table that references a column other than the primary key on a table? The documentation seems to imply that you can only pass a table to
ForeignKeyand it picks up the pk. I would like to do something like the following...Is there a way to accomplish this?