db: drop unused columns from users table.
Note that the password_hash column was replaced by bcrypt_password_hash in 2013, but the old password_hash column was never dropped.
This commit is contained in:
@@ -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
|
||||
|
||||
@@ -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,
|
||||
|
||||
@@ -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"
|
||||
|
||||
10
db/migrate/20191116224228_drop_unused_columns_from_users.rb
Normal file
10
db/migrate/20191116224228_drop_unused_columns_from_users.rb
Normal file
@@ -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
|
||||
@@ -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');
|
||||
|
||||
|
||||
|
||||
@@ -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}
|
||||
|
||||
Reference in New Issue
Block a user