Skip to content

rajasekhar911/knex-csv-seeder

 
 

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

81 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

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

About

CSV file seeder for Knex

Resources

License

Stars

Watchers

Forks

Packages

No packages published

Languages

  • JavaScript 55.7%
  • CoffeeScript 44.3%