Skip to content

postgrelize / ReplicationOptions

Type Alias: ReplicationOptions ​

ReplicationOptions = Readonly<{ read: ReplicationMember | readonly ReplicationMember[]; write?: ReplicationMember; }>

Defined in: src/connection/options.ts:99

The replication option: readers receive SELECTs outside transactions, the writer everything else.

Members inherit missing connection settings from the top-level options. See ReplicationMember.

Example ​

ts
const replication: ReplicationOptions = {
  read: [{ host: 'replica-1.internal' }, { host: 'replica-2.internal' }],
  write: { host: 'primary.internal' },
};
const db = new Sequelize('app', 'user', 'pass', { dialect: 'postgres', replication });

Released under the MIT License.