3

Strapi助力Flutter开发国际化App - 整理Sqlite数据库与图片

 2 years ago
source link: https://segmentfault.com/a/1190000040791648
Go to the source link to view the article. You can view the picture content, updated content and better typesetting reading experience. If the link is broken, please click the button below to view the snapshot at that time.
neoserver,ios ssh client

Strapi助力Flutter开发国际化App - 整理Sqlite数据库与图片

使用DBeaver软件或者你自己习惯的数据库管理软件打开Strapi的sqlite数据库文件。

可以看到locale字段区别出了国际化的数据。另外,vegettables表中并没有cover图片字段。

分析数据库得出,图片是通过upload_fileupload_file_morph两个表与vegettables表进行了关联。

在sql编辑器中写入

SELECT
    v.id,
    v.name,
    v.desc,
    v.locale,
    uf.hash,
    uf.ext, 
    v.created_at,
    v.updated_at
from
    vegetables v
LEFT OUTER JOIN upload_file_morph ufm on
    v.id = ufm.related_id
LEFT OUTER JOIN upload_file uf on
    ufm.upload_file_id = uf.id;

测试成功! 根据上述代码创建视图。

接下来分析图片,在Strapi项目中图片都被上传到了[project_root]/strapi/public/uploads文件夹下。

image-20211010121704-khc3x8r.png

修改pubspec.yaml增加如下配置

flutter: 
  assets: 
    - assets/db/
    - strapi/public/uploads/  
  uses-material-design: true

上一篇:数据建模
下一篇:使用Sqlite数据库


About Joyk


Aggregate valuable and interesting links.
Joyk means Joy of geeK