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?
0 Replies
No replies yetBe the first to reply to this messageJoin
Want results from more Discord servers?
Add your server