1.9.14.sql 5 KB
SET FOREIGN_KEY_CHECKS = 0;

CREATE TABLE `hi-sing`.`activity_status_records`
(
    `id`    bigint       NOT NULL AUTO_INCREMENT,
    `up`    int UNSIGNED NOT NULL DEFAULT 0,
    `down`  int UNSIGNED NOT NULL DEFAULT 0,
    `match` int UNSIGNED NOT NULL DEFAULT 0,
    `send`  int UNSIGNED NOT NULL DEFAULT 0,
    `time`  date         NOT NULL,
    PRIMARY KEY (`id`) USING BTREE,
    UNIQUE INDEX `time` (`time` ASC) USING BTREE
) ENGINE = InnoDB
  CHARACTER SET = utf8mb4
  COLLATE = utf8mb4_unicode_ci
  ROW_FORMAT = Dynamic;

ALTER TABLE `hi-sing`.`projects`
    ADD COLUMN `master_id` bigint UNSIGNED NOT NULL DEFAULT 0 COMMENT '主理人' AFTER `user_id`;

ALTER TABLE `hi-sing`.`system_config`
    MODIFY COLUMN `content` varchar(800) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci NOT NULL DEFAULT '' COMMENT '内容' AFTER `identifier`;

CREATE TABLE `hi-sing`.`user_logins`
(
    `id`             int                                                           NOT NULL AUTO_INCREMENT,
    `user_id`        int                                                           NOT NULL DEFAULT 0 COMMENT '用户id',
    `os`             varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci NOT NULL COMMENT '客户端',
    `device`         varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci NOT NULL COMMENT '设备信息',
    `system_version` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci NOT NULL COMMENT '系统信息',
    `app_version`    varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci NOT NULL COMMENT '应用信息',
    `created_at`     datetime                                                      NULL     DEFAULT NULL,
    `updated_at`     datetime                                                      NULL     DEFAULT NULL,
    PRIMARY KEY (`id`) USING BTREE
) ENGINE = InnoDB
  CHARACTER SET = utf8mb4
  COLLATE = utf8mb4_unicode_ci
  ROW_FORMAT = Dynamic;

CREATE OR REPLACE ALGORITHM = UNDEFINED SQL SECURITY DEFINER VIEW `hi-sing`.`activity_works` AS
select `activity_has_users`.`id`                    AS `id`,
       `activity_has_users`.`activity_id`           AS `activity_id`,
       `activitys`.`song_name`                      AS `activity_name`,
       `activitys`.`cover`                          AS `activity_cover`,
       `activitys`.`sub_title`                      AS `activity_title`,
       `activitys`.`status`                         AS `activity_status`,
       `activitys`.`user_id`                        AS `activity_user_id`,
       `activity_has_users`.`user_id`               AS `user_id`,
       `users`.`nick_name`                          AS `user_nick_name`,
       `users`.`real_name`                          AS `user_real_name`,
       `users`.`identity`                           AS `user_identity`,
       `users`.`status`                             AS `user_status`,
       `users`.`role`                               AS `user_role`,
       `activity_has_users`.`demo_url`              AS `demo_url`,
       `activity_has_users`.`durations`             AS `durations`,
       `activity_has_users`.`type`                  AS `type`,
       `activity_has_users`.`status`                AS `status`,
       `activity_has_users`.`syn_data`              AS `syn_data`,
       `activity_has_users`.`syn_status`            AS `syn_status`,
       `activity_has_users`.`mode`                  AS `mode`,
       `activity_has_users`.`open_id`               AS `open_id`,
       `activity_has_users`.`is_checked`            AS `is_checked`,
       `activity_has_users`.`is_top`                AS `is_top`,
       `activity_has_users`.`is_hide`               AS `is_hide`,
       `activity_has_users`.`submit_at`             AS `submit_at`,
       `activity_has_users`.`version`               AS `version`,
       `activity_has_users`.`sing_type`             AS `sing_type`,
       `activity_has_users`.`created_at`            AS `created_at`,
       `activity_has_users`.`updated_at`            AS `updated_at`,
       `activity_has_users`.`deleted_at`            AS `deleted_at`,
       ifnull(`users`.`business_id`, 0)             AS `business_id`,
       ifnull(`activity_share_users`.`share_id`, 0) AS `share_id`,
       ifnull(`activitys`.`project_id`, 0)          AS `project_id`,
       ifnull(`activity_user_has_prices`.`id`, 0)   AS `price_id`
from ((((`activity_has_users` join `users` on ((`users`.`id` = `activity_has_users`.`user_id`))) join `activitys`
        on ((`activitys`.`id` = `activity_has_users`.`activity_id`))) left join `activity_share_users`
       on (((`activity_has_users`.`user_id` = `activity_share_users`.`user_id`) and
            (`activity_has_users`.`activity_id` =
             `activity_share_users`.`activity_id`)))) left join `activity_user_has_prices`
      on (((`activity_has_users`.`user_id` = `activity_user_has_prices`.`user_id`) and
           (`activity_has_users`.`activity_id` = `activity_user_has_prices`.`activity_id`))));


insert into activity_status_records (up, down, time)
select up_activity, down_activity, time
from `app_day_records`;

SET FOREIGN_KEY_CHECKS = 1;