sequelize-auto
sequelize-auto copied to clipboard
Treat a single column, nonnull unique index as a primary key if no primary key was found
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.