comfy_blog 1.12.3 → 2.0.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/.travis.yml +5 -15
- data/Gemfile +7 -6
- data/LICENSE +1 -1
- data/README.md +14 -9
- data/Rakefile +1 -32
- data/app/controllers/comfy/admin/blog/posts_controller.rb +26 -22
- data/app/controllers/comfy/blog/posts_controller.rb +31 -38
- data/app/models/comfy/blog/post.rb +34 -36
- data/app/views/comfy/admin/blog/partials/_navigation.html.haml +4 -6
- data/app/views/comfy/admin/blog/posts/_form.html.haml +23 -11
- data/app/views/comfy/admin/blog/posts/edit.html.haml +2 -2
- data/app/views/comfy/admin/blog/posts/index.html.haml +29 -25
- data/app/views/comfy/admin/blog/posts/new.html.haml +2 -2
- data/app/views/comfy/blog/posts/index.html.haml +25 -10
- data/app/views/comfy/blog/posts/index.rss.builder +12 -12
- data/app/views/layouts/comfy/blog/application.html.erb +22 -0
- data/comfy_blog.gemspec +3 -1
- data/config/application.rb +13 -7
- data/config/blog_routes.rb +2 -2
- data/config/environments/development.rb +37 -4
- data/config/environments/test.rb +13 -4
- data/config/initializers/comfy_blog.rb +3 -7
- data/config/locales/cs.yml +38 -0
- data/config/locales/da.yml +38 -0
- data/config/locales/de.yml +38 -0
- data/config/locales/en.yml +38 -0
- data/config/locales/es.yml +38 -0
- data/config/locales/fr.yml +38 -0
- data/config/locales/it.yml +38 -0
- data/config/locales/ja.yml +38 -0
- data/config/locales/nb.yml +38 -0
- data/config/locales/nl.yml +38 -0
- data/config/locales/pl.yml +38 -0
- data/config/locales/pt-BR.yml +38 -0
- data/config/locales/ru.yml +38 -0
- data/config/locales/sv.yml +38 -0
- data/config/locales/tr.yml +38 -0
- data/config/locales/uk.yml +38 -0
- data/config/locales/zh-CN.yml +38 -0
- data/config/locales/zh-TW.yml +38 -0
- data/config/storage.yml +35 -0
- data/db/migrate/00_create_cms.rb +144 -116
- data/db/migrate/01_create_blog.rb +15 -43
- data/lib/comfy_blog/configuration.rb +9 -9
- data/lib/comfy_blog/engine.rb +7 -7
- data/lib/comfy_blog/routes/blog.rb +12 -13
- data/lib/comfy_blog/routes/blog_admin.rb +7 -12
- data/lib/comfy_blog/version.rb +1 -1
- data/lib/generators/comfy/blog/blog_generator.rb +16 -14
- data/test/controllers/comfy/admin/blog/posts_controller_test.rb +83 -59
- data/test/controllers/comfy/blog/posts_controller_test.rb +56 -42
- data/test/fixtures/comfy/blog/posts.yml +3 -4
- data/test/fixtures/comfy/cms/layouts.yml +10 -0
- data/test/fixtures/comfy/cms/sites.yml +1 -1
- data/test/fixtures/generators/blog/routes.rb +2 -3
- data/test/gemfiles/Gemfile.rails.5.2 +22 -0
- data/test/generators/blog_generator_test.rb +7 -7
- data/test/integration/i18n_test.rb +37 -0
- data/test/lib/configuration_test.rb +4 -5
- data/test/models/posts_test.rb +35 -30
- data/test/test_helper.rb +40 -29
- metadata +29 -35
- data/app/controllers/comfy/admin/blog/base_controller.rb +0 -12
- data/app/controllers/comfy/admin/blog/blogs_controller.rb +0 -51
- data/app/controllers/comfy/admin/blog/comments_controller.rb +0 -33
- data/app/controllers/comfy/blog/base_controller.rb +0 -33
- data/app/controllers/comfy/blog/comments_controller.rb +0 -33
- data/app/models/comfy/blog/blog.rb +0 -31
- data/app/models/comfy/blog/comment.rb +0 -29
- data/app/views/comfy/admin/blog/blogs/_form.html.haml +0 -11
- data/app/views/comfy/admin/blog/blogs/edit.html.haml +0 -5
- data/app/views/comfy/admin/blog/blogs/index.html.haml +0 -26
- data/app/views/comfy/admin/blog/blogs/new.html.haml +0 -5
- data/app/views/comfy/admin/blog/comments/_comment.html.haml +0 -17
- data/app/views/comfy/admin/blog/comments/index.html.haml +0 -17
- data/app/views/comfy/admin/blog/comments/toggle_publish.js.erb +0 -1
- data/app/views/comfy/blog/comments/_form.html.haml +0 -10
- data/app/views/comfy/blog/posts/show.html.haml +0 -18
- data/app/views/layouts/comfy/blog/application.html.haml +0 -7
- data/config/initializers/secret_token.rb +0 -15
- data/test/controllers/comfy/admin/blog/blogs_controller_test.rb +0 -94
- data/test/controllers/comfy/admin/blog/comments_controller_test.rb +0 -57
- data/test/controllers/comfy/blog/comments_controller_test.rb +0 -36
- data/test/fixtures/comfy/blog/blogs.yml +0 -7
- data/test/fixtures/comfy/blog/comments.yml +0 -6
- data/test/gemfiles/Gemfile.rails.4.0 +0 -10
- data/test/gemfiles/Gemfile.rails.4.1 +0 -10
- data/test/gemfiles/Gemfile.rails.4.2 +0 -10
- data/test/gemfiles/Gemfile.rails.master +0 -10
- data/test/models/blog_test.rb +0 -59
- data/test/models/comments_test.rb +0 -45
@@ -0,0 +1,38 @@
|
|
1
|
+
uk:
|
2
|
+
activerecord:
|
3
|
+
models:
|
4
|
+
comfy/blog/post: Post
|
5
|
+
attributes:
|
6
|
+
comfy/blog/post:
|
7
|
+
title: Title
|
8
|
+
slug: Slug
|
9
|
+
published_at: Published at
|
10
|
+
is_published: Is Published
|
11
|
+
|
12
|
+
comfy:
|
13
|
+
admin:
|
14
|
+
cms:
|
15
|
+
base:
|
16
|
+
posts: Blog Posts
|
17
|
+
blog:
|
18
|
+
posts:
|
19
|
+
created: Blog Post created
|
20
|
+
create_failure: Failed to create Blog Post
|
21
|
+
updated: Blog Post updated
|
22
|
+
update_failure: Failed to update Blog Post
|
23
|
+
deleted: Blog Post removed
|
24
|
+
not_found: Blog Post not found
|
25
|
+
index:
|
26
|
+
title: Blog Posts
|
27
|
+
new_link: New Blog Post
|
28
|
+
edit: Edit
|
29
|
+
delete: Delete
|
30
|
+
are_you_sure: Are you sure?
|
31
|
+
new:
|
32
|
+
title: New Blog Post
|
33
|
+
edit:
|
34
|
+
title: Edit Blog Post
|
35
|
+
form:
|
36
|
+
create: Create Post
|
37
|
+
update: Update Post
|
38
|
+
cancel: Cancel
|
@@ -0,0 +1,38 @@
|
|
1
|
+
zh-CN:
|
2
|
+
activerecord:
|
3
|
+
models:
|
4
|
+
comfy/blog/post: Post
|
5
|
+
attributes:
|
6
|
+
comfy/blog/post:
|
7
|
+
title: Title
|
8
|
+
slug: Slug
|
9
|
+
published_at: Published at
|
10
|
+
is_published: Is Published
|
11
|
+
|
12
|
+
comfy:
|
13
|
+
admin:
|
14
|
+
cms:
|
15
|
+
base:
|
16
|
+
posts: Blog Posts
|
17
|
+
blog:
|
18
|
+
posts:
|
19
|
+
created: Blog Post created
|
20
|
+
create_failure: Failed to create Blog Post
|
21
|
+
updated: Blog Post updated
|
22
|
+
update_failure: Failed to update Blog Post
|
23
|
+
deleted: Blog Post removed
|
24
|
+
not_found: Blog Post not found
|
25
|
+
index:
|
26
|
+
title: Blog Posts
|
27
|
+
new_link: New Blog Post
|
28
|
+
edit: Edit
|
29
|
+
delete: Delete
|
30
|
+
are_you_sure: Are you sure?
|
31
|
+
new:
|
32
|
+
title: New Blog Post
|
33
|
+
edit:
|
34
|
+
title: Edit Blog Post
|
35
|
+
form:
|
36
|
+
create: Create Post
|
37
|
+
update: Update Post
|
38
|
+
cancel: Cancel
|
@@ -0,0 +1,38 @@
|
|
1
|
+
zh-TW:
|
2
|
+
activerecord:
|
3
|
+
models:
|
4
|
+
comfy/blog/post: Post
|
5
|
+
attributes:
|
6
|
+
comfy/blog/post:
|
7
|
+
title: Title
|
8
|
+
slug: Slug
|
9
|
+
published_at: Published at
|
10
|
+
is_published: Is Published
|
11
|
+
|
12
|
+
comfy:
|
13
|
+
admin:
|
14
|
+
cms:
|
15
|
+
base:
|
16
|
+
posts: Blog Posts
|
17
|
+
blog:
|
18
|
+
posts:
|
19
|
+
created: Blog Post created
|
20
|
+
create_failure: Failed to create Blog Post
|
21
|
+
updated: Blog Post updated
|
22
|
+
update_failure: Failed to update Blog Post
|
23
|
+
deleted: Blog Post removed
|
24
|
+
not_found: Blog Post not found
|
25
|
+
index:
|
26
|
+
title: Blog Posts
|
27
|
+
new_link: New Blog Post
|
28
|
+
edit: Edit
|
29
|
+
delete: Delete
|
30
|
+
are_you_sure: Are you sure?
|
31
|
+
new:
|
32
|
+
title: New Blog Post
|
33
|
+
edit:
|
34
|
+
title: Edit Blog Post
|
35
|
+
form:
|
36
|
+
create: Create Post
|
37
|
+
update: Update Post
|
38
|
+
cancel: Cancel
|
data/config/storage.yml
ADDED
@@ -0,0 +1,35 @@
|
|
1
|
+
test:
|
2
|
+
service: Disk
|
3
|
+
root: <%= Rails.root.join("tmp/storage") %>
|
4
|
+
|
5
|
+
local:
|
6
|
+
service: Disk
|
7
|
+
root: <%= Rails.root.join("storage") %>
|
8
|
+
|
9
|
+
# Use rails credentials:edit to set the AWS secrets (as aws:access_key_id|secret_access_key)
|
10
|
+
# amazon:
|
11
|
+
# service: S3
|
12
|
+
# access_key_id: <%= Rails.application.credentials.dig(:aws, :access_key_id) %>
|
13
|
+
# secret_access_key: <%= Rails.application.credentials.dig(:aws, :secret_access_key) %>
|
14
|
+
# region: us-east-1
|
15
|
+
# bucket: your_own_bucket
|
16
|
+
|
17
|
+
# Remember not to checkin your GCS keyfile to a repository
|
18
|
+
# google:
|
19
|
+
# service: GCS
|
20
|
+
# project: your_project
|
21
|
+
# keyfile: <%= Rails.root.join("path/to/gcs.keyfile") %>
|
22
|
+
# bucket: your_own_bucket
|
23
|
+
|
24
|
+
# Use rails credentials:edit to set the Azure Storage secret (as azure_storage:storage_access_key)
|
25
|
+
# microsoft:
|
26
|
+
# service: AzureStorage
|
27
|
+
# path: your_azure_storage_path
|
28
|
+
# storage_account_name: your_account_name
|
29
|
+
# storage_access_key: <%= Rails.application.credentials.dig(:azure_storage, :storage_access_key) %>
|
30
|
+
# container: your_container_name
|
31
|
+
|
32
|
+
# mirror:
|
33
|
+
# service: Mirror
|
34
|
+
# primary: local
|
35
|
+
# mirrors: [ amazon, google, microsoft ]
|
data/db/migrate/00_create_cms.rb
CHANGED
@@ -1,139 +1,167 @@
|
|
1
|
-
class CreateCms < ActiveRecord::Migration
|
2
|
-
|
3
|
-
|
4
|
-
|
5
|
-
|
6
|
-
|
7
|
-
|
8
|
-
|
9
|
-
|
10
|
-
|
11
|
-
|
12
|
-
|
13
|
-
|
14
|
-
t.string
|
15
|
-
t.
|
16
|
-
|
1
|
+
class CreateCms < ActiveRecord::Migration[5.2]
|
2
|
+
|
3
|
+
LIMIT = 16777215
|
4
|
+
|
5
|
+
def change
|
6
|
+
|
7
|
+
# -- Active Storage --------------------------------------------------------
|
8
|
+
create_table :active_storage_blobs do |t|
|
9
|
+
t.string :key, null: false
|
10
|
+
t.string :filename, null: false
|
11
|
+
t.string :content_type
|
12
|
+
t.text :metadata
|
13
|
+
t.bigint :byte_size, null: false
|
14
|
+
t.string :checksum, null: false
|
15
|
+
t.datetime :created_at, null: false
|
16
|
+
|
17
|
+
t.index [:key], unique: true
|
18
|
+
end
|
19
|
+
|
20
|
+
create_table :active_storage_attachments do |t|
|
21
|
+
t.string :name, null: false
|
22
|
+
t.references :record, null: false, polymorphic: true, index: false
|
23
|
+
t.references :blob, null: false
|
24
|
+
t.datetime :created_at, null: false
|
25
|
+
|
26
|
+
t.index [:record_type, :record_id, :name, :blob_id],
|
27
|
+
name: "index_active_storage_attachments_uniqueness",
|
28
|
+
unique: true
|
29
|
+
end
|
30
|
+
|
31
|
+
# -- Sites -----------------------------------------------------------------
|
32
|
+
create_table :comfy_cms_sites, force: true do |t|
|
33
|
+
t.string :label, null: false
|
34
|
+
t.string :identifier, null: false
|
35
|
+
t.string :hostname, null: false
|
17
36
|
t.string :path
|
18
|
-
t.string :locale, :
|
19
|
-
t.
|
37
|
+
t.string :locale, null: false, default: "en"
|
38
|
+
t.timestamps
|
39
|
+
|
40
|
+
t.index :hostname
|
20
41
|
end
|
21
|
-
|
22
|
-
|
23
|
-
|
24
|
-
|
25
|
-
create_table :comfy_cms_layouts do |t|
|
26
|
-
t.integer :site_id, :null => false
|
42
|
+
|
43
|
+
# -- Layouts ---------------------------------------------------------------
|
44
|
+
create_table :comfy_cms_layouts, force: true do |t|
|
45
|
+
t.integer :site_id, null: false
|
27
46
|
t.integer :parent_id
|
28
47
|
t.string :app_layout
|
29
|
-
t.string :label, :
|
30
|
-
t.string :identifier, :
|
31
|
-
t.text :content,
|
32
|
-
t.text :css,
|
33
|
-
t.text :js,
|
34
|
-
t.integer :position, :
|
35
|
-
t.boolean :is_shared, :null => false, :default => false
|
48
|
+
t.string :label, null: false
|
49
|
+
t.string :identifier, null: false
|
50
|
+
t.text :content, limit: LIMIT
|
51
|
+
t.text :css, limit: LIMIT
|
52
|
+
t.text :js, limit: LIMIT
|
53
|
+
t.integer :position, null: false, default: 0
|
36
54
|
t.timestamps
|
55
|
+
|
56
|
+
t.index [:parent_id, :position]
|
57
|
+
t.index [:site_id, :identifier], unique: true
|
37
58
|
end
|
38
|
-
|
39
|
-
|
40
|
-
|
41
|
-
|
42
|
-
create_table :comfy_cms_pages do |t|
|
43
|
-
t.integer :site_id, :null => false
|
59
|
+
|
60
|
+
# -- Pages -----------------------------------------------------------------
|
61
|
+
create_table :comfy_cms_pages, force: true do |t|
|
62
|
+
t.integer :site_id, null: false
|
44
63
|
t.integer :layout_id
|
45
64
|
t.integer :parent_id
|
46
65
|
t.integer :target_page_id
|
47
|
-
t.string :label, :
|
66
|
+
t.string :label, null: false
|
48
67
|
t.string :slug
|
49
|
-
t.string :full_path, :
|
50
|
-
t.text :content_cache,
|
51
|
-
t.integer :position, :
|
52
|
-
t.integer :children_count, :
|
53
|
-
t.boolean :is_published, :
|
54
|
-
t.boolean :is_shared, :null => false, :default => false
|
68
|
+
t.string :full_path, null: false
|
69
|
+
t.text :content_cache, limit: LIMIT
|
70
|
+
t.integer :position, null: false, default: 0
|
71
|
+
t.integer :children_count, null: false, default: 0
|
72
|
+
t.boolean :is_published, null: false, default: true
|
55
73
|
t.timestamps
|
74
|
+
|
75
|
+
t.index [:site_id, :full_path]
|
76
|
+
t.index [:parent_id, :position]
|
77
|
+
t.index [:is_published]
|
56
78
|
end
|
57
|
-
|
58
|
-
|
59
|
-
|
60
|
-
|
61
|
-
|
62
|
-
t.
|
63
|
-
t.
|
64
|
-
t.
|
79
|
+
|
80
|
+
# -- Translations ----------------------------------------------------------
|
81
|
+
create_table :comfy_cms_translations, force: true do |t|
|
82
|
+
t.string :locale, null: false
|
83
|
+
t.integer :page_id, null: false
|
84
|
+
t.integer :layout_id
|
85
|
+
t.string :label, null: false
|
86
|
+
t.text :content_cache, limit: LIMIT
|
87
|
+
t.boolean :is_published, null: false, default: true
|
65
88
|
t.timestamps
|
89
|
+
|
90
|
+
t.index [:page_id]
|
91
|
+
t.index [:locale]
|
92
|
+
t.index [:is_published]
|
66
93
|
end
|
67
|
-
|
68
|
-
|
69
|
-
|
70
|
-
|
71
|
-
|
72
|
-
t.
|
73
|
-
t.
|
74
|
-
t.
|
75
|
-
t.
|
76
|
-
t.integer :position, :null => false, :default => 0
|
77
|
-
t.boolean :is_shared, :null => false, :default => false
|
94
|
+
|
95
|
+
# -- Fragments -------------------------------------------------------------
|
96
|
+
create_table :comfy_cms_fragments, force: true do |t|
|
97
|
+
t.references :record, polymorphic: true
|
98
|
+
t.string :identifier, null: false
|
99
|
+
t.string :tag, null: false, default: "text"
|
100
|
+
t.text :content, limit: LIMIT
|
101
|
+
t.boolean :boolean, null: false, default: false
|
102
|
+
t.datetime :datetime
|
78
103
|
t.timestamps
|
104
|
+
|
105
|
+
t.index [:identifier]
|
106
|
+
t.index [:datetime]
|
107
|
+
t.index [:boolean]
|
79
108
|
end
|
80
|
-
|
81
|
-
|
82
|
-
|
83
|
-
|
84
|
-
|
85
|
-
t.
|
86
|
-
t.
|
87
|
-
t.
|
88
|
-
t.string :file_file_name, :null => false
|
89
|
-
t.string :file_content_type, :null => false
|
90
|
-
t.integer :file_file_size, :null => false
|
91
|
-
t.string :description, :limit => 2048
|
92
|
-
t.integer :position, :null => false, :default => 0
|
109
|
+
|
110
|
+
# -- Snippets --------------------------------------------------------------
|
111
|
+
create_table :comfy_cms_snippets, force: true do |t|
|
112
|
+
t.integer :site_id, null: false
|
113
|
+
t.string :label, null: false
|
114
|
+
t.string :identifier, null: false
|
115
|
+
t.text :content, limit: LIMIT
|
116
|
+
t.integer :position, null: false, default: 0
|
93
117
|
t.timestamps
|
118
|
+
|
119
|
+
t.index [:site_id, :identifier], unique: true
|
120
|
+
t.index [:site_id, :position]
|
94
121
|
end
|
95
|
-
|
96
|
-
|
97
|
-
|
98
|
-
|
99
|
-
|
100
|
-
|
101
|
-
|
102
|
-
t.
|
103
|
-
|
104
|
-
t.
|
122
|
+
|
123
|
+
# -- Files -----------------------------------------------------------------
|
124
|
+
create_table :comfy_cms_files, force: true do |t|
|
125
|
+
t.integer :site_id, null: false
|
126
|
+
t.string :label, null: false, default: ""
|
127
|
+
t.text :description, limit: 2048
|
128
|
+
t.integer :position, null: false, default: 0
|
129
|
+
t.timestamps
|
130
|
+
|
131
|
+
t.index [:site_id, :position]
|
132
|
+
end
|
133
|
+
|
134
|
+
# -- Revisions -------------------------------------------------------------
|
135
|
+
create_table :comfy_cms_revisions, force: true do |t|
|
136
|
+
t.string :record_type, null: false
|
137
|
+
t.integer :record_id, null: false
|
138
|
+
t.text :data, limit: LIMIT
|
105
139
|
t.datetime :created_at
|
140
|
+
|
141
|
+
t.index [:record_type, :record_id, :created_at],
|
142
|
+
name: "index_cms_revisions_on_rtype_and_rid_and_created_at"
|
106
143
|
end
|
107
|
-
|
108
|
-
|
109
|
-
|
110
|
-
|
111
|
-
|
112
|
-
t.
|
113
|
-
|
114
|
-
t.
|
144
|
+
|
145
|
+
# -- Categories ------------------------------------------------------------
|
146
|
+
create_table :comfy_cms_categories, force: true do |t|
|
147
|
+
t.integer :site_id, null: false
|
148
|
+
t.string :label, null: false
|
149
|
+
t.string :categorized_type, null: false
|
150
|
+
|
151
|
+
t.index [:site_id, :categorized_type, :label],
|
152
|
+
unique: true,
|
153
|
+
name: "index_cms_categories_on_site_id_and_cat_type_and_label"
|
115
154
|
end
|
116
|
-
|
117
|
-
|
118
|
-
|
119
|
-
|
120
|
-
t.integer :
|
121
|
-
|
122
|
-
t.
|
155
|
+
|
156
|
+
create_table :comfy_cms_categorizations, force: true do |t|
|
157
|
+
t.integer :category_id, null: false
|
158
|
+
t.string :categorized_type, null: false
|
159
|
+
t.integer :categorized_id, null: false
|
160
|
+
|
161
|
+
t.index [:category_id, :categorized_type, :categorized_id],
|
162
|
+
unique: true,
|
163
|
+
name: "index_cms_categorizations_on_cat_id_and_catd_type_and_catd_id"
|
123
164
|
end
|
124
|
-
|
125
|
-
:name => 'index_cms_categorizations_on_cat_id_and_catd_type_and_catd_id'
|
126
|
-
end
|
127
|
-
|
128
|
-
def self.down
|
129
|
-
drop_table :comfy_cms_sites
|
130
|
-
drop_table :comfy_cms_layouts
|
131
|
-
drop_table :comfy_cms_pages
|
132
|
-
drop_table :comfy_cms_snippets
|
133
|
-
drop_table :comfy_cms_blocks
|
134
|
-
drop_table :comfy_cms_files
|
135
|
-
drop_table :comfy_cms_revisions
|
136
|
-
drop_table :comfy_cms_categories
|
137
|
-
drop_table :comfy_cms_categorizations
|
165
|
+
|
138
166
|
end
|
139
|
-
end
|
167
|
+
end
|
@@ -1,52 +1,24 @@
|
|
1
|
-
class CreateBlog < ActiveRecord::Migration
|
1
|
+
class CreateBlog < ActiveRecord::Migration[5.2]
|
2
2
|
|
3
|
-
|
4
|
-
create_table :comfy_blogs do |t|
|
5
|
-
t.integer :site_id, :null => false
|
6
|
-
t.string :label, :null => false
|
7
|
-
t.string :identifier, :null => false
|
8
|
-
t.string :app_layout, :null => false, :default => 'application'
|
9
|
-
t.string :path
|
10
|
-
t.text :description
|
11
|
-
end
|
12
|
-
add_index :comfy_blogs, [:site_id, :path]
|
13
|
-
add_index :comfy_blogs, :identifier
|
3
|
+
LIMIT = 16777215
|
14
4
|
|
5
|
+
def change
|
15
6
|
create_table :comfy_blog_posts do |t|
|
16
|
-
t.integer :
|
17
|
-
t.string :title, :
|
18
|
-
t.string :slug, :
|
19
|
-
t.
|
20
|
-
t.
|
21
|
-
t.
|
22
|
-
t.integer :
|
23
|
-
t.
|
24
|
-
t.
|
25
|
-
t.datetime :published_at, :null => false
|
7
|
+
t.integer :site_id, null: false
|
8
|
+
t.string :title, null: false
|
9
|
+
t.string :slug, null: false
|
10
|
+
t.integer :layout_id
|
11
|
+
t.text :content_cache, limit: LIMIT
|
12
|
+
t.integer :year, null: false, limit: 4
|
13
|
+
t.integer :month, null: false, limit: 2
|
14
|
+
t.boolean :is_published, null: false, default: true
|
15
|
+
t.datetime :published_at, null: false
|
26
16
|
t.timestamps
|
27
|
-
end
|
28
|
-
add_index :comfy_blog_posts, [:is_published, :year, :month, :slug],
|
29
|
-
:name => 'index_blog_posts_on_published_year_month_slug'
|
30
|
-
add_index :comfy_blog_posts, [:is_published, :created_at]
|
31
|
-
add_index :comfy_blog_posts, :created_at
|
32
17
|
|
33
|
-
|
34
|
-
t.
|
35
|
-
t.
|
36
|
-
t.string :email, :null => false
|
37
|
-
t.text :content
|
38
|
-
t.boolean :is_published, :null => false, :default => false
|
39
|
-
t.timestamps
|
18
|
+
t.index [:site_id, :is_published]
|
19
|
+
t.index [:year, :month, :slug]
|
20
|
+
t.index [:created_at]
|
40
21
|
end
|
41
|
-
add_index :comfy_blog_comments, [:post_id, :created_at]
|
42
|
-
add_index :comfy_blog_comments, [:post_id, :is_published, :created_at],
|
43
|
-
:name => 'index_blog_comments_on_post_published_created'
|
44
|
-
end
|
45
22
|
|
46
|
-
def self.down
|
47
|
-
drop_table :comfy_blogs
|
48
|
-
drop_table :comfy_blog_posts
|
49
|
-
drop_table :comfy_blog_comments
|
50
23
|
end
|
51
|
-
|
52
24
|
end
|