diff --git a/app/logical/user_deletion.rb b/app/logical/user_deletion.rb index 155ef0bc4..fd72f1794 100644 --- a/app/logical/user_deletion.rb +++ b/app/logical/user_deletion.rb @@ -32,7 +32,6 @@ private user.email = nil user.last_logged_in_at = nil user.last_forum_read_at = nil - user.recent_tags = '' user.favorite_tags = '' user.blacklisted_tags = '' user.hide_deleted_posts = false diff --git a/app/models/user.rb b/app/models/user.rb index 117fc3a98..cf46338a9 100644 --- a/app/models/user.rb +++ b/app/models/user.rb @@ -167,7 +167,6 @@ class User < ApplicationRecord end def encrypt_password_on_create - self.password_hash = "" self.bcrypt_password_hash = User.bcrypt(password) end @@ -581,7 +580,7 @@ class User < ApplicationRecord attributes += BOOLEAN_ATTRIBUTES attributes += [ :updated_at, :email, :last_logged_in_at, :last_forum_read_at, - :recent_tags, :comment_threshold, :default_image_size, + :comment_threshold, :default_image_size, :favorite_tags, :blacklisted_tags, :time_zone, :per_page, :custom_style, :favorite_count, :api_regen_multiplier, :api_burst_limit, :remaining_api_limit, :statement_timeout, diff --git a/config/danbooru_default_config.rb b/config/danbooru_default_config.rb index 4748e7023..4e62a4982 100644 --- a/config/danbooru_default_config.rb +++ b/config/danbooru_default_config.rb @@ -65,7 +65,6 @@ module Danbooru # user.can_upload_free = false # user.is_super_voter = false # - # user.base_upload_limit = 10 # user.comment_threshold = -1 # user.blacklisted_tags = ["spoilers", "guro", "scat", "furry -rating:s"].join("\n") # user.default_image_size = "large" diff --git a/db/migrate/20191116224228_drop_unused_columns_from_users.rb b/db/migrate/20191116224228_drop_unused_columns_from_users.rb new file mode 100644 index 000000000..095aaa9d5 --- /dev/null +++ b/db/migrate/20191116224228_drop_unused_columns_from_users.rb @@ -0,0 +1,10 @@ +class DropUnusedColumnsFromUsers < ActiveRecord::Migration[6.0] + def change + execute "set statement_timeout = 0" + + remove_column :users, :base_upload_limit, :integer, null: false, default: 10 + remove_column :users, :recent_tags, :string + remove_column :users, :email_verification_key, :string + remove_column :users, :password_hash, :string, null: false + end +end diff --git a/db/structure.sql b/db/structure.sql index 084c85703..13eadf3c7 100644 --- a/db/structure.sql +++ b/db/structure.sql @@ -2235,18 +2235,14 @@ ALTER TABLE ONLY public.posts ALTER COLUMN tag_index SET STATISTICS 2000; CREATE TABLE public.users ( id integer NOT NULL, name character varying NOT NULL, - password_hash character varying NOT NULL, level integer DEFAULT 20 NOT NULL, email character varying, - recent_tags text DEFAULT ''::text NOT NULL, inviter_id integer, created_at timestamp without time zone NOT NULL, last_logged_in_at timestamp without time zone DEFAULT now(), last_forum_read_at timestamp without time zone DEFAULT '1960-01-01 00:00:00'::timestamp without time zone, - base_upload_limit integer, comment_threshold integer DEFAULT 0 NOT NULL, updated_at timestamp without time zone, - email_verification_key character varying, default_image_size character varying DEFAULT 'large'::character varying NOT NULL, favorite_tags text, blacklisted_tags text DEFAULT 'spoilers @@ -7552,6 +7548,7 @@ INSERT INTO "schema_migrations" (version) VALUES ('20191111004329'), ('20191111024520'), ('20191116001441'), -('20191116021759'); +('20191116021759'), +('20191116224228'); diff --git a/test/factories/user.rb b/test/factories/user.rb index 5ee114be3..efce25266 100644 --- a/test/factories/user.rb +++ b/test/factories/user.rb @@ -4,10 +4,8 @@ FactoryBot.define do "user#{n}" end password {"password"} - password_hash {User.sha1("password")} email {FFaker::Internet.email} default_image_size {"large"} - base_upload_limit {10} level {20} created_at {Time.now} last_logged_in_at {Time.now}