From e58a8c843befce577dbe6d5a80167673249b540b Mon Sep 17 00:00:00 2001 From: Marc Ignacio Date: Wed, 6 Jul 2016 01:04:02 +0800 Subject: [PATCH] Fix spec failure due to leaky ActiveRecord abstraction of booleans (#311) --- db/migrate/20160704022756_change_story_columns.rb | 6 ++++++ db/schema.rb | 6 +++--- 2 files changed, 9 insertions(+), 3 deletions(-) create mode 100644 db/migrate/20160704022756_change_story_columns.rb diff --git a/db/migrate/20160704022756_change_story_columns.rb b/db/migrate/20160704022756_change_story_columns.rb new file mode 100644 index 0000000..391ec53 --- /dev/null +++ b/db/migrate/20160704022756_change_story_columns.rb @@ -0,0 +1,6 @@ +class ChangeStoryColumns < ActiveRecord::Migration + def change + change_column :stories, :is_moderated, :boolean, default: false, null: false + change_column :stories, :is_expired, :boolean, default: false, null: false + end +end diff --git a/db/schema.rb b/db/schema.rb index fc7cf55..fe2d5ef 100644 --- a/db/schema.rb +++ b/db/schema.rb @@ -11,7 +11,7 @@ # # It's strongly recommended that you check this file into your version control system. -ActiveRecord::Schema.define(version: 20160515162433) do +ActiveRecord::Schema.define(version: 20160704022756) do create_table "comments", force: true do |t| t.datetime "created_at", null: false @@ -122,10 +122,10 @@ ActiveRecord::Schema.define(version: 20160515162433) do t.string "title", limit: 150, default: "", null: false t.text "description", limit: 16777215 t.string "short_id", limit: 6, default: "", null: false - t.integer "is_expired", limit: 1, default: 0, null: false + t.boolean "is_expired", default: false, null: false t.integer "upvotes", default: 0, null: false t.integer "downvotes", default: 0, null: false - t.integer "is_moderated", limit: 1, default: 0, null: false + t.boolean "is_moderated", default: false, null: false t.decimal "hotness", precision: 20, scale: 10, default: 0.0, null: false t.text "markeddown_description", limit: 16777215 t.text "story_cache", limit: 16777215