Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion packages/core/package.json
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
{
"name": "sequelize-core-papandreou",
"name": "@sequelize/core",
"description": "Sequelize is a promise-based Node.js ORM tool for Postgres, MySQL, MariaDB, SQLite, Microsoft SQL Server, Amazon Redshift, Snowflake’s Data Cloud, Db2, and IBM i. It features solid transaction support, relations, eager and lazy loading, read replication and more.",
"version": "7.0.0-alpha.41-patch9",
"funding": [
Expand Down
8 changes: 8 additions & 0 deletions packages/core/src/associations/base.ts
Original file line number Diff line number Diff line change
Expand Up @@ -291,6 +291,12 @@ export interface ForeignKeyOptions<ForeignKey extends string>
export type NormalizedAssociationOptions<ForeignKey extends string> =
NormalizeBaseAssociationOptions<AssociationOptions<ForeignKey>>;

/** Foreign Key Options */
export interface CompositeForeignKeysOptions {
source: string;
target: string;
}

/**
* Options provided when associating models
*/
Expand All @@ -313,6 +319,8 @@ export interface AssociationOptions<ForeignKey extends string = string> extends
*/
foreignKey?: ForeignKey | ForeignKeyOptions<ForeignKey>;

foreignKeys?: ForeignKey[] | Array<{ source: string; target: string }>;

/**
* Should ON UPDATE, ON DELETE, and REFERENCES constraints be enabled on the foreign key.
*/
Expand Down
2 changes: 1 addition & 1 deletion packages/core/src/associations/belongs-to-many.ts
Original file line number Diff line number Diff line change
Expand Up @@ -169,7 +169,7 @@ export class BelongsToManyAssociation<
* The name of the Column that the {@link foreignKey} fk (located on the Through Table) will reference on the Source model.
*/
get sourceKeyField(): string {
return this.fromThroughToSource.targetKeyField;
return this.fromThroughToSource.targetKeyField(this.fromThroughToSource.targetKey);
}

/**
Expand Down
Loading