feat(auth): Add Clerk user sync to database using webhooks

This commit is contained in:
2024-11-21 01:53:43 -05:00
parent 8fc8da036c
commit 645b4b63aa
6 changed files with 375 additions and 40 deletions

28
src/db/drop.ts Normal file
View File

@@ -0,0 +1,28 @@
import { sql } from '@vercel/postgres';
import { db } from './index';
import { config } from 'dotenv';
// load .env.local
config({ path: '.env.local' });
async function dropAllTables() {
try {
await sql`
DROP TABLE IF EXISTS
user_roles,
role_permissions,
permissions,
roles,
participant,
study,
users
CASCADE;
`;
console.log('All tables dropped successfully');
} catch (error) {
console.error('Error dropping tables:', error);
process.exit(1);
}
}
dropAllTables();