Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 4 additions & 3 deletions dashboard/starter-example/app/seed/route.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ import { invoices, customers, revenue, users } from '../lib/placeholder-data';
const sql = postgres(process.env.POSTGRES_URL!, { ssl: 'require' });

async function seedUsers() {
await sql`CREATE EXTENSION IF NOT EXISTS "uuid-ossp"`;

await sql`
CREATE TABLE IF NOT EXISTS users (
id UUID DEFAULT uuid_generate_v4() PRIMARY KEY,
Expand All @@ -30,7 +30,6 @@ async function seedUsers() {
}

async function seedInvoices() {
await sql`CREATE EXTENSION IF NOT EXISTS "uuid-ossp"`;

await sql`
CREATE TABLE IF NOT EXISTS invoices (
Expand All @@ -56,7 +55,6 @@ async function seedInvoices() {
}

async function seedCustomers() {
await sql`CREATE EXTENSION IF NOT EXISTS "uuid-ossp"`;

await sql`
CREATE TABLE IF NOT EXISTS customers (
Expand Down Expand Up @@ -103,6 +101,9 @@ async function seedRevenue() {

export async function GET() {
try {

await sql`CREATE EXTENSION IF NOT EXISTS "uuid-ossp"`;

const result = await sql.begin((sql) => [
seedUsers(),
seedCustomers(),
Expand Down