Handling initial user setup (authlogic)

Hey,
I was just wondering what you do to handle the initial user setup with
a project using authlogic.

I'm still in development but what i find annoying is the create new
users function is obviously kept in the admin section. I can't get
into the admin section without a user... You see the problem.

In most cases i have an admin user setup but now that i'm so far in
development everything is being locked down (ie user creating behind
closed doors) and if I make a db change and migrate my user table gets
wiped out.

How should I go about migrating with an initial admin user ?

OK, your question is a bit specific for your application but, one
thing you can do is to create a rake task for creating this admin
user.

So as of Rails 2.3.4 they've added a seeding function.

see http://ryandaigle.com/articles/2009/5/13/what-s-new-in-edge-rails-database-seeding
for tutorial.

Basically, add a seeds.rb to the db/ folder.

Fill it out with any ruby code. I used:
User.create(:username => "admin", :password =>
"temp", :password_confirmation => "temp", :email => "admin@temp.com")
puts "Created admin account"

then run: rake db:setup

This will migrate the schema and fill the db from your seed data.

Allows better separation of your seed data from your migration files.
And a distinct place to do it instead of assorted rake files.

Thankis, for your reply I wouldn't have found it had i not started to
search for rake tasks.