© 2026 Hedgehog Software, LLC

TwitterGitHubDiscord
More
CommunitiesDocsAboutTermsPrivacy
Search
Star
Setup for Free
Drizzle TeamDT
Drizzle Team•16mo ago
Mike

applying migrations... PostgresError: column "x" cannot be cast automatically to type x

when I modify a column from type text to enum
export const channelSubscriptionsTable = pgTable("channel_subscriptions", {
  ...
  subscription_type: text("subscription_type"),
});
export const channelSubscriptionsTable = pgTable("channel_subscriptions", {
  ...
  subscription_type: text("subscription_type"),
});

to this
export const subscriptionTypeEnum = pgEnum("subscription_type", [
  "free",
  "paid",
]);
export const channelSubscriptionsTable = pgTable("channel_subscriptions", {
  ...
  subscription_type: subscriptionTypeEnum("subscription_type")
});
export const subscriptionTypeEnum = pgEnum("subscription_type", [
  "free",
  "paid",
]);
export const channelSubscriptionsTable = pgTable("channel_subscriptions", {
  ...
  subscription_type: subscriptionTypeEnum("subscription_type")
});

I got this error
 severity_local: 'ERROR',
  severity: 'ERROR',
  code: '42804',
  hint: 'You might need to specify "USING subscription_type::subscription_type".',
  file: 'tablecmds.c',
  line: '12310',
  routine: 'ATPrepAlterColumnType'
 severity_local: 'ERROR',
  severity: 'ERROR',
  code: '42804',
  hint: 'You might need to specify "USING subscription_type::subscription_type".',
  file: 'tablecmds.c',
  line: '12310',
  routine: 'ATPrepAlterColumnType'

How do I fix this?
Drizzle TeamJoin
The official Discord for all Drizzle related projects, such as Drizzle ORM, Drizzle Kit, Drizzle Studio and more!
11,879Members
Resources

Similar Threads

Was this page helpful?
Recent Announcements

Similar Threads

Column _ cannot be cast automatically to type integer
Drizzle TeamDTDrizzle Team / help
3y ago
column "summary" cannot be cast automatically to type jsonb
Drizzle TeamDTDrizzle Team / help
3y ago
error: column "id" cannot be cast automatically to type uuid
Drizzle TeamDTDrizzle Team / help
3y ago
Cannot be cast automatically
Drizzle TeamDTDrizzle Team / help
11mo ago