[DB] Remove test_parser extension

Usage has been removed in 5215876862 and pr #476
This commit is contained in:
Earlopain 2023-02-26 16:41:02 +01:00
parent 3094cee260
commit fbf33f7d29
No known key found for this signature in database
GPG Key ID: 6CFB948E15246897
6 changed files with 16 additions and 95 deletions

View File

@ -210,14 +210,6 @@ class ApplicationRecord < ActiveRecord::Base
end
end
concerning :PostgresExtensions do
class_methods do
def columns(*params)
super.reject {|x| x.sql_type == "tsvector"}
end
end
end
concerning :SimpleVersioningMethods do
class_methods do
def simple_versioning(options = {})

View File

@ -1402,7 +1402,7 @@ class Post < ApplicationRecord
module ApiMethods
def hidden_attributes
list = super + [:tag_index, :pool_string, :fav_string]
list = super + [:pool_string, :fav_string]
if !visible?
list += [:md5, :file_ext]
end

View File

@ -0,0 +1,12 @@
class RemoveTestparser < ActiveRecord::Migration[7.0]
def up
execute "DROP TRIGGER trigger_posts_on_tag_index_update ON posts"
remove_column :posts, :tag_index
execute "DROP TEXT SEARCH CONFIGURATION danbooru"
execute "DROP TEXT SEARCH PARSER testparser"
%i[testprs_start testprs_lextype testprs_getlexeme testprs_end].each do |function|
execute "DROP FUNCTION #{function}"
end
end
end

View File

@ -40,65 +40,6 @@ END;
$$;
--
-- Name: testprs_end(internal); Type: FUNCTION; Schema: public; Owner: -
--
CREATE FUNCTION public.testprs_end(internal) RETURNS void
LANGUAGE c STRICT
AS '$libdir/test_parser', 'testprs_end';
--
-- Name: testprs_getlexeme(internal, internal, internal); Type: FUNCTION; Schema: public; Owner: -
--
CREATE FUNCTION public.testprs_getlexeme(internal, internal, internal) RETURNS internal
LANGUAGE c STRICT
AS '$libdir/test_parser', 'testprs_getlexeme';
--
-- Name: testprs_lextype(internal); Type: FUNCTION; Schema: public; Owner: -
--
CREATE FUNCTION public.testprs_lextype(internal) RETURNS internal
LANGUAGE c STRICT
AS '$libdir/test_parser', 'testprs_lextype';
--
-- Name: testprs_start(internal, integer); Type: FUNCTION; Schema: public; Owner: -
--
CREATE FUNCTION public.testprs_start(internal, integer) RETURNS internal
LANGUAGE c STRICT
AS '$libdir/test_parser', 'testprs_start';
--
-- Name: testparser; Type: TEXT SEARCH PARSER; Schema: public; Owner: -
--
CREATE TEXT SEARCH PARSER public.testparser (
START = public.testprs_start,
GETTOKEN = public.testprs_getlexeme,
END = public.testprs_end,
HEADLINE = prsd_headline,
LEXTYPES = public.testprs_lextype );
--
-- Name: danbooru; Type: TEXT SEARCH CONFIGURATION; Schema: public; Owner: -
--
CREATE TEXT SEARCH CONFIGURATION public.danbooru (
PARSER = public.testparser );
ALTER TEXT SEARCH CONFIGURATION public.danbooru
ADD MAPPING FOR word WITH simple;
SET default_tablespace = '';
SET default_table_access_method = heap;
@ -1643,7 +1584,6 @@ CREATE TABLE public.posts (
last_comment_bumped_at timestamp without time zone,
fav_count integer DEFAULT 0 NOT NULL,
tag_string text DEFAULT ''::text NOT NULL,
tag_index tsvector,
tag_count integer DEFAULT 0 NOT NULL,
tag_count_general integer DEFAULT 0 NOT NULL,
tag_count_artist integer DEFAULT 0 NOT NULL,
@ -4071,13 +4011,6 @@ CREATE INDEX index_posts_on_string_to_array_tag_string ON public.posts USING gin
ALTER INDEX public.index_posts_on_string_to_array_tag_string ALTER COLUMN 1 SET STATISTICS 3000;
--
-- Name: index_posts_on_tags_index; Type: INDEX; Schema: public; Owner: -
--
CREATE INDEX index_posts_on_tags_index ON public.posts USING gin (tag_index);
--
-- Name: index_posts_on_uploader_id; Type: INDEX; Schema: public; Owner: -
--
@ -4379,13 +4312,6 @@ CREATE INDEX index_wiki_pages_on_updated_at ON public.wiki_pages USING btree (up
CREATE TRIGGER posts_update_change_seq BEFORE UPDATE ON public.posts FOR EACH ROW EXECUTE FUNCTION public.posts_trigger_change_seq();
--
-- Name: posts trigger_posts_on_tag_index_update; Type: TRIGGER; Schema: public; Owner: -
--
CREATE TRIGGER trigger_posts_on_tag_index_update BEFORE INSERT OR UPDATE ON public.posts FOR EACH ROW EXECUTE FUNCTION tsvector_update_trigger('tag_index', 'public.danbooru', 'tag_string', 'fav_string', 'pool_string');
--
-- Name: staff_audit_logs fk_rails_02329e5ef9; Type: FK CONSTRAINT; Schema: public; Owner: -
--
@ -4691,6 +4617,7 @@ INSERT INTO "schema_migrations" (version) VALUES
('20230210092829'),
('20230219115601'),
('20230221145226'),
('20230221153458');
('20230221153458'),
('20230226152600');

View File

@ -58,7 +58,7 @@ services:
- "3000:3000"
postgres:
build: ./docker/postgres
image: postgres:12-alpine
environment:
- POSTGRES_USER=danbooru
- POSTGRES_HOST_AUTH_METHOD=trust

View File

@ -1,10 +0,0 @@
FROM postgres:12-alpine
ARG BUILD_DEPS="git make gcc libc-dev clang llvm"
ADD https://api.github.com/repos/r888888888/test_parser/git/refs/heads/master /tmp/test_parser_version.json
RUN apk --no-cache add $BUILD_DEPS \
&& git clone https://github.com/r888888888/test_parser.git /tmp/test_parser \
&& cd /tmp/test_parser \
&& make -j$(nproc) install \
&& rm -rf /tmp/test_parser \
&& apk del $BUILD_DEPS