create database if not exists ln_scene character set utf8mb4 collate utf8mb4_unicode_ci;
-- >>------------------------------------------------------------------------------------
use ln_scene;

-- 舞台表
drop TABLE if exists `sweet_stage`;
CREATE TABLE `sweet_stage`
(
    `mid`        bigint unsigned NOT NULL AUTO_INCREMENT,
    `stage_id`   varchar(200)    NOT NULL DEFAULT '' COMMENT 'stage_id',
    `title`      varchar(200)    NOT NULL DEFAULT '' COMMENT '舞台名称',
    `status`     tinyint         NOT NULL DEFAULT 1 COMMENT '状态 1可用 0不可用',
    `created_at` datetime        NULL     DEFAULT CURRENT_TIMESTAMP COMMENT '创建时间',
    `updated_at` datetime        NULL     DEFAULT CURRENT_TIMESTAMP COMMENT '更新时间',
    PRIMARY KEY (`mid`),
    KEY `stage_id_index` (`stage_id`),
    KEY `title_index` (`title`),
    KEY `status_index` (`status`)
) ENGINE = InnoDB
  DEFAULT CHARSET = utf8
  COLLATE = utf8_unicode_ci
  ROW_FORMAT = DYNAMIC COMMENT '舞台表';

-- 艺人表
drop TABLE if exists `sweet_artists`;
CREATE TABLE `sweet_artists`
(
    `mid`        bigint unsigned                                         NOT NULL AUTO_INCREMENT,
    `artists_id` varchar(200)                                            NOT NULL COMMENT 'artists_id',
    `pic_url`    varchar(200) CHARACTER SET utf8 COLLATE utf8_unicode_ci NOT NULL COMMENT '图片地址',
    `name`       varchar(200) CHARACTER SET utf8 COLLATE utf8_unicode_ci NOT NULL COMMENT '艺人名称',
    `pinyin`     varchar(200) CHARACTER SET utf8 COLLATE utf8_unicode_ci NOT NULL COMMENT '拼音',
    `describes`  text CHARACTER SET utf8 COLLATE utf8_unicode_ci         NOT NULL COMMENT '艺人简介',
    `status`     tinyint                                                 NOT NULL DEFAULT 1 COMMENT '状态 1可用 0不可用',
    `created_at` datetime                                                NULL     DEFAULT CURRENT_TIMESTAMP COMMENT '创建时间',
    `updatd_at`  datetime                                                NULL     DEFAULT CURRENT_TIMESTAMP COMMENT '更新时间',
    PRIMARY KEY (`mid`),
    KEY `artists_id_index` (`artists_id`),
    KEY `name_index` (`name`),
    KEY `status_index` (`status`)
) ENGINE = InnoDB
  DEFAULT CHARSET = utf8
  COLLATE = utf8_unicode_ci
  ROW_FORMAT = DYNAMIC COMMENT '艺人表';

-- 电子宣传手册表
drop TABLE if exists `sweet_manual`;
CREATE TABLE `sweet_manual`
(
    `mid`            bigint unsigned NOT NULL AUTO_INCREMENT,
    `manual_id`      varchar(200)    NOT NULL DEFAULT '0' COMMENT 'manual_id',
    `performance_id` varchar(200)    NULL COMMENT '演出id',
    `status`         tinyint         NOT NULL DEFAULT 1 COMMENT '0关闭 1开启',
    `is_release`     tinyint         NOT NULL DEFAULT 1 COMMENT '0取消 1发布',
    `created_at`     datetime        NULL     DEFAULT CURRENT_TIMESTAMP COMMENT '创建时间',
    `updated_at`     datetime        NULL     DEFAULT CURRENT_TIMESTAMP COMMENT '更新时间',
    PRIMARY KEY (`mid`),

    KEY `manual_id_index` (`manual_id`),
    KEY `performance_id_index` (`performance_id`),
    KEY `is_release_index` (`is_release`),
    KEY `status_index` (`status`)
) ENGINE = InnoDB
  DEFAULT CHARSET = utf8
  COLLATE = utf8_unicode_ci
  ROW_FORMAT = DYNAMIC COMMENT '电子宣传手册表';

-- 电子宣传手册显示内容表
drop TABLE if exists `sweet_manual_sort`;
CREATE TABLE `sweet_manual_sort`
(
    `mid`           bigint unsigned NOT NULL AUTO_INCREMENT,
    `manual_id`     varchar(200)    NOT NULL DEFAULT '0' COMMENT 'manual_id',
    `show_position` varchar(200)    NULL COMMENT '显示哪个，号隔开',
    `created_at`    datetime        NULL     DEFAULT CURRENT_TIMESTAMP COMMENT '创建时间',
    `updated_at`    datetime        NULL     DEFAULT CURRENT_TIMESTAMP COMMENT '更新时间',
    PRIMARY KEY (`mid`),
    KEY `manual_id_index` (`manual_id`)
) ENGINE = InnoDB
  DEFAULT CHARSET = utf8
  COLLATE = utf8_unicode_ci
  ROW_FORMAT = DYNAMIC COMMENT '电子宣传手册显示内容表';

-- 电子宣传手册富文本表
drop TABLE if exists `sweet_richtext`;
CREATE TABLE `sweet_richtext`
(
    `mid`         bigint unsigned NOT NULL AUTO_INCREMENT,
    `richtext_id` varchar(200)    NOT NULL DEFAULT '0' COMMENT 'order_refund_id',
    `manual_id`   varchar(200)    NOT NULL DEFAULT '0' COMMENT 'manual_id',
    `details`     longtext        NULL COMMENT '富文本详情',
    `local`       varchar(200)    NOT NULL DEFAULT '' COMMENT '经纬度 5需要',
    `pic_url`     varchar(200)    NOT NULL DEFAULT '' COMMENT '地图图片地址 2需要',
    `type`        tinyint         NOT NULL DEFAULT 0 COMMENT '类型 1签售时间 2现场地图 3官方大巴 4公共交通 5自驾导航坐标 6官方支持 7观众须知 8防疫指南 9观演攻略',
    `status`      tinyint         NOT NULL DEFAULT 1 COMMENT '0关闭 1开启',
    `created_at`  datetime        NULL     DEFAULT CURRENT_TIMESTAMP COMMENT '创建时间',
    `updated_at`  datetime        NULL     DEFAULT CURRENT_TIMESTAMP COMMENT '更新时间',
    PRIMARY KEY (`mid`),

    KEY `richtext_id_index` (`richtext_id`),
    KEY `manual_id_index` (`manual_id`),
    KEY `type_index` (`type`),
    KEY `status_index` (`status`)
) ENGINE = InnoDB
  DEFAULT CHARSET = utf8
  COLLATE = utf8_unicode_ci
  ROW_FORMAT = DYNAMIC COMMENT '电子宣传手册富文本表';


-- 电子宣传手册艺人表
drop TABLE if exists `sweet_manual_artists`;
CREATE TABLE `sweet_manual_artists`
(
    `mid`                bigint unsigned NOT NULL AUTO_INCREMENT,
    `manual_relation_id` varchar(200)    NOT NULL DEFAULT '0' COMMENT 'manual_relation_id',
    `manual_id`          varchar(200)    NOT NULL DEFAULT '' COMMENT '电子宣传手册id',
    `stage_id`           varchar(200)    NULL COMMENT '关联id',
    `artists_id`         varchar(200)    NULL COMMENT '关联id',
    `performance_start`  datetime        NULL COMMENT '演出开始时间',
    `performance_end`    datetime        NULL COMMENT '演出结束时间',
    `signature_start`    datetime        NULL COMMENT '签收开始时间',
    `signature_end`      datetime        NULL COMMENT '签收结束时间',
    `status`             tinyint         NOT NULL DEFAULT 1 COMMENT '0关闭 1开启',
    `created_at`         datetime        NULL     DEFAULT CURRENT_TIMESTAMP COMMENT '创建时间',
    `updated_at`         datetime        NULL     DEFAULT CURRENT_TIMESTAMP COMMENT '更新时间',
    PRIMARY KEY (`mid`),

    KEY `manual_relation_id_index` (`manual_relation_id`),
    KEY `manual_id_index` (`manual_id`),
    KEY `stage_id_index` (`stage_id`),
    KEY `artists_id_index` (`artists_id`),
    KEY `status_index` (`status`)
) ENGINE = InnoDB
  DEFAULT CHARSET = utf8
  COLLATE = utf8_unicode_ci
  ROW_FORMAT = DYNAMIC COMMENT '电子宣传手册艺人表';


-- 电子宣传手册通知表
drop TABLE if exists `sweet_manual_notify`;
CREATE TABLE `sweet_manual_notify`
(
    `mid`              bigint unsigned NOT NULL AUTO_INCREMENT,
    `manual_notify_id` varchar(200)    NOT NULL DEFAULT '0' COMMENT 'manual_notify_id',
    `manual_id`          varchar(200)    NOT NULL DEFAULT '' COMMENT '电子宣传手册id',
    `title`            varchar(200)    NOT NULL DEFAULT '' COMMENT '标题',
    `content`          longtext        NULL COMMENT '内容',
    `status`           tinyint         NOT NULL DEFAULT 1 COMMENT '0关闭 1开启',
    `created_at`       datetime        NULL     DEFAULT CURRENT_TIMESTAMP COMMENT '创建时间',
    `updated_at`       datetime        NULL     DEFAULT CURRENT_TIMESTAMP COMMENT '更新时间',
    PRIMARY KEY (`mid`),
    KEY `manual_notify_id_index` (`manual_notify_id`),
    KEY `manual_id_index` (`manual_id`),
    KEY `status_index` (`status`)
) ENGINE = InnoDB
  DEFAULT CHARSET = utf8
  COLLATE = utf8_unicode_ci
  ROW_FORMAT = DYNAMIC COMMENT '电子宣传手册通知表';


-- 电子宣传手册商铺表
drop TABLE if exists `sweet_manual_shop`;
CREATE TABLE `sweet_manual_shop`
(
    `mid`                   bigint unsigned NOT NULL AUTO_INCREMENT,
    `manual_shop_id`        varchar(200)    NOT NULL DEFAULT '0' COMMENT 'manual_shop_id',
    `manual_id`             varchar(200)    NOT NULL DEFAULT '' COMMENT '电子宣传手册id',
    `title`                 varchar(200)    NOT NULL DEFAULT '' COMMENT '商家名称',
    `pic_url`               varchar(200)    NOT NULL DEFAULT '' COMMENT '商家图片',
    `describes`              longtext        NULL COMMENT '商家介绍',
    `type`                  tinyint         NOT NULL DEFAULT 1 COMMENT '1吃喝 2玩乐',
    `is_recommend`          tinyint         NOT NULL DEFAULT 1 COMMENT '0不推荐 1推荐',
    `sort`                  tinyint         NOT NULL DEFAULT 0 COMMENT '排序字段 数字越大越靠前',
    `status`                tinyint         NOT NULL DEFAULT 1 COMMENT '0关闭 1开启',
    `created_at`            datetime        NULL     DEFAULT CURRENT_TIMESTAMP COMMENT '创建时间',
    `updated_at`            datetime        NULL     DEFAULT CURRENT_TIMESTAMP COMMENT '更新时间',
    PRIMARY KEY (`mid`),
    KEY `manual_shop_index` (`manual_shop_id`),
    KEY `manual_id_index` (`manual_id`),
    KEY `status_index` (`status`)
) ENGINE = InnoDB
  DEFAULT CHARSET = utf8
  COLLATE = utf8_unicode_ci
  ROW_FORMAT = DYNAMIC COMMENT '电子宣传手册商铺表';
