puffy_tugboat
puffy_tugboat
DTDrizzle Team
Created by puffy_tugboat on 3/20/2024 in #help
Migration filename format with Supabase
Is there a way to configure the generated migration file name format in drizzle-kit? Supabase expects it in <timestamp>_name.sql , which I'm guessing is for checking the order of migrations, but the current format eg 0000_random_words.sql doesn't play nicely with that. Any suggestions?
1 replies
DTDrizzle Team
Created by puffy_tugboat on 3/14/2024 in #help
Raw sql in schema
Hello! I'm trying to reference the supabase auth table as mentioned in the supabase docs (https://supabase.com/docs/guides/auth/managing-user-data):
create table public.profiles (
id uuid not null references auth.users on delete cascade,
first_name text,
last_name text,

primary key (id)
);
create table public.profiles (
id uuid not null references auth.users on delete cascade,
first_name text,
last_name text,

primary key (id)
);
Here's what I have:
export const users = pgTable('users', {
id: sql`uuid not null references auth.users on delete cascade`,
});
export const users = pgTable('users', {
id: sql`uuid not null references auth.users on delete cascade`,
});
But I guess I'm not doing it correctly as Ts complains:
Type 'SQL<unknown>' is not assignable to type 'PgColumnBuilderBase<ColumnBuilderBaseConfig<ColumnDataType, string>, object>'.
Types of property '_' are incompatible.
Type '{ brand: "SQL"; type: unknown; }' is missing the following properties from type '{ brand: "ColumnBuilder"; name: string; dataType: ColumnDataType; columnType: string; data: unknown; driverParam: unknown; notNull: boolean; hasDefault: boolean; enumValues: string[] | undefined; dialect: "pg"; }': name, dataType, columnType, data, and 5 more.ts(2322)
Type 'SQL<unknown>' is not assignable to type 'PgColumnBuilderBase<ColumnBuilderBaseConfig<ColumnDataType, string>, object>'.
Types of property '_' are incompatible.
Type '{ brand: "SQL"; type: unknown; }' is missing the following properties from type '{ brand: "ColumnBuilder"; name: string; dataType: ColumnDataType; columnType: string; data: unknown; driverParam: unknown; notNull: boolean; hasDefault: boolean; enumValues: string[] | undefined; dialect: "pg"; }': name, dataType, columnType, data, and 5 more.ts(2322)
I'm aware there are other "solutions" to this problem of referencing the auth table that involve editing the generated SQL afterwards, but would prefer if I could somehow define the raw sql in the schema itself Thanks in advance
5 replies