-
Notifications
You must be signed in to change notification settings - Fork 82
/
schema.rb
116 lines (102 loc) · 4.02 KB
/
schema.rb
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
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
module Mobility
module Test
if ENV['RAILS_VERSION'] == '4.2'
parent_class = ::ActiveRecord::Migration
else
parent_class = ::ActiveRecord::Migration[[::ActiveRecord::VERSION::MAJOR, ::ActiveRecord::VERSION::MINOR].join(".")]
end
class Schema < parent_class
class << self
def up
create_table "posts" do |t|
t.boolean :published
end
create_table "post_metadatas" do |t|
t.string :metadata
t.integer :post_id
end
create_table "fallback_posts" do |t|
t.boolean :published
end
create_table "articles" do |t|
t.string :slug
t.boolean :published
end
create_table "article_translations" do |t|
t.string :locale
t.integer :article_id
t.string :title
t.text :content
end
create_table "multitable_posts" do |t|
t.string :slug
t.boolean :published
end
create_table "multitable_post_translations" do |t|
t.string :locale
t.integer :multitable_post_id
t.string :title
end
create_table "multitable_post_foo_translations" do |t|
t.string :locale
t.integer :multitable_post_id
t.string :foo
end
create_table "mobility_string_translations" do |t|
t.string :locale, null: false
t.string :key, null: false
t.string :value, null: false
t.integer :translatable_id, null: false
t.string :translatable_type, null: false
end
add_index :mobility_string_translations, [:translatable_id, :translatable_type, :locale, :key], unique: true, name: :index_mobility_string_translations_on_keys
add_index :mobility_string_translations, [:translatable_id, :translatable_type, :key], name: :index_mobility_string_translations_on_translatable_attribute
add_index :mobility_string_translations, [:translatable_type, :key, :value, :locale], name: :index_mobility_string_translations_on_query_keys
create_table "mobility_text_translations" do |t|
t.string :locale, null: false
t.string :key, null: false
t.text :value, null: false
t.integer :translatable_id, null: false
t.string :translatable_type, null: false
end
add_index :mobility_text_translations, [:translatable_id, :translatable_type, :locale, :key], unique: true, name: :index_mobility_text_translations_on_keys
add_index :mobility_text_translations, [:translatable_id, :translatable_type, :key], name: :index_mobility_text_translations_on_translatable_attribute
create_table "comments" do |t|
t.text :content_en
t.text :content_ja
t.text :content_pt_br
t.text :content_ru
t.text :author_en
t.text :author_ja
t.text :author_pt_br
t.text :author_ru
t.boolean :published
end
create_table "serialized_posts" do |t|
t.text :title
t.text :content
t.boolean :published
end
if ENV['DB'] == 'postgres'
create_table "jsonb_posts" do |t|
if ::ActiveRecord::VERSION::STRING < '5.0'
t.jsonb :title, default: '{}'
t.jsonb :content, default: '{}'
else
t.jsonb :title, default: ''
t.jsonb :content, default: ''
end
t.boolean :published
end
execute "CREATE EXTENSION IF NOT EXISTS hstore"
create_table "hstore_posts" do |t|
t.hstore :title, default: ''
t.hstore :content, default: ''
t.boolean :published
end
end
end
end
end
end
end