Database Migrations (Postgres)

Is there any additional documentation or info sources on the migrations functionality in the RDS module, specifically around Postgresql?

I have a couple of questions :slight_smile:

  1. Is there any way to enable extensions on the newly created database e.g. CREATE EXTENSION IF NOT EXISTS "uuid-ossp" to enable UUID functions in the database?

  2. Assuming 1) above, what is the syntax to use it in a column definition e.g. .addColumn("width", "uuid")?

  3. How do you create composite (multi-field) unique constraints? I know we can use (col) => col.primaryKey() as part of table creation. Does using that call on multiple columns create a multi-field constraint? Would that be a unique constraint?

  4. How do you specify a default column value? I know we can use .addColumn("width", "integer", (col) => col.notNull()) to specify not null, is there a similar call to specify default? If so, can it then be used with a DEFAULT uuid_generate_v4() definition to auto-populate uuids?

Cheers all!


As stated in the SST Docs it uses Kysely so you might be able to find the answers to all your questions over here.