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)
)

+ Add column

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

+ Add index

Indexes

Name Columns Unique SQL Drop?
ix_ingredient_units_abbreviation_normalized abbreviation_normalized SQL
CREATE INDEX ix_ingredient_units_abbreviation_normalized
ON ingredient_units (abbreviation_normalized)
Drop
ix_ingredient_units_created_at created_at SQL
CREATE INDEX ix_ingredient_units_created_at
ON ingredient_units (created_at)
Drop
ix_ingredient_units_group_id group_id SQL
CREATE INDEX ix_ingredient_units_group_id
ON ingredient_units (group_id)
Drop
ix_ingredient_units_name_normalized name_normalized SQL
CREATE INDEX ix_ingredient_units_name_normalized
ON ingredient_units (name_normalized)
Drop
ix_ingredient_units_plural_abbreviation_normalized plural_abbreviation_normalized SQL
CREATE INDEX ix_ingredient_units_plural_abbreviation_normalized
ON ingredient_units (plural_abbreviation_normalized)
Drop
ix_ingredient_units_plural_name_normalized plural_name_normalized SQL
CREATE INDEX ix_ingredient_units_plural_name_normalized
ON ingredient_units (plural_name_normalized)
Drop
sqlite_autoindex_ingredient_units_1 id SQL
-- no sql found --
Drop
sqlite_autoindex_ingredient_units_2
  • name
  • group_id
SQL
-- no sql found --
Drop