# Creating database static data (roles, adminstators accounts)

**URL:** <https://www.ruby-forum.com/t/creating-database-static-data-roles-adminstators-accounts/149190>\
**Category:** Rails\
**Created:** [September 22, 2008, 12:50pm UTC](https://www.ruby-forum.com/t/creating-database-static-data-roles-adminstators-accounts/149190 "2008-09-22T12:50:09Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![daniel304](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/d/e5b9ba/32.png) [@daniel304](https://www.ruby-forum.com/u/daniel304)\
**Post date:** [September 22, 2008, 12:50pm UTC](https://www.ruby-forum.com/t/creating-database-static-data-roles-adminstators-accounts/149190/1 "2008-09-22T12:50:09Z")

</div>

Hello! I have a task to create some static data in database (for  
instance, bunch of user roles or administrator account).

Certainly, we should not create it up in our migrations.

If we create them in initializers, we’ll have to check if data is  
already in DB and even if such table exists (otherwise, rake tasks,  
even db:migrate will fail).

So, is there some brilliant solution?

---

<div class="post-metadata">

**Author:** ![daniel304](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/d/e5b9ba/32.png) [@daniel304](https://www.ruby-forum.com/u/daniel304)\
**Post date:** [September 22, 2008, 7:17pm UTC](https://www.ruby-forum.com/t/creating-database-static-data-roles-adminstators-accounts/149190/2 "2008-09-22T19:17:28Z")

</div>

On Sep 22, 6:49 pm, Daniel V. [removed\_email\_address@domain.invalid](mailto:removed_email_address@domain.invalid) wrote:

> Hello! I have a task to create some static data in database (for  
> instance, bunch of user roles or administrator account).
> 
> Certainly, we should not create it up in our migrations.
> 
> If we create them in initializers, we’ll have to check if data is  
> already in DB and even if such table exists (otherwise, rake tasks,  
> even db:migrate will fail).
> 
> So, is there some brilliant solution?

How about using a custom rake task?

I’m curious though, why can’t you create them via a migration?
