-
-
Notifications
You must be signed in to change notification settings - Fork 0
Closed
Description
Summary
OpenSaaS Stack does not support the type: 'enum' option on select() fields. In Keystone 6, this option caused the Prisma schema generator to emit proper PostgreSQL enum types and reference them in the column definition. Without this support, all select fields emit String columns, which is a breaking schema change when migrating from Keystone 6.
Keystone 6 Behaviour
direction: select({
type: 'enum',
options: [
{ label: 'Inbound', value: 'INBOUND' },
{ label: 'Outbound', value: 'OUTBOUND' },
],
validation: { isRequired: true },
db: { isNullable: false },
})Produced in schema.prisma:
direction TextMessageDirectionType
enum TextMessageDirectionType {
INBOUND
OUTBOUND
@@schema("public")
}OpenSaaS Stack Behaviour
The type: 'enum' option is silently ignored (or not accepted). The same field config produces:
direction StringImpact on Migration
When migrating a live Keystone 6 database to OpenSaaS Stack, the generated Prisma migration will attempt to alter the column type from the PostgreSQL enum type to text/varchar. This requires:
- An explicit
ALTER TABLE ... ALTER COLUMN ... TYPE text USING ...::textmigration - Dropping the enum type from the database
- This can fail or require manual intervention if there are foreign key constraints or other dependencies
In this project, the affected models and fields are:
| Model | Field | Keystone 6 Enum Type |
|---|---|---|
TextMessage |
direction |
TextMessageDirectionType |
TextMessage |
channel |
TextMessageChannelType |
TextMessage |
status |
TextMessageStatusType |
TextMessage |
callStatus |
TextMessageCallStatusType |
VoiceSession |
direction |
VoiceSessionDirectionType |
VoiceSession |
status |
VoiceSessionStatusType |
Conversation |
status |
ConversationStatusType |
Requested Behaviour
Either:
- Add
type: 'enum'support toselect()fields so the Prisma schema emits proper enum types, or - Document the migration path clearly: what SQL migration steps are required to safely convert enum columns to text when migrating from Keystone 6, and whether
prisma migratehandles this automatically or requires manual SQL
Additional Context
- Losing enum types removes database-level validation that prevents invalid values from being stored directly via SQL
- The silent drop of
type: 'enum'means users can easily miss this breaking change during migration
Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
No labels