Find centralized, trusted content and collaborate around the technologies you use most.
Teams
Q&A for work
Connect and share knowledge within a single location that is structured and easy to search.
我是 iOS 新手,但是,我知道在 Android 中,如果您将 SQLLite DB 的表结构从旧版本的应用程序更改为另一个。比我需要更改名为“DATABASE_VERSION”的东西,以便删除旧表并创建新表。
如何在 iOS 中做同样的事情?
iOS 版本的 SQLite(实际的 SQLite 库)没有这种便利性。为了跟踪数据库版本,SQLite 提供了一个名为 的良性字段PRAGMA user_version,您可以手动使用UPDATE它,但它不会像 Android 那样触发数据库升级。相反,你必须要么DROP TABLE自己ALTER TABLE做。
PRAGMA user_version
UPDATE
DROP TABLE
ALTER TABLE