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
56
57
58
59
60
61
62
|
# File 'lib/cortex_reaver/migrations/006_tags.rb', line 9
def up
unless table_exists? :tags
create_table :tags do
primary_key :id
varchar :name, :null => false, :index => true, :unique => true
integer :count, :null => false, :default => 0
varchar :title, :null => false
end
end
unless table_exists? :journals_tags
create_table :journals_tags do
primary_key :id
foreign_key :journal_id, :table => :journals
foreign_key :tag_id, :table => :tags
unique [:journal_id, :tag_id]
end
end
unless table_exists? :photographs_tags
create_table :photographs_tags do
primary_key :id
foreign_key :photograph_id, :table => :photographs
foreign_key :tag_id, :table => :tags
unique [:photograph_id, :tag_id]
end
end
unless table_exists? :projects_tags
create_table :projects_tags do
primary_key :id
foreign_key :project_id, :table => :projects
foreign_key :tag_id, :table => :tags
unique [:project_id, :tag_id]
end
end
unless table_exists? :pages_tags
create_table :pages_tags do
primary_key :id
foreign_key :page_id, :table => :pages
foreign_key :tag_id, :table => :tags
unique [:page_id, :tag_id]
end
end
end
|