Skip to content

Schema and migrations ​

Generate the canonical DDL for your naming configuration:

ts
import { createPostgresMemorySchemaSql } from '@anvia/memory-postgres'

const sql = createPostgresMemorySchemaSql({
  tablePrefix: 'assistant_',
})

The SQL creates pgcrypto, session, message, and error tables plus the unique message-position index. Apply it with your migration system, review privileges, and set createIfMissing: false at runtime.

The schema uses generated UUIDs and cascading foreign keys. Renaming a prefix or explicit table name points the adapter at a different schema; it does not rename existing objects or copy data.

Re-generate and diff DDL after package upgrades. The source changelog records contract changes, but your deployment owns rollout and rollback.

Built for Anvia.