SQL
CREATE TABLE "ingredient_units" (
created_at DATETIME,
update_at DATETIME,
id CHAR(32) NOT NULL,
group_id CHAR(32) NOT NULL,
name VARCHAR,
description VARCHAR,
abbreviation VARCHAR,
fraction BOOLEAN,
use_abbreviation BOOLEAN,
name_normalized VARCHAR,
abbreviation_normalized VARCHAR,
plural_name VARCHAR,
plural_name_normalized VARCHAR,
plural_abbreviation VARCHAR,
plural_abbreviation_normalized VARCHAR,
PRIMARY KEY (id),
CONSTRAINT ingredient_units_name_group_id_key UNIQUE (name, group_id),
FOREIGN KEY(group_id) REFERENCES groups (id)
)
Columns
| Column | Data type | Allow null | Primary key | Actions |
|---|---|---|---|---|
created_at |
DATETIME |
✓ | Rename | Drop | |
update_at |
DATETIME |
✓ | Rename | Drop | |
id |
CHAR(32) |
✓ | Rename | Drop | |
group_id |
CHAR(32) |
Rename | Drop | ||
name |
VARCHAR |
✓ | Rename | Drop | |
description |
VARCHAR |
✓ | Rename | Drop | |
abbreviation |
VARCHAR |
✓ | Rename | Drop | |
fraction |
BOOLEAN |
✓ | Rename | Drop | |
use_abbreviation |
BOOLEAN |
✓ | Rename | Drop | |
name_normalized |
VARCHAR |
✓ | Rename | Drop | |
abbreviation_normalized |
VARCHAR |
✓ | Rename | Drop | |
plural_name |
VARCHAR |
✓ | Rename | Drop | |
plural_name_normalized |
VARCHAR |
✓ | Rename | Drop | |
plural_abbreviation |
VARCHAR |
✓ | Rename | Drop | |
plural_abbreviation_normalized |
VARCHAR |
✓ | Rename | Drop |
Foreign Keys
| Column | Destination |
|---|---|
group_id |
groups.id |
Indexes
| Name | Columns | Unique | SQL | Drop? |
|---|---|---|---|---|
| ix_ingredient_units_abbreviation_normalized |
abbreviation_normalized
|
SQL | Drop | |
| ix_ingredient_units_created_at |
created_at
|
SQL | Drop | |
| ix_ingredient_units_group_id |
group_id
|
SQL | Drop | |
| ix_ingredient_units_name_normalized |
name_normalized
|
SQL | Drop | |
| ix_ingredient_units_plural_abbreviation_normalized |
plural_abbreviation_normalized
|
SQL | Drop | |
| ix_ingredient_units_plural_name_normalized |
plural_name_normalized
|
SQL | Drop | |
| sqlite_autoindex_ingredient_units_1 |
id
|
✓ | SQL | Drop |
| sqlite_autoindex_ingredient_units_2 |
|
✓ | SQL | Drop |