Skip to content
This repository has been archived by the owner on Apr 9, 2024. It is now read-only.

Latest commit

 

History

History
35 lines (26 loc) · 1.09 KB

README.md

File metadata and controls

35 lines (26 loc) · 1.09 KB

knex-csv-seeder

npm version Build Status codecov.io Dependency Status

Basic usage

Create a seed file for Knex.

knex seed:make seed_name

Change the code to import the data from CSV.
Please refer to the link format of the file.

import seeder from 'knex-csv-seeder';

exports.seed = seeder({
  table: 'users',
  file: '/path/to/users.csv',
  // recordsPerQuery: 100,
  // encoding: 'utf8' default encoding
  // parser: {
  //   delimiter: ',',
  //   quote: '"',
  //   escape: '\\'
  // }
});

Execute the seed files.

knex seed:run