-
Notifications
You must be signed in to change notification settings - Fork 2
/
54-project-ownership-migration.patch
55 lines (46 loc) · 1.67 KB
/
54-project-ownership-migration.patch
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
project-ownership-migration
From: Bryan Larsen <[email protected]>
Run the migration generator to see the effect on the app:
$ ./script/generate hobo_migration
---
...1201135235_hobo_migration_project_membership.rb | 11 +++++++++++
db/schema.rb | 5 ++++-
2 files changed, 15 insertions(+), 1 deletions(-)
create mode 100644 db/migrate/20091201135235_hobo_migration_project_membership.rb
diff --git a/db/migrate/20091201135235_hobo_migration_project_membership.rb b/db/migrate/20091201135235_hobo_migration_project_membership.rb
new file mode 100644
index 0000000..e1114d7
--- /dev/null
+++ b/db/migrate/20091201135235_hobo_migration_project_membership.rb
@@ -0,0 +1,11 @@
+class HoboMigrationProjectMembership < ActiveRecord::Migration
+ def self.up
+ add_column :projects, :owner_id, :integer
+ add_index :projects, [:owner_id]
+ end
+
+ def self.down
+ remove_column :projects, :owner_id
+ remove_index :projects, :name => :index_projects_on_owner_id
+ end
+end
diff --git a/db/schema.rb b/db/schema.rb
index 128439e..c434f2d 100644
--- a/db/schema.rb
+++ b/db/schema.rb
@@ -9,14 +9,17 @@
#
# It's strongly recommended to check this file into your version control system.
-ActiveRecord::Schema.define(:version => 20091201134811) do
+ActiveRecord::Schema.define(:version => 20091201135235) do
create_table "projects", :force => true do |t|
t.string "name"
t.datetime "created_at"
t.datetime "updated_at"
+ t.integer "owner_id"
end
+ add_index "projects", ["owner_id"], :name => "index_projects_on_owner_id"
+
create_table "stories", :force => true do |t|
t.string "title"
t.text "body"