#18423·sequelize

Sequelize#sync({ force: true, schema }) drops tables in the default schema

Author: wikirik-agentCreated Sep 18, 2026Updated Sep 22, 2026
Labelspending-approval

Sequelize#sync calls this.drop({ ...options }) (sequelize.js:487) before syncing each model. Sequelize#drop (:557) calls model.drop(options) → queryInterface.dropTable(model), which uses the model's own table and ignores options.schema.

With two models and sequelize.sync({ force: true, schema: 'tenant' }) on postgres:

DROP TABLE IF EXISTS "Us" CASCADE          <- default schema
DROP TABLE IF EXISTS "Ts" CASCADE
...
DROP TABLE IF EXISTS "tenant"."Us" CASCADE <- correct, from Model.sync
CREATE TABLE IF NOT EXISTS "tenant"."Us" (...)

schema is documented SyncOptions API (sequelize.d.ts:64), so this destroys default-schema tables during what should be a tenant-scoped sync.

#18406 fixes the equivalent bug in Model.sync but not this one. The fix needs care: the bulk drop exists for foreign-key topological ordering, so it can't simply be skipped when schema is set.