teableio/teable

View on GitHub
packages/db-main-prisma/src/seeds/seed.abstract.ts

Summary

Maintainability
A
0 mins
Test Coverage
import type { PrismaClient } from '@prisma/client';

export abstract class AbstractSeed {
  constructor(
    public prisma: PrismaClient,
    public driver: 'postgresql' | 'sqlite3',
    public outLog: boolean = false
  ) {}

  abstract execute(): Promise<void>;

  protected log = (operation: 'UPSERT' | 'CREATE' | 'UPDATE', msg: string) => {
    (process.env.CI || this.outLog) && console.log(`${operation}: ${msg}`);
  };
}