Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add support for ThroughOptions #122

Closed
RobinBuschmann opened this issue Sep 1, 2017 · 0 comments · Fixed by #186
Closed

Add support for ThroughOptions #122

RobinBuschmann opened this issue Sep 1, 2017 · 0 comments · Fixed by #186
Assignees

Comments

@RobinBuschmann
Copy link
Member

RobinBuschmann commented Sep 1, 2017

See http://docs.sequelizejs.com/manual/tutorial/associations.html#n-m

Post.belongsToMany(Tag, {
  through: {
    model: ItemTag,
    unique: false,
    scope: {
      taggable: 'post'
    }
  },
  foreignKey: 'taggable_id',
  constraints: false
});

and https://github.com/DefinitelyTyped/DefinitelyTyped/blob/master/types/sequelize/index.d.ts#L1374:

interface ThroughOptions {

        /**
         * The model used to join both sides of the N:M association.
         */
        model: Model<any, any>;

        /**
         * A key/value set that will be used for association create and find defaults on the through model.
         * (Remember to add the attributes to the through model)
         */
        scope?: AssociationScope;

        /**
         * If true a unique key will be generated from the foreign keys used (might want to turn this off and create
         * specific unique keys when using scopes)
         *
         * Defaults to true
         */
        unique?: boolean;

    }
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant