Questions tagged [seeding]

525 questions
568
votes
21 answers

Seeding the random number generator in Javascript

Is it possible to seed the random number generator (Math.random) in JavaScript?
weepy
  • 6,181
  • 4
  • 20
  • 10
168
votes
7 answers

Reset the database (purge all), then seed a database

Is there a rake command to wipe out the data in the database tables? How do I create a db:seed script to pre-fill data to my tables?
Blankman
  • 259,732
  • 324
  • 769
  • 1,199
114
votes
6 answers

EntityType 'IdentityUserLogin' has no key defined. Define the key for this EntityType

I am working with Entity Framework Code First and MVC 5. When I created my application with Individual User Accounts Authentication I was given an Account controller and along with it all the required classes and code that is needed to get the Indiv…
J86
  • 14,345
  • 47
  • 130
  • 228
98
votes
7 answers

MVC 5 Seed Users and Roles

I have been playing about with the new MVC 5, I have a few models, controller and views setup using code first migrations. My question is how do I seed users and roles? I currently seed some reference data in my Seed method in Configuration.cs. But…
MrBeanzy
  • 2,286
  • 3
  • 28
  • 38
93
votes
6 answers

Rails: Invalid byte sequence in US-ASCII (Argument Error) when I run rake db:seed

When I run rake db:seed in my Rails app, I'm getting this error: invalid byte sequence in US-ASCII (Argument Error) I just added science_majors and down to my seed file, and now when I run rake db:seed it gives me this error: invalid byte…
Adam Zerner
  • 17,797
  • 15
  • 90
  • 156
67
votes
12 answers

How to Seed Users and Roles with Code First Migration using Identity ASP.NET Core

I have created a new clean asp.net 5 project (rc1-final). Using Identity Authentication I just have the ApplicationDbContext.cs with the following code: public class ApplicationDbContext : IdentityDbContext { protected override…
Sauron
  • 2,156
  • 5
  • 17
  • 20
44
votes
4 answers

Entity Framework - Migrations - Code First - Seeding per Migration

I am looking into Migrations in an effort to clean up our deployment processes. The less manual intervention required when pushing a change to production the better. I have run into 3 major snags with the migrations system. They are show stoppers…
Talon
  • 3,466
  • 3
  • 32
  • 47
38
votes
2 answers

FactoryGirl + Faker - same data being generated for every object in db seed data

I am using FactoryGirl and Faker to generate user objects in my seeds.rb file but for some reason the exact same user is being created and rake db:seed is failing because of an email uniqueness validation. Factory for users: #users.rb require…
sixty4bit
  • 7,422
  • 7
  • 33
  • 57
37
votes
1 answer

Can I pass an argument to rake db:seed?

Part of my seeds.rb loads a lot of data into the database. I want to be able to selectively load this data. E.g. $ rake db:seed or $rake db:seed[0] would just load the necessary data to run the site, while $ rake db:seed[1] would load my big…
Chris
  • 1,231
  • 1
  • 17
  • 35
36
votes
5 answers

RoR, Can't iterate from DateTime/TimeWithZone

I have a simple task where I want to take a starting date and an ending date and loop over the days/dates. This code is being used in my db:seed rake task. Currently, my code has gone through the following…
Black Dynamite
  • 4,067
  • 5
  • 40
  • 75
34
votes
8 answers

Laravel 5.1 refresh and seed a single table

I'm looking to refresh and seed a single table in Laravel 5.1. Is this even possible? I have tried the below, but it gives an error (incorrect syntax). php artisan migrate:refresh --path=database/migrations/CreateTableTimesheet If I use: php…
V4n1ll4
  • 5,973
  • 14
  • 53
  • 92
31
votes
2 answers

setting seed locally (not globally) in R

I'd like to set seeds in R only locally (inside functions), but it seems that R sets seeds not only locally, but also globally. Here's a simple example of what I'm trying (not) to do. myfunction <- function () { set.seed(2) } # now, whenever I…
Manoel Galdino
  • 2,376
  • 6
  • 27
  • 40
29
votes
2 answers

What is a seed in terms of generating a random number?

What is a seed in terms of generating a random number? I need to generate hundreds to thousands of random numbers, I have read a lot about using a "seed". What is a seed? Is a seed where the random numbers start from? For example if I set my seed…
SirRupertIII
  • 12,324
  • 20
  • 72
  • 121
26
votes
2 answers

Laravel 5.3 db:seed command simply doesn't work

I do everything by-the-book: Installed fresh Laravel 5.3.9 app (all my non-fresh apps produce the same error) run php artisan make:auth create migrations for a new table `php artisan make:migration create_quotations_table…
Peter
  • 2,634
  • 7
  • 32
  • 46
26
votes
9 answers

appending to rake db:seed in rails and running it without duplicating data

Rake db:seed populates your db with default database values for an app right? So what if you already have a seed and you need to add to it(you add a new feature that requires the seed). In my experience, when I ran rake db:seed again, it added the…
corroded
  • 21,406
  • 19
  • 83
  • 132
1
2 3
34 35