Skip to content

Latest commit

 

History

History
70 lines (55 loc) · 2.39 KB

1.x_upgrade_2.x.md

File metadata and controls

70 lines (55 loc) · 2.39 KB

1.x 升级 2.x 指南

1.备份当前数据表 esu_url、代码(如有问题,方便快速回滚)

2.根据 2.x .env 修改配置文件

# 短网址服务域名
ESU_DOMAIN=http://s.lukachen.com

# 数据库配置
ESU_DB_HOST=127.0.0.1
ESU_DB_DBNAME=esu
ESU_DB_USERNAME=root
ESU_DB_PASSWORD=root
ESU_DB_PORT=3306
ESU_DB_CHARSET=utf8

# Redis 配置
ESU_REDIS_DSN=tcp://127.0.0.1:6379

# 是否开启缓存,可选项 0: 不开启, 1: 开启 (开启缓存,数据表跳转统计将失效)
ESU_CACHE_OPEN=0

# 缓存方式,可选项 Filesystem: 本地文件缓存, Redis: 缓存 (Redis 缓存,依赖 ESU_REDIS_DSN 配置)
ESU_CACHE_CLIENT=Filesystem

# 默认缓存时间 604800 秒 (1星期)
ESU_CACHE_LIFETIME=604800

# web_admin 页 access_key
ESU_WEB_ADMIN_ACCESS_KEY=esu

3.执行 SQL,添加数据表

ALTER TABLE esu_url ADD COLUMN `access_key` VARCHAR ( 32 ) CHARACTER SET utf8 COLLATE utf8_bin NOT NULL DEFAULT '' COMMENT '密钥' AFTER `ip`;
ALTER TABLE esu_url ADD COLUMN `updated_at` datetime(0) NOT NULL COMMENT '更新时间';
UPDATE esu_url SET updated_at = created_at;

UPDATE esu_url SET access_key = 'esu';

CREATE TABLE `esu_access`  (
  `id` int(11) NOT NULL AUTO_INCREMENT,
  `access_key` varchar(32) CHARACTER SET utf8 COLLATE utf8_bin NOT NULL DEFAULT '' COMMENT '密钥',
  `access_domain` varchar(128) CHARACTER SET utf8 COLLATE utf8_general_ci NOT NULL DEFAULT '' COMMENT '可跳转域名',
  `created_at` datetime(0) NOT NULL COMMENT '创建时间',
  `updated_at` datetime(0) NOT NULL COMMENT '更新时间',
  PRIMARY KEY (`id`) USING BTREE
) ENGINE = InnoDB CHARACTER SET = utf8 COLLATE = utf8_general_ci COMMENT = '授权表' ROW_FORMAT = Dynamic;

INSERT INTO `esu_access` VALUES (1, 'esu', 'lukachen.com', '2021-01-05 18:34:48', '2021-01-05 18:34:48');

4.添加授权数据

整理当前 esu_url 表中,需要跳转的域名

INSERT INTO `esu_access`(`access_key`, `access_domain`, `created_at`, `updated_at`) VALUES ('esu', 'todo1.com', now(), now());
INSERT INTO `esu_access`(`access_key`, `access_domain`, `created_at`, `updated_at`) VALUES ('esu', 'todo2.com', now(), now());
INSERT INTO `esu_access`(`access_key`, `access_domain`, `created_at`, `updated_at`) VALUES ('esu', 'todo3.com', now(), now());

5.修改 composer.json 文件

修改版本号为 ^2

"require": {
    "chenlongqiang/easy-short-url": "^2"
}

6.执行 composer update 完成升级