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

PK constraint not created #3350

Closed
B4nan opened this issue Jul 31, 2022 · 0 comments
Closed

PK constraint not created #3350

B4nan opened this issue Jul 31, 2022 · 0 comments
Labels
bug Something isn't working

Comments

@B4nan
Copy link
Member

B4nan commented Jul 31, 2022

@Entity({ tableName: 'something' })
export class Something5 {

  @PrimaryKey({ primary: true })
  id!: string;

  @Property({ autoincrement: true })
  _id!: number;

  @Property()
  foo!: string;
}

The schema created is

create table "something" ("id" varchar(255) not null, "_id" serial, "foo" varchar(255) not null);

The correct one should be

create table "something" ("id" varchar(255) not null, "_id" serial, "foo" varchar(255) not null, constraint "something_pkey" primary key ("id"));

The index was omitted to create in function

private createTable(tableDef: DatabaseTable): Knex.SchemaBuilder

Originally posted by @Jedliu in #3187 (comment)

@B4nan B4nan added the bug Something isn't working label Jul 31, 2022
@B4nan B4nan closed this as completed in 6c589b0 Jul 31, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

1 participant