Skip to content

EAV prisma schema #2226

Answered by nikolasburk
ledniy asked this question in Q&A
Apr 19, 2020 · 1 comments · 5 replies
Discussion options

You must be logged in to vote

Hey @ledniy, thanks a lot for your question! I'm not too familiar with EAV but I tried to model your diagram using the Prisma schema:

datasource db {
  provider = "sqlite"
  url      = "file:./dev.db"
}

generator client {
  provider = "prisma-client-js"
}

model catalog_product_entity {
  entity_id      Int @default(autoincrement()) @id
  entity_type_id Int @unique
}

model eav_attribute {
  attribute_id   Int                    @default(autoincrement()) @id
  entity_type_id Int
  entity_type    catalog_product_entity @relation(fields: [entity_type_id], references: [entity_type_id])
  attribute_code String
}

model catalog_product_entity_attribute_varchar {
  attribute_id Int           @id

Replies: 1 comment 5 replies

Comment options

You must be logged in to vote
5 replies
@ledniy
Comment options

@ledniy
Comment options

@nikolasburk
Comment options

@ledniy
Comment options

@nikolasburk
Comment options

Answer selected by ledniy
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
2 participants