DROP TABLE IF EXISTS `enforce_obj_architecture_relate`;
CREATE TABLE `enforce_obj_architecture_relate` (
                                             `id` bigint(20) NOT NULL AUTO_INCREMENT COMMENT '主键id',
                                             `enforce_obj_id` varchar(256) NOT NULL COMMENT '执法对象ID',
                                             `architecture_id` bigint(20) DEFAULT NULL COMMENT '建筑id',
                                             `architecture_uuid` char(36) DEFAULT NULL COMMENT '建筑uuid',
                                             `relate_type` int(1) DEFAULT 0 COMMENT '关系类型:0入驻关系 ,1管理关系',
                                             `create_user_id` varchar(64) DEFAULT NULL,
                                             `create_user_name` varchar(64) DEFAULT NULL,
                                             `create_time` datetime DEFAULT CURRENT_TIMESTAMP,
                                             `update_user_id` varchar(64) DEFAULT NULL,
                                             `update_user_name` varchar(128) DEFAULT NULL COMMENT '更新人名称',
                                             `update_time` datetime DEFAULT CURRENT_TIMESTAMP,
                                             PRIMARY KEY (`id`) USING BTREE
) ENGINE=InnoDB AUTO_INCREMENT=2 DEFAULT CHARSET=utf8mb4 ROW_FORMAT=DYNAMIC COMMENT='单位与建筑的关联';

DROP TABLE IF EXISTS `enforce_obj_architecture_relate_his`;
CREATE TABLE `enforce_obj_architecture_relate_his` (
                                                   `id` bigint(20) NOT NULL AUTO_INCREMENT COMMENT '主键id',
                                                   `enforce_obj_id` varchar(256) NOT NULL COMMENT '执法对象ID',
                                                   `before_architecture_id` bigint(20) DEFAULT NULL COMMENT '更正前建筑id',
                                                   `before_architecture_uuid` char(36) DEFAULT NULL COMMENT '更正前建筑uuid',
                                                   `after_architecture_id` bigint(20) DEFAULT NULL COMMENT '更正后建筑id',
                                                   `after_architecture_uuid` char(36) DEFAULT NULL COMMENT '更正后建筑uuid',
                                                   `create_user_id` varchar(64) DEFAULT NULL,
                                                   `create_user_name` varchar(64) DEFAULT NULL,
                                                   `create_time` datetime DEFAULT CURRENT_TIMESTAMP,
                                                   PRIMARY KEY (`id`) USING BTREE
) ENGINE=InnoDB AUTO_INCREMENT=2 DEFAULT CHARSET=utf8mb4 ROW_FORMAT=DYNAMIC COMMENT='单位与建筑的关联更正记录表';