Search code examples
compoundjsrailway.js

In CompoundJS how does database seeding work?


I see that there is a folder for database seeds and a command for it but I couldn't find any documentation on how it works. Can someone help?


Solution

  • I'm sure this is a little late for an answer, but if you haven't found one yet, here goes.

    To create seeds:

    railway seed harvest 
    

    The keyword harvest will invoke the railway app so that it creates seeds based on whatever you currently have in the database. As for where this goes, depending on what environment you have set, eg development, production, etc, it will place you seed files like so:

    root/db/seeds/[environment]/[model].coffee
    

    ...where [model] is your model (User, Post, Account, etc), and [environment] is your environment (development, test, production, etc).

    To seed the database:

    railway seed
    

    The documentation is a little light on seeding right now.