ALTER TABLE `Building` ADD `workflow_finished` INT NOT NULL DEFAULT '0' AFTER `networksection_id`;

CREATE TABLE `Workflowitem` (
  `id` int NOT NULL AUTO_INCREMENT,
  `num` int NOT NULL DEFAULT '0',
  `object_type` enum('Building','Termination') COLLATE utf8mb4_unicode_520_ci NOT NULL DEFAULT 'Building',
  `active` int NOT NULL DEFAULT '1',
  `visible` int NOT NULL DEFAULT '1',
  `required` int NOT NULL DEFAULT '1',
  `name` varchar(1024) COLLATE utf8mb4_unicode_520_ci NOT NULL,
  `label` varchar(1024) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_520_ci NOT NULL,
  `description` text CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_520_ci,
  `type` enum('string','int','bool','enum','text','file','gps','color','delimiter') CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_520_ci NOT NULL DEFAULT 'string',
  `typedata` text COLLATE utf8mb4_unicode_520_ci,
  `placeholder` varchar(1024) COLLATE utf8mb4_unicode_520_ci DEFAULT NULL,
  `create_by` int NOT NULL,
  `edit_by` int NOT NULL,
  `create` int NOT NULL,
  `edit` int NOT NULL,
  PRIMARY KEY (`id`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_520_ci;

CREATE TABLE `Workflowvalue` (
  `id` int NOT NULL AUTO_INCREMENT,
  `item_id` int NOT NULL,
  `object_id` int NOT NULL,
  `value_string` varchar(1024) COLLATE utf8mb4_unicode_520_ci DEFAULT NULL,
  `value_int` int DEFAULT NULL,
  `value_text` text COLLATE utf8mb4_unicode_520_ci NOT NULL,
  `changed_by` int NOT NULL,
  `changed` int NOT NULL,
  `create_by` int NOT NULL,
  `edit_by` int NOT NULL,
  `create` int NOT NULL,
  `edit` int NOT NULL,
  PRIMARY KEY (`id`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_520_ci;