SQL

CREATE TABLE `telegramIngredientApprovalSession`  (
  `id` text PRIMARY KEY,
  `chat_id` text NOT NULL,
  `active_ingredient_id` text NOT NULL,
  `active_ingredient_localization_id` text NOT NULL,
  `status` text DEFAULT 'active' NOT NULL,
  `cursor` integer DEFAULT 0 NOT NULL,
  `draft_json` text DEFAULT '{}' NOT NULL,
  `created_at` integer DEFAULT (CURRENT_TIMESTAMP),
  `updated_at` integer DEFAULT (CURRENT_TIMESTAMP),
  CONSTRAINT `fk_telegramIngredientApprovalSession_active_ingredient_id_activeIngredient_id_fk` FOREIGN KEY (`active_ingredient_id`) REFERENCES `activeIngredient`(`id`),
  CONSTRAINT `fk_telegramIngredientApprovalSession_active_ingredient_localization_id_activeIngredientLocalization_id_fk` FOREIGN KEY (`active_ingredient_localization_id`) REFERENCES `activeIngredientLocalization`(`id`)
)

+ Add column

Columns

Column Data type Allow null Primary key Actions
id TEXT Rename | Drop
chat_id TEXT Rename | Drop
active_ingredient_id TEXT Rename | Drop
active_ingredient_localization_id TEXT Rename | Drop
status TEXT Rename | Drop
cursor INTEGER Rename | Drop
draft_json TEXT Rename | Drop
created_at INTEGER Rename | Drop
updated_at INTEGER Rename | Drop

Foreign Keys

Column Destination
active_ingredient_localization_id activeIngredientLocalization.id
active_ingredient_id activeIngredient.id

+ Add index

Indexes

Name Columns Unique SQL Drop?
sqlite_autoindex_telegramIngredientApprovalSession_1 id SQL
-- no sql found --
Drop
telegram_approval_session_active_ingredient_id_idx active_ingredient_id SQL
CREATE INDEX `telegram_approval_session_active_ingredient_id_idx`
ON `telegramIngredientApprovalSession` (`active_ingredient_id`)
Drop
telegram_approval_session_chat_id_idx chat_id SQL
CREATE INDEX `telegram_approval_session_chat_id_idx`
ON `telegramIngredientApprovalSession` (`chat_id`)
Drop
telegram_approval_session_status_idx status SQL
CREATE INDEX `telegram_approval_session_status_idx`
ON `telegramIngredientApprovalSession` (`status`)
Drop