about summary refs log tree commit diff stats
path: root/db/migrate
diff options
context:
space:
mode:
authorKelly Rauchenberger <fefferburbia@gmail.com>2018-07-04 10:42:21 -0400
committerKelly Rauchenberger <fefferburbia@gmail.com>2018-07-04 10:42:21 -0400
commitd48adb741c5c30ba3f2d3c039a7e342b43add352 (patch)
treecbc25ac929e73702142a5ec5728a98dc54d88602 /db/migrate
parent66353403efcc9c0b16c82ea8ab9860ca8a44aa4c (diff)
downloadthoughts-d48adb741c5c30ba3f2d3c039a7e342b43add352.tar.gz
thoughts-d48adb741c5c30ba3f2d3c039a7e342b43add352.tar.bz2
thoughts-d48adb741c5c30ba3f2d3c039a7e342b43add352.zip
Added blog drafts
An unpublished post is not viewable unless you are logged in. The "Create record" field is disabled for unpublished posts, though this is only in JavaScript and the backend will not disallow creating records for unpublished posts if forced to. Unpublishing a post does not destroy records for that post.

This only applies to blog posts, currently; streams and stream updates cannot be drafted. Unpublished posts still require titles and slugs. There is no autosaving functionality yet.

refs #1
Diffstat (limited to 'db/migrate')
-rw-r--r--db/migrate/20180704125527_add_blog_drafts.rb17
1 files changed, 17 insertions, 0 deletions
diff --git a/db/migrate/20180704125527_add_blog_drafts.rb b/db/migrate/20180704125527_add_blog_drafts.rb new file mode 100644 index 0000000..07c5078 --- /dev/null +++ b/db/migrate/20180704125527_add_blog_drafts.rb
@@ -0,0 +1,17 @@
1class AddBlogDrafts < ActiveRecord::Migration[5.1]
2 def change
3 add_column :blogs, :published, :boolean, null: false, default: false
4 add_column :blogs, :published_at, :datetime, null: true
5
6 reversible do |dir|
7 dir.up do
8 Blog.all.each do |blog|
9 blog.published = true
10 blog.published_at = blog.created_at
11
12 blog.save!
13 end
14 end
15 end
16 end
17end