From 90c63192e6baa3dd2c48ba115bc9d96dd19df501 Mon Sep 17 00:00:00 2001 From: lizanle <491823689@qq.com> Date: Wed, 30 Dec 2015 10:32:32 +0800 Subject: [PATCH] =?UTF-8?q?=E5=8E=86=E5=8F=B2=E8=B5=84=E6=BA=90=E6=A8=A1?= =?UTF-8?q?=E5=9E=8B=E4=BF=AE=E6=94=B9?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/models/attachment.rb | 4 ++++ app/models/attachment_history.rb | 2 +- ...chment_histories_column_version_id_to_attachment_id.rb | 8 ++++++++ db/schema.rb | 4 ++-- 4 files changed, 15 insertions(+), 3 deletions(-) create mode 100644 db/migrate/20151230022443_rename_attachment_histories_column_version_id_to_attachment_id.rb diff --git a/app/models/attachment.rb b/app/models/attachment.rb index ae23428f1..f08bcdddf 100644 --- a/app/models/attachment.rb +++ b/app/models/attachment.rb @@ -519,6 +519,10 @@ class Attachment < ActiveRecord::Base end end + #更新文件的版本 + def update_attchment_version + end + private # Physically deletes the file from the file system diff --git a/app/models/attachment_history.rb b/app/models/attachment_history.rb index 4ff1ddd0d..2160d242d 100644 --- a/app/models/attachment_history.rb +++ b/app/models/attachment_history.rb @@ -1,3 +1,3 @@ class AttachmentHistory < ActiveRecord::Base - belongs_to :attachment,foreign_key: 'attach_id' + belongs_to :attachment,foreign_key: 'attachment_id' end diff --git a/db/migrate/20151230022443_rename_attachment_histories_column_version_id_to_attachment_id.rb b/db/migrate/20151230022443_rename_attachment_histories_column_version_id_to_attachment_id.rb new file mode 100644 index 000000000..15d0837d3 --- /dev/null +++ b/db/migrate/20151230022443_rename_attachment_histories_column_version_id_to_attachment_id.rb @@ -0,0 +1,8 @@ +class RenameAttachmentHistoriesColumnVersionIdToAttachmentId < ActiveRecord::Migration + def up + rename_column :attachment_histories,:version_id,:attachment_id + end + + def down + end +end diff --git a/db/schema.rb b/db/schema.rb index 8e9bff4e2..374b44abf 100644 --- a/db/schema.rb +++ b/db/schema.rb @@ -11,7 +11,7 @@ # # It's strongly recommended to check this file into your version control system. -ActiveRecord::Schema.define(:version => 20151229045505) do +ActiveRecord::Schema.define(:version => 20151230022443) do create_table "activities", :force => true do |t| t.integer "act_id", :null => false @@ -98,7 +98,7 @@ ActiveRecord::Schema.define(:version => 20151229045505) do t.integer "copy_from" t.integer "quotes" t.integer "version" - t.integer "version_id" + t.integer "attachment_id" end create_table "attachments", :force => true do |t|