Merge pull request #3482 from evazion/fix-3480

Fix #3480: NoMethodError error when adding artist tag to post.
This commit is contained in:
Albert Yi
2018-01-02 10:39:43 -08:00
committed by GitHub
3 changed files with 30 additions and 4 deletions

View File

@@ -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

View File

@@ -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');

View 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