scan, list, describe, hover and er read Sequelize models as well as Django, SQLAlchemy, Prisma, Drizzle, Rails, EF Core and TypeORM ones, and so do the MCP tools list_apps, list_models, describe_model, find_relations and er_diagram. Sequelize has no schema file, so the model code is read: the classes, the init and define calls, and the associations between them. It is read as text, with no Node and no database.
uvx orm-lens scan -f table # every model and join table
uvx orm-lens er -f dbml # ER diagram: mermaid, dbml, d2, plantuml or dot
uvx orm-lens describe Document # one model: columns, keys and what each does on delete
The other commands don’t read Sequelize yet, and neither does the VS Code extension. The Django analyses never see a Sequelize model, and a Python relation never points at one.
The .ts, .js, .mjs and .cjs files of every package whose package.json depends on sequelize or sequelize-typescript. node_modules, dist, build, test directories, *.spec.*, *.test.* and *.d.ts are skipped, and so are files over 2 MB, anything that isn’t a regular file (a pipe, a socket) and links that lead outside the workspace. A directory whose package.json lists dependencies of its own is another package, read only when it depends on Sequelize too; one that lists none (PeerTube’s server/, which uses the root’s) is read with the root.
In a workspace with no Django or SQLAlchemy project, the MCP server looks for such a package.json at most four directories down. If yours is deeper, point workspace_root at a directory closer to it. The CLI has no such limit.
Models are declared two ways, and both are read:
@Table, whose properties carry @Column, @PrimaryKey, @AllowNull, @Default, @Unique, @ForeignKey, @BelongsTo, @HasMany, @HasOne and @BelongsToMany. Attributes declared on a base class without @Table are inherited.Model.init({ ...attributes }, { sequelize, ... }) and sequelize.define("Name", { ...attributes }, { ... }), with the associations made by A.belongsTo(B, ...), A.hasMany(B, ...), A.hasOne(B, ...) and A.belongsToMany(B, ...) anywhere in the package: in an associate() method (this.belongsTo(models.User)), in an index.ts that sets them all up (m.Comment.belongsTo(m.User)), or next to the model. A model exported under another name (export { Address as AddressModel }) is found by that name too, and one in another module’s namespace (billing.User after import * as billing from "./billing") through that import and the barrels it re-exports from. A name with no import to follow (models.Role in associate()) is looked for in the file’s own package first. A define counts when it is called on a Sequelize instance (a name with sequelize in it) or its attributes use Sequelize’s data types, so another library’s registry.define("Checkout", { enabled: true }) is not taken for a model.A model is listed under its class name, or the name define gives it. The table is tableName, or the model name (modelName when given) in the plural, as Sequelize makes it (Category → Categories, Person → People; in snake_case with underscored: AuditLog → audit_logs), or the model name as is with freezeTableName.
Columns are the attributes, named by field (kept as written, even with underscored) or, with underscored, in snake_case. An attribute inherited from a base class is named by the model’s own underscored. The type is the DataTypes one without its prefix (STRING(255), UUID, ENUM); a sequelize-typescript @Column without a type takes it from the property’s TypeScript type, as sequelize-typescript does. A column is nullable unless allowNull: false or it is the primary key. args shows NOT NULL, UNIQUE and DEFAULT ... (Sequelize.fn("now") as now()).
What Sequelize adds is added too: an id (INTEGER) when no attribute is the primary key, createdAt and updatedAt unless timestamps: false (renamed by createdAt: "createdOn", which is in snake_case with underscored, and left out by createdAt: false), and deletedAt for a paranoid model. A timestamp the model declares itself, under that name, is kept as declared. In sequelize-typescript, @CreatedAt, @UpdatedAt and @DeletedAt name these timestamps the same way: as options that a subclass inherits along with underscored and paranoid, and that its own @Table overrides (@Table({ updatedAt: false })).
Foreign keys come from the associations and from an attribute’s own references:
A.belongsTo(B) keys on A: the attribute foreignKey names ("userId", or { name: "userId" }, whose field names its column), else, for a sequelize-typescript decorator (@BelongsTo), the first @ForeignKey(() => B) property (a base class’s come before the model’s own, and one a subclass declares again for another target still counts for the base’s), else <as or B's model name><primary key> (belongsTo(User) → UserId).A.hasMany(B) and A.hasOne(B) key on B, named the same way from A’s model name; a hasOne with as is named after its singular (as: "billingProfile" → billingProfileId). An inherited @ForeignKey(() => Owner) is read in the file that declares it, and it also matches an association with a subclass of Owner. @ForeignKey is read only for the decorators: Order.belongsTo(User) called directly is plain Sequelize and gives UserId.A.belongsToMany(B, { through }) keys on the through model, which through may also name (through: "member_roles" when a model is called that). A name that is no model’s (through: "order_categories") makes a join table of its own, listed as a model: the two keys are its primary key, and it has createdAt and updatedAt unless the association that defines it says timestamps: false, named as that association’s source model names its own: its createdAt: false leaves that column out of the join table too, and createdAt: "createdOn" renames it. The inverse association reuses the table, so its options don’t change these columns. The join table is defined with the defining association’s options and its source model’s (underscored gives user_id), and through: { paranoid: true } adds deletedAt; a name is one table per package. The two sides of a pair (User.belongsToMany(Role, { through: "user_roles" }) and its inverse, or two through one model) share their keys: an omitted otherKey is the other side’s foreignKey. A self-association names its other key after the singular of as (as: "Friends" → FriendId; an object as by its plural). A through model with no primary key of its own has the two keys as its primary key instead of id, as Sequelize does.references: { model, key } is a key to that model or table, with its own onDelete.A key points at the primary key, or at the attribute targetKey (belongsTo) or sourceKey (hasMany, hasOne, belongsToMany) names. When the model doesn’t declare the key, it is added with the type of that attribute. A key on the primary key or a unique column, and a hasOne’s, is shown as a OneToOneField; the others as ForeignKey.
Delete policy is the one Sequelize gives the constraint: an attribute’s own onDelete wins, then the association’s. Without one, a nullable key is SET NULL; otherwise belongsTo gives NO ACTION and hasMany / hasOne give CASCADE. As in Sequelize, a key the model declares counts as nullable here only with allowNull: true. belongsToMany keys delete on cascade. constraints: false makes no constraint, so the key has no delete policy, the join table’s keys included; the column and the association are still shown, since queries join on them.
define in new Sequelize(...)) come from configuration at run time and are not read; a project that sets underscored or freezeTableName there has other names in the database.@ForeignKey and a @BelongsTo name different targets for one column, the association’s target is used, since that is the constraint Sequelize makes.All the models of a workspace are one app, sequelize (sequelize_2 if another app already has that name), since they usually refer to each other across files. The grouping is by workspace, not a sign of one database: packages with databases of their own are listed together all the same. orm-lens scan --format json marks them with "orm": "sequelize" and adds tableName. Django models serialize exactly as before.
The models of PeerTube and Outline (sequelize-typescript), and of the Open Collective API and OWASP Juice Shop (init and associations), were read and compared with a separate count over the same source: every @Table class, init and define model, and every key the source names — a belongsTo / hasMany / hasOne with foreignKey, an attribute with references, a @ForeignKey used by an association — with its target and its onDelete when given. All 192 models and 420 named keys were found (426 keys in all, with the ones Sequelize names itself), no column was left without a type, and the DBML diagram has one reference per key. The only differences are three columns where PeerTube and Outline give @ForeignKey one target and @BelongsTo another. On the 29 Django and SQLAlchemy projects used for parser changes the output is the same as before.