-- Generated by sz-rust-cli make:plugin --template {{ template_type }} --name {{ plugin_name }}
-- Generation time: {{ generated_at }}
-- DO NOT EDIT MANUALLY
CREATE TABLE IF NOT EXISTS `{{ table_name }}` (
{%- for field in fields %}
`{{ field.name }}` {{ field.sql_type }} {%- if field.nullable %} NULL{%- else %} NOT NULL{%- endif %}{%- if field.default %} DEFAULT {{ field.default }}{%- endif %},
{%- endfor %}
`current_state` VARCHAR(50) NOT NULL DEFAULT '{{ initial_state }}',
`created_at` TIMESTAMP NOT NULL DEFAULT CURRENT_TIMESTAMP,
`updated_at` TIMESTAMP NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP,
PRIMARY KEY (`{{ primary_key_name }}`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;
-- Index for state filtering
CREATE INDEX `idx_{{ table_name }}_state` ON `{{ table_name }}` (`current_state`);