From daa46d7acb65d2ca47ab31a316d37d7abc473876 Mon Sep 17 00:00:00 2001 From: Skud Date: Sat, 18 May 2013 09:49:00 +1000 Subject: [PATCH] seed account types; require name too --- ...0130517234458_require_account_type_name.rb | 9 ++++++++ db/schema.rb | 4 ++-- db/seeds.rb | 22 +++++++++++++++++++ 3 files changed, 33 insertions(+), 2 deletions(-) create mode 100644 db/migrate/20130517234458_require_account_type_name.rb diff --git a/db/migrate/20130517234458_require_account_type_name.rb b/db/migrate/20130517234458_require_account_type_name.rb new file mode 100644 index 000000000..c4bdfa69a --- /dev/null +++ b/db/migrate/20130517234458_require_account_type_name.rb @@ -0,0 +1,9 @@ +class RequireAccountTypeName < ActiveRecord::Migration + def up + change_column :account_types, :name, :string, :null => false + end + + def down + change_column :account_types, :name, :string, :null => true + end +end diff --git a/db/schema.rb b/db/schema.rb index 6798d6d9a..d70d92d58 100644 --- a/db/schema.rb +++ b/db/schema.rb @@ -11,7 +11,7 @@ # # It's strongly recommended to check this file into your version control system. -ActiveRecord::Schema.define(:version => 20130517051922) do +ActiveRecord::Schema.define(:version => 20130517234458) do create_table "account_details", :force => true do |t| t.integer "member_id", :null => false @@ -22,7 +22,7 @@ ActiveRecord::Schema.define(:version => 20130517051922) do end create_table "account_types", :force => true do |t| - t.string "name" + t.string "name", :null => false t.boolean "is_paid" t.boolean "is_permanent_paid" t.datetime "created_at", :null => false diff --git a/db/seeds.rb b/db/seeds.rb index ce30ed5c1..601811628 100644 --- a/db/seeds.rb +++ b/db/seeds.rb @@ -58,6 +58,28 @@ if Rails.env.development? or Rails.env.test? @wrangler_user.roles << @wrangler @wrangler_user.save! + puts "Adding account types..." + AccountType.create!( + :name => "Free", + :is_paid => false, + :is_permanent_paid => false + ) + AccountType.create!( + :name => "Paid", + :is_paid => true, + :is_permanent_paid => false + ) + AccountType.create!( + :name => "Seed", + :is_paid => true, + :is_permanent_paid => true + ) + AccountType.create!( + :name => "Staff", + :is_paid => true, + :is_permanent_paid => true + ) + puts "Adding products..." Product.create!( :name => "Annual subscription",