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

Treat a single column, nonnull unique index as a primary key if no primary key was found #639

Open
hhowe29 opened this issue Mar 11, 2023 · 0 comments

Comments

@hhowe29
Copy link

hhowe29 commented Mar 11, 2023

Don't ask how, but we have to deal with some legacy MSSQL tables that look like this:

create table foo
(
    foo_id  integer not null,
    name  varchar(50)
);

create unique index if not exists idx_foo_id
on foo (foo_id);

Modify auto-builder.ts to detect this joyous occasion and treat foo_id as a primary key. This is similar to the logic for #480 , and that block of cod would be a good insertion point for this logic. The indexes are loaded just above that.

hhowe29 pushed a commit to hhowe29/sequelize-auto that referenced this issue Mar 11, 2023
…t single column unique indexes as a primary key if no other primary key was found. Fixes sequelize#638 and implement sequelize#639.
hhowe29 added a commit to hhowe29/sequelize-auto that referenced this issue Mar 11, 2023
…t single column unique indexes as a primary key if no other primary key was found. Fixes sequelize#638 and implement sequelize#639.
@hhowe29 hhowe29 changed the title Treat a single column unique index as a primary key if no primary key was found Treat a single column, nonnull unique index as a primary key if no primary key was found Mar 11, 2023
hhowe29 added a commit to hhowe29/sequelize-auto that referenced this issue Mar 11, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant