问题描述
我有一个带有 better-sqlite3
的 Discord 机器人硬币和 XP 的数据库.直到 2 周前它一直运行良好.现在,每次重新启动后,它只会设置 XP 和硬币.这真的很烦人,因为人们每天都在升级同一级别.
I have a Discord bot with a better-sqlite3
database for coins and XP. It always worked fine until 2 weeks ago. Now, after every restart it just sets the XP and coins back. It's really annoying because people are leveling up to the same level every day.
有人知道如何解决这个问题吗?
Does someone know how to fix this?
推荐答案
如果这能正常工作,我会非常感到惊讶.
I would be very surprised if this ever worked properly.
Heroku 的 临时文件系统 会在您的 dynos 重新启动时丢失对其所做的所有更改.这经常发生(每天至少一次).因此,Heroku 不支持基于文件的数据库,如 SQLite .
Heroku's ephemeral filesystem loses all changes made to it whenever your dynos restart. This happens frequently (at least once per day). As a result, file-based databases like SQLite aren't supported on Heroku.
如果你想在 Heroku 上运行你的代码,你必须切换到客户端-服务器数据库.PostgreSQL 是一种常见的选择,Heroku 提供了自己的托管 PostgreSQL 服务,您可以免费开始使用.
You'll have to switch to a client-server database if you want to run your code on Heroku. PostgreSQL is a common choice, and Heroku provides its own hosted PostgreSQL service that you can start using for free.
这篇关于在 Heroku 上重新启动后,Better-SQLite3 数据库重置的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持编程学习网!