From 1fbd6e4c8c0c8cb31120040a0434170181f60499 Mon Sep 17 00:00:00 2001 From: Chris Bielinski Date: Thu, 26 Jun 2014 14:41:24 -0700 Subject: [PATCH] update migration and test schema to *not* set default values for ID columns --- .../templates/migration.rb | 8 ++++---- spec/db/schema.rb | 6 +++--- 2 files changed, 7 insertions(+), 7 deletions(-) diff --git a/lib/generators/acts_as_commentable_with_threading_migration/templates/migration.rb b/lib/generators/acts_as_commentable_with_threading_migration/templates/migration.rb index d22c266..728b26b 100644 --- a/lib/generators/acts_as_commentable_with_threading_migration/templates/migration.rb +++ b/lib/generators/acts_as_commentable_with_threading_migration/templates/migration.rb @@ -1,20 +1,20 @@ class ActsAsCommentableWithThreadingMigration < ActiveRecord::Migration def self.up create_table :comments, :force => true do |t| - t.integer :commentable_id, :default => 0 + t.integer :commentable_id t.string :commentable_type t.string :title t.text :body t.string :subject - t.integer :user_id, :default => 0, :null => false + t.integer :user_id, :null => false t.integer :parent_id, :lft, :rgt t.timestamps end - + add_index :comments, :user_id add_index :comments, [:commentable_id, :commentable_type] end - + def self.down drop_table :comments end diff --git a/spec/db/schema.rb b/spec/db/schema.rb index 805f097..dde14e6 100644 --- a/spec/db/schema.rb +++ b/spec/db/schema.rb @@ -2,18 +2,18 @@ create_table "users", :force => true do |t| t.timestamps end - + create_table "commentables", :force => true do |t| t.timestamps end create_table "comments", :force => true do |t| - t.integer "commentable_id", :default => 0 + t.integer "commentable_id" t.string "commentable_type", :limit => 15, :default => "" t.string "title", :default => "" t.text "body", :default => "" t.string "subject", :default => "" - t.integer "user_id", :default => 0, :null => false + t.integer "user_id", :null => false t.integer "parent_id" t.integer "lft" t.integer "rgt"