b_patel
b_patel
DTDrizzle Team
Created by b_patel on 4/18/2024 in #help
Text Enum Typing
I'm getting a type error that I don't understand
This will throw an error
Type 'string[]' is not assignable to type 'readonly [string, ...string[]] | [string, ...string[]] | undefined'.
Type 'string[]' is not assignable to type '[string, ...string[]]'.
Source provides no match for required element at position 0 in target.ts(2322)
export const AwxRFIStatus = {
ACTION_REQURED: "ACTION_REQUIRED",
ANSWERED: "ANSWERED",
CLOSED: "CLOSED",
};

export const awsOrganizationStateTable = pgTable("awx_organization_state", {
organizationId: text("organization_id").notNull().primaryKey(),
awsRFIStatus: varchar("aws_kyc_account_status", {
length: 256,
enum: Object.values(AwxRFIStatus),
}).notNull(),
This will throw an error
Type 'string[]' is not assignable to type 'readonly [string, ...string[]] | [string, ...string[]] | undefined'.
Type 'string[]' is not assignable to type '[string, ...string[]]'.
Source provides no match for required element at position 0 in target.ts(2322)
export const AwxRFIStatus = {
ACTION_REQURED: "ACTION_REQUIRED",
ANSWERED: "ANSWERED",
CLOSED: "CLOSED",
};

export const awsOrganizationStateTable = pgTable("awx_organization_state", {
organizationId: text("organization_id").notNull().primaryKey(),
awsRFIStatus: varchar("aws_kyc_account_status", {
length: 256,
enum: Object.values(AwxRFIStatus),
}).notNull(),
Was able to resolve by casting but doesn't make sense to me
export const AwxRFIStatus = {
ACTION_REQURED: "ACTION_REQUIRED",
ANSWERED: "ANSWERED",
CLOSED: "CLOSED",
};

export const awsOrganizationStateTable = pgTable("awx_organization_state", {
organizationId: text("organization_id").notNull().primaryKey(),
awsRFIStatus: varchar("aws_kyc_account_status", {
length: 256,
enum: Object.values(AwxRFIStatus) as [string, ...string[]],
}).notNull(),
export const AwxRFIStatus = {
ACTION_REQURED: "ACTION_REQUIRED",
ANSWERED: "ANSWERED",
CLOSED: "CLOSED",
};

export const awsOrganizationStateTable = pgTable("awx_organization_state", {
organizationId: text("organization_id").notNull().primaryKey(),
awsRFIStatus: varchar("aws_kyc_account_status", {
length: 256,
enum: Object.values(AwxRFIStatus) as [string, ...string[]],
}).notNull(),
1 replies
DTDrizzle Team
Created by b_patel on 1/2/2024 in #help
Setup for multiple databases
Looking to get some help on how to configure drizzle with an application that connects to multiple databases. Establishing different connection pools is pretty intuitive, but I could use some help understanding the setup for different configs for each database and different migration directories.
13 replies