Create seed using csv file

Hi guys, there is a way I can use seeds to store data from a csv file?

hi @rodolphonetto

I think you can use some librairies like : https://www.npmjs.com/package/csv-parser

and easly create data with Lucid.

I don’t have examples for that but I think your can do it easly.

Don’t hesitate if you need help :slight_smile:

1 Like

mb question is about how to copy csv files to build folder in adonis 5 ?

hi @protzi

You can configure your .adonisrc.json file :

"metaFiles": [
    ".env",
    ".adonisrc.json",
    "resources/views/**/*.edge",
    "public/**",
    "data/**/*.csv"
  ]

csv files in data folder will be automatically copied to build folder

2 Likes

Thanks, I’ll do that way :slight_smile:

1 Like