Skip to content

Commit

Permalink
🔥 chore (finance): Updated seed script
Browse files Browse the repository at this point in the history
  • Loading branch information
aryanprince committed Mar 3, 2024
1 parent a28196d commit f0da6df
Showing 1 changed file with 1 addition and 67 deletions.
68 changes: 1 addition & 67 deletions apps/finance/src/server/db/seed.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ import { drizzle } from "drizzle-orm/postgres-js";
import postgres from "postgres";

import { env } from "~/env";
import { financeAccount, invoice } from "./schema";
import { financeAccount, invoice } from "./schema/main-schema";

if (!env.DATABASE_URL) {
throw new Error("DATABASE_URL is not set");
Expand All @@ -21,72 +21,6 @@ async function seed() {

await db.delete(invoice);
await db.delete(financeAccount);

await db.insert(invoice).values([
{
id: 1,
amount: "100",
dueDate: "2024-01-01",
invoiceType: "LIBRARY_FINE",
referenceId: "ABC123",
studentId: "c12345678",
updatedAt: new Date(),
},
{
id: 2,
amount: "200",
dueDate: "2024-01-01",
invoiceType: "LIBRARY_FINE",
referenceId: "DEF456",
studentId: "c23124112",
updatedAt: new Date(),
},
{
id: 3,
amount: "300",
dueDate: "2024-01-01",
invoiceType: "TUITION_FEES",
referenceId: "GHI789",
studentId: "c12345678",
updatedAt: new Date(),
},
{
id: 4,
amount: "400",
dueDate: "2024-01-01",
invoiceType: "LIBRARY_FINE",
referenceId: "JKL101",
studentId: "c23124112",
updatedAt: new Date(),
},
{
id: 5,
amount: "500",
dueDate: "2024-01-01",
invoiceType: "TUITION_FEES",
referenceId: "MNO111",
studentId: "c91238923",
updatedAt: new Date(),
},
]);

await db.insert(financeAccount).values([
{
id: 1,
studentId: "c12345678",
hasOutstandingBalance: true,
},
{
id: 2,
studentId: "c23124112",
hasOutstandingBalance: true,
},
{
id: 3,
studentId: "c91238923",
hasOutstandingBalance: true,
},
]);
}

seed()
Expand Down

0 comments on commit f0da6df

Please sign in to comment.