refactor:完善数据库表设计

This commit is contained in:
hackycy
2020-06-19 21:44:08 +08:00
parent acf68dc14e
commit 442daa4cd4
2 changed files with 4 additions and 2 deletions

View File

@@ -16,5 +16,6 @@
| 字段 | 类型 | 空 | 默认 | 注释 |
| ---- | ------------ | ---- | ---- | ---------------------------- |
| id | int | 否 | | 自增ID |
| path | VARCHAR(255) | 否 | | 图片上传成功后对应的对路径 |
| path | VARCHAR(255) | 否 | | 图片上传成功后对应的对路径 |
| type | VARCHAR(20) | 否 | | 图床类型 |

View File

@@ -53,7 +53,8 @@ class DbProvider {
await db.execute('''
CREATE TABLE uploaded (
id INTEGER PRIMARY KEY AUTOINCREMENT,
path varchar(255) NOT NULL
path varchar(255) NOT NULL,
type varchar(20) NOT NULL UNIQUE
)''');
await db.transaction((txn) async {
int id1 = await txn.rawInsert(