diff --git a/db/migrate/20220918031429_change_ip_addresses_to_nullable.rb b/db/migrate/20220918031429_change_ip_addresses_to_nullable.rb new file mode 100644 index 000000000..5168fd29d --- /dev/null +++ b/db/migrate/20220918031429_change_ip_addresses_to_nullable.rb @@ -0,0 +1,17 @@ +class ChangeIpAddressesToNullable < ActiveRecord::Migration[7.0] + def change + change_column_null :artist_versions, :updater_ip_addr, true + change_column_null :artist_commentary_versions, :updater_ip_addr, true + change_column_null :note_versions, :updater_ip_addr, true + change_column_null :wiki_page_versions, :updater_ip_addr, true + change_column_null :post_versions, :updater_ip_addr, true + change_column_null :pool_versions, :updater_ip_addr, true + + change_column_null :comments, :creator_ip_addr, true + change_column_null :comments, :updater_ip_addr, true + change_column_null :dmails, :creator_ip_addr, true + + change_column_null :posts, :uploader_ip_addr, true + change_column_null :uploads, :uploader_ip_addr, true + end +end diff --git a/db/structure.sql b/db/structure.sql index ad13d83eb..8a4c4d918 100644 --- a/db/structure.sql +++ b/db/structure.sql @@ -195,7 +195,7 @@ CREATE TABLE public.artist_commentary_versions ( id integer NOT NULL, post_id integer NOT NULL, updater_id integer NOT NULL, - updater_ip_addr inet NOT NULL, + updater_ip_addr inet, original_title text DEFAULT ''::text NOT NULL, original_description text DEFAULT ''::text NOT NULL, translated_title text DEFAULT ''::text NOT NULL, @@ -269,7 +269,7 @@ CREATE TABLE public.artist_versions ( artist_id integer NOT NULL, name character varying NOT NULL, updater_id integer NOT NULL, - updater_ip_addr inet NOT NULL, + updater_ip_addr inet, is_deleted boolean DEFAULT false NOT NULL, other_names text[] DEFAULT '{}'::text[] NOT NULL, group_name character varying DEFAULT ''::character varying NOT NULL, @@ -453,7 +453,7 @@ CREATE TABLE public.comments ( post_id integer NOT NULL, creator_id integer NOT NULL, body text NOT NULL, - creator_ip_addr inet NOT NULL, + creator_ip_addr inet, score integer DEFAULT 0 NOT NULL, created_at timestamp without time zone NOT NULL, updated_at timestamp without time zone NOT NULL, @@ -500,7 +500,7 @@ CREATE TABLE public.dmails ( is_deleted boolean DEFAULT false NOT NULL, created_at timestamp without time zone NOT NULL, updated_at timestamp without time zone NOT NULL, - creator_ip_addr inet NOT NULL, + creator_ip_addr inet, is_spam boolean DEFAULT false NOT NULL ); @@ -1105,7 +1105,7 @@ CREATE TABLE public.note_versions ( width integer NOT NULL, height integer NOT NULL, body text NOT NULL, - updater_ip_addr inet NOT NULL, + updater_ip_addr inet, is_active boolean DEFAULT true NOT NULL, note_id integer NOT NULL, post_id integer NOT NULL, @@ -1216,7 +1216,7 @@ CREATE TABLE public.pool_versions ( updated_at timestamp(6) without time zone NOT NULL, pool_id bigint NOT NULL, updater_id bigint NOT NULL, - updater_ip_addr inet NOT NULL, + updater_ip_addr inet, version integer DEFAULT 1 NOT NULL, name text NOT NULL, description text DEFAULT ''::text NOT NULL, @@ -1481,7 +1481,7 @@ CREATE TABLE public.post_versions ( updated_at timestamp(6) without time zone NOT NULL, post_id bigint NOT NULL, updater_id bigint NOT NULL, - updater_ip_addr inet NOT NULL, + updater_ip_addr inet, version integer DEFAULT 1 NOT NULL, parent_changed boolean DEFAULT false NOT NULL, rating_changed boolean DEFAULT false NOT NULL, @@ -1564,7 +1564,7 @@ CREATE TABLE public.posts ( rating character(1) DEFAULT 'q'::bpchar NOT NULL, image_width integer NOT NULL, image_height integer NOT NULL, - uploader_ip_addr inet NOT NULL, + uploader_ip_addr inet, tag_string text DEFAULT ''::text NOT NULL, fav_count integer DEFAULT 0 NOT NULL, file_ext character varying NOT NULL, @@ -1921,7 +1921,7 @@ CREATE TABLE public.uploads ( id integer NOT NULL, source text, uploader_id integer NOT NULL, - uploader_ip_addr inet NOT NULL, + uploader_ip_addr inet, status text DEFAULT 'pending'::text NOT NULL, created_at timestamp without time zone NOT NULL, updated_at timestamp without time zone NOT NULL, @@ -2056,7 +2056,7 @@ CREATE TABLE public.wiki_page_versions ( title character varying NOT NULL, body text NOT NULL, updater_id integer NOT NULL, - updater_ip_addr inet NOT NULL, + updater_ip_addr inet, wiki_page_id integer NOT NULL, is_locked boolean NOT NULL, other_names text[] DEFAULT '{}'::text[] NOT NULL, @@ -6693,6 +6693,7 @@ INSERT INTO "schema_migrations" (version) VALUES ('20220909211649'), ('20220913191300'), ('20220913191309'), -('20220917204044'); +('20220917204044'), +('20220918031429');