mirror of
https://github.com/philomena-dev/philomena.git
synced 2024-11-30 14:57:59 +01:00
Migration
This commit is contained in:
parent
4ef45327c1
commit
2c144c14a3
2 changed files with 155 additions and 416 deletions
152
priv/repo/migrations/20240727203034_remove_unused_data.exs
Normal file
152
priv/repo/migrations/20240727203034_remove_unused_data.exs
Normal file
|
@ -0,0 +1,152 @@
|
|||
defmodule Philomena.Repo.Migrations.RemoveUnusedData do
|
||||
use Ecto.Migration
|
||||
|
||||
def change do
|
||||
# migration tables
|
||||
drop table(:old_source_changes)
|
||||
|
||||
# no longer relevant
|
||||
drop table(:unread_notifications)
|
||||
drop table(:notifications)
|
||||
drop table(:user_whitelists)
|
||||
drop table(:vpns)
|
||||
|
||||
# dead columns
|
||||
alter table(:artist_links) do
|
||||
remove :hostname, :string
|
||||
remove :path, :string
|
||||
end
|
||||
|
||||
alter table(:channels) do
|
||||
remove :channel_image, :string
|
||||
remove :banner_image, :string
|
||||
remove :tags, :string
|
||||
remove :watcher_ids, {:array, :integer}, default: [], null: false
|
||||
remove :watcher_count, :integer, default: 0, null: false
|
||||
remove :viewer_minutes_today, :integer, default: 0, null: false
|
||||
remove :viewer_minutes_thisweek, :integer, default: 0, null: false
|
||||
remove :viewer_minutes_thismonth, :integer, default: 0, null: false
|
||||
remove :total_viewer_minutes, :integer, default: 0, null: false
|
||||
remove :remote_stream_id, :integer
|
||||
remove :thumbnail_url, :string, default: ""
|
||||
end
|
||||
|
||||
alter table(:comments) do
|
||||
remove :referrer, :string, default: ""
|
||||
remove :user_agent, :string, default: ""
|
||||
remove :name_at_post_time, :string
|
||||
remove :body_textile, :string, default: "", null: false
|
||||
end
|
||||
|
||||
alter table(:commission_items) do
|
||||
remove :description_textile, :string
|
||||
remove :add_ons_textile, :string
|
||||
end
|
||||
|
||||
alter table(:commissions) do
|
||||
remove :information_textile, :string
|
||||
remove :contact_textile, :string
|
||||
remove :will_create_textile, :string
|
||||
remove :will_not_create_textile, :string
|
||||
end
|
||||
|
||||
alter table(:dnp_entries) do
|
||||
remove :conditions_textile, :string, default: "", null: false
|
||||
remove :reason_textile, :string, default: "", null: false
|
||||
remove :instructions_textile, :string, default: "", null: false
|
||||
end
|
||||
|
||||
alter table(:forums) do
|
||||
remove :watcher_ids, {:array, :integer}, default: [], null: false
|
||||
remove :watcher_count, :integer, default: 0, null: false
|
||||
end
|
||||
|
||||
alter table(:galleries) do
|
||||
remove :watcher_ids, {:array, :integer}, default: [], null: false
|
||||
remove :watcher_count, :integer, default: 0, null: false
|
||||
end
|
||||
|
||||
alter table(:images) do
|
||||
remove :referrer, :string, default: ""
|
||||
remove :user_agent, :string, default: ""
|
||||
remove :watcher_ids, {:array, :integer}, default: [], null: false
|
||||
remove :watcher_count, :integer, default: 0, null: false
|
||||
remove :tag_ids, {:array, :integer}, default: [], null: false
|
||||
remove :ne_intensity, :"double precision"
|
||||
remove :nw_intensity, :"double precision"
|
||||
remove :se_intensity, :"double precision"
|
||||
remove :sw_intensity, :"double precision"
|
||||
remove :average_intensity, :"double precision"
|
||||
remove :votes_count, :integer, default: 0, null: false
|
||||
remove :description_textile, :string, default: "", null: false
|
||||
remove :scratchpad_textile, :string
|
||||
remove :tag_list_cache, :string
|
||||
remove :tag_list_plus_alias_cache, :string
|
||||
remove :file_name_cache, :string
|
||||
end
|
||||
|
||||
alter table(:messages) do
|
||||
remove :body_textile, :string, default: "", null: false
|
||||
end
|
||||
|
||||
alter table(:mod_notes) do
|
||||
remove :body_textile, :text, default: "", null: false
|
||||
end
|
||||
|
||||
alter table(:polls) do
|
||||
remove :hidden_from_users, :boolean, default: false, null: false
|
||||
remove :deleted_by_id, references(:users, name: "fk_rails_2bf9149369")
|
||||
remove :deletion_reason, :string, default: "", null: false
|
||||
end
|
||||
|
||||
alter table(:posts) do
|
||||
remove :referrer, :string, default: ""
|
||||
remove :user_agent, :string, default: ""
|
||||
remove :name_at_post_time, :string
|
||||
remove :body_textile, :string, default: "", null: false
|
||||
end
|
||||
|
||||
alter table(:reports) do
|
||||
remove :referrer, :string, default: ""
|
||||
remove :user_agent, :string, default: ""
|
||||
remove :reason_textile, :string, default: "", null: false
|
||||
end
|
||||
|
||||
alter table(:roles) do
|
||||
remove :resource_id, :integer
|
||||
remove :created_at, :"timestamp without time zone"
|
||||
remove :updated_at, :"timestamp without time zone"
|
||||
end
|
||||
|
||||
alter table(:source_changes) do
|
||||
remove :user_agent, :string, size: 255, default: ""
|
||||
remove :referrer, :string, size: 255, default: ""
|
||||
end
|
||||
|
||||
alter table(:tags) do
|
||||
remove :description_textile, :string, default: ""
|
||||
end
|
||||
|
||||
alter table(:tag_changes) do
|
||||
remove :user_agent, :string, default: ""
|
||||
remove :referrer, :string, default: ""
|
||||
end
|
||||
|
||||
alter table(:topics) do
|
||||
remove :watcher_ids, {:array, :integer}, default: [], null: false
|
||||
remove :watcher_count, :integer, default: 0, null: false
|
||||
end
|
||||
|
||||
alter table(:users) do
|
||||
remove :sign_in_count, :integer, default: 0, null: false
|
||||
remove :current_sign_in_at, :"timestamp without time zone"
|
||||
remove :current_sign_in_ip, :inet
|
||||
remove :last_sign_in_at, :"timestamp without time zone"
|
||||
remove :last_sign_in_ip, :inet
|
||||
remove :last_donation_at, :"timestamp without time zone"
|
||||
remove :unread_notification_ids, {:array, :integer}, default: [], null: false
|
||||
remove :description_textile, :string
|
||||
remove :scratchpad_textile, :text
|
||||
end
|
||||
end
|
||||
end
|
|
@ -82,8 +82,6 @@ CREATE TABLE public.artist_links (
|
|||
id integer NOT NULL,
|
||||
aasm_state character varying NOT NULL,
|
||||
uri character varying NOT NULL,
|
||||
hostname character varying,
|
||||
path character varying,
|
||||
verification_code character varying NOT NULL,
|
||||
public boolean DEFAULT true NOT NULL,
|
||||
next_check_at timestamp without time zone,
|
||||
|
@ -229,27 +227,16 @@ CREATE TABLE public.channels (
|
|||
id integer NOT NULL,
|
||||
short_name character varying NOT NULL,
|
||||
title character varying NOT NULL,
|
||||
channel_image character varying,
|
||||
tags character varying,
|
||||
viewers integer DEFAULT 0 NOT NULL,
|
||||
nsfw boolean DEFAULT false NOT NULL,
|
||||
is_live boolean DEFAULT false NOT NULL,
|
||||
last_fetched_at timestamp without time zone,
|
||||
next_check_at timestamp without time zone,
|
||||
last_live_at timestamp without time zone,
|
||||
watcher_ids integer[] DEFAULT '{}'::integer[] NOT NULL,
|
||||
watcher_count integer DEFAULT 0 NOT NULL,
|
||||
type character varying NOT NULL,
|
||||
created_at timestamp without time zone NOT NULL,
|
||||
updated_at timestamp without time zone NOT NULL,
|
||||
associated_artist_tag_id integer,
|
||||
viewer_minutes_today integer DEFAULT 0 NOT NULL,
|
||||
viewer_minutes_thisweek integer DEFAULT 0 NOT NULL,
|
||||
viewer_minutes_thismonth integer DEFAULT 0 NOT NULL,
|
||||
total_viewer_minutes integer DEFAULT 0 NOT NULL,
|
||||
banner_image character varying,
|
||||
remote_stream_id integer,
|
||||
thumbnail_url character varying DEFAULT ''::character varying
|
||||
viewers integer DEFAULT 0 NOT NULL
|
||||
);
|
||||
|
||||
|
||||
|
@ -278,11 +265,8 @@ ALTER SEQUENCE public.channels_id_seq OWNED BY public.channels.id;
|
|||
|
||||
CREATE TABLE public.comments (
|
||||
id integer NOT NULL,
|
||||
body_textile character varying DEFAULT ''::character varying NOT NULL,
|
||||
ip inet,
|
||||
fingerprint character varying,
|
||||
user_agent character varying DEFAULT ''::character varying,
|
||||
referrer character varying DEFAULT ''::character varying,
|
||||
anonymous boolean DEFAULT false,
|
||||
hidden_from_users boolean DEFAULT false NOT NULL,
|
||||
user_id integer,
|
||||
|
@ -294,7 +278,6 @@ CREATE TABLE public.comments (
|
|||
edited_at timestamp without time zone,
|
||||
deletion_reason character varying DEFAULT ''::character varying NOT NULL,
|
||||
destroyed_content boolean DEFAULT false,
|
||||
name_at_post_time character varying,
|
||||
body character varying NOT NULL,
|
||||
approved boolean DEFAULT false
|
||||
);
|
||||
|
@ -327,9 +310,7 @@ CREATE TABLE public.commission_items (
|
|||
id integer NOT NULL,
|
||||
commission_id integer,
|
||||
item_type character varying,
|
||||
description_textile character varying,
|
||||
base_price numeric,
|
||||
add_ons_textile character varying,
|
||||
example_image_id integer,
|
||||
created_at timestamp without time zone NOT NULL,
|
||||
updated_at timestamp without time zone NOT NULL,
|
||||
|
@ -366,11 +347,7 @@ CREATE TABLE public.commissions (
|
|||
user_id integer NOT NULL,
|
||||
open boolean NOT NULL,
|
||||
categories character varying[] DEFAULT '{}'::character varying[] NOT NULL,
|
||||
information_textile character varying,
|
||||
contact_textile character varying,
|
||||
sheet_image_id integer,
|
||||
will_create_textile character varying,
|
||||
will_not_create_textile character varying,
|
||||
commission_items_count integer DEFAULT 0 NOT NULL,
|
||||
created_at timestamp without time zone NOT NULL,
|
||||
updated_at timestamp without time zone NOT NULL,
|
||||
|
@ -450,10 +427,7 @@ CREATE TABLE public.dnp_entries (
|
|||
tag_id integer NOT NULL,
|
||||
aasm_state character varying DEFAULT 'requested'::character varying NOT NULL,
|
||||
dnp_type character varying NOT NULL,
|
||||
conditions_textile character varying DEFAULT ''::character varying NOT NULL,
|
||||
reason_textile character varying DEFAULT ''::character varying NOT NULL,
|
||||
hide_reason boolean DEFAULT false NOT NULL,
|
||||
instructions_textile character varying DEFAULT ''::character varying NOT NULL,
|
||||
feedback character varying NOT NULL,
|
||||
created_at timestamp without time zone NOT NULL,
|
||||
updated_at timestamp without time zone NOT NULL,
|
||||
|
@ -682,8 +656,6 @@ CREATE TABLE public.forums (
|
|||
access_level character varying DEFAULT 'normal'::character varying NOT NULL,
|
||||
topic_count integer DEFAULT 0 NOT NULL,
|
||||
post_count integer DEFAULT 0 NOT NULL,
|
||||
watcher_ids integer[] DEFAULT '{}'::integer[] NOT NULL,
|
||||
watcher_count integer DEFAULT 0 NOT NULL,
|
||||
created_at timestamp without time zone NOT NULL,
|
||||
updated_at timestamp without time zone NOT NULL,
|
||||
last_post_id integer,
|
||||
|
@ -723,8 +695,6 @@ CREATE TABLE public.galleries (
|
|||
creator_id integer NOT NULL,
|
||||
created_at timestamp without time zone NOT NULL,
|
||||
updated_at timestamp without time zone NOT NULL,
|
||||
watcher_ids integer[] DEFAULT '{}'::integer[] NOT NULL,
|
||||
watcher_count integer DEFAULT 0 NOT NULL,
|
||||
image_count integer DEFAULT 0 NOT NULL,
|
||||
order_position_asc boolean DEFAULT false NOT NULL
|
||||
);
|
||||
|
@ -987,26 +957,16 @@ CREATE TABLE public.images (
|
|||
image_aspect_ratio double precision,
|
||||
ip inet,
|
||||
fingerprint character varying,
|
||||
user_agent character varying DEFAULT ''::character varying,
|
||||
referrer character varying DEFAULT ''::character varying,
|
||||
anonymous boolean DEFAULT false,
|
||||
score integer DEFAULT 0 NOT NULL,
|
||||
faves_count integer DEFAULT 0 NOT NULL,
|
||||
upvotes_count integer DEFAULT 0 NOT NULL,
|
||||
downvotes_count integer DEFAULT 0 NOT NULL,
|
||||
votes_count integer DEFAULT 0 NOT NULL,
|
||||
watcher_ids integer[] DEFAULT '{}'::integer[] NOT NULL,
|
||||
watcher_count integer DEFAULT 0 NOT NULL,
|
||||
source_url character varying,
|
||||
description_textile character varying DEFAULT ''::character varying NOT NULL,
|
||||
image_sha512_hash character varying,
|
||||
image_orig_sha512_hash character varying,
|
||||
deletion_reason character varying,
|
||||
tag_list_cache character varying,
|
||||
tag_list_plus_alias_cache character varying,
|
||||
file_name_cache character varying,
|
||||
duplicate_id integer,
|
||||
tag_ids integer[] DEFAULT '{}'::integer[] NOT NULL,
|
||||
comments_count integer DEFAULT 0 NOT NULL,
|
||||
processed boolean DEFAULT false NOT NULL,
|
||||
thumbnails_generated boolean DEFAULT false NOT NULL,
|
||||
|
@ -1018,18 +978,12 @@ CREATE TABLE public.images (
|
|||
is_animated boolean NOT NULL,
|
||||
first_seen_at timestamp without time zone NOT NULL,
|
||||
featured_on timestamp without time zone,
|
||||
se_intensity double precision,
|
||||
sw_intensity double precision,
|
||||
ne_intensity double precision,
|
||||
nw_intensity double precision,
|
||||
average_intensity double precision,
|
||||
user_id integer,
|
||||
deleted_by_id integer,
|
||||
created_at timestamp without time zone NOT NULL,
|
||||
updated_at timestamp without time zone NOT NULL,
|
||||
destroyed_content boolean DEFAULT false NOT NULL,
|
||||
hidden_image_key character varying,
|
||||
scratchpad_textile character varying,
|
||||
hides_count integer DEFAULT 0 NOT NULL,
|
||||
image_duration double precision,
|
||||
description character varying DEFAULT ''::character varying NOT NULL,
|
||||
|
@ -1064,7 +1018,6 @@ ALTER SEQUENCE public.images_id_seq OWNED BY public.images.id;
|
|||
|
||||
CREATE TABLE public.messages (
|
||||
id integer NOT NULL,
|
||||
body_textile character varying DEFAULT ''::character varying NOT NULL,
|
||||
created_at timestamp without time zone NOT NULL,
|
||||
updated_at timestamp without time zone NOT NULL,
|
||||
from_id integer NOT NULL,
|
||||
|
@ -1102,7 +1055,6 @@ CREATE TABLE public.mod_notes (
|
|||
moderator_id integer NOT NULL,
|
||||
notable_id integer NOT NULL,
|
||||
notable_type character varying NOT NULL,
|
||||
body_textile text DEFAULT ''::text NOT NULL,
|
||||
deleted boolean DEFAULT false NOT NULL,
|
||||
created_at timestamp without time zone NOT NULL,
|
||||
updated_at timestamp without time zone NOT NULL,
|
||||
|
@ -1162,80 +1114,6 @@ CREATE SEQUENCE public.moderation_logs_id_seq
|
|||
ALTER SEQUENCE public.moderation_logs_id_seq OWNED BY public.moderation_logs.id;
|
||||
|
||||
|
||||
--
|
||||
-- Name: notifications; Type: TABLE; Schema: public; Owner: -
|
||||
--
|
||||
|
||||
CREATE TABLE public.notifications (
|
||||
id integer NOT NULL,
|
||||
action character varying NOT NULL,
|
||||
watcher_ids integer[] DEFAULT '{}'::integer[] NOT NULL,
|
||||
actor_id integer NOT NULL,
|
||||
actor_type character varying NOT NULL,
|
||||
created_at timestamp without time zone NOT NULL,
|
||||
updated_at timestamp without time zone NOT NULL,
|
||||
actor_child_id integer,
|
||||
actor_child_type character varying
|
||||
);
|
||||
|
||||
|
||||
--
|
||||
-- Name: notifications_id_seq; Type: SEQUENCE; Schema: public; Owner: -
|
||||
--
|
||||
|
||||
CREATE SEQUENCE public.notifications_id_seq
|
||||
START WITH 1
|
||||
INCREMENT BY 1
|
||||
NO MINVALUE
|
||||
NO MAXVALUE
|
||||
CACHE 1;
|
||||
|
||||
|
||||
--
|
||||
-- Name: notifications_id_seq; Type: SEQUENCE OWNED BY; Schema: public; Owner: -
|
||||
--
|
||||
|
||||
ALTER SEQUENCE public.notifications_id_seq OWNED BY public.notifications.id;
|
||||
|
||||
|
||||
--
|
||||
-- Name: old_source_changes; Type: TABLE; Schema: public; Owner: -
|
||||
--
|
||||
|
||||
CREATE TABLE public.old_source_changes (
|
||||
id integer NOT NULL,
|
||||
ip inet NOT NULL,
|
||||
fingerprint character varying,
|
||||
user_agent character varying DEFAULT ''::character varying,
|
||||
referrer character varying DEFAULT ''::character varying,
|
||||
new_value character varying,
|
||||
initial boolean DEFAULT false NOT NULL,
|
||||
created_at timestamp without time zone NOT NULL,
|
||||
updated_at timestamp without time zone NOT NULL,
|
||||
user_id integer,
|
||||
image_id integer NOT NULL
|
||||
);
|
||||
|
||||
|
||||
--
|
||||
-- Name: old_source_changes_id_seq; Type: SEQUENCE; Schema: public; Owner: -
|
||||
--
|
||||
|
||||
CREATE SEQUENCE public.old_source_changes_id_seq
|
||||
START WITH 1
|
||||
INCREMENT BY 1
|
||||
NO MINVALUE
|
||||
NO MAXVALUE
|
||||
CACHE 1;
|
||||
|
||||
|
||||
--
|
||||
-- Name: old_source_changes_id_seq; Type: SEQUENCE OWNED BY; Schema: public; Owner: -
|
||||
--
|
||||
|
||||
ALTER SEQUENCE public.old_source_changes_id_seq OWNED BY public.old_source_changes.id;
|
||||
|
||||
|
||||
--
|
||||
-- Name: poll_options; Type: TABLE; Schema: public; Owner: -
|
||||
--
|
||||
|
@ -1311,9 +1189,6 @@ CREATE TABLE public.polls (
|
|||
total_votes integer DEFAULT 0 NOT NULL,
|
||||
created_at timestamp without time zone NOT NULL,
|
||||
updated_at timestamp without time zone NOT NULL,
|
||||
hidden_from_users boolean DEFAULT false NOT NULL,
|
||||
deleted_by_id integer,
|
||||
deletion_reason character varying DEFAULT ''::character varying NOT NULL,
|
||||
topic_id integer NOT NULL
|
||||
);
|
||||
|
||||
|
@ -1343,12 +1218,9 @@ ALTER SEQUENCE public.polls_id_seq OWNED BY public.polls.id;
|
|||
|
||||
CREATE TABLE public.posts (
|
||||
id integer NOT NULL,
|
||||
body_textile character varying DEFAULT ''::character varying NOT NULL,
|
||||
edit_reason character varying,
|
||||
ip inet,
|
||||
fingerprint character varying,
|
||||
user_agent character varying DEFAULT ''::character varying,
|
||||
referrer character varying DEFAULT ''::character varying,
|
||||
topic_position integer NOT NULL,
|
||||
hidden_from_users boolean DEFAULT false NOT NULL,
|
||||
anonymous boolean DEFAULT false,
|
||||
|
@ -1360,7 +1232,6 @@ CREATE TABLE public.posts (
|
|||
edited_at timestamp without time zone,
|
||||
deletion_reason character varying DEFAULT ''::character varying NOT NULL,
|
||||
destroyed_content boolean DEFAULT false NOT NULL,
|
||||
name_at_post_time character varying,
|
||||
body character varying NOT NULL,
|
||||
approved boolean DEFAULT false
|
||||
);
|
||||
|
@ -1393,9 +1264,6 @@ CREATE TABLE public.reports (
|
|||
id integer NOT NULL,
|
||||
ip inet NOT NULL,
|
||||
fingerprint character varying,
|
||||
user_agent character varying DEFAULT ''::character varying,
|
||||
referrer character varying DEFAULT ''::character varying,
|
||||
reason_textile character varying DEFAULT ''::character varying NOT NULL,
|
||||
state character varying DEFAULT 'open'::character varying NOT NULL,
|
||||
open boolean DEFAULT true NOT NULL,
|
||||
created_at timestamp without time zone NOT NULL,
|
||||
|
@ -1435,10 +1303,7 @@ ALTER SEQUENCE public.reports_id_seq OWNED BY public.reports.id;
|
|||
CREATE TABLE public.roles (
|
||||
id integer NOT NULL,
|
||||
name character varying,
|
||||
resource_id integer,
|
||||
resource_type character varying,
|
||||
created_at timestamp without time zone,
|
||||
updated_at timestamp without time zone
|
||||
resource_type character varying
|
||||
);
|
||||
|
||||
|
||||
|
@ -1522,8 +1387,6 @@ CREATE TABLE public.source_changes (
|
|||
updated_at timestamp(0) without time zone NOT NULL,
|
||||
added boolean NOT NULL,
|
||||
fingerprint character varying(255),
|
||||
user_agent character varying(255) DEFAULT ''::character varying,
|
||||
referrer character varying(255) DEFAULT ''::character varying,
|
||||
value character varying(255) NOT NULL
|
||||
);
|
||||
|
||||
|
@ -1661,8 +1524,6 @@ CREATE TABLE public.tag_changes (
|
|||
id integer NOT NULL,
|
||||
ip inet,
|
||||
fingerprint character varying,
|
||||
user_agent character varying DEFAULT ''::character varying,
|
||||
referrer character varying DEFAULT ''::character varying,
|
||||
added boolean NOT NULL,
|
||||
tag_name_cache character varying DEFAULT ''::character varying NOT NULL,
|
||||
created_at timestamp without time zone NOT NULL,
|
||||
|
@ -1700,7 +1561,6 @@ CREATE TABLE public.tags (
|
|||
id integer NOT NULL,
|
||||
name character varying NOT NULL,
|
||||
slug character varying NOT NULL,
|
||||
description_textile character varying DEFAULT ''::character varying,
|
||||
short_description character varying DEFAULT ''::character varying,
|
||||
namespace character varying,
|
||||
name_in_namespace character varying,
|
||||
|
@ -1772,8 +1632,6 @@ CREATE TABLE public.topics (
|
|||
lock_reason character varying,
|
||||
slug character varying NOT NULL,
|
||||
anonymous boolean DEFAULT false,
|
||||
watcher_ids integer[] DEFAULT '{}'::integer[] NOT NULL,
|
||||
watcher_count integer DEFAULT 0 NOT NULL,
|
||||
created_at timestamp without time zone NOT NULL,
|
||||
updated_at timestamp without time zone NOT NULL,
|
||||
forum_id integer NOT NULL,
|
||||
|
@ -1804,36 +1662,6 @@ CREATE SEQUENCE public.topics_id_seq
|
|||
ALTER SEQUENCE public.topics_id_seq OWNED BY public.topics.id;
|
||||
|
||||
|
||||
--
|
||||
-- Name: unread_notifications; Type: TABLE; Schema: public; Owner: -
|
||||
--
|
||||
|
||||
CREATE TABLE public.unread_notifications (
|
||||
id integer NOT NULL,
|
||||
notification_id integer NOT NULL,
|
||||
user_id integer NOT NULL
|
||||
);
|
||||
|
||||
|
||||
--
|
||||
-- Name: unread_notifications_id_seq; Type: SEQUENCE; Schema: public; Owner: -
|
||||
--
|
||||
|
||||
CREATE SEQUENCE public.unread_notifications_id_seq
|
||||
START WITH 1
|
||||
INCREMENT BY 1
|
||||
NO MINVALUE
|
||||
NO MAXVALUE
|
||||
CACHE 1;
|
||||
|
||||
|
||||
--
|
||||
-- Name: unread_notifications_id_seq; Type: SEQUENCE OWNED BY; Schema: public; Owner: -
|
||||
--
|
||||
|
||||
ALTER SEQUENCE public.unread_notifications_id_seq OWNED BY public.unread_notifications.id;
|
||||
|
||||
|
||||
--
|
||||
-- Name: user_bans; Type: TABLE; Schema: public; Owner: -
|
||||
--
|
||||
|
@ -2040,38 +1868,6 @@ CREATE SEQUENCE public.user_tokens_id_seq
|
|||
ALTER SEQUENCE public.user_tokens_id_seq OWNED BY public.user_tokens.id;
|
||||
|
||||
|
||||
--
|
||||
-- Name: user_whitelists; Type: TABLE; Schema: public; Owner: -
|
||||
--
|
||||
|
||||
CREATE TABLE public.user_whitelists (
|
||||
id integer NOT NULL,
|
||||
reason character varying NOT NULL,
|
||||
created_at timestamp without time zone NOT NULL,
|
||||
updated_at timestamp without time zone NOT NULL,
|
||||
user_id integer NOT NULL
|
||||
);
|
||||
|
||||
|
||||
--
|
||||
-- Name: user_whitelists_id_seq; Type: SEQUENCE; Schema: public; Owner: -
|
||||
--
|
||||
|
||||
CREATE SEQUENCE public.user_whitelists_id_seq
|
||||
START WITH 1
|
||||
INCREMENT BY 1
|
||||
NO MINVALUE
|
||||
NO MAXVALUE
|
||||
CACHE 1;
|
||||
|
||||
|
||||
--
|
||||
-- Name: user_whitelists_id_seq; Type: SEQUENCE OWNED BY; Schema: public; Owner: -
|
||||
--
|
||||
|
||||
ALTER SEQUENCE public.user_whitelists_id_seq OWNED BY public.user_whitelists.id;
|
||||
|
||||
|
||||
--
|
||||
-- Name: users; Type: TABLE; Schema: public; Owner: -
|
||||
--
|
||||
|
@ -2083,11 +1879,6 @@ CREATE TABLE public.users (
|
|||
reset_password_token character varying,
|
||||
reset_password_sent_at timestamp without time zone,
|
||||
remember_created_at timestamp without time zone,
|
||||
sign_in_count integer DEFAULT 0 NOT NULL,
|
||||
current_sign_in_at timestamp without time zone,
|
||||
last_sign_in_at timestamp without time zone,
|
||||
current_sign_in_ip inet,
|
||||
last_sign_in_ip inet,
|
||||
created_at timestamp without time zone NOT NULL,
|
||||
updated_at timestamp without time zone NOT NULL,
|
||||
deleted_at timestamp without time zone,
|
||||
|
@ -2095,7 +1886,6 @@ CREATE TABLE public.users (
|
|||
name character varying NOT NULL,
|
||||
slug character varying NOT NULL,
|
||||
role character varying DEFAULT 'user'::character varying NOT NULL,
|
||||
description_textile character varying,
|
||||
avatar character varying,
|
||||
spoiler_type character varying DEFAULT 'static'::character varying NOT NULL,
|
||||
theme character varying DEFAULT 'default'::character varying NOT NULL,
|
||||
|
@ -2121,7 +1911,6 @@ CREATE TABLE public.users (
|
|||
forum_posts_count integer DEFAULT 0 NOT NULL,
|
||||
topic_count integer DEFAULT 0 NOT NULL,
|
||||
recent_filter_ids integer[] DEFAULT '{}'::integer[] NOT NULL,
|
||||
unread_notification_ids integer[] DEFAULT '{}'::integer[] NOT NULL,
|
||||
watched_tag_ids integer[] DEFAULT '{}'::integer[] NOT NULL,
|
||||
deleted_by_user_id integer,
|
||||
current_filter_id integer,
|
||||
|
@ -2133,8 +1922,6 @@ CREATE TABLE public.users (
|
|||
comments_posted_count integer DEFAULT 0 NOT NULL,
|
||||
metadata_updates_count integer DEFAULT 0 NOT NULL,
|
||||
images_favourited_count integer DEFAULT 0 NOT NULL,
|
||||
last_donation_at timestamp without time zone,
|
||||
scratchpad_textile text,
|
||||
use_centered_layout boolean DEFAULT true NOT NULL,
|
||||
secondary_role character varying,
|
||||
hide_default_role boolean DEFAULT false NOT NULL,
|
||||
|
@ -2223,15 +2010,6 @@ CREATE SEQUENCE public.versions_id_seq
|
|||
ALTER SEQUENCE public.versions_id_seq OWNED BY public.versions.id;
|
||||
|
||||
|
||||
--
|
||||
-- Name: vpns; Type: TABLE; Schema: public; Owner: -
|
||||
--
|
||||
|
||||
CREATE TABLE public.vpns (
|
||||
ip inet NOT NULL
|
||||
);
|
||||
|
||||
|
||||
--
|
||||
-- Name: adverts id; Type: DEFAULT; Schema: public; Owner: -
|
||||
--
|
||||
|
@ -2393,20 +2171,6 @@ ALTER TABLE ONLY public.mod_notes ALTER COLUMN id SET DEFAULT nextval('public.mo
|
|||
ALTER TABLE ONLY public.moderation_logs ALTER COLUMN id SET DEFAULT nextval('public.moderation_logs_id_seq'::regclass);
|
||||
|
||||
|
||||
--
|
||||
-- Name: notifications id; Type: DEFAULT; Schema: public; Owner: -
|
||||
--
|
||||
|
||||
ALTER TABLE ONLY public.notifications ALTER COLUMN id SET DEFAULT nextval('public.notifications_id_seq'::regclass);
|
||||
|
||||
|
||||
--
|
||||
-- Name: old_source_changes id; Type: DEFAULT; Schema: public; Owner: -
|
||||
--
|
||||
|
||||
ALTER TABLE ONLY public.old_source_changes ALTER COLUMN id SET DEFAULT nextval('public.old_source_changes_id_seq'::regclass);
|
||||
|
||||
|
||||
--
|
||||
-- Name: poll_options id; Type: DEFAULT; Schema: public; Owner: -
|
||||
--
|
||||
|
@ -2505,13 +2269,6 @@ ALTER TABLE ONLY public.tags ALTER COLUMN id SET DEFAULT nextval('public.tags_id
|
|||
ALTER TABLE ONLY public.topics ALTER COLUMN id SET DEFAULT nextval('public.topics_id_seq'::regclass);
|
||||
|
||||
|
||||
--
|
||||
-- Name: unread_notifications id; Type: DEFAULT; Schema: public; Owner: -
|
||||
--
|
||||
|
||||
ALTER TABLE ONLY public.unread_notifications ALTER COLUMN id SET DEFAULT nextval('public.unread_notifications_id_seq'::regclass);
|
||||
|
||||
|
||||
--
|
||||
-- Name: user_bans id; Type: DEFAULT; Schema: public; Owner: -
|
||||
--
|
||||
|
@ -2554,13 +2311,6 @@ ALTER TABLE ONLY public.user_statistics ALTER COLUMN id SET DEFAULT nextval('pub
|
|||
ALTER TABLE ONLY public.user_tokens ALTER COLUMN id SET DEFAULT nextval('public.user_tokens_id_seq'::regclass);
|
||||
|
||||
|
||||
--
|
||||
-- Name: user_whitelists id; Type: DEFAULT; Schema: public; Owner: -
|
||||
--
|
||||
|
||||
ALTER TABLE ONLY public.user_whitelists ALTER COLUMN id SET DEFAULT nextval('public.user_whitelists_id_seq'::regclass);
|
||||
|
||||
|
||||
--
|
||||
-- Name: users id; Type: DEFAULT; Schema: public; Owner: -
|
||||
--
|
||||
|
@ -2759,22 +2509,6 @@ ALTER TABLE ONLY public.moderation_logs
|
|||
ADD CONSTRAINT moderation_logs_pkey PRIMARY KEY (id);
|
||||
|
||||
|
||||
--
|
||||
-- Name: notifications notifications_pkey; Type: CONSTRAINT; Schema: public; Owner: -
|
||||
--
|
||||
|
||||
ALTER TABLE ONLY public.notifications
|
||||
ADD CONSTRAINT notifications_pkey PRIMARY KEY (id);
|
||||
|
||||
|
||||
--
|
||||
-- Name: old_source_changes old_source_changes_pkey; Type: CONSTRAINT; Schema: public; Owner: -
|
||||
--
|
||||
|
||||
ALTER TABLE ONLY public.old_source_changes
|
||||
ADD CONSTRAINT old_source_changes_pkey PRIMARY KEY (id);
|
||||
|
||||
|
||||
--
|
||||
-- Name: poll_options poll_options_pkey; Type: CONSTRAINT; Schema: public; Owner: -
|
||||
--
|
||||
|
@ -2895,14 +2629,6 @@ ALTER TABLE ONLY public.topics
|
|||
ADD CONSTRAINT topics_pkey PRIMARY KEY (id);
|
||||
|
||||
|
||||
--
|
||||
-- Name: unread_notifications unread_notifications_pkey; Type: CONSTRAINT; Schema: public; Owner: -
|
||||
--
|
||||
|
||||
ALTER TABLE ONLY public.unread_notifications
|
||||
ADD CONSTRAINT unread_notifications_pkey PRIMARY KEY (id);
|
||||
|
||||
|
||||
--
|
||||
-- Name: user_bans user_bans_pkey; Type: CONSTRAINT; Schema: public; Owner: -
|
||||
--
|
||||
|
@ -2951,14 +2677,6 @@ ALTER TABLE ONLY public.user_tokens
|
|||
ADD CONSTRAINT user_tokens_pkey PRIMARY KEY (id);
|
||||
|
||||
|
||||
--
|
||||
-- Name: user_whitelists user_whitelists_pkey; Type: CONSTRAINT; Schema: public; Owner: -
|
||||
--
|
||||
|
||||
ALTER TABLE ONLY public.user_whitelists
|
||||
ADD CONSTRAINT user_whitelists_pkey PRIMARY KEY (id);
|
||||
|
||||
|
||||
--
|
||||
-- Name: users users_pkey; Type: CONSTRAINT; Schema: public; Owner: -
|
||||
--
|
||||
|
@ -3780,13 +3498,6 @@ CREATE INDEX index_images_on_featured_on ON public.images USING btree (featured_
|
|||
CREATE INDEX index_images_on_image_orig_sha512_hash ON public.images USING btree (image_orig_sha512_hash);
|
||||
|
||||
|
||||
--
|
||||
-- Name: index_images_on_tag_ids; Type: INDEX; Schema: public; Owner: -
|
||||
--
|
||||
|
||||
CREATE INDEX index_images_on_tag_ids ON public.images USING gin (tag_ids);
|
||||
|
||||
|
||||
--
|
||||
-- Name: index_images_on_updated_at; Type: INDEX; Schema: public; Owner: -
|
||||
--
|
||||
|
@ -3829,34 +3540,6 @@ CREATE INDEX index_mod_notes_on_moderator_id ON public.mod_notes USING btree (mo
|
|||
CREATE INDEX index_mod_notes_on_notable_type_and_notable_id ON public.mod_notes USING btree (notable_type, notable_id);
|
||||
|
||||
|
||||
--
|
||||
-- Name: index_notifications_on_actor_id_and_actor_type; Type: INDEX; Schema: public; Owner: -
|
||||
--
|
||||
|
||||
CREATE UNIQUE INDEX index_notifications_on_actor_id_and_actor_type ON public.notifications USING btree (actor_id, actor_type);
|
||||
|
||||
|
||||
--
|
||||
-- Name: index_old_source_changes_on_image_id; Type: INDEX; Schema: public; Owner: -
|
||||
--
|
||||
|
||||
CREATE INDEX index_old_source_changes_on_image_id ON public.old_source_changes USING btree (image_id);
|
||||
|
||||
|
||||
--
|
||||
-- Name: index_old_source_changes_on_ip; Type: INDEX; Schema: public; Owner: -
|
||||
--
|
||||
|
||||
CREATE INDEX index_old_source_changes_on_ip ON public.old_source_changes USING btree (ip);
|
||||
|
||||
|
||||
--
|
||||
-- Name: index_old_source_changes_on_user_id; Type: INDEX; Schema: public; Owner: -
|
||||
--
|
||||
|
||||
CREATE INDEX index_old_source_changes_on_user_id ON public.old_source_changes USING btree (user_id);
|
||||
|
||||
|
||||
--
|
||||
-- Name: index_poll_options_on_poll_id_and_label; Type: INDEX; Schema: public; Owner: -
|
||||
--
|
||||
|
@ -3878,13 +3561,6 @@ CREATE UNIQUE INDEX index_poll_votes_on_poll_option_id_and_user_id ON public.pol
|
|||
CREATE INDEX index_poll_votes_on_user_id ON public.poll_votes USING btree (user_id);
|
||||
|
||||
|
||||
--
|
||||
-- Name: index_polls_on_deleted_by_id; Type: INDEX; Schema: public; Owner: -
|
||||
--
|
||||
|
||||
CREATE INDEX index_polls_on_deleted_by_id ON public.polls USING btree (deleted_by_id) WHERE (deleted_by_id IS NOT NULL);
|
||||
|
||||
|
||||
--
|
||||
-- Name: index_polls_on_topic_id; Type: INDEX; Schema: public; Owner: -
|
||||
--
|
||||
|
@ -3948,13 +3624,6 @@ CREATE INDEX index_reports_on_open ON public.reports USING btree (open);
|
|||
CREATE INDEX index_reports_on_user_id ON public.reports USING btree (user_id);
|
||||
|
||||
|
||||
--
|
||||
-- Name: index_roles_on_name_and_resource_type_and_resource_id; Type: INDEX; Schema: public; Owner: -
|
||||
--
|
||||
|
||||
CREATE INDEX index_roles_on_name_and_resource_type_and_resource_id ON public.roles USING btree (name, resource_type, resource_id);
|
||||
|
||||
|
||||
--
|
||||
-- Name: index_site_notices_on_start_date_and_finish_date; Type: INDEX; Schema: public; Owner: -
|
||||
--
|
||||
|
@ -4186,20 +3855,6 @@ CREATE INDEX index_topics_on_slug ON public.topics USING btree (slug);
|
|||
CREATE INDEX index_topics_on_user_id ON public.topics USING btree (user_id);
|
||||
|
||||
|
||||
--
|
||||
-- Name: index_unread_notifications_on_notification_id_and_user_id; Type: INDEX; Schema: public; Owner: -
|
||||
--
|
||||
|
||||
CREATE UNIQUE INDEX index_unread_notifications_on_notification_id_and_user_id ON public.unread_notifications USING btree (notification_id, user_id);
|
||||
|
||||
|
||||
--
|
||||
-- Name: index_unread_notifications_on_user_id; Type: INDEX; Schema: public; Owner: -
|
||||
--
|
||||
|
||||
CREATE INDEX index_unread_notifications_on_user_id ON public.unread_notifications USING btree (user_id);
|
||||
|
||||
|
||||
--
|
||||
-- Name: index_user_bans_on_banning_user_id; Type: INDEX; Schema: public; Owner: -
|
||||
--
|
||||
|
@ -4277,13 +3932,6 @@ CREATE INDEX index_user_statistics_on_user_id ON public.user_statistics USING bt
|
|||
CREATE UNIQUE INDEX index_user_statistics_on_user_id_and_day ON public.user_statistics USING btree (user_id, day);
|
||||
|
||||
|
||||
--
|
||||
-- Name: index_user_whitelists_on_user_id; Type: INDEX; Schema: public; Owner: -
|
||||
--
|
||||
|
||||
CREATE UNIQUE INDEX index_user_whitelists_on_user_id ON public.user_whitelists USING btree (user_id);
|
||||
|
||||
|
||||
--
|
||||
-- Name: index_users_on_authentication_token; Type: INDEX; Schema: public; Owner: -
|
||||
--
|
||||
|
@ -4375,20 +4023,6 @@ CREATE UNIQUE INDEX index_users_roles_on_user_id_and_role_id ON public.users_rol
|
|||
CREATE INDEX index_versions_on_item_type_and_item_id ON public.versions USING btree (item_type, item_id);
|
||||
|
||||
|
||||
--
|
||||
-- Name: index_vpns_on_ip; Type: INDEX; Schema: public; Owner: -
|
||||
--
|
||||
|
||||
CREATE INDEX index_vpns_on_ip ON public.vpns USING gist (ip inet_ops);
|
||||
|
||||
|
||||
--
|
||||
-- Name: intensities_index; Type: INDEX; Schema: public; Owner: -
|
||||
--
|
||||
|
||||
CREATE INDEX intensities_index ON public.images USING btree (se_intensity, sw_intensity, ne_intensity, nw_intensity, average_intensity);
|
||||
|
||||
|
||||
--
|
||||
-- Name: moderation_logs_created_at_index; Type: INDEX; Schema: public; Owner: -
|
||||
--
|
||||
|
@ -4509,14 +4143,6 @@ ALTER TABLE ONLY public.image_taggings
|
|||
ADD CONSTRAINT fk_rails_0f89cd23a9 FOREIGN KEY (image_id) REFERENCES public.images(id) ON UPDATE CASCADE ON DELETE CASCADE;
|
||||
|
||||
|
||||
--
|
||||
-- Name: old_source_changes fk_rails_10271ec4d0; Type: FK CONSTRAINT; Schema: public; Owner: -
|
||||
--
|
||||
|
||||
ALTER TABLE ONLY public.old_source_changes
|
||||
ADD CONSTRAINT fk_rails_10271ec4d0 FOREIGN KEY (image_id) REFERENCES public.images(id) ON UPDATE CASCADE ON DELETE CASCADE;
|
||||
|
||||
|
||||
--
|
||||
-- Name: image_subscriptions fk_rails_15f6724e1c; Type: FK CONSTRAINT; Schema: public; Owner: -
|
||||
--
|
||||
|
@ -4565,14 +4191,6 @@ ALTER TABLE ONLY public.messages
|
|||
ADD CONSTRAINT fk_rails_2bcf7eed31 FOREIGN KEY (from_id) REFERENCES public.users(id) ON UPDATE CASCADE ON DELETE RESTRICT;
|
||||
|
||||
|
||||
--
|
||||
-- Name: polls fk_rails_2bf9149369; Type: FK CONSTRAINT; Schema: public; Owner: -
|
||||
--
|
||||
|
||||
ALTER TABLE ONLY public.polls
|
||||
ADD CONSTRAINT fk_rails_2bf9149369 FOREIGN KEY (deleted_by_id) REFERENCES public.users(id) ON UPDATE CASCADE ON DELETE SET NULL;
|
||||
|
||||
|
||||
--
|
||||
-- Name: image_hides fk_rails_335978518a; Type: FK CONSTRAINT; Schema: public; Owner: -
|
||||
--
|
||||
|
@ -4621,14 +4239,6 @@ ALTER TABLE ONLY public.comments
|
|||
ADD CONSTRAINT fk_rails_3f25c5a043 FOREIGN KEY (deleted_by_id) REFERENCES public.users(id) ON UPDATE CASCADE ON DELETE SET NULL;
|
||||
|
||||
|
||||
--
|
||||
-- Name: unread_notifications fk_rails_429c8d75ab; Type: FK CONSTRAINT; Schema: public; Owner: -
|
||||
--
|
||||
|
||||
ALTER TABLE ONLY public.unread_notifications
|
||||
ADD CONSTRAINT fk_rails_429c8d75ab FOREIGN KEY (user_id) REFERENCES public.users(id) ON UPDATE CASCADE ON DELETE CASCADE;
|
||||
|
||||
|
||||
--
|
||||
-- Name: dnp_entries fk_rails_473a736b4a; Type: FK CONSTRAINT; Schema: public; Owner: -
|
||||
--
|
||||
|
@ -4909,14 +4519,6 @@ ALTER TABLE ONLY public.polls
|
|||
ADD CONSTRAINT fk_rails_861a79e923 FOREIGN KEY (topic_id) REFERENCES public.topics(id) ON UPDATE CASCADE ON DELETE CASCADE;
|
||||
|
||||
|
||||
--
|
||||
-- Name: old_source_changes fk_rails_8d8cb9cb3b; Type: FK CONSTRAINT; Schema: public; Owner: -
|
||||
--
|
||||
|
||||
ALTER TABLE ONLY public.old_source_changes
|
||||
ADD CONSTRAINT fk_rails_8d8cb9cb3b FOREIGN KEY (user_id) REFERENCES public.users(id) ON UPDATE CASCADE ON DELETE SET NULL;
|
||||
|
||||
|
||||
--
|
||||
-- Name: topics fk_rails_8fdcbf6aed; Type: FK CONSTRAINT; Schema: public; Owner: -
|
||||
--
|
||||
|
@ -4933,14 +4535,6 @@ ALTER TABLE ONLY public.image_features
|
|||
ADD CONSTRAINT fk_rails_90c2421c89 FOREIGN KEY (user_id) REFERENCES public.users(id) ON UPDATE CASCADE ON DELETE RESTRICT;
|
||||
|
||||
|
||||
--
|
||||
-- Name: unread_notifications fk_rails_97681c85bb; Type: FK CONSTRAINT; Schema: public; Owner: -
|
||||
--
|
||||
|
||||
ALTER TABLE ONLY public.unread_notifications
|
||||
ADD CONSTRAINT fk_rails_97681c85bb FOREIGN KEY (notification_id) REFERENCES public.notifications(id) ON UPDATE CASCADE ON DELETE CASCADE;
|
||||
|
||||
|
||||
--
|
||||
-- Name: artist_links fk_rails_9939489c5c; Type: FK CONSTRAINT; Schema: public; Owner: -
|
||||
--
|
||||
|
@ -5213,14 +4807,6 @@ ALTER TABLE ONLY public.users_roles
|
|||
ADD CONSTRAINT fk_rails_eb7b4658f8 FOREIGN KEY (role_id) REFERENCES public.roles(id) ON UPDATE CASCADE ON DELETE CASCADE;
|
||||
|
||||
|
||||
--
|
||||
-- Name: user_whitelists fk_rails_eda0eaebbb; Type: FK CONSTRAINT; Schema: public; Owner: -
|
||||
--
|
||||
|
||||
ALTER TABLE ONLY public.user_whitelists
|
||||
ADD CONSTRAINT fk_rails_eda0eaebbb FOREIGN KEY (user_id) REFERENCES public.users(id) ON UPDATE CASCADE ON DELETE CASCADE;
|
||||
|
||||
|
||||
--
|
||||
-- Name: dnp_entries fk_rails_f428aa5665; Type: FK CONSTRAINT; Schema: public; Owner: -
|
||||
--
|
||||
|
@ -5447,3 +5033,4 @@ INSERT INTO public."schema_migrations" (version) VALUES (20211219194836);
|
|||
INSERT INTO public."schema_migrations" (version) VALUES (20220321173359);
|
||||
INSERT INTO public."schema_migrations" (version) VALUES (20240707191353);
|
||||
INSERT INTO public."schema_migrations" (version) VALUES (20240723122759);
|
||||
INSERT INTO public."schema_migrations" (version) VALUES (20240727203034);
|
||||
|
|
Loading…
Reference in a new issue