Fix #3480: NoMethodError error when adding artist tag to post.
This commit is contained in:
@@ -0,0 +1,8 @@
|
||||
class ChangeTimestampsToNonNullOnTags < ActiveRecord::Migration
|
||||
def change
|
||||
Post.without_timeout do
|
||||
change_column_null :tags, :created_at, false
|
||||
change_column_null :tags, :updated_at, false
|
||||
end
|
||||
end
|
||||
end
|
||||
@@ -3010,8 +3010,8 @@ CREATE TABLE tags (
|
||||
category integer DEFAULT 0 NOT NULL,
|
||||
related_tags text,
|
||||
related_tags_updated_at timestamp without time zone,
|
||||
created_at timestamp without time zone,
|
||||
updated_at timestamp without time zone,
|
||||
created_at timestamp without time zone NOT NULL,
|
||||
updated_at timestamp without time zone NOT NULL,
|
||||
is_locked boolean DEFAULT false NOT NULL
|
||||
);
|
||||
|
||||
@@ -7541,7 +7541,9 @@ INSERT INTO schema_migrations (version) VALUES ('20171106075030');
|
||||
|
||||
INSERT INTO schema_migrations (version) VALUES ('20171127195124');
|
||||
|
||||
INSERT INTO schema_migrations (version) VALUES ('20171219001521');
|
||||
|
||||
INSERT INTO schema_migrations (version) VALUES ('20171218213037');
|
||||
|
||||
INSERT INTO schema_migrations (version) VALUES ('20171219001521');
|
||||
|
||||
INSERT INTO schema_migrations (version) VALUES ('20171230220225');
|
||||
|
||||
|
||||
16
script/fixes/052_fix_tag_timestamps.rb
Executable file
16
script/fixes/052_fix_tag_timestamps.rb
Executable file
@@ -0,0 +1,16 @@
|
||||
#!/usr/bin/env ruby
|
||||
|
||||
require File.expand_path(File.join(File.dirname(__FILE__), '..', '..', 'config', 'environment'))
|
||||
|
||||
CurrentUser.user = User.system
|
||||
CurrentUser.ip_addr = "127.0.0.1"
|
||||
|
||||
Tag.transaction do
|
||||
Tag.without_timeout do
|
||||
puts "Tag.where(updated_at: nil).count = #{Tag.where(updated_at: nil).count}"
|
||||
puts "Tag.where(created_at: nil).count = #{Tag.where(created_at: nil).count}"
|
||||
|
||||
Tag.where(updated_at: nil).update_all(updated_at: Time.zone.now)
|
||||
Tag.where(created_at: nil).update_all("created_at = updated_at")
|
||||
end
|
||||
end
|
||||
Reference in New Issue
Block a user