Skip to content

Commit

Permalink
Merge pull request #78 from chrisb/master
Browse files Browse the repository at this point in the history
Agreed.  Default values should not be set on referencing id columns.
  • Loading branch information
petergoldstein committed Aug 12, 2014
2 parents 6a04f39 + 1fbd6e4 commit 42aeed1
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 7 deletions.
@@ -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
Expand Down
6 changes: 3 additions & 3 deletions spec/db/schema.rb
Expand Up @@ -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"
Expand Down

0 comments on commit 42aeed1

Please sign in to comment.