Changelog
All notable changes to postgrelize are documented in this file.
The format follows Keep a Changelog 1.1.0, and the project follows Semantic Versioning. From 1.0.0 a breaking change raises the major version, a new feature the minor version and a fix the patch version (before 1.0.0 a breaking change raised the minor version). Breaking changes are listed under Breaking and also under the usual heading.
Entries link the pull request and, for roadmap work, the stage name and the ADR or spec that describes it (specs and ADRs live in .10x/). Until 0.12.0 the package was published as @tormozz48/postgrelize on GitHub Packages only.
Stages and releases
| Stage | Shipped in | Pull requests | Spec / ADR |
|---|---|---|---|
M0 tooling, M1 core, M2 ON CONFLICT, M3 lifecycle, M4 associations, M5 schema | 0.1.0 | #1–#6 | MVP design, ADR-001 to ADR-005, ADR-008 to ADR-010 |
| P1 PostgreSQL power (A query, B write, C connection, D schema) | 0.2.0 | #8–#11 | P1 design |
CTE options, copyTo | 0.3.0 | #13 | CTE and COPY design, ADR-013 |
| Read replicas, nested creation | 0.4.0 | #15 | Replication design, ADR-012, ADR-014 |
returningOld, scopes of included models | 0.5.0 | #17 | RETURNING old design, ADR-015 |
| Backlog 2: S1 README and coverage, S2 Sequelize issues review | 0.6.0 | #20, #22, #23 | Backlog 2 roadmap, S2 design, ADR-016 |
| Backlog 2: S3 docs site, S4 Effect core (steps 1 to 4) | 0.7.0 | #24–#26, #28 | S4 design, ADR-017 |
| OOP rewrite (S4 stopped, Effect removed) | 0.8.0 | #29 | OOP rewrite design, ADR-018 |
| Test isolation, contributor guide | 0.8.1 | #31, #32 | ADR-019 |
| Backlog 3: S5 injection assurance | 0.9.0 | #34 | ADR-020 |
| Backlog 3: S6 refactor (a to g), public decorators | 0.9.0 | #35–#40, #42, #43 | S6 design, ADR-021, ADR-022 |
| Backlog 3: S9 PostgreSQL coverage matrix | 0.9.0 | #41 | pg gap analysis |
| Backlog 3: S7 coverage, S7b parity and robustness | 0.9.0 | #44, #47, #48, #50 | S7b design |
| Backlog 3: S8 LLM docs and TSDoc | 0.9.0 | #46, #49 | ADR-007 |
| Backlog 3: S10 performance | 0.9.0 | #51–#53, #55–#57 | S10 design |
| S16 session extras, named prepared statements | 0.10.0 | #61, #64 | S16 design, ADR-023 |
| Backlog 4: S14 types I | 0.10.0 | #62 | S14 design |
| Backlog 4: S12 set operations and FROM sources | 0.10.0 | #63, #65, #66 | S12 design, ADR-024 |
| S10b raw reads | 0.10.0 | #67 | S10b design |
| Backlog 4: S11 DDL objects, S17 operator helpers | 0.11.0 | #70–#75 | S11 design, ADR-025, S17 design |
| Backlog 4: S13 constraints, indexes, partitioning | 0.12.0 | #78, #81, #82, #84 | S13 design, ADR-027 |
| Backlog 4: S15 types II | 0.12.0 | #77, #79, #80, #83 | S15 design, ADR-026 |
| S16b feature examples enforcement | 0.12.0 | #85, #86 | Feature examples design |
| Brand: logo (0.10.0), hero art and favicon | 0.10.0, 1.0.0 | #60, #88 | none |
| Backlog 5: distribution on npmjs.com (S18a) | 1.0.0 | #89, #90 | Backlog 5 roadmap, ADR-028 |
Unreleased
1.9.2 - 2026-11-25
Fixed
- The data types are callable and constructable like in v6:
DataTypes.INTEGER(11),DataTypes.BIGINT({ length: 20 }),new DataTypes.INTEGER(),DataTypes.SMALLINT.UNSIGNED.ZEROFILL(),DataTypes.UUID(),new DataTypes.JSONB(),DataTypes.DOUBLE(10, 2)(alsoTINYINT,MEDIUMINT,REAL,BOOLEAN,TIME,DATEONLY,CITEXT,INET,CIDR,MACADDR,TSVECTOR,HSTORE,JSON); they were not, and callingDataTypes.INTEGER(11)threw. The arguments are recorded intype.optionsand PostgreSQL ignores them, as in v6;UNSIGNED/ZEROFILLrecord a flag inoptions(still no effect on the column). The calls return theDataTypes.<X>DataTypeinterface types. The bareDataTypes.STRINGand similar types now havetoSql()too, as their types already claimed. (#182)
1.9.1 - 2026-11-25
Fixed
- The queries of models, instances and the
QueryInterfacerun throughsequelize.query, like v6, so a wrapper or an override ofsequelize.querysees the SQL of every statement (it bypassed the method before, going to the connection manager directly). The statement arrives as a string with the bound values inoptions.bind; a wrapper has to hand the options on unchanged. See Wrappingsequelize.query. (#183)
Changed
- Regression tests pin that, with
Sequelize.useCLS()(AsyncLocalStorage or a namespace), the hooks offindAll/findOne/findByPk/count/create/bulkCreate/update/destroy/upsert/restore/ aggregates and of the instancesave/update/destroy/reloadreceive the ambient transaction inoptions.transaction, like v6; a follow-up query in anafterFindhook with it sees the uncommitted rows. This already worked in 1.9.0; an explicittransaction: nullis respected. (#183)
1.9.0 - 2026-11-25
Added
- The
DataTypes.<X>DataTypeinterface family of Sequelize v6 is exported as types throughDataTypes(DataTypes.DecimalDataType,StringDataType,IntegerDataType,EnumDataType<T>,ArrayDataType<T>, … and their...DataTypeOptions), so(type: DataTypes.DecimalDataType) => type.options.scalecompiles like in v6. The data types carry the matching runtime members:options(the arguments the type was created with),toSql(), and onVIRTUALreturnType/fields. Members postgrelize does not provide (dialectTypes,stringify,validate,BINARY,escape) are not declared, and v6 has noJSON/UUID/JSONBdata type interfaces. (#180)
1.8.5 - 2026-11-25
Fixed
- The table alias of a query (main table and includes) follows the model's current
Model.name, like v6, which reads it whenever it builds a query: a class renamed afterinit(a bundler, a test redefiningname) still emits the alias raw SQL fragments built fromModel.namerefer to. (#178)
1.8.4 - 2026-11-24
Fixed
instance.reload()of an instance reached through nested includes (ahasManychild, abelongsToof a child, …) loads that instance's own includes again, like v6 (_options.includeof a nested build); 1.8.3 did this only for an instance a finder returned itself. (#176)
Changed
- The
loggingcallback receives the SQL with the values inlined as literals (first argument), like v6, so a logged statement can be run as it is; the statement sent to PostgreSQL keeps its bound parameters. The second argument is{ bind, parameterizedSql }(the bound values and the statement as sent;parameterizedSqlis a postgrelize extension). The defaultconsole.loglogger therefore prints the values ofINSERT/UPDATEstatements too: setlogging: falseor a logger that redacts where that matters. (#176)
1.8.3 - 2026-11-24
Fixed
instance.reload()without options loads again theincludethe instance was loaded with by a finder, like v6 (_options.include); the loaded association was gone afterreload(). (#172)WhereOptions<T>never infersTfrom the attribute conditions, like v6, so a generic helperscope<T>(where: WhereOptions<T>)can feed a typedwhere(findAll({ where: scope({ type: { [Op.in]: types } }) })), and a where value may beundefinedin the types underexactOptionalPropertyTypes(the runtime still throws, like v6). (#172)
1.8.2 - 2026-11-24
Fixed
changed(key, value)has the two-argument overloadchanged<K extends keyof this>(key: K, value: boolean)of the v6 typings; it was found by the new generated type-call tests (#170).
Changed
- Generated API calls (unions,
null,keyof M, generic helpers, subclasses) and sample-value acceptance checks forWhereOptionsandupdatevalues are compared with v6 too, andnoUncheckedIndexedAccessjoins the compiler-flag matrix of the type-parity tests (#170).
1.8.1 - 2026-11-24
Fixed
- Regressions of 1.8.0 found by the nightly v6 suite:
instance.update()aftercreate(…, { fields })no longer fails with anundefinedprimary key, a stampedupdatedAtreaches the instance again,update(values, { fields })assigns only the listed attributes (custom setters excepted), andModel.update({ individualHooks: true })returns the instances its hooks worked on. The v6 suite baseline drops the 12 entries that now pass. instance.reload({ include })replaces an association instance the caller assigned earlier with the freshly loaded row, and drops values the fresh row no longer holds unlessattributeslimits the reload (v6reset). Compat tests also pin thatinstance.update()leaves the writtenupdatedAton the instance and thatModel.nameequalsmodelNamefor a renamed class.- Types now match Sequelize v6 where ddt hit gaps:
Model.updateaccepts a value of a union of attribute interfaces (UpdateValuesno longer distributes over the union),changed(key)acceptskeyof Min generic code,Model.primaryKeyAttributeis typedstring, and aWhereOptionsvariable initialised with{}acceptswhere.name = …(logic operators are separate members that require their operator).
Changed
- Type-parity tests now also compile the corpus under other compiler flags, and
npm run types:consumercompiles a Sequelize v6 project against v6 and against postgrelize and lists the errors only postgrelize reports.
1.8.0 - 2026-11-24
Fixed
instance.update()/save()send noRETURNINGdata back into the instance, like v6: it keeps its in-memory values ('08:30'for aTIMEcolumn, soafterUpdatehooks see what the caller assigned, not'08:30:00'; a column a hook decrypted stays decrypted after a paranoiddestroy()); only columns written fromfn/literaland generated columns take the value PostgreSQL computed. (#165)beforeFindAfterExpandIncludeAllhooks receive{ association }includes already resolved tomodelandas(and{ all: true }expanded), like v6. (#165)- An association value assigned to an instance (
b.form.transport = b) is a plain property, not one of its values, like v6:get({ plain: true })andtoJSON()follow only the includes the query loaded and no longer overflow the stack on a cycle. (#165) Model.nameequals themodelNameinit option when the model has nobeforeDefinehook (it stayed the class name, e.g.File$1from a bundler), like v6, so SQL built fromModel.namematches the table alias. (#165)instance.update(values)ignores keys whose value isundefined, like v6, instead of validating them asnull. (#165)ValidationErrorItem.originalholds what a custom (attribute or model) validator threw, like v6, so callers can tell their own error class apart. (#165)instance.update(values)/save()with nothing changed runs validation and thebeforeUpdate/beforeSavehooks before returning, like v6, so a hook can still change the write or veto it; no query runs when nothing ends up changed. (#165)findAllwithincludereturns every row when no include is a multi-association (hasMany,belongsToMany), like v6: rows with equal selected values are no longer collapsed when the primary key is not selected. With a multi-association include rows are still grouped (by primary key, else by the selected values). (#165)ForeignKeyConstraintError.fieldsandExclusionConstraintError.fieldskeep what the caller passed (an object stays an object, no value isundefined), like v6; they were turned into arrays of keys. (#165)WhereOptions<T>no longer infersTfrom the conditions underOp.and/Op.or/Op.not, so generic helpers such asapplyScope<T>(where: WhereOptions<T>)type-check when called with{ [Op.or]: [...] }. (#165)
Added
FindOptions.tableAs(a v6 option missing from its typings) aliases the main table inFROM; it is ignored whenincludeis set. (#165)
1.7.0 - 2026-11-24
Fixed
Model.updatesetsoptions.fields(the attributes invalues, plusupdatedAt) andoptions.attributes(the values with the newupdatedAt) before thebeforeBulkUpdatehooks, like v6; an explicitfieldsoption is kept, and a hook that changesfields,attributesorindividualHookstakes effect (#162).- In
afterCreate/afterUpdate/afterSavehooks the instance still reports its pre-save state (changed(),previous(key)), like v6: previous values and change tracking are reset after the after hooks (with afieldsoption only for the saved fields);isNewRecordis alreadyfalsethere. WithindividualHooks, a bulkupdaterunsafterUpdateon the instancesbeforeUpdatesaw (changed, with the newupdatedAt) unlessreturningor row-by-row saves apply (#162). [Op.or]/[Op.and]with a plain-object value join its entries with OR / AND like v6 (_whereGroupBind);{ owner: { [Op.or]: { [Op.is]: null, [Op.eq]: 5 } } }wasIS NULL AND = 5and returned no rows (#162).- A
required: trueinclude nested under a non-required include is joined inside the parent's parenthesisedLEFT OUTER JOIN ( ... )like v6, so root rows whose optional parent is empty are kept (it was a top-levelINNER JOINthat dropped them). Withlimitand a multi-association parent, the rootEXISTSfilter also applies when a direct child is required, as v6subQueryFilter(#162). - String arguments of
fn()are written into the SQL as escaped literals like Sequelize v6 (COUNT('*'),concat_ws(' ', ...),to_char(..., 'YYYY')) instead of bound parameters, which PostgreSQL could not type; the postgrelize helpers (trigramSimilarity, text search) keep binding their strings (#161). ADR-038. Op.isaccepts aliteral()or any other value, rendered like v6 (IS NULL,IS 5), instead of throwing;WhereOperatorstypes[Op.is]asboolean | null | Literal(#161). ADR-038.col('a.b.c')with three or more parts renders"a->b"."c"(include alias path) like v6, instead of three identifiers (#161).- The
get/setof an attribute definition have the model instance asthis(ModelAttributes<M, TAttributes>andAttributeOptions<M>take the model type, as in v6 types) (#161). - Option types of the finders and writers (
FindOptions,UpdateOptions,DestroyOptions,SaveOptions,CreateOptions,BulkCreateOptions, ...) have mutable keys, sooptions.where = ...and{ ...options, paranoid: false }compile as in v6 (#161).
1.6.0 - 2026-11-23
Changed
- Finder
replacements(literal()with:name/?infindAll,count,findByPk,update, ...) are written into the SQL as escaped literals like Sequelize v6, instead of one bound parameter per occurrence; a placeholder used inSELECTandGROUP BYnow produces identical expressions. Narrow exception to ADR-002, extends ADR-036 (ADR-037). Jsonandjson()takestring | number | boolean | nullas value, as in v6 types.DataTypeInputalso accepts a raw PostgreSQL type name ({ type: 'vector(384)' }), asDataTypeof v6 does.
Added
sequelize.getQueryInterface().queryGenerator.selectQuery(tableName, options, model)renders finder options to SQL text (values as escaped literals, ends with;), as v6; no scope, paranoid filter or hook is applied.
Fixed
get({ plain: true }),get()andtoJSON()include every attribute with a custom getter, also VIRTUAL ones without a stored value, as in Sequelize v6.order: [[Model.association, 'id', 'ASC']]accepts an association instance as the first item (findAll,reload); it threwInvalid order direction: id.where: { '$user.agent.id$': ... }with more than two path parts addresses the nested include alias"user->agent"."id", as v6.- A finder value beyond the
int4range (findByPk(99999999999)) compares as abigintand finds nothing instead of failing without of range for type integer. instance.validate()resolves with the instance at runtime, as v6 (declaredPromise<void>).- A column option object with a string
type({ type: 'varchar(5)' }) is read as column options. - Type parity with Sequelize v6: plain strings, numbers, booleans and dates are accepted for narrow columns in
where(enums, unions,Date | null,[Op.between]with astring[]);WhereOptions<T>accepts a top-level{ [Op.and]: [...] };Model#previoushas the v6 overloads;SaveOptionswithout argument is assignable toSaveOptions<Attrs>;sequelize.transactioncallbacks returnPromiseLike<T>, which keeps the contextual return type.
1.5.0 - 2026-11-23
Changed
sequelize.querywritesreplacements(:nameand?) into the SQL text as escaped literals through the sharedSqlLiteralescaper, as Sequelize v6 does, instead of binding them as$nparameters. A query with several;-separated statements and replacements now runs (before:cannot insert multiple commands into a prepared statement).bindand the replacements of the finders stay bound; a string with a NUL character throws. This is a deliberate, narrow exception to always-bound values; payload and property tests cover the escaper. v6 gap H, ADR-036.
Added
dialectModuleconstructor option, accepted for Sequelize v6 type compatibility (postgrelize always loadspgand ignores it).
Fixed
- An explicit
undefinedno longer overrides an attribute default:Model.build({ s: undefined }),createandupsertusedefaultValuelike Sequelize v6 instead of failing aNOT NULLconstraint. - A function
defaultValueis called once per new row and its result used, as in Sequelize v6 (build,create,bulkCreate,findOrCreate); it threwDataCloneErrorbefore.syncno longer renders the function source as aDEFAULTclause. Model.count({ group })is typed asGroupedCountResultItem[](v6 overloads), sorows.map((r) => r.count)type-checks; the ungrouped call staysnumber.CountWithOptionsis exported. Runtime unchanged. Part of the Sequelize v6 type-parity work (ADR-032).- Type parity with Sequelize v6:
IncludeOptionsand thefieldsoption ofSaveOptions/UpdateOptionsare mutable (hooks and helpers can assigninclude.required,options.fields, …);Model.max/Model.mintake<T, M>in the v6 order, somax<string | null, MyModel>('name')compiles;validatemodel functions are typed withthisas the model instance, sothis.otherAttributeandthis: MyModelboth compile. Model.updatetypes follow v6: withreturning: truethe result is[affectedCount, affectedRows](rows no longer optional), otherwise[affectedCount]. Part of the Sequelize v6 type-parity work (ADR-032).OrderisFn | Col | Literal | OrderItem[]as in Sequelize v6 instead of collapsing tounknown, soconst order: Order = []; order.push(['id', 'ASC'])type-checks. Part of the Sequelize v6 type-parity work (ADR-032).WhereOptions<A | B>no longer distributes over a union model: like v6 it keys on the attributes the members share, so{ type: ['a', 'c'] }type-checks whentypeis'a' | 'b'onAand'c'onB. Part of the Sequelize v6 type-parity work (ADR-032).- VIRTUAL attributes as in Sequelize v6:
Model.updatenever writes a virtual attribute (it used to fail withcolumn "x" does not exist) and, withsideEffects(defaulttrue), also updates the attributes the setter of a virtual attribute changes (sideEffects: falseturns this off);DataTypes.VIRTUAL(type, ['a', 'b'])dependencies are used: a query that selects the virtual attribute selectsaandbinstead of a non-existent column. Found by the v6 suite harness; differential tests. - Finished transactions as in Sequelize v6: a query on a transaction that was committed or rolled back (or whose
commit()/rollback()is already running) is rejected withcommit|rollback has been called on this transaction(<id>), you can no longer use it. (The rejected query is attached as the 'sql' property of this error)and the error hassql, instead ofTransaction has not startedor running;transaction.afterCommit(fn)throws"fn" must be a functionfor anything else. Found by the v6 suite harness; differential tests. instance.destroy()of a paranoid model (soft delete) andinstance.restore()resolve with the instance, as in Sequelize v6 (they resolved with nothing); a harddestroy()still resolves with nothing (v6 resolves with[]). The declared type staysPromise<void>. Found by the v6 suite harness; differential test.- A model that declares
createdAt/updatedAtitself withallowNull: false(typically with a customfield) can create records: the timestamps of a new record are set before validation, as in Sequelize v6; before,create,saveandbulkCreatefailed withnotNull Violation: createdAt cannot be null. Found by the v6 suite harness; differential test. - Association API as in Sequelize v6: defining an association whose alias is the name of an attribute of the source model throws
Naming collision between attribute 'x' and association 'x' on model M. To remedy this, change either foreignKey or as in your association definition(it used to shadow the attribute);hasMany.get(instances)andhasOne.get(instances)load the rows of several source instances with one query and return an object keyed by the source key (arrays forhasMany, an instance ornullforhasOne). Found by the v6 suite harness; differential tests.
1.4.0 - 2026-11-23
Sequelize v6 parity part four: cascade hooks, hook semantics, sequelize.query statements and error messages, and the v6 guards against writes without where; breaking only for code that relied on those guards missing.
Added
- Cascade hooks, as in Sequelize v6: an association with
onDelete: 'CASCADE'andhooks: trueloads its rows and destroys each with its ownbeforeDestroy/afterDestroyhooks when the owner instance is destroyed (a real delete, not the soft delete of a paranoid model); an error in a hook stops the destroy. This replaces the documented limitation thathookswas accepted and ignored.association.optionsis public, as in v6. Found by the v6 suite harness; differential tests. IncludeOptions.on(customONcondition of an include join, as in v6),AssociationOptions.hooks(accepted for v6 typing; the cascade runs in PostgreSQL),QueryInterface#queryGenerator(typedunknownlike v6), theLOCKtype next to theLOCKvalue,GroupedCountResultItem,instance.update(key, value), andfn/col/literalvalues forModel.update,Model.updateStatementandinstance.update. Part of the Sequelize v6 type-parity work (#133, ADR-032).Model#get(key: string)overload andget<K extends keyof this>(key)like v6, so included associations and model getters type-check.
Changed
findAndCountAllhas the v6 overloads:countis a number, or an array ofGroupedCountResultItemwhengroupis given.ConstraintErrorOptions.parentis optional, andLoggingFunctionis(sql: string, timing?: number) => voidas in v6.
Fixed
- Guards of Sequelize v6 against writes and reads that match more than intended:
Model.updatewithoutwherethrowsMissing where attribute in the options parameter;Model.destroywithoutwhere(and withouttruncate: true) throwsMissing where or truncate attribute in the options parameter of model.destroy.(both used to update or delete every row); awhereattribute whose value isundefined(a missing variable) throwsWHERE parameter "x" has invalid "undefined" valuein every query that takes awhere, instead of silently matching nothing; anENUMattribute without values throwsValues for ENUM have not been defined.when the model is defined. Breaking only for code that relied on the old behaviour (an update or destroy withoutwhere, an undefined value in awhere);where: {}is still allowed. Found by the v6 suite harness; differential tests. - With
Sequelize.useCLS, model hooks (beforeCreate,afterFind,beforeBulkUpdate,beforeCount,beforeDestroy,beforeRestore,beforeUpsert, ...) receive the current transaction in thetransactionoption they are given, as in Sequelize v6; the queries of the operation already used it. Found by the v6 suite harness; differential test. sequelize.queryas in Sequelize v6: a statement given as an object ({ query, values },{ query, bind }, or a class instance with these properties) works; conflictingreplacements/bind(alsosql.values,sql.bind) are rejected with the v6 messages ("Bothreplacementsandbindcannot be set at the same time", ...);replacementsthat is neither an array nor a plain object, a missing named replacement (Named replacement ":x" has no entry in the replacement map.) and a missing bind parameter (Named bind parameter "$x" has no value in the given object., also for$0and$01of an array) use the v6 error messages; integer and boolean replacements are sent with a cast ($1::int4,$2::boolean) so thatselect :n as nreturns a number, as v6 does by writing the value into the SQL (the value stays a bound parameter). The generated SQL text of replacements changes accordingly. Found by the v6 suite harness; differential tests.- Hook semantics of Sequelize v6:
individualHooksofupdate,destroyandrestorerun the hook for every row at once (Promise.all; the first rejection ends the call) instead of one row after the other; abeforeDestroyhook that sets a VIRTUAL attribute no longer breaks the soft delete (virtual attributes are never written bysave);sequelize.options.hooks = {}replaces the global hooks of the instance;sequelize.modelManager(models,getModel,addModel,removeModel). Differential tests. InitOptions.name({ singular, plural }) is applied: it gives the default alias and foreign key ofbelongsTo,hasOne,hasManyandbelongsToManyand the accessor names; it was ignored, soAgent.belongsTo(User)withname: { singular: 'user' }looked for the columnUserIdinstead ofuserId(#133).findAndCountAll({ group })forwardsgroupto the count query, socountis the per-group array as in v6 instead of the total number of rows (#133).
1.3.0 - 2026-11-22
Sequelize v6 parity part three: findByPk and replacements, the default export and constructable CommonJS entry, four runtime gaps found by Sequelize's own test suite, and a docs site rebuilt for finding any feature fast.
Added
- Static hooks of
Sequelize, as in v6:Sequelize.addHook,removeHook,hasHook,hasHooks,runHooksand the shorthand for every hook type (Sequelize.beforeInit(fn),Sequelize.afterConnect(name, fn), ...).beforeInit(config, options)andafterInit(sequelize)run for every instance created afterwards (changes toconfigandoptionsare used for the connection); other static hook types are stored.Sequelize.options.hooks = {}removes all static hooks. beforeDefine(attributes, options)andafterDefine(model)hooks of aSequelizeinstance run when a model is defined (defineorModel.init): they can changeoptions.modelName,options.name, the attributes and the options. Found by the v6 suite harness; differential tests.findByPk(id, { rejectOnEmpty })overload that resolves to the model (Sequelize v6NonNullFindOptions);findOnetakes the sameNonNullFindOptions.FindOptions.replacementsworks as in v6::nameand?placeholders insideliteral()offindAll,findOne,findByPk,count,findAndCountAll(and the other model queries) are substituted, every value as a bound parameter, arrays expanding to a list. This reverses the 1.2.0 deviation that finders ignored the option. New row on the Security page, payload and property tests, and a differential test against Sequelize v6.- Default export and constructable CommonJS entry, as in Sequelize v6:
import Sequelize from 'postgrelize'works, andrequire('postgrelize')is theSequelizeclass with every named export as a property (sonew (require('postgrelize'))(url)andrequire('postgrelize').Sequelizeboth work). In CommonJSHasOne,HasMany,BelongsToandBelongsToManystay the decorators. ADR-034 nest: trueforsequelize.query(nestsa.bcolumn names; impliesSELECT),distinctandcolforfindAndCountAll(forwarded to its count query),WhereAttributeHashValueexport.- Docs site reorganised for finding things fast: a Reference hub (by entity and by task), an Extensions page listing everything that Sequelize v6 lacks, and a generated option reference with a table (type, default, effect) for every option of every method. New guide pages for errors and for connection, pool and logging. Extensions are tagged
@postgrelizein TSDoc (registered intsdoc.json), and apostgrelize extensionbadge built from the tag marks them in the option reference, the API reference and the guide;tests/docsfail when an option has no description, an option's v6 status is undecided, a guide link has a dead anchor, or an extension section has no badge. Spec:.10x/specs/2026-11-22-docs-reference-design.md, ADR-035. Existing URLs are unchanged.
Changed
Model#reload(options)takes theFindOptionsof v6 (include,attributes,paranoid,lock,hooks, ...) and reads the row throughfindOne, so default scopes andparanoidapply as in v6 (reloading a soft-deleted row needsparanoid: false). Breaking only for code that reloaded a soft-deleted row without options.- Types now match v6: attribute
get/settakethisas the model,WhereAttributeHash<T = any>,Model.sequelizeandinstance.sequelizeareSequelize,ModelValidatorFunctionaccepts the callback style, hook function parameters areany.
Fixed
Model.updatewithindividualHooks: true, as in Sequelize v6: it returns[affectedCount, instances]even withoutreturning, and the changesbeforeUpdatehooks make to the instances are written (as one UPDATE when every row got the same changes, else row by row withhooks: false). It used to ignore them. Found by the v6 suite harness; differential tests.afterFindhooks offindOneandfindByPkreceive the instance (ornull), not an array, so a hook that changes the instance changes whatfindOnereturns, as in v6. Code that read an array in anafterFindhook offindOnemust read the instance.findAllis unchanged.{ type: DataTypes.ENUM, values: ['a', 'b'] }(the bareENUMtype with avaluesattribute option, as in Sequelize v6) defines the enum column; the type used to be undefined andsync()failed withtype "undefined" does not exist. New attribute optionvalues. Found by the v6 suite harness; differential test.- An include given only a model (
include: [{ model: Tag }]) resolves, when the source has several associations to that model, to the one without an explicit alias, as in Sequelize v6; it used to throwEagerLoadingError: ... associated multiple times. It still throws when every association to the model has an alias. Found by the v6 suite harness; differential test. - Four gaps found by running Sequelize v6's own test suite against postgrelize, each with a differential test:
ValidationError#get(path)returns the items of one attribute;sequelize.define(name)works without attributes;BelongsTo#get(instances)loads several sources at once and returns an object keyed by foreign key;references: { model: SomeModel }accepts a model class (DDL andsyncordering use its table name). Stage G3 of the v6 compatibility gate, spec2026-11-22-v6-compat-gate-design.
1.2.0 - 2026-11-22
Sequelize v6 parity for a production migration, part two: the retry option, the public connectionManager and the Sequelize v6 type API.
Added
- The
retryoption of Sequelize v6 (max,match,backoffBase,backoffExponent,backoffJitter,timeout,name,report) on theSequelizeconstructor, on queries and on transactions (merged field by field over the instance option). It repeats a failed query, including the connection acquisition, and the connection acquisition plusBEGINof a transaction, with the matching and backoff rules ofretry-as-promised(implemented in-house, no new dependency). A statement inside an open transaction,COMMIT, COPY andlistenare not retried; nothing is retried by default or withoutmax. The connection error classes carry the v6 names (SequelizeConnectionRefusedError, ...), so v6matchlists work unchanged. ADR-031 sequelize.connectionManagerwithgetConnection(options?)andreleaseConnection(connection), as in Sequelize v6. Every query, finder, write, transaction,findEach,copyFrom/copyTo, advisory lock andsyncacquires and releases its pooled connection through these two methods, looked up at call time, so apps can reassign them on the instance to route connections (for example per request to one of several databases). A connection from anotherSequelizeinstance's manager works on this instance and is released to its own pool; releasing a connection twice is ignored. New typesConnection,GetConnectionOptions,ConnectionManagerContract. ADR-030sequelize.connectionManager.destroyConnection(connection)(closes a broken connection and removes it from its pool; the pool opens a replacement on demand) andsequelize.connectionManager.poolwith livesize,available,using,waitingandmaxSizecounters for health gauges, as in Sequelize v6 (readable before the first connection). Withreplicationthe counters are totals over the writer and the replicas, pluspool.readandpool.write(v6 has no totals there);getConnection({ type: 'read' })returns a replica connection andreleaseConnectionreturns it to its replica pool (v6 reaches a replica only for the type'SELECT', which is accepted too). New typesConnectionPool,PoolCounters. ADR-033- Type API of Sequelize v6:
Model<TAttributes extends {} = any, TCreationAttributes = TAttributes>,ModelStaticas in v6,InitOptions.name,FindOptions.replacements, theSequelize#queryoverloads (query<T>(sql, { type: QueryTypes.SELECT })returnsT[],plain: truereturnsT | null,modelreturns instances,QueryTypes.SELECTworks as a type), genericAssociation<S, T>and genericBelongsTo/HasMany/HasOne/BelongsToManytypes, every*Mixinand*MixinOptionstype of the four association files, and the exportsIncludeable,ProjectionAlias,FindAndCountOptions,Options,Utils(expression classes,useInflection,pluralize,singularize),ModelCtor,ModelDefined,ModelType,NonNullFindOptions,FindOrBuildOptions,InstanceUpdateOptions,Identifier,GroupOption,BindOrReplacements,ColumnsDescription. Not typed on purpose:FindOptions.replacements(finders do not substitute placeholders, onlysequelize.querydoes) and the v6{ query, values }form ofsequelize.query(not accepted at runtime);InitOptions.nameis typed but not yet applied to association names. A compat test compiles a corpus of v6-style code against the v6 declarations and against postgrelize and lists every v6 type name and option key that is still missing. ADR-032
Changed
Modelattributes default toany(wasRecord<string, unknown>) andModelStatic<M>has the v6 shape, so interface-typed models without index signatures compile.Model.associations,belongsTo,hasOne,hasManyandbelongsToManyreturn the association class types instead of a structural description;Sequelize.Utilsis now provided. ADR-032
1.1.0 - 2026-11-22
Sequelize v6 parity for a production migration (S19): minifyAliases, afterConnect, useCLS(namespace) with cls-hooked namespaces, the static aliases, hook shorthands and the missing Model / QueryInterface methods, backed by a test that compares the public API with sequelize@6.
Added
Sequelize#truncate(empties all model tables, referencing tables first, as in v6),Deferrable.SET_DEFERRED/Deferrable.SET_IMMEDIATEfor thedeferrabletransaction option andqueryInterface.deferConstraints(S19). With these, every v6 name that postgrelize lacks is on the API-surface allow-list with a reason. #107- Sequelize v6
QueryInterfacemethods:showIndex,showConstraint(andQueryTypes.SHOWCONSTRAINTS),getForeignKeysForTables,assertTableHasColumn,databaseVersion,createDatabase,dropDatabase,quoteIdentifier,quoteIdentifiers(S19). The catalog lookups filter by schema andshowConstrainthonours the constraint name (v6 ignores it). #106 - Sequelize v6
Modelmembers:describe,dropSchema,queryInterface,findCreateFind,getAssociations,getAssociationForAlias,hasAlias,removeAttribute,refreshAttributes, and on instancesequalsOneOf,setAttributes,whereandtoString(S19).findCreateFindinside a transaction uses a savepoint and returns the row that won a race withcreated: false(v6 returns an unsaved instance). #105 - Hook shorthands as in Sequelize v6:
sequelize.beforeCreate(fn)and the other hooks that run (alsobeforeConnect,afterConnect,beforeBulkSync,afterBulkSync),sequelize.runHooks(),Model.beforeSync()andModel.afterSync()(S19). #104 - Sequelize v6 static aliases: the data types (
Sequelize.STRING, ...), the error classes (alsoQueryError,SequelizeScopeError,UnknownConstraintError,ValidationErrorItemOrigin/ValidationErrorItemTypeandError),Deferrable,and,or,useInflection,version,Associationand the association classes,QueryInterface,Validator; the same data types and errors as module exports;DataTypes.NUMERICandDataTypes['DOUBLE PRECISION']; instance membersqueryInterface,QueryTypes,random(),escape(),validate(),getDatabaseName(),refreshTypes(),log(),and,or(S19). #103 - A test compares the public API surface of
Sequelize,Model,QueryInterface,Transaction,DataTypesand the exports withsequelize@6; every v6 name postgrelize lacks is on an allow-list (tests/compat/api-surface-exceptions.json) that is rendered as "API differences" in the migration guide and only shrinks (S19). #102 minifyAliasesconstructor option (Sequelize v6 parity): shortens include column aliases and table aliases of 64 or more characters so deep includes with long association names stay within PostgreSQL's 63-byte identifier limit, and maps rows back. #101
Fixed
- The
afterConnecthook now runs for every new pooled connection afterbeforeConnect, with(connection, config)as in Sequelize v6; the hook may run queries on the connection, and an error it throws closes that connection and rejects the query that needed it (v6 parity). #99 Sequelize.useCLS(namespace)no longer ignores acls-hookedstyle namespace: managed transactions store themselves undernamespace.get('transaction')(cleared when they finish), queries without atransactionoption read it from there, and a non-namespace argument throwsMust provide CLS namespace, as in Sequelize v6 (v6 parity).useCLS()without an argument is unchanged. #100
1.0.0 - 2026-11-21
First release on npmjs.com, as postgrelize (npm i postgrelize). The scoped @tormozz48/postgrelize mirror on GitHub Packages continues at the same version and is deprecated (ADR-028). The public API exported from src/index.ts is now covered by Semantic Versioning.
Breaking
- The package is renamed from
@tormozz48/postgrelizetopostgrelizefor publishing on npmjs.com; install it withnpm i postgrelizeand update imports (S18a, ADR-028). #90
Added
- Release workflow publishes to npmjs.com with provenance and keeps a deprecated GitHub Packages mirror (S18a, ADR-028). #90
- Hero art and a favicon set for the documentation site. #88
- npm version and downloads badges, and a migration note for users of the scoped name (S18b). #92
- Backlog 5 roadmap spec for publishing on npmjs.com (planning only, no code). #89
Changed
- CI runs the checks on Node 20, 22 and 24; one integration and compat job runs on Node 24 with PostgreSQL 18. #93
0.12.0 - 2026-11-16
Added
- Expression indexes:
{ expression }index fields, withnullsordering (S13, ADR-027). #78 EXCLUDEconstraints,NOT VALIDconstraints andvalidateConstraint(S13, ADR-027). #81- PostgreSQL 18 constraint forms:
NOT ENFORCED,WITHOUT OVERLAPS,PERIOD(S13, ADR-027). #82 - Declarative table partitioning (S13, ADR-027). #84
- Geometric data types
POINT,LINE,LSEG,BOX,PATH,POLYGON,CIRCLE(S15, ADR-026). #77 MULTIRANGEdata type (S15, ADR-026). #79COMPOSITEdata type (S15, ADR-026). #80- PostGIS
GEOGRAPHYandGEOMETRYGeoJSON values with a hex EWKB reader and writer, tested in an optional CI job (S15, ADR-026). #83
Changed
- Every PostgreSQL feature beyond Sequelize v6 now needs a runnable example, a guide section and a CI check (S16b). #85
- Added examples and guide entries for
NULLS FIRST/LAST,OVERRIDINGand longINlists. #86 - Release 0.12.0 version bump. #87
0.11.0 - 2026-11-16
Added
- QueryInterface support for extensions and sequences (S11, ADR-025). #70
- QueryInterface support for functions and triggers (S11, ADR-025). #72
- QueryInterface support for views and materialized views (S11, ADR-025). #73
- Row-level security policies on QueryInterface (S11, ADR-025). #74
UNLOGGEDandTEMPORARYtables (S11, ADR-025). #75- Operator and search helpers:
Op.similarTo,Op.notSimilarTo,jsonPathExists, range and network operators, full-text helpers (toTsVector,tsRank,tsHeadline,setWeight) andpg_trgmhelpers (S17). #71
Changed
- Release flow documented: the release commit goes through a pull request. #69
- Release 0.11.0 version bump. #76
0.10.0 - 2026-11-16
Added
- Opt-in named prepared statements through the
statementCacheoption (S16, ADR-023). #61 DEFERRABLEtransaction mode, per-querystatementTimeoutandbulkCreate({ unnest: true })(S16). #64- Set operations (
union,intersect,except) on subqueries andFETCH FIRST … WITH TIES(S12, ADR-024). #63 FROMsources:VALUES, set-returning functions with ordinality,JSON_TABLE(PostgreSQL 17),LATERALandTABLESAMPLE(S12, ADR-024). #65- Data-modifying CTEs and CTE
SEARCH/CYCLEclauses (S12, ADR-024). #66 - New data types: HSTORE objects,
LTREE,TIMESTAMP,MONEY,MACADDR8,XML,BIT/VARBIT,TSQUERY(S14). #62 - Project logo. #60
Changed
- Raw reads resolve the column plan once per result, so they run faster (S10b). #67
- Release 0.10.0 version bump. #68
Fixed
- HSTORE values are returned as objects. #62
0.9.0 - 2026-11-15
Added
- Public model decorators (
@Table,@Column, association and hook decorators) andsequelize.addModels(S6g, ADR-022). #42 - PostgreSQL coverage matrix page listing what is supported, literal-only, planned or out of scope (S9). #41
- LLM-facing documentation:
llms.txt,llms-full.txt,llm/USAGE.mdand an Agent Skill shipped in the npm package (S8a). #46 - TSDoc for the whole public API, enforced by tests and the docs build (S8b). #49
- Security page, SQL-injection test suite (payload and property tests), CodeQL scanning and
SECURITY.md(S5, ADR-020). #34 - Performance guide, plus a benchmark that compares every case with Sequelize v6 (S10). #51, #57
Sequelize#createSchema,showAllSchemas,dropSchemaandQueryInterface#dropAllSchemas, which v6 exposes. #34
Changed
- Internals are split into small classes, mixins and decorators under enforced size limits (S6a to S6f, ADR-021). #35, #36, #37, #38, #39, #40, #43
- Performance work on row mapping, include assembly, option merging, hook dispatch, SQL assembly,
toJSON, change tracking and validation (S10). #52, #53, #55, #56 - Test coverage raised to 99.7% lines, with thresholds enforced in CI (S7). #44
- Parity and robustness fixes against Sequelize v6 behaviour (S7b). #47, #48, #50
Fixed
create,bulkCreateandsavewith an explicitfieldslist add timestamps, version and defaulted keys like v6. #47Model.schema(name, options)returns a schema-bound model,set()keeps an attribute changed after setting it back,aggregatehonoursplain: falseanddataType, andhasHookof an unregistered type returnsundefined. #47- LISTEN reconnects after a failed connect,
beforeBulkSync/afterBulkSyncand per-model sync hooks run, and checked-out clients handle errors and are discarded when broken. #48 - Association, validation and raw-query results match v6 (for example
hasOnesetters,EagerLoadingErroron a wrong alias,belongsToManyjoinTableAttributes). #50
Security
- Closed the injection paths found by the S5 audit: unknown lock strengths fall back to
FOR UPDATE,Model.aggregatevalidates the function name,where(attr, comparator, value)rejects comment tokens,transaction({ isolationLevel })anddeferrableaccept only known constants, DDL type options must be non-negative integers, and thetimezoneoption must be an offset or IANA name (S5, ADR-020). #34
0.8.1 - 2026-11-15
Added
AGENTS.mdcontributor guide and documentation sync rules (ADR-019). #32
Fixed
- Test databases are isolated per run and lock-ordering races in tests are removed. No library code changed. #31
0.8.0 - 2026-11-15
Breaking
- The
postgrelize/effectentry point and the Effect-based API are removed. Use the mainpostgrelizeentry point. #29
Changed
- The whole library is rewritten as small classes with injected collaborators instead of an Effect core (OOP rewrite, ADR-018, supersedes ADR-005 and ADR-017). #29
Removed
- The
effectdependency and thepostgrelize/effectexport. #29
Fixed
describeTablereads enum values from the column type's own schema, in declared order. #29- Expression classes are recognised across package copies, so
instanceofchecks keep working. #29
0.7.0 - 2026-11-15
Added
- VitePress documentation site with runnable examples and a generated API reference (S3). #24
- Effect-based connection and transaction layer and the
postgrelize/effectentry point (S4 steps 1 to 3, ADR-017). #26 - Hooks and the read pipeline (
findAll,count) as Effect programs (S4 step 4). #28
Fixed
- A transaction-start failure no longer leaks a pooled connection. #26
include: [{ separate: true, limit }]applieslimitper parent, like v6. #25findEachloadsseparate: trueincludes for each batch. #25
0.6.0 - 2026-11-14
Added
- README badges and a self-hosted coverage report (S1). #20
docs/sequelize-issues.md: a public page of the Sequelize v6 PostgreSQL issues postgrelize fixes (S2, ADR-016). #22, #23
Fixed
- Included associations and junction rows are instance properties (
todo.User,user.Posts). #22 upsertandbulkCreate({ updateOnDuplicate })pick the conflict target from uniqueindexeslike v6 (sequelize#13734). #22- Explicit
createdAt/updatedAtattributes keep their definition (sequelize#10419), andupsertkeeps a suppliedupdatedAt(sequelize#17486). #22 ARRAY(ENUM)returns arrays (sequelize#15466, sequelize#11100). #22sync()handles foreign-key cycles by adding back-references after all tables exist (sequelize#15522). #22addColumnandsync({ alter })keep columncomment(sequelize#17118). #22order: ['jsonCol.path']works and orders by the jsonb value (sequelize#9040). #22- JSON
wherekeys with,,"or\match correctly (sequelize#18617), jsonb operators work on nested paths (sequelize#5173), and{ [Op.any]: [...] }works (sequelize#16043). #23 upsert({ overriding })works onGENERATED ALWAYSidentity columns (sequelize#14497) and uses a partial unique index predicate (sequelize#12595). #23bulkCreate({ ignoreDuplicates })assigns returned rows to the inserted records. #23describeTableunquotes literal defaults (sequelize#16787), andsync({ alter })keeps the sequence of non-keyautoIncrementcolumns (sequelize#13167). #23sync({ schema })anddrop({ schema })act only on that schema (sequelize#18423). #23belongsToManywith a customsourceKeyandlimit(sequelize#18256), and a top-level$include.attr$condition with ahasManyinclude andlimit(sequelize#12971). #23
0.5.0 - 2026-11-14
Added
returningOld/oldValues:RETURNING old.*on PostgreSQL 18 (ADR-015). #17- Scopes of included models apply, like v6 (ADR-015). #17
0.4.0 - 2026-11-14
Added
- Read replica routing with the
replicationoption anduseMaster(ADR-014). #15 - Nested creation through
include, for examplePost.create({ Comments: [...] }, { include }). #15
0.3.0 - 2026-11-14
Added
0.2.0 - 2026-11-14
Added
- Query power (P1-A): subqueries,
EXISTS,DISTINCT ON, window functions and row comparison. #8 - Write power (P1-B):
UPDATE … FROM,DELETE … USING,INSERT … SELECTandMERGE. #9 - Connection power (P1-C): cursors,
LISTEN/NOTIFY,SET LOCAL, advisory locks andCOPY. #10 - Schema power (P1-D): identity and generated columns,
INTERVAL,OVERRIDINGand enum alteration. #11
0.1.0 - 2026-11-14
First release: a PostgreSQL-only, Sequelize v6 drop-in ORM written in TypeScript, published to GitHub Packages.
Added
- Project tooling, CI/CD on GitHub Actions and the first documentation (M0, ADR-001, ADR-006, ADR-007). #1
- Core:
Sequelize, model CRUD,whereandOp, data types, errors and transactions, on thepgdriver with bound parameters (M1, ADR-002, ADR-004). #2 INSERT … ON CONFLICTthrough theonConflictoption andModel.insert(), plus security hardening (M2, ADR-003). #3- Hooks, validation (validator.js and Standard Schema), scopes, paranoid models and optimistic locking (M3, ADR-008). #4
- Associations and eager loading with
include(M4, ADR-009). #5 QueryInterface,sync/dropand constraints (M5, ADR-010). #6