Skip to content

Commit

Permalink
Avoid storing long ids in the database
Browse files Browse the repository at this point in the history
  • Loading branch information
skyxv committed Jan 6, 2020
1 parent 7f97414 commit 07ae04b
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 17 deletions.
15 changes: 0 additions & 15 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -107,21 +107,6 @@ pipenv run python manage.py migrate
```

#### [修改自增初值](#)
连接mysql后执行:
```text
use kort_url;
alter table link_map auto_increment = 60000000000 ;
```
看到如下结果即修改成功。
```text
mysql> alter table link_map auto_increment = 60000000000 ;
Query OK, 0 rows affected (0.17 sec)
Records: 0 Duplicates: 0 Warnings: 0
```

#### [生产环境下的部署](#)
原本这里是一些自己写的生产环境部署的内容,后来想了想,文档还是官方的好,所以就只附链接了:

Expand Down
4 changes: 2 additions & 2 deletions apps/utils/transfer_url.py
Original file line number Diff line number Diff line change
Expand Up @@ -29,9 +29,9 @@ def _any2ten(code, b=64):


def get_code(n):
return _ten2any(n, 62)
return _ten2any(n+60000000000, 62)


def get_id(code):
return _any2ten(code, 62)
return _any2ten(code, 62)-60000000000

0 comments on commit 07ae04b

Please sign in to comment.