import BaseSchema from 'sosise-core/build/Database/BaseSchema'; import { faker } from '@faker-js/faker'; /** * For additional information, refer to: http://knexjs.org/#Schema ; https://fakerjs.dev/ */ export default class %name% extends BaseSchema { /** * Allows running the seeder only in a local environment (APP_ENV=local) */ protected onlyInLocalEnvironment = false; /** * Specifies the table where the data should be inserted */ protected tableName = 'table_name_comes_here'; /** * Executes the seeder */ public async run(): Promise { // Prepare data for seeding const data: any = []; // Generate 100 rows for (let row = 0; row < 100; row++) { data.push({ example_field_1: faker.person.firstName(), example_field_2: faker.date.between({ from: '2020-01-01', to: '2024-12-31' }) }); } // Insert data into the table await this.dbConnection.table(this.tableName).insert(data); } }