Migrating without getting seeds loaded?


(Andrew Roth) #1

Hi all,

Is there a way to run migrations without getting the seeds also run? Actually, I suppose I should check – is that normal behavior? As it is what I’m seeing. In any case I’ve tried rake -T seed/seeds/migrate to see if there are any tasks already defined and I don’t see any… and also tried googling it a bit but I haven’t seen anything.

Thanks!


(Andrew Roth) #2

To answer my own question… after some more examination, it seems this is done in lib/tasks/db.rake. Usually I think of seeds as run when you first install your application and never again, because you might customize the data and the seeds would put back stuff you modified or deleted. However, it seems from what I’m seeing in the code that discourse includes seed files that are smart enough to check 1) only install data that discourse absolutely needs (such as a “system” user) or 2) checks your site config before inserting data so that if you don’t want something, it won’t come back inadvertently. Just for the benefit of anyone else wondering about this, a more experienced dev can correct me if I’m not accurate here.


(Allen - Watchman Monitoring) #3

What’s coming back, that you don’t want?


(Andrew Roth) #4

I thought the staff category which we had removed was going to come back when I saw the output of migrate (which runs seeds), but I didn’t actually check. So in actual fact, nothing.


(Kane York) #5

The seeds will reset the security settings of the staff category, but only if it still exists.
If it detects that it had created the category in the past, but it’s not there anymore, it won’t recreate it (ever).