alter table `department` add `registered_only` int not null default '0' after `disable_user_email_replies`;
insert into `migrations` (`migration`, `batch`) values ("database/migrations/2.3.0/Ticket/2017_09_21_189202_alter_department_table.php", 245);

alter table `user_customfield` add `regex` text null after `locked`, add `regex_error_message` text null after `regex`, add `depends_on_field_id` int unsigned null after `type`, add `depends_on_option_id` int unsigned null after `depends_on_field_id`;
alter table `user_customfield` add constraint `user_customfield_depends_on_field_id_foreign` foreign key (`depends_on_field_id`) references `user_customfield` (`id`) on delete set null;
alter table `user_customfield` add constraint `user_customfield_depends_on_option_id_foreign` foreign key (`depends_on_option_id`) references `user_customfield_option` (`id`) on delete set null;
insert into `migrations` (`migration`, `batch`) values ("database/migrations/2.3.0/User/2017_10_02_081714_update_user_customfield_table.php", 245);

alter table `user_organisation_customfield` add `regex` text null after `locked`, add `regex_error_message` text null after `regex`, add `depends_on_field_id` int unsigned null after `type`, add `depends_on_option_id` int unsigned null after `depends_on_field_id`;
alter table `user_organisation_customfield` add constraint `user_organisation_customfield_depends_on_field_id_foreign` foreign key (`depends_on_field_id`) references `user_organisation_customfield` (`id`) on delete set null;
alter table `user_organisation_customfield` add constraint `user_organisation_customfield_depends_on_option_id_foreign` foreign key (`depends_on_option_id`) references `user_organisation_customfield_option` (`id`) on delete set null;
insert into `migrations` (`migration`, `batch`) values ("database/migrations/2.3.0/User/2017_10_02_081752_update_user_organisation_customfield_table.php", 245);

alter table `ticket_customfield` add `regex` text null after `locked`, add `regex_error_message` text null after `regex`, add `depends_on_field_id` int unsigned null after `type`, add `depends_on_option_id` int unsigned null after `depends_on_field_id`;
alter table `ticket_customfield` add constraint `ticket_customfield_depends_on_field_id_foreign` foreign key (`depends_on_field_id`) references `ticket_customfield` (`id`) on delete set null;
alter table `ticket_customfield` add constraint `ticket_customfield_depends_on_option_id_foreign` foreign key (`depends_on_option_id`) references `ticket_customfield_option` (`id`) on delete set null;
insert into `migrations` (`migration`, `batch`) values ("database/migrations/2.3.0/Ticket/2017_10_02_081825_update_ticket_customfield_table.php", 245);

alter table `ticket_customfield_translation` add `regex_error_message` text null after `description`;
insert into `migrations` (`migration`, `batch`) values ("database/migrations/2.3.0/Ticket/2017_10_02_083054_update_ticket_customfield_translation_table.php", 245);

alter table `user_customfield_translation` add `regex_error_message` text null after `description`;
insert into `migrations` (`migration`, `batch`) values ("database/migrations/2.3.0/User/2017_10_02_083258_update_user_customfield_translation_table.php", 245);

alter table `user_organisation_customfield_translation` add `regex_error_message` text null after `description`;
insert into `migrations` (`migration`, `batch`) values ("database/migrations/2.3.0/User/2017_10_02_083410_update_user_organisation_customfield_translation_table.php", 245);

alter table `feedback_form_field_option` add `order` int unsigned null after `field_id`;
insert into `migrations` (`migration`, `batch`) values ("database/migrations/2.3.0/Ticket/2017_10_05_042946_update_feedback_form_field_option_table.php", 245);

alter table `ticket_customfield_option` add `order` int unsigned null after `field_id`;
insert into `migrations` (`migration`, `batch`) values ("database/migrations/2.3.0/Ticket/2017_10_05_043034_update_ticket_customfield_option_table.php", 245);

alter table `user_customfield_option` add `order` int unsigned null after `field_id`;
insert into `migrations` (`migration`, `batch`) values ("database/migrations/2.3.0/User/2017_10_05_043058_update_user_customfield_option_table.php", 245);

alter table `user_organisation_customfield_option` add `order` int unsigned null after `field_id`;
insert into `migrations` (`migration`, `batch`) values ("database/migrations/2.3.0/User/2017_10_05_043119_update_user_organisation_customfield_option_table.php", 245);

alter table `email_log` add index `email_log_created_at_index`(`created_at`);
insert into `migrations` (`migration`, `batch`) values ("database/migrations/2.3.0/Core/2017_10_09_104415_update_email_log_table.php", 245);

alter table `sla_escalation_rule` add `order` int unsigned null after `plan_id`;
insert into `migrations` (`migration`, `batch`) values ("database/migrations/2.3.0/Ticket/2017_10_11_123538_update_sla_escalation_rule_table.php", 245);

alter table `ticket_followup_action` add `order` int unsigned null after `followup_id`;
insert into `migrations` (`migration`, `batch`) values ("database/migrations/2.3.0/Ticket/2017_10_11_123603_update_ticket_followup_action_table.php", 245);

alter table `ticket_macro_action` add `order` int unsigned null after `macro_id`;
insert into `migrations` (`migration`, `batch`) values ("database/migrations/2.3.0/Ticket/2017_10_11_123655_update_ticket_macro_action_table.php", 245);

alter table `feedback_form` drop foreign key `feedback_form_email_template_id_foreign`;
ALTER TABLE feedback_form CHANGE email_template_id email_template_id INT UNSIGNED DEFAULT NULL;
alter table `feedback_form` add constraint `feedback_form_email_template_id_foreign` foreign key (`email_template_id`) references `email_template` (`id`) on delete set null;
insert into `migrations` (`migration`, `batch`) values ("database/migrations/2.3.0/Ticket/2017_10_16_141108_update_feedback_form_table.php", 245);

alter table `ticket_followup` drop foreign key `ticket_followup_status_id_foreign`;
ALTER TABLE ticket_followup CHANGE status_id status_id INT UNSIGNED DEFAULT NULL;
alter table `ticket_followup` add constraint `ticket_followup_status_id_foreign` foreign key (`status_id`) references `ticket_status` (`id`) on delete set null;
insert into `migrations` (`migration`, `batch`) values ("database/migrations/2.3.0/Ticket/2017_10_16_143309_update_ticket_followup_table.php", 245);

alter table `ticket_filter_condition` add `value_extra` varchar(255) null after `value`;
insert into `migrations` (`migration`, `batch`) values ("database/migrations/2.3.0/Ticket/2017_11_13_184100_update_ticket_filter_condition_table.php", 245);

alter table `ticket_macro_condition` add `value_extra` varchar(255) null after `value`;
insert into `migrations` (`migration`, `batch`) values ("database/migrations/2.3.0/Ticket/2017_11_13_184300_update_ticket_macro_condition_table.php", 245);

alter table `feedback_form_condition` add `value_extra` varchar(255) null after `value`;
insert into `migrations` (`migration`, `batch`) values ("database/migrations/2.3.0/Ticket/2017_11_13_184500_update_feedback_form_condition_table.php", 245);

alter table `sla_condition` add `value_extra` varchar(255) null after `value`;
insert into `migrations` (`migration`, `batch`) values ("database/migrations/2.3.0/Ticket/2017_11_13_184700_update_sla_condition_table.php", 245);

create table `ticket_link_membership` (`ticket_id` int unsigned not null, `other_id` int unsigned not null) default character set utf8mb4 collate utf8mb4_unicode_ci engine = InnoDB;
alter table `ticket_link_membership` add constraint `ticket_link_membership_ticket_id_foreign` foreign key (`ticket_id`) references `ticket` (`id`) on delete cascade;
alter table `ticket_link_membership` add constraint `ticket_link_membership_other_id_foreign` foreign key (`other_id`) references `ticket` (`id`) on delete cascade;
alter table `ticket_link_membership` add unique `ticket_link_membership_ticket_id_other_id_unique`(`ticket_id`, `other_id`);
insert into `migrations` (`migration`, `batch`) values ("database/migrations/2.3.0/Ticket/2017_11_20_205334_create_ticket_link_membership_table.php", 245);

alter table `ticket_message` add `extra` text null after `social_id`;
alter table `ticket_message` add index `ticket_message_social_id_index`(`social_id` (191));
insert into `migrations` (`migration`, `batch`) values ("database/migrations/2.3.0/Ticket/2017_12_09_143000_update_ticket_message_table.php", 245);

alter table `email_queue` add `message_id` int unsigned null after `batch_id`;
alter table `email_queue` add constraint `email_queue_message_id_foreign` foreign key (`message_id`) references `ticket_message` (`id`) on delete set null;
insert into `migrations` (`migration`, `batch`) values ("database/migrations/2.3.0/Core/2017_12_12_172027_update_email_queue_table.php", 245);

alter table `upload` add `token` varchar(255) null after `size`;
insert into `migrations` (`migration`, `batch`) values ("database/migrations/2.3.0/Core/2017_12_13_143200_update_upload_table.php", 245);

update `ticket` set `cc` = NULL where `cc` LIKE "[]";
insert into `migrations` (`migration`, `batch`) values ("database/migrations/2.3.0/Ticket/2017_12_20_215000_update_ticket_table.php", 245);

alter table `operator_private_conversation` add unique `operator_private_conversation_unique`(`from_user_id`, `to_user_id`);
insert into `migrations` (`migration`, `batch`) values ("database/migrations/2.3.0/Core/2017_12_22_151732_update_operator_private_conversation_table.php", 245);
