remove json_attributes from domain_post_files

This commit is contained in:
Dylan Knutson
2025-07-18 16:51:20 +00:00
parent 8e00a7578c
commit 0c5f6e84cb
8 changed files with 49 additions and 155 deletions

View File

@@ -18,7 +18,6 @@ class AddColumnsToPostFiles < ActiveRecord::Migration[7.2]
SQL
change_column_null :domain_post_files, :state, false
# TODO - drop json_attributes column
end
def down

View File

@@ -0,0 +1,27 @@
# typed: strict
# frozen_string_literal: true
class RemoveJsonAttributesFromDomainPostFiles < ActiveRecord::Migration[7.2]
extend T::Sig
sig { void }
def change
remove_index :domain_post_files,
"((json_attributes->>'ib_id')::integer)",
where: "type = 'Domain::PostFile::InkbunnyPostFile'",
name: "idx_domain_inkbunny_post_files_on_ib_id",
unique: true
remove_index :domain_post_files,
"lower((json_attributes->>'url_str')::text) text_pattern_ops",
name: "idx_domain_post_files_on_url_str_lower"
remove_index :domain_post_files,
"reverse(lower((json_attributes->>'url_str')::text)) text_pattern_ops",
name: "idx_domain_post_files_on_url_str_lower_reverse"
remove_column :domain_post_files, :json_attributes, :jsonb, default: {}
mirai_tablespace!(both_ways: true)
end
end

View File

@@ -2821,7 +2821,6 @@ CREATE TABLE public.domain_post_files (
post_id bigint NOT NULL,
log_entry_id bigint,
blob_sha256 bytea,
json_attributes jsonb DEFAULT '{}'::jsonb,
created_at timestamp(6) without time zone NOT NULL,
updated_at timestamp(6) without time zone NOT NULL,
state character varying NOT NULL,
@@ -5968,13 +5967,6 @@ CREATE UNIQUE INDEX idx_domain_fa_posts_on_fa_id ON public.domain_posts USING bt
CREATE UNIQUE INDEX idx_domain_fa_users_on_url_name ON public.domain_users USING btree (((json_attributes ->> 'url_name'::text))) WHERE (type = 'Domain::User::FaUser'::public.domain_user_type);
--
-- Name: idx_domain_inkbunny_post_files_on_ib_id; Type: INDEX; Schema: public; Owner: -; Tablespace: mirai
--
CREATE UNIQUE INDEX idx_domain_inkbunny_post_files_on_ib_id ON public.domain_post_files USING btree ((((json_attributes ->> 'ib_id'::text))::integer)) WHERE (type = 'Domain::PostFile::InkbunnyPostFile'::public.domain_post_file_type);
--
-- Name: idx_domain_inkbunny_posts_on_ib_id; Type: INDEX; Schema: public; Owner: -; Tablespace: mirai
--
@@ -5996,20 +5988,6 @@ CREATE UNIQUE INDEX idx_domain_inkbunny_users_on_ib_id ON public.domain_users US
CREATE UNIQUE INDEX idx_domain_inkbunny_users_on_name ON public.domain_users USING btree (((json_attributes ->> 'name'::text))) WHERE (type = 'Domain::User::InkbunnyUser'::public.domain_user_type);
--
-- Name: idx_domain_post_files_on_url_str_lower; Type: INDEX; Schema: public; Owner: -; Tablespace: mirai
--
CREATE INDEX idx_domain_post_files_on_url_str_lower ON public.domain_post_files USING btree (lower((json_attributes ->> 'url_str'::text)) text_pattern_ops);
--
-- Name: idx_domain_post_files_on_url_str_lower_reverse; Type: INDEX; Schema: public; Owner: -; Tablespace: mirai
--
CREATE INDEX idx_domain_post_files_on_url_str_lower_reverse ON public.domain_post_files USING btree (reverse(lower((json_attributes ->> 'url_str'::text))) text_pattern_ops);
--
-- Name: idx_domain_post_groups_on_owner_id; Type: INDEX; Schema: public; Owner: -; Tablespace: mirai
--
@@ -9351,6 +9329,7 @@ ALTER TABLE ONLY public.domain_twitter_tweets
SET search_path TO "$user", public;
INSERT INTO "schema_migrations" (version) VALUES
('20250718162608'),
('20250717204152'),
('20250716164417'),
('20250711014943'),