uploads: drop unused columns.

This commit is contained in:
evazion
2022-02-04 02:07:07 -06:00
parent 30940ccf8a
commit 7c63ac8dbd
3 changed files with 27 additions and 45 deletions

View File

@@ -3,13 +3,6 @@
class Upload < ApplicationRecord
extend Memoist
self.ignored_columns = %i[
file_path content_type rating tag_string backtrace post_id md5_confirmation
server parent_id md5 file_ext file_size image_width image_height
artist_commentary_desc artist_commentary_title include_artist_commentary
context translated_commentary_title translated_commentary_desc
]
attr_accessor :file
belongs_to :uploader, class_name: "User"

View File

@@ -0,0 +1,24 @@
class DropUnusedColumnsFromUploads < ActiveRecord::Migration[7.0]
def change
remove_column :uploads, :file_path, :string
remove_column :uploads, :content_type, :string
remove_column :uploads, :rating, :character
remove_column :uploads, :tag_string, :text
remove_column :uploads, :backtrace, :text
remove_column :uploads, :post_id, :integer
remove_column :uploads, :md5_confirmation, :string
remove_column :uploads, :server, :text
remove_column :uploads, :parent_id, :integer
remove_column :uploads, :md5, :string
remove_column :uploads, :file_ext, :string
remove_column :uploads, :file_size, :integer
remove_column :uploads, :image_width, :integer
remove_column :uploads, :image_height, :integer
remove_column :uploads, :artist_commentary_desc, :text
remove_column :uploads, :artist_commentary_title, :text
remove_column :uploads, :include_artist_commentary, :boolean
remove_column :uploads, :context, :text
remove_column :uploads, :translated_commentary_title, :text
remove_column :uploads, :translated_commentary_desc, :text
end
end

View File

@@ -1945,32 +1945,12 @@ ALTER SEQUENCE public.upload_media_assets_id_seq OWNED BY public.upload_media_as
CREATE TABLE public.uploads (
id integer NOT NULL,
source text,
file_path character varying,
content_type character varying,
rating character(1),
uploader_id integer NOT NULL,
uploader_ip_addr inet NOT NULL,
tag_string text,
status text DEFAULT 'pending'::text NOT NULL,
backtrace text,
post_id integer,
md5_confirmation character varying,
created_at timestamp without time zone NOT NULL,
updated_at timestamp without time zone NOT NULL,
server text,
parent_id integer,
md5 character varying,
file_ext character varying,
file_size integer,
image_width integer,
image_height integer,
artist_commentary_desc text,
artist_commentary_title text,
include_artist_commentary boolean,
context text,
referer_url text,
translated_commentary_title text DEFAULT ''::text NOT NULL,
translated_commentary_desc text DEFAULT ''::text NOT NULL
referer_url text
);
@@ -4851,22 +4831,6 @@ ALTER TABLE ONLY public.comment_votes
ADD CONSTRAINT fk_rails_0873e64a40 FOREIGN KEY (user_id) REFERENCES public.users(id) DEFERRABLE INITIALLY DEFERRED;
--
-- Name: uploads fk_rails_0e5f710d62; Type: FK CONSTRAINT; Schema: public; Owner: -
--
ALTER TABLE ONLY public.uploads
ADD CONSTRAINT fk_rails_0e5f710d62 FOREIGN KEY (parent_id) REFERENCES public.posts(id) DEFERRABLE INITIALLY DEFERRED;
--
-- Name: uploads fk_rails_127111e6ac; Type: FK CONSTRAINT; Schema: public; Owner: -
--
ALTER TABLE ONLY public.uploads
ADD CONSTRAINT fk_rails_127111e6ac FOREIGN KEY (post_id) REFERENCES public.posts(id) DEFERRABLE INITIALLY DEFERRED NOT VALID;
--
-- Name: upload_media_assets fk_rails_171271f781; Type: FK CONSTRAINT; Schema: public; Owner: -
--
@@ -5776,6 +5740,7 @@ INSERT INTO "schema_migrations" (version) VALUES
('20220110171024'),
('20220120233850'),
('20220124195900'),
('20220203040648');
('20220203040648'),
('20220204075610');