- adds pages for a variety of guides
- add images to the many of the guides and docs pages
This commit is contained in:
Amruth Pillai
2026-01-23 14:18:48 +01:00
parent 895af548a0
commit ed74fb67f2
59 changed files with 325 additions and 139 deletions
+2 -14
View File
@@ -9,27 +9,15 @@ export async function resetDatabase() {
const pool = new Pool({ connectionString: env.DATABASE_URL });
const db = drizzle({ client: pool });
// Extract the username from a PostgreSQL connection string like: postgresql://postgres:password@localhost:5432/db
const username = (() => {
try {
const match = env.DATABASE_URL.match(/^postgres(?:ql)?:\/\/([^:]+):[^@]+@/);
return match ? match[1] : undefined;
} catch {
return undefined;
}
})();
console.log("🔑 Username:", username);
try {
await db.transaction(async (tx) => {
await tx.execute(sql`DROP SCHEMA drizzle CASCADE`);
await tx.execute(sql`CREATE SCHEMA drizzle`);
await tx.execute(sql.raw(`GRANT ALL ON SCHEMA drizzle TO ${username}`));
await tx.execute(sql`GRANT ALL ON SCHEMA drizzle TO postgres`);
await tx.execute(sql`DROP SCHEMA public CASCADE`);
await tx.execute(sql`CREATE SCHEMA public`);
await tx.execute(sql.raw(`GRANT ALL ON SCHEMA public TO ${username}`));
await tx.execute(sql`GRANT ALL ON SCHEMA public TO postgres`);
});
console.log("✅ Database reset completed");