aboutsummaryrefslogtreecommitdiff
path: root/db
diff options
context:
space:
mode:
authorWei Xie <xieconnect@gmail.com>2010-06-06 10:14:09 +0800
committerHans de Graaff <hans@degraaff.org>2010-07-25 09:08:51 +0200
commit854029152445e65fa67a59d49721801a8ee654df (patch)
tree4f489226a6e7e45ed8246f55b6b031a7246b2854 /db
parentimport User data from db:seed (diff)
downloadcouncil-webapp-854029152445e65fa67a59d49721801a8ee654df.tar.gz
council-webapp-854029152445e65fa67a59d49721801a8ee654df.tar.bz2
council-webapp-854029152445e65fa67a59d49721801a8ee654df.zip
Agenda implemented and tested
Diffstat (limited to 'db')
-rw-r--r--db/migrate/20100606022209_create_agendas.rb18
-rw-r--r--db/seeds.rb21
2 files changed, 39 insertions, 0 deletions
diff --git a/db/migrate/20100606022209_create_agendas.rb b/db/migrate/20100606022209_create_agendas.rb
new file mode 100644
index 0000000..14a878d
--- /dev/null
+++ b/db/migrate/20100606022209_create_agendas.rb
@@ -0,0 +1,18 @@
+class CreateAgendas < ActiveRecord::Migration
+ def self.up
+ create_table :agendas do |t|
+ t.string :name
+ t.text :description
+ t.datetime :start_at
+ t.datetime :end_at
+ t.datetime :created_at
+ t.datetime :updated_at
+ t.integer :owner_id
+ end
+ add_index :agendas, [:owner_id]
+ end
+
+ def self.down
+ drop_table :agendas
+ end
+end
diff --git a/db/seeds.rb b/db/seeds.rb
index 5882a4b..cd12661 100644
--- a/db/seeds.rb
+++ b/db/seeds.rb
@@ -31,3 +31,24 @@ users = User.create([
:password => 'developer',
:password_confirmation => 'developer'}
])
+
+puts 'adding agendas...'
+agendas = Agenda.create([
+ { :name => 'Go to the Zoo',
+ :description => 'Disneyland',
+ :start_at => 15.days.from_now,
+ :end_at => 16.days.from_now,
+ :owner_id => users[1].id},
+
+ { :name => 'hosting a party',
+ :description => 'HIT',
+ :start_at => 15.days.from_now,
+ :end_at => 16.days.from_now,
+ :owner_id => users[1].id},
+
+ { :name => 'agenda_test_name',
+ :description => 'agenda_test_description',
+ :start_at => 15.days.from_now,
+ :end_at => 16.days.from_now,
+ :owner_id => users[1].id}
+])