Questions tagged [seeding]
525 questions
6
votes
4 answers
Laravel Seeding Does not Fill in Fields
I have a database seed file:
class ContactTableSeeder extends Seeder {
public function run()
{
$contacts = array(
array(
'first_name' => 'Test',
'last_name' => 'Contact',
…

Gareth Daine
- 4,016
- 5
- 40
- 67
5
votes
2 answers
Laravel Factories and Seeding: Static array of arrays
For some of my tables, I'd like to insert a fixed amount of rows with specific data.
This is my categories factory:
$factory->define(Category::class, function (Faker $faker) {
return [
[
'name' => 'Politics',
…

good_afternoon
- 1,529
- 1
- 12
- 41
5
votes
1 answer
EF Core 2.1 HasData() creating deletes and re-inserts for unchanged entities on subsequent migrations
Update 8/29/18
Seeing this issue in inline new-ing of seed data as well. Opened an EF Core issue. Will update the question with any findings.
I am trying to use EF Core 2.1's seeding mechanism. However, I want to load the seed data from json flat…

Collin Barrett
- 2,441
- 5
- 32
- 53
5
votes
0 answers
How to generate SQL script from code first seeding?
As I am unable to use the migrate.exe tool to update the database, I am creating migration SQL scripts, and applying them manually, which works perfectly.
As the seed part is not included into the migrations, they do not yield an SQL script.
How…
user4233758
5
votes
1 answer
Hibernate - Seed database without using import.sql
I come from php/laravel. Whenever I want to seed the database i only need to run php artisan db:seed. This will run some php scripts that will insert data into the database.
I want to achieve this same feature using spring/hibernate. I know I can…

leamasuero
- 341
- 1
- 7
- 17
5
votes
2 answers
How to seed data for a node+mongo app deployed to Heroku?
I have a node express app with MongoDB as database. I want to have a seed.js file which I can run to fill in initial data to the database. I have no problem doing this on my local maschine. I just write the mongo commands in my seed.js file and run…

June
- 385
- 5
- 14
5
votes
2 answers
Why is the seed method not being called?
I am coding a MVC 5 internet application and would like some help to execute the seed method to populate the database with some entities.
Here is my DbContext code:
public class CanFindLocationDatabaseContext : DbContext
{
public class…

Simon
- 7,991
- 21
- 83
- 163
5
votes
2 answers
Laravel4 Database Seeder error - Call to undefined method SeedDummyOrders::setContainer()
I have two tables in my database:
order_header
order_details
I need some dummy data, so I created the following SeedDummyOrders class:
delete();
…

Latheesan
- 23,247
- 32
- 107
- 201
5
votes
3 answers
Laravel seeding error - wrong table name
Laravel is throwing this error when I try to seed the database.
My table is institution_school and not institution_schools, what Laravel reports in the error.
[Illuminate\Database\QueryException]
SQLSTATE[42S02]: Base table or view not found: 1146…

Aleksandar
- 636
- 1
- 7
- 24
5
votes
1 answer
How to have different seeders per environments in Laravel 4?
I have a simple question but I haven't found an answer in the web. Maybe my keywords are false.
So I am developing an app in Laravel 4. And I need to seed the database with different values according to the current active environment.
So for…

Reflic
- 1,411
- 15
- 25
5
votes
1 answer
rake undefined method `fields' for nil:NilClass on database seed
When i try to do
rake db:reset
or
rake db:drop
rake db:create
rake db:schema:load
rake db:seed
I randomly get a NoMethodError: undefined method 'fields' for nil:NilClass when the seed occurs.
Here's one:
[1m[35m (186.0ms)[0m INSERT INTO…

Crystark
- 3,693
- 5
- 40
- 61
4
votes
1 answer
Add seed data to development database for testing
I have a few tables that I would like to add about 10 rows of data to, in a manner that respects and illustrates their relationships.
How can I add seed data (dummy data) to my applications' development database for testing?
I'm hoping someone…

E.E.33
- 2,013
- 3
- 22
- 34
4
votes
2 answers
Using operator>> to seed mt19937
In a blog post entitled "C++ Seeding Surprises," Melissa E. O'Neill reports that, "When std::seed_seq tries to “fix” high-quality seed data, it actually makes it worse." According O'Neill, a truly random seeding makes all states possible, but if you…

tbxfreeware
- 547
- 1
- 9
4
votes
0 answers
Entity Framework Core seed data only if it does not exist
Entity Framework Migrations provide a way to seed data along with the creation of the table by using .HasData() on the Entity Type.
This will translate into a Migration with calls to MigrationBuilder.InsertData to insert the data when the migration…

Markus S.
- 2,602
- 13
- 44
4
votes
1 answer
How to create Seed in Nestjs?
I have my application with this directory structure.
App
|-- src
|-- modules
|-- user
|-- role
|-- company
|-- ...
|-- app.module.ts
|-- main.js (Application Bootstrap)
|-- seed.js
|--…

Sanders Gutiérrez
- 85
- 1
- 8