Below you will find pages that utilize the taxonomy term “seeder”
Posts
Easy Node.js Mysql database table seeder
First, install npm dependencies:
npm i mysql2 @faker-js/faker dotenv Run the script with the command
node ./index.js Don’t forget to add the mysql db credentials to your .env file and of course edit the getSeedQuery function if you want to use it for your own table.
const mysql = require("mysql2"); const { faker } = require("@faker-js/faker"); require("dotenv").config(); function getSeedQuery(amount = 10000) { return Array.from({ length: amount }) .map(() => { const date = faker.