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

[BUG]: Composite Primary Key Not Automatically Creating #3810

Closed
1 task done
JonathanAmdahl opened this issue Dec 19, 2024 · 1 comment
Closed
1 task done

[BUG]: Composite Primary Key Not Automatically Creating #3810

JonathanAmdahl opened this issue Dec 19, 2024 · 1 comment
Labels
bug Something isn't working

Comments

@JonathanAmdahl
Copy link

Report hasn't been filed before.

  • I have verified that the bug I'm about to report hasn't been filed before.

What version of drizzle-orm are you using?

0.38.2

What version of drizzle-kit are you using?

0.30.1

Other packages

No response

Describe the Bug

I am creating a composite primary key on the fields: id, assetId, and inGameName. It never adds the primary key when pushing, I always have to add it manually.

export const product= pgTable('product', {
  id: varchar('id').notNull(),
  assetId: varchar('asset_id').notNull(),
  inGameName: varchar('in_game_name').notNull(),
  displayName: varchar('display_name').notNull(),
  type: varchar('type', { enum: typeValues }).notNull(),
  rarity: varchar('rarity', { enum: rarityValues }).notNull(),
  year: integer('year'),
  event: varchar('event'),
  chroma: boolean('chroma').notNull(),
  season: varchar('season'),
  defaultImageUrl: varchar('default_image_url').notNull(),
  obtainable: boolean('obtainable').notNull(),
  tradeable: boolean('tradeable'),
  createdAt: timestamp('created_at').notNull(),
  updatedAt: timestamp('updated_at').notNull()
}, (table) => {
    return [{
        item: primaryKey({name: 'item', columns: [table.id, table.assetId, table.inGameName]})
    }]
})
@JonathanAmdahl JonathanAmdahl added the bug Something isn't working label Dec 19, 2024
@JonathanAmdahl
Copy link
Author

#3596 Didn't realize it was a postgres specific issue

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