Skip to content

composite key and foreign keys #537

@ShintaroNippon

Description

@ShintaroNippon

HI there i'm trying to use sequelize typescript in order to create a composite unique key

this is my code:

@Column({
		field: 'is_default',
		type: DataType.BOOLEAN,
		unique: 'active_unique',
	})
	public isDefault: boolean;
	// ForeignKeys
	@ForeignKey(() => Profile)
	@Column({
		allowNull: false,
		field: 'profile_id',
		type: DataType.STRING(255),
		unique: 'active_unique',
	})

But I'm having problems in creation new rows with different Profile and online unique in isDefault...

Does any can help please?

Thanks in advance
Carlos Vieira

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions