© 2026 Hedgehog Software, LLC

TwitterGitHubDiscord
More
CommunitiesDocsAboutTermsPrivacy
Search
Star
Setup for Free
Drizzle TeamDT
Drizzle Team•2y ago•
3 replies
Mike

drizzle-kit generate doesn't run custom sql

In addition to my
schema.ts
schema.ts
file to define tables, I also have
functions_and_triggers.ts 
functions_and_triggers.ts 
to create functions and triggers for Supabase
export const customAccessTokenHook = async () => {
  await db.execute(sql`
    CREATE OR REPLACE FUNCTION public.custom_access_token_hook(event jsonb)
    RETURNS jsonb
    LANGUAGE plpgsql
    AS $$
    BEGIN
       // do stuff here
    END;
    $$;
  `);
};
export const customAccessTokenHook = async () => {
  await db.execute(sql`
    CREATE OR REPLACE FUNCTION public.custom_access_token_hook(event jsonb)
    RETURNS jsonb
    LANGUAGE plpgsql
    AS $$
    BEGIN
       // do stuff here
    END;
    $$;
  `);
};

However when I run
drizzle-kit generate
drizzle-kit generate
it only runs the table creation and not the other file
Here's my drizzle.config.ts
export default defineConfig({
  dialect: 'postgresql',
  schemaFilter: ['public'],
  schema: './src/lib/db/schema/*',
  out: './supabase/migrations',
  dbCredentials: {
    url: process.env.DATABASE_URL || 'postgresql://postgres:postgres@127.0.0.1:54322/postgres'
  }
});
export default defineConfig({
  dialect: 'postgresql',
  schemaFilter: ['public'],
  schema: './src/lib/db/schema/*',
  out: './supabase/migrations',
  dbCredentials: {
    url: process.env.DATABASE_URL || 'postgresql://postgres:postgres@127.0.0.1:54322/postgres'
  }
});
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

`drizzle-kit generate:sqlite` doesn't work
Drizzle TeamDTDrizzle Team / help
2y ago
Cannot run "drizzle-kit generate" anymore
Drizzle TeamDTDrizzle Team / help
11mo ago
issue drizzle-kit pull -> drizzle-kit-generate -> drizzle-kit migrations
Drizzle TeamDTDrizzle Team / help
9mo ago
drizzle-kit generate not generating sql file anymore?
Drizzle TeamDTDrizzle Team / help
13mo ago