Skip to content
Discussion options

You must be logged in to vote

Seeds as described in the docs are just classes with run method. You can put any database related queries in them, You can use seeds to upload your custom data

https://adonisjs.com/docs/4.1/seeds-and-factories#_seeds

I think you are confusing seeds with factories. Factories are an additional resource you can use to create dummy data, You should be able to use seeds alone to upload the data

const Factory = use('Factory')
const Database = use('Database')

// Get your data from a json file or hardcode it like below

class UserSeeder {
  async run () {
    await Database
        .from('users')
        .insert([{username: 'foo'}, {username: 'bar'}])
  }
}

module.exports = UserSeeder

Replies: 1 comment 1 reply

Comment options

You must be logged in to vote
1 reply
@FashMuyhee
Comment options

Answer selected by FashMuyhee
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Help
Labels
None yet
2 participants