You are viewing the 2.0 beta. 1.x docs
dimah-s3v2.0.0-beta.4
Database

Upgrade the Schema

Schema 2.1.0 is the only schema this line reads.

@dimah-s3/db 2.0 beta reads and writes schema 2.1.0, and that schema is the only one in the package. It does not upgrade a 1.x database or a database created at schema 2.0.0. For the code changes in every package, see Upgrade to 2.0 beta.

A new database

Create the tables from Setup: the SQL file, the Drizzle tables, the Prisma schema, or migrate(client) with Kysely. Point those tools at a new database. An ORM diff against an older database can drop columns.

A database from an earlier 2.0 beta, including one already at 2.0.0, is not migrated. Create schema 2.1.0 on a new database. Folders are rows with ids: an object stores folderId, and renaming or moving a folder rewrites cached paths without rewriting object rows.

Check

Call checkSchema at startup. It throws unless the database is at 2.1.0:

await s3.db.checkSchema();

A database at any other version throws on the first query too.

On this page