3
Strapi助力Flutter开发国际化App - 整理Sqlite数据库与图片
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.
Strapi助力Flutter开发国际化App - 整理Sqlite数据库与图片
使用DBeaver软件或者你自己习惯的数据库管理软件打开Strapi的sqlite数据库文件。
可以看到locale
字段区别出了国际化的数据。另外,vegettables
表中并没有cover图片字段。
分析数据库得出,图片是通过upload_file
和upload_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
文件夹下。
修改pubspec.yaml
增加如下配置
flutter: assets: - assets/db/ - strapi/public/uploads/ uses-material-design: true
Recommend
About Joyk
Aggregate valuable and interesting links.
Joyk means Joy of geeK