Entity category
A product category; categories form a tree.
Subject areas: Catalog
Attributes
| # | Name | Type | Null | Default | Key | Terms | Description |
| 1 | id | bigint | no | | PK | | |
| 2 | parent_id | bigint | yes | | FK | | |
| 3 | name | text(100) | no | | UQ | | |
Keys
| Kind | Name | Attributes |
| primary | pk_category | id |
| unique | uq_category_name | name |
Relationships
| Name | Role | Other entity | Cardinality | Attributes | Identifying | On delete | On update |
| category_parent | self | category | zero_or_one to many | category.parent_id -> category.id | no | no_action | no_action |
| product_category | parent | product | one to many | product.category_id -> category.id | no | no_action | no_action |
Physical
lite (sqlite): main.category
| # | Name | Type | Null | Default | Identity | Collation | Attribute | Comment |
| 1 | id | integer | no | | by_default | | id | |
| 2 | parent_id | integer | yes | | | | parent_id | |
| 3 | name | text | no | | | | name | |
- primary key pk_category (id)
- unique uq_category_name (name)
- foreign key fk_category_parent (parent_id) references category (id)
- index ix_category_parent (parent_id)
pg (postgresql): public.category
| # | Name | Type | Null | Default | Identity | Collation | Attribute | Comment |
| 1 | id | bigint | no | | always | | id | |
| 2 | parent_id | bigint | yes | | | | parent_id | |
| 3 | name | varchar(100) | no | | | | name | |
- primary key pk_category (id)
- unique uq_category_name (name)
- foreign key fk_category_parent (parent_id) references category (id)
- index ix_category_parent (parent_id)