-- -- PostgreSQL database dump -- -- Dumped from database version 10.15 (Ubuntu 10.15-0ubuntu0.18.04.1) -- Dumped by pg_dump version 10.15 (Ubuntu 10.15-0ubuntu0.18.04.1) SET statement_timeout = 0; SET lock_timeout = 0; SET idle_in_transaction_session_timeout = 0; SET client_encoding = 'UTF8'; SET standard_conforming_strings = on; SELECT pg_catalog.set_config('search_path', '', false); SET check_function_bodies = false; SET xmloption = content; SET client_min_messages = warning; SET row_security = off; -- -- Name: plpgsql; Type: EXTENSION; Schema: -; Owner: -- CREATE EXTENSION IF NOT EXISTS plpgsql WITH SCHEMA pg_catalog; -- -- Name: EXTENSION plpgsql; Type: COMMENT; Schema: -; Owner: -- COMMENT ON EXTENSION plpgsql IS 'PL/pgSQL procedural language'; -- -- Name: pgcrypto; Type: EXTENSION; Schema: -; Owner: -- CREATE EXTENSION IF NOT EXISTS pgcrypto WITH SCHEMA public; -- -- Name: EXTENSION pgcrypto; Type: COMMENT; Schema: -; Owner: -- COMMENT ON EXTENSION pgcrypto IS 'cryptographic functions'; SET default_tablespace = ''; SET default_with_oids = false; -- -- Name: scans; Type: TABLE; Schema: public; Owner: -- CREATE TABLE public.scans ( id bigint NOT NULL, started_date timestamp without time zone, completed_date timestamp without time zone, user_id bigint NOT NULL, status text, title text, scan_type integer, scan_text text, scan_url text, scan_stats text, doc_id bigint, error_message text, text_id bigint, word_count integer DEFAULT 0 NOT NULL, api_scan_id bigint, scan_by_email_id text, url_id bigint, whitelist_results text, whitelist_id integer, language character varying(50) DEFAULT 'EN'::character varying, watch_words_results text, watch_words_id integer, revision_id integer, revision_index integer ); -- -- Name: analysis_history(bigint); Type: FUNCTION; Schema: public; Owner: -- CREATE FUNCTION public.analysis_history(userid bigint) RETURNS SETOF public.scans LANGUAGE sql AS $$ SELECT s.* FROM Scans s left outer join revisions r on s.revision_id = r.id WHERE s.user_id = userID AND s.status = 'Complete' OR s.user_id = userID AND s.status = 'Queued' ORDER by coalesce(r.last_revised_date, s.completed_date) desc, s.completed_date desc; $$; -- -- Name: analysis_history_account(bigint); Type: FUNCTION; Schema: public; Owner: -- CREATE FUNCTION public.analysis_history_account(accountid bigint) RETURNS SETOF public.scans LANGUAGE sql AS $$ SELECT s.* FROM Scans s left outer join revisions r on s.revision_id = r.id join users u on s.user_id = u.id WHERE u.account_id = accountId AND (s.status = 'Complete' OR s.status = 'Queued') ORDER by coalesce(r.last_revised_date, s.completed_date) desc, s.completed_date desc; $$; -- -- Name: convert_whitelist(text); Type: FUNCTION; Schema: public; Owner: -- CREATE FUNCTION public.convert_whitelist(_whitelist text) RETURNS character varying[] LANGUAGE plpgsql AS $$ DECLARE m varchar; arr varchar[] := regexp_split_to_array(_whitelist, ','); resultArr varchar[]; BEGIN if(arr IS NOT NULL) then FOREACH m IN ARRAY arr LOOP m = TRIM(m); if(m) != '' Then resultArr := array_append(resultArr, m); End if; END LOOP; RETURN resultArr; else RETURN arr; end if; END $$; -- -- Name: account_threshold_settings; Type: TABLE; Schema: public; Owner: -- CREATE TABLE public.account_threshold_settings ( id bigint NOT NULL, account_id bigint NOT NULL, long_sentence_good integer NOT NULL, long_sentence_bad integer NOT NULL, avg_sentence_good integer NOT NULL, avg_sentence_bad integer NOT NULL, passive_good integer NOT NULL, passive_bad integer NOT NULL, readability_bad integer NOT NULL, readability_good integer NOT NULL, long_sentence_cutoff integer NOT NULL, very_long_sentence_cutoff integer NOT NULL, grade_level_good integer NOT NULL, grade_level_bad integer NOT NULL, lix_good integer DEFAULT 30 NOT NULL, lix_bad integer DEFAULT 65 NOT NULL, last_modified timestamp without time zone ); -- -- Name: account_threshold_settings_id_seq; Type: SEQUENCE; Schema: public; Owner: -- CREATE SEQUENCE public.account_threshold_settings_id_seq START WITH 1 INCREMENT BY 1 NO MINVALUE NO MAXVALUE CACHE 1; -- -- Name: account_threshold_settings_id_seq; Type: SEQUENCE OWNED BY; Schema: public; Owner: -- ALTER SEQUENCE public.account_threshold_settings_id_seq OWNED BY public.account_threshold_settings.id; -- -- Name: account_watch_words; Type: TABLE; Schema: public; Owner: -- CREATE TABLE public.account_watch_words ( id bigint NOT NULL, account_id bigint NOT NULL, watch_words jsonb, last_modified timestamp without time zone, last_modified_username text, description text ); -- -- Name: account_watch_words_account_id_seq; Type: SEQUENCE; Schema: public; Owner: -- CREATE SEQUENCE public.account_watch_words_account_id_seq START WITH 1 INCREMENT BY 1 NO MINVALUE NO MAXVALUE CACHE 1; -- -- Name: account_watch_words_account_id_seq; Type: SEQUENCE OWNED BY; Schema: public; Owner: -- ALTER SEQUENCE public.account_watch_words_account_id_seq OWNED BY public.account_watch_words.account_id; -- -- Name: account_watch_words_id_seq; Type: SEQUENCE; Schema: public; Owner: -- CREATE SEQUENCE public.account_watch_words_id_seq START WITH 1 INCREMENT BY 1 NO MINVALUE NO MAXVALUE CACHE 1; -- -- Name: account_watch_words_id_seq; Type: SEQUENCE OWNED BY; Schema: public; Owner: -- ALTER SEQUENCE public.account_watch_words_id_seq OWNED BY public.account_watch_words.id; -- -- Name: account_whitelist; Type: TABLE; Schema: public; Owner: -- CREATE TABLE public.account_whitelist ( id bigint NOT NULL, account_id bigint NOT NULL, whitelist jsonb, last_modified timestamp without time zone, last_modified_username text ); -- -- Name: account_whitelist_account_id_seq; Type: SEQUENCE; Schema: public; Owner: -- CREATE SEQUENCE public.account_whitelist_account_id_seq START WITH 1 INCREMENT BY 1 NO MINVALUE NO MAXVALUE CACHE 1; -- -- Name: account_whitelist_account_id_seq; Type: SEQUENCE OWNED BY; Schema: public; Owner: -- ALTER SEQUENCE public.account_whitelist_account_id_seq OWNED BY public.account_whitelist.account_id; -- -- Name: account_whitelist_id_seq; Type: SEQUENCE; Schema: public; Owner: -- CREATE SEQUENCE public.account_whitelist_id_seq START WITH 1 INCREMENT BY 1 NO MINVALUE NO MAXVALUE CACHE 1; -- -- Name: account_whitelist_id_seq; Type: SEQUENCE OWNED BY; Schema: public; Owner: -- ALTER SEQUENCE public.account_whitelist_id_seq OWNED BY public.account_whitelist.id; -- -- Name: accounts; Type: TABLE; Schema: public; Owner: -- CREATE TABLE public.accounts ( id bigint NOT NULL, account_name text NOT NULL, scan_by_email boolean DEFAULT false, expires_on timestamp without time zone, max_users integer, tier_id bigint, account_settings jsonb DEFAULT '{"scanRetentionDays": -1, "scanByEmailRetentionDays": -1}'::jsonb, license_check text, allow_unregistered_email boolean DEFAULT false, team_account boolean, smtp_configured boolean DEFAULT false NOT NULL, vtinsights_enabled boolean DEFAULT false, support_email text, anon_user_names boolean DEFAULT false ); -- -- Name: accounts_id_seq; Type: SEQUENCE; Schema: public; Owner: -- CREATE SEQUENCE public.accounts_id_seq START WITH 1 INCREMENT BY 1 NO MINVALUE NO MAXVALUE CACHE 1; -- -- Name: accounts_id_seq; Type: SEQUENCE OWNED BY; Schema: public; Owner: -- ALTER SEQUENCE public.accounts_id_seq OWNED BY public.accounts.id; -- -- Name: auth_token; Type: TABLE; Schema: public; Owner: -- CREATE TABLE public.auth_token ( id integer NOT NULL, email character varying(255) NOT NULL, operation character varying(255), time_stamp timestamp without time zone NOT NULL, token character varying(255) NOT NULL ); -- -- Name: auth_token_id_seq; Type: SEQUENCE; Schema: public; Owner: -- CREATE SEQUENCE public.auth_token_id_seq START WITH 16 INCREMENT BY 1 NO MINVALUE NO MAXVALUE CACHE 1; -- -- Name: authentication_settings; Type: TABLE; Schema: public; Owner: -- CREATE TABLE public.authentication_settings ( id integer NOT NULL, accountid integer, authtype character varying NOT NULL, samlconfig bytea ); -- -- Name: authentication_settings_id_seq; Type: SEQUENCE; Schema: public; Owner: -- CREATE SEQUENCE public.authentication_settings_id_seq AS integer START WITH 1 INCREMENT BY 1 NO MINVALUE NO MAXVALUE CACHE 1; -- -- Name: authentication_settings_id_seq; Type: SEQUENCE OWNED BY; Schema: public; Owner: -- ALTER SEQUENCE public.authentication_settings_id_seq OWNED BY public.authentication_settings.id; -- -- Name: custom_templates; Type: TABLE; Schema: public; Owner: -- CREATE TABLE public.custom_templates ( id bigint NOT NULL, account_id bigint NOT NULL, template_key text NOT NULL, template text NOT NULL ); -- -- Name: custom_templates_id_seq; Type: SEQUENCE; Schema: public; Owner: -- CREATE SEQUENCE public.custom_templates_id_seq START WITH 1 INCREMENT BY 1 NO MINVALUE NO MAXVALUE CACHE 1; -- -- Name: custom_templates_id_seq; Type: SEQUENCE OWNED BY; Schema: public; Owner: -- ALTER SEQUENCE public.custom_templates_id_seq OWNED BY public.custom_templates.id; -- -- Name: documents; Type: TABLE; Schema: public; Owner: -- CREATE TABLE public.documents ( id bigint NOT NULL, doc_name text, doc_type text, doc_content bytea ); -- -- Name: documents_id_seq; Type: SEQUENCE; Schema: public; Owner: -- CREATE SEQUENCE public.documents_id_seq START WITH 1 INCREMENT BY 1 NO MINVALUE NO MAXVALUE CACHE 1; -- -- Name: documents_id_seq; Type: SEQUENCE OWNED BY; Schema: public; Owner: -- ALTER SEQUENCE public.documents_id_seq OWNED BY public.documents.id; -- -- Name: email_config; Type: TABLE; Schema: public; Owner: -- CREATE TABLE public.email_config ( id bigint NOT NULL, inbound_email_type character varying(255) NOT NULL, pop_server character varying(255) NOT NULL, pop_user character varying(255) NOT NULL, pop_port character varying(255) NOT NULL, pop_password character varying(255) NOT NULL, imap_server character varying(255) NOT NULL, imap_user character varying(255) NOT NULL, imap_password character varying(255) NOT NULL, imap_port character varying(255) NOT NULL ); -- -- Name: email_config_id_seq; Type: SEQUENCE; Schema: public; Owner: -- CREATE SEQUENCE public.email_config_id_seq START WITH 1 INCREMENT BY 1 NO MINVALUE NO MAXVALUE CACHE 1; -- -- Name: email_config_id_seq; Type: SEQUENCE OWNED BY; Schema: public; Owner: -- ALTER SEQUENCE public.email_config_id_seq OWNED BY public.email_config.id; -- -- Name: email_scan_by_email_status; Type: TABLE; Schema: public; Owner: -- CREATE TABLE public.email_scan_by_email_status ( id bigint NOT NULL, message_id character varying(255) NOT NULL, flag_sent boolean DEFAULT false ); -- -- Name: email_scan_by_email_status_id_seq; Type: SEQUENCE; Schema: public; Owner: -- CREATE SEQUENCE public.email_scan_by_email_status_id_seq START WITH 1 INCREMENT BY 1 NO MINVALUE NO MAXVALUE CACHE 1; -- -- Name: email_scan_by_email_status_id_seq; Type: SEQUENCE OWNED BY; Schema: public; Owner: -- ALTER SEQUENCE public.email_scan_by_email_status_id_seq OWNED BY public.email_scan_by_email_status.id; -- -- Name: insights_records; Type: TABLE; Schema: public; Owner: -- CREATE TABLE public.insights_records ( account_id bigint NOT NULL, account_name character varying NOT NULL, user_name character varying NOT NULL, scan_id bigint, scan_title character varying, scan_type character varying, doc_type character varying, date timestamp without time zone NOT NULL, statistics character varying, language character varying, watch_word_results character varying, team_id integer, is_data_operation boolean DEFAULT false NOT NULL, operation_data character varying, record_id bigint DEFAULT 0 NOT NULL ); -- -- Name: monthly_usage_report; Type: TABLE; Schema: public; Owner: -- CREATE TABLE public.monthly_usage_report ( id bigint NOT NULL, usage_tier_user_id bigint NOT NULL, user_id bigint NOT NULL, start_date timestamp without time zone NOT NULL, end_date timestamp without time zone, total_docs integer, total_url integer, total_text integer ); -- -- Name: monthly_usage_report_id_seq; Type: SEQUENCE; Schema: public; Owner: -- CREATE SEQUENCE public.monthly_usage_report_id_seq START WITH 1 INCREMENT BY 1 NO MINVALUE NO MAXVALUE CACHE 1; -- -- Name: monthly_usage_report_id_seq; Type: SEQUENCE OWNED BY; Schema: public; Owner: -- ALTER SEQUENCE public.monthly_usage_report_id_seq OWNED BY public.monthly_usage_report.id; -- -- Name: paragraphs; Type: TABLE; Schema: public; Owner: -- CREATE TABLE public.paragraphs ( id bigint NOT NULL, scan_id bigint NOT NULL, paragraph_stats jsonb, paragraph_index integer DEFAULT 0 NOT NULL, word_count integer DEFAULT 0 NOT NULL, paragraph_counter integer DEFAULT 0 NOT NULL ); -- -- Name: paragraphs_id_seq; Type: SEQUENCE; Schema: public; Owner: -- CREATE SEQUENCE public.paragraphs_id_seq START WITH 1 INCREMENT BY 1 NO MINVALUE NO MAXVALUE CACHE 1; -- -- Name: paragraphs_id_seq; Type: SEQUENCE OWNED BY; Schema: public; Owner: -- ALTER SEQUENCE public.paragraphs_id_seq OWNED BY public.paragraphs.id; -- -- Name: record_id_seq; Type: SEQUENCE; Schema: public; Owner: -- CREATE SEQUENCE public.record_id_seq START WITH 1 INCREMENT BY 1 NO MINVALUE NO MAXVALUE CACHE 1; -- -- Name: record_id_seq; Type: SEQUENCE OWNED BY; Schema: public; Owner: -- ALTER SEQUENCE public.record_id_seq OWNED BY public.insights_records.record_id; -- -- Name: revisions; Type: TABLE; Schema: public; Owner: -- CREATE TABLE public.revisions ( id integer NOT NULL, revision_start_date timestamp without time zone NOT NULL, last_revised_date timestamp without time zone NOT NULL, original_scan_id bigint NOT NULL, latest_scan_id bigint NOT NULL ); -- -- Name: revisions_id_seq; Type: SEQUENCE; Schema: public; Owner: -- CREATE SEQUENCE public.revisions_id_seq AS integer START WITH 1 INCREMENT BY 1 NO MINVALUE NO MAXVALUE CACHE 1; -- -- Name: revisions_id_seq; Type: SEQUENCE OWNED BY; Schema: public; Owner: -- ALTER SEQUENCE public.revisions_id_seq OWNED BY public.revisions.id; -- -- Name: scan_by_email_domain; Type: TABLE; Schema: public; Owner: -- CREATE TABLE public.scan_by_email_domain ( id bigint NOT NULL, account_id bigint NOT NULL, domain_name character varying(255) NOT NULL ); -- -- Name: scan_by_email_domain_id_seq; Type: SEQUENCE; Schema: public; Owner: -- CREATE SEQUENCE public.scan_by_email_domain_id_seq START WITH 1 INCREMENT BY 1 NO MINVALUE NO MAXVALUE CACHE 1; -- -- Name: scan_by_email_domain_id_seq; Type: SEQUENCE OWNED BY; Schema: public; Owner: -- ALTER SEQUENCE public.scan_by_email_domain_id_seq OWNED BY public.scan_by_email_domain.id; -- -- Name: scans_id_seq; Type: SEQUENCE; Schema: public; Owner: -- CREATE SEQUENCE public.scans_id_seq START WITH 1 INCREMENT BY 1 NO MINVALUE NO MAXVALUE CACHE 1; -- -- Name: scans_id_seq; Type: SEQUENCE OWNED BY; Schema: public; Owner: -- ALTER SEQUENCE public.scans_id_seq OWNED BY public.scans.id; -- -- Name: schema_version; Type: TABLE; Schema: public; Owner: -- CREATE TABLE public.schema_version ( installed_rank integer NOT NULL, version character varying(50), description character varying(200) NOT NULL, type character varying(20) NOT NULL, script character varying(1000) NOT NULL, checksum integer, installed_by character varying(100) NOT NULL, installed_on timestamp without time zone DEFAULT now() NOT NULL, execution_time integer NOT NULL, success boolean NOT NULL ); -- -- Name: teams; Type: TABLE; Schema: public; Owner: -- CREATE TABLE public.teams ( id integer NOT NULL, account_id integer NOT NULL, team_name character varying(160) DEFAULT 'Default team'::character varying NOT NULL, team_descriptor character varying(160), creation_date timestamp without time zone NOT NULL, deletion_date timestamp without time zone ); -- -- Name: teams_id_seq; Type: SEQUENCE; Schema: public; Owner: -- CREATE SEQUENCE public.teams_id_seq AS integer START WITH 1 INCREMENT BY 1 NO MINVALUE NO MAXVALUE CACHE 1; -- -- Name: teams_id_seq; Type: SEQUENCE OWNED BY; Schema: public; Owner: -- ALTER SEQUENCE public.teams_id_seq OWNED BY public.teams.id; -- -- Name: text_scans; Type: TABLE; Schema: public; Owner: -- CREATE TABLE public.text_scans ( id bigint NOT NULL, text_name text, text_content text ); -- -- Name: text_scans_id_seq; Type: SEQUENCE; Schema: public; Owner: -- CREATE SEQUENCE public.text_scans_id_seq START WITH 1 INCREMENT BY 1 NO MINVALUE NO MAXVALUE CACHE 1; -- -- Name: text_scans_id_seq; Type: SEQUENCE OWNED BY; Schema: public; Owner: -- ALTER SEQUENCE public.text_scans_id_seq OWNED BY public.text_scans.id; -- -- Name: usage_tiers; Type: TABLE; Schema: public; Owner: -- CREATE TABLE public.usage_tiers ( id bigint NOT NULL, name text, url_scans_per_month integer, text_scans_per_month integer, doc_scans_per_month integer, flag_default boolean DEFAULT false NOT NULL, pricing_per_month integer, registration_msg character varying, text_revisions_per_scan integer DEFAULT 1000000 NOT NULL ); -- -- Name: usage_tiers_id_seq; Type: SEQUENCE; Schema: public; Owner: -- CREATE SEQUENCE public.usage_tiers_id_seq START WITH 1 INCREMENT BY 1 NO MINVALUE NO MAXVALUE CACHE 1; -- -- Name: usage_tiers_id_seq; Type: SEQUENCE OWNED BY; Schema: public; Owner: -- ALTER SEQUENCE public.usage_tiers_id_seq OWNED BY public.usage_tiers.id; -- -- Name: usage_tiers_users; Type: TABLE; Schema: public; Owner: -- CREATE TABLE public.usage_tiers_users ( id bigint NOT NULL, start_date timestamp without time zone NOT NULL, tier_id bigint NOT NULL, user_id bigint NOT NULL, subscription_id text ); -- -- Name: usage_tiers_users_id_seq; Type: SEQUENCE; Schema: public; Owner: -- CREATE SEQUENCE public.usage_tiers_users_id_seq START WITH 1 INCREMENT BY 1 NO MINVALUE NO MAXVALUE CACHE 1; -- -- Name: usage_tiers_users_id_seq; Type: SEQUENCE OWNED BY; Schema: public; Owner: -- ALTER SEQUENCE public.usage_tiers_users_id_seq OWNED BY public.usage_tiers_users.id; -- -- Name: user_activity; Type: TABLE; Schema: public; Owner: -- CREATE TABLE public.user_activity ( id bigint NOT NULL, user_id bigint, event_type integer NOT NULL, description text NOT NULL, completed_date timestamp with time zone NOT NULL ); -- -- Name: user_activity_id_seq; Type: SEQUENCE; Schema: public; Owner: -- CREATE SEQUENCE public.user_activity_id_seq START WITH 1 INCREMENT BY 1 NO MINVALUE NO MAXVALUE CACHE 1; -- -- Name: user_activity_id_seq; Type: SEQUENCE OWNED BY; Schema: public; Owner: -- ALTER SEQUENCE public.user_activity_id_seq OWNED BY public.user_activity.id; -- -- Name: user_threshold_settings; Type: TABLE; Schema: public; Owner: -- CREATE TABLE public.user_threshold_settings ( id bigint NOT NULL, user_id bigint NOT NULL, long_sentence_good integer NOT NULL, long_sentence_bad integer NOT NULL, avg_sentence_good integer NOT NULL, avg_sentence_bad integer NOT NULL, passive_good integer NOT NULL, passive_bad integer NOT NULL, readability_bad integer NOT NULL, readability_good integer NOT NULL, long_sentence_cutoff integer NOT NULL, very_long_sentence_cutoff integer NOT NULL, grade_level_good integer DEFAULT 8 NOT NULL, grade_level_bad integer DEFAULT 13 NOT NULL, lix_good integer DEFAULT 30 NOT NULL, lix_bad integer DEFAULT 65 NOT NULL, last_modified timestamp without time zone ); -- -- Name: user_threshold_settings_id_seq; Type: SEQUENCE; Schema: public; Owner: -- CREATE SEQUENCE public.user_threshold_settings_id_seq START WITH 1 INCREMENT BY 1 NO MINVALUE NO MAXVALUE CACHE 1; -- -- Name: user_threshold_settings_id_seq; Type: SEQUENCE OWNED BY; Schema: public; Owner: -- ALTER SEQUENCE public.user_threshold_settings_id_seq OWNED BY public.user_threshold_settings.id; -- -- Name: users; Type: TABLE; Schema: public; Owner: -- CREATE TABLE public.users ( id bigint NOT NULL, user_name character varying(160), user_email character varying(160), user_pass character varying(160), first_name character varying(160), last_name character varying(160), last_sign_in date, preferences text DEFAULT '{}'::text NOT NULL, social_id character varying(160), is_email_activation_required boolean DEFAULT false, account_id bigint, payments_customer_id text, last_login_time timestamp without time zone, team_id integer NOT NULL, team_modified_date timestamp without time zone, temp_password character varying(160) ); -- -- Name: users_id_seq; Type: SEQUENCE; Schema: public; Owner: -- CREATE SEQUENCE public.users_id_seq AS integer START WITH 1 INCREMENT BY 1 NO MINVALUE NO MAXVALUE CACHE 1; -- -- Name: users_id_seq; Type: SEQUENCE OWNED BY; Schema: public; Owner: -- ALTER SEQUENCE public.users_id_seq OWNED BY public.users.id; -- -- Name: users_roles; Type: TABLE; Schema: public; Owner: -- CREATE TABLE public.users_roles ( id bigint NOT NULL, user_id bigint NOT NULL, role text NOT NULL ); -- -- Name: users_roles_id_seq; Type: SEQUENCE; Schema: public; Owner: -- CREATE SEQUENCE public.users_roles_id_seq START WITH 1 INCREMENT BY 1 NO MINVALUE NO MAXVALUE CACHE 1; -- -- Name: users_roles_id_seq; Type: SEQUENCE OWNED BY; Schema: public; Owner: -- ALTER SEQUENCE public.users_roles_id_seq OWNED BY public.users_roles.id; -- -- Name: vw_account_admin; Type: VIEW; Schema: public; Owner: -- CREATE VIEW public.vw_account_admin AS SELECT a.id, a.account_name, a.scan_by_email, a.expires_on, a.max_users, a.tier_id, a.account_settings, a.allow_unregistered_email, a.team_account, a.vtinsights_enabled, ( SELECT count(u.*) AS count FROM (public.users_roles ur JOIN public.users u ON ((ur.user_id = u.id))) WHERE ((a.id = u.account_id) AND (ur.role = 'USER'::text))) AS active_users FROM public.accounts a; -- -- Name: vw_user_admin; Type: VIEW; Schema: public; Owner: -- CREATE VIEW public.vw_user_admin AS SELECT u.id, u.user_name, u.user_email, u.user_pass, u.first_name, u.last_name, u.last_sign_in, u.preferences, u.social_id, u.is_email_activation_required, u.account_id, u.payments_customer_id, u.last_login_time, u.team_id, ( SELECT ut.name FROM (public.usage_tiers_users utu JOIN public.usage_tiers ut ON ((utu.tier_id = ut.id))) WHERE (utu.user_id = u.id) ORDER BY utu.start_date DESC LIMIT 1) AS last_tier, ( SELECT count(s.id) AS count FROM public.scans s WHERE ((s.user_id = u.id) AND (s.scan_type = 2) AND ((s.status = 'Complete'::text) OR (s.status = 'Deleted'::text)))) AS doc_count, ( SELECT count(s.id) AS count FROM public.scans s WHERE ((s.user_id = u.id) AND (s.scan_type = 2) AND ((s.status = 'Complete'::text) OR (s.status = 'Deleted'::text)) AND (s.scan_by_email_id IS NOT NULL) AND (s.scan_by_email_id <> ''::text))) AS email_doc_count, ( SELECT count(s.id) AS count FROM public.scans s WHERE ((s.user_id = u.id) AND (s.scan_type = 1) AND ((s.status = 'Complete'::text) OR (s.status = 'Deleted'::text)))) AS url_count, ( SELECT count(s.id) AS count FROM public.scans s WHERE ((s.user_id = u.id) AND (s.scan_type = 3) AND ((s.status = 'Complete'::text) OR (s.status = 'Deleted'::text)))) AS text_count, ( SELECT count(s.id) AS count FROM public.scans s WHERE ((s.user_id = u.id) AND ((s.status = 'Complete'::text) OR (s.status = 'Deleted'::text)))) AS scan_count, ( SELECT (count(ur.id) > 0) FROM public.users_roles ur WHERE ((ur.user_id = u.id) AND (ur.role = 'ADMIN'::text))) AS flag_is_admin, ( SELECT (count(ur.id) > 0) FROM public.users_roles ur WHERE ((ur.user_id = u.id) AND (ur.role = 'USER'::text))) AS flag_is_user, ( SELECT (count(ur.id) > 0) FROM public.users_roles ur WHERE ((ur.user_id = u.id) AND (ur.role = 'VT_INSIGHTS_USER'::text))) AS flag_is_vtinsights_user, ( SELECT (count(ur.id) > 0) FROM public.users_roles ur WHERE ((ur.user_id = u.id) AND (ur.role = 'SYSTEM_ADMIN'::text))) AS flag_is_sys_admin, ( SELECT a.account_name FROM public.accounts a WHERE (a.id = u.account_id)) AS account_name, ( SELECT t.team_name FROM public.teams t WHERE (t.id = u.team_id)) AS team_name FROM public.users u; -- -- Name: vw_user_admin_2; Type: VIEW; Schema: public; Owner: -- CREATE VIEW public.vw_user_admin_2 AS SELECT u.id, u.user_name, u.user_email, u.user_pass, u.first_name, u.last_name, u.last_sign_in, u.preferences, u.social_id, u.is_email_activation_required, u.account_id, u.payments_customer_id, u.last_login_time, ( SELECT ut.name FROM (public.usage_tiers_users utu JOIN public.usage_tiers ut ON ((utu.tier_id = ut.id))) WHERE (utu.user_id = u.id) ORDER BY utu.start_date DESC LIMIT 1) AS last_tier, ( SELECT count(s.id) AS count FROM public.scans s WHERE ((s.user_id = u.id) AND (s.scan_type = 2) AND ((s.status = 'Complete'::text) OR (s.status = 'Deleted'::text)) AND ((s.scan_by_email_id IS NULL) OR (s.scan_by_email_id = ''::text)))) AS doc_count, ( SELECT count(s.id) AS count FROM public.scans s WHERE ((s.user_id = u.id) AND (s.scan_type = 2) AND ((s.status = 'Complete'::text) OR (s.status = 'Deleted'::text)) AND (s.scan_by_email_id IS NOT NULL) AND (s.scan_by_email_id <> ''::text))) AS email_doc_count, ( SELECT count(s.id) AS count FROM public.scans s WHERE ((s.user_id = u.id) AND (s.scan_type = 1) AND ((s.status = 'Complete'::text) OR (s.status = 'Deleted'::text)))) AS url_count, ( SELECT count(s.id) AS count FROM public.scans s WHERE ((s.user_id = u.id) AND (s.scan_type = 3) AND ((s.status = 'Complete'::text) OR (s.status = 'Deleted'::text)))) AS text_count, ( SELECT count(s.id) AS count FROM public.scans s WHERE ((s.user_id = u.id) AND ((s.status = 'Complete'::text) OR (s.status = 'Deleted'::text)))) AS scan_count, ( SELECT (count(ur.id) > 0) FROM public.users_roles ur WHERE ((ur.user_id = u.id) AND (ur.role = 'ADMIN'::text))) AS flag_is_admin, ( SELECT (count(ur.id) > 0) FROM public.users_roles ur WHERE ((ur.user_id = u.id) AND (ur.role = 'USER'::text))) AS flag_is_user, ( SELECT a.account_name FROM public.accounts a WHERE (a.id = u.account_id)) AS account_name FROM public.users u; -- -- Name: account_threshold_settings id; Type: DEFAULT; Schema: public; Owner: -- ALTER TABLE ONLY public.account_threshold_settings ALTER COLUMN id SET DEFAULT nextval('public.account_threshold_settings_id_seq'::regclass); -- -- Name: account_watch_words id; Type: DEFAULT; Schema: public; Owner: -- ALTER TABLE ONLY public.account_watch_words ALTER COLUMN id SET DEFAULT nextval('public.account_watch_words_id_seq'::regclass); -- -- Name: account_watch_words account_id; Type: DEFAULT; Schema: public; Owner: -- ALTER TABLE ONLY public.account_watch_words ALTER COLUMN account_id SET DEFAULT nextval('public.account_watch_words_account_id_seq'::regclass); -- -- Name: account_whitelist id; Type: DEFAULT; Schema: public; Owner: -- ALTER TABLE ONLY public.account_whitelist ALTER COLUMN id SET DEFAULT nextval('public.account_whitelist_id_seq'::regclass); -- -- Name: account_whitelist account_id; Type: DEFAULT; Schema: public; Owner: -- ALTER TABLE ONLY public.account_whitelist ALTER COLUMN account_id SET DEFAULT nextval('public.account_whitelist_account_id_seq'::regclass); -- -- Name: accounts id; Type: DEFAULT; Schema: public; Owner: -- ALTER TABLE ONLY public.accounts ALTER COLUMN id SET DEFAULT nextval('public.accounts_id_seq'::regclass); -- -- Name: authentication_settings id; Type: DEFAULT; Schema: public; Owner: -- ALTER TABLE ONLY public.authentication_settings ALTER COLUMN id SET DEFAULT nextval('public.authentication_settings_id_seq'::regclass); -- -- Name: custom_templates id; Type: DEFAULT; Schema: public; Owner: -- ALTER TABLE ONLY public.custom_templates ALTER COLUMN id SET DEFAULT nextval('public.custom_templates_id_seq'::regclass); -- -- Name: documents id; Type: DEFAULT; Schema: public; Owner: -- ALTER TABLE ONLY public.documents ALTER COLUMN id SET DEFAULT nextval('public.documents_id_seq'::regclass); -- -- Name: email_config id; Type: DEFAULT; Schema: public; Owner: -- ALTER TABLE ONLY public.email_config ALTER COLUMN id SET DEFAULT nextval('public.email_config_id_seq'::regclass); -- -- Name: email_scan_by_email_status id; Type: DEFAULT; Schema: public; Owner: -- ALTER TABLE ONLY public.email_scan_by_email_status ALTER COLUMN id SET DEFAULT nextval('public.email_scan_by_email_status_id_seq'::regclass); -- -- Name: monthly_usage_report id; Type: DEFAULT; Schema: public; Owner: -- ALTER TABLE ONLY public.monthly_usage_report ALTER COLUMN id SET DEFAULT nextval('public.monthly_usage_report_id_seq'::regclass); -- -- Name: paragraphs id; Type: DEFAULT; Schema: public; Owner: -- ALTER TABLE ONLY public.paragraphs ALTER COLUMN id SET DEFAULT nextval('public.paragraphs_id_seq'::regclass); -- -- Name: revisions id; Type: DEFAULT; Schema: public; Owner: -- ALTER TABLE ONLY public.revisions ALTER COLUMN id SET DEFAULT nextval('public.revisions_id_seq'::regclass); -- -- Name: scan_by_email_domain id; Type: DEFAULT; Schema: public; Owner: -- ALTER TABLE ONLY public.scan_by_email_domain ALTER COLUMN id SET DEFAULT nextval('public.scan_by_email_domain_id_seq'::regclass); -- -- Name: scans id; Type: DEFAULT; Schema: public; Owner: -- ALTER TABLE ONLY public.scans ALTER COLUMN id SET DEFAULT nextval('public.scans_id_seq'::regclass); -- -- Name: teams id; Type: DEFAULT; Schema: public; Owner: -- ALTER TABLE ONLY public.teams ALTER COLUMN id SET DEFAULT nextval('public.teams_id_seq'::regclass); -- -- Name: text_scans id; Type: DEFAULT; Schema: public; Owner: -- ALTER TABLE ONLY public.text_scans ALTER COLUMN id SET DEFAULT nextval('public.text_scans_id_seq'::regclass); -- -- Name: usage_tiers id; Type: DEFAULT; Schema: public; Owner: -- ALTER TABLE ONLY public.usage_tiers ALTER COLUMN id SET DEFAULT nextval('public.usage_tiers_id_seq'::regclass); -- -- Name: usage_tiers_users id; Type: DEFAULT; Schema: public; Owner: -- ALTER TABLE ONLY public.usage_tiers_users ALTER COLUMN id SET DEFAULT nextval('public.usage_tiers_users_id_seq'::regclass); -- -- Name: user_activity id; Type: DEFAULT; Schema: public; Owner: -- ALTER TABLE ONLY public.user_activity ALTER COLUMN id SET DEFAULT nextval('public.user_activity_id_seq'::regclass); -- -- Name: user_threshold_settings id; Type: DEFAULT; Schema: public; Owner: -- ALTER TABLE ONLY public.user_threshold_settings ALTER COLUMN id SET DEFAULT nextval('public.user_threshold_settings_id_seq'::regclass); -- -- Name: users id; Type: DEFAULT; Schema: public; Owner: -- ALTER TABLE ONLY public.users ALTER COLUMN id SET DEFAULT nextval('public.users_id_seq'::regclass); -- -- Name: users_roles id; Type: DEFAULT; Schema: public; Owner: -- ALTER TABLE ONLY public.users_roles ALTER COLUMN id SET DEFAULT nextval('public.users_roles_id_seq'::regclass); -- -- Data for Name: account_threshold_settings; Type: TABLE DATA; Schema: public; Owner: -- COPY public.account_threshold_settings (id, account_id, long_sentence_good, long_sentence_bad, avg_sentence_good, avg_sentence_bad, passive_good, passive_bad, readability_bad, readability_good, long_sentence_cutoff, very_long_sentence_cutoff, grade_level_good, grade_level_bad, lix_good, lix_bad, last_modified) FROM stdin; \. -- -- Data for Name: account_watch_words; Type: TABLE DATA; Schema: public; Owner: -- COPY public.account_watch_words (id, account_id, watch_words, last_modified, last_modified_username, description) FROM stdin; \. -- -- Data for Name: account_whitelist; Type: TABLE DATA; Schema: public; Owner: -- COPY public.account_whitelist (id, account_id, whitelist, last_modified, last_modified_username) FROM stdin; \. -- -- Data for Name: accounts; Type: TABLE DATA; Schema: public; Owner: -- COPY public.accounts (id, account_name, scan_by_email, expires_on, max_users, tier_id, account_settings, license_check, allow_unregistered_email, team_account, smtp_configured, vtinsights_enabled, support_email, anon_user_names) FROM stdin; \. -- -- Data for Name: auth_token; Type: TABLE DATA; Schema: public; Owner: -- COPY public.auth_token (id, email, operation, time_stamp, token) FROM stdin; \. -- -- Data for Name: authentication_settings; Type: TABLE DATA; Schema: public; Owner: -- COPY public.authentication_settings (id, accountid, authtype, samlconfig) FROM stdin; \. -- -- Data for Name: custom_templates; Type: TABLE DATA; Schema: public; Owner: -- COPY public.custom_templates (id, account_id, template_key, template) FROM stdin; \. -- -- Data for Name: documents; Type: TABLE DATA; Schema: public; Owner: -- COPY public.documents (id, doc_name, doc_type, doc_content) FROM stdin; \. -- -- Data for Name: email_config; Type: TABLE DATA; Schema: public; Owner: -- COPY public.email_config (id, inbound_email_type, pop_server, pop_user, pop_port, pop_password, imap_server, imap_user, imap_password, imap_port) FROM stdin; \. -- -- Data for Name: email_scan_by_email_status; Type: TABLE DATA; Schema: public; Owner: -- COPY public.email_scan_by_email_status (id, message_id, flag_sent) FROM stdin; \. -- -- Data for Name: insights_records; Type: TABLE DATA; Schema: public; Owner: -- COPY public.insights_records (account_id, account_name, user_name, scan_id, scan_title, scan_type, doc_type, date, statistics, language, watch_word_results, team_id, is_data_operation, operation_data, record_id) FROM stdin; \. -- -- Data for Name: monthly_usage_report; Type: TABLE DATA; Schema: public; Owner: -- COPY public.monthly_usage_report (id, usage_tier_user_id, user_id, start_date, end_date, total_docs, total_url, total_text) FROM stdin; \. -- -- Data for Name: paragraphs; Type: TABLE DATA; Schema: public; Owner: -- COPY public.paragraphs (id, scan_id, paragraph_stats, paragraph_index, word_count, paragraph_counter) FROM stdin; \. -- -- Data for Name: revisions; Type: TABLE DATA; Schema: public; Owner: -- COPY public.revisions (id, revision_start_date, last_revised_date, original_scan_id, latest_scan_id) FROM stdin; \. -- -- Data for Name: scan_by_email_domain; Type: TABLE DATA; Schema: public; Owner: -- COPY public.scan_by_email_domain (id, account_id, domain_name) FROM stdin; \. -- -- Data for Name: scans; Type: TABLE DATA; Schema: public; Owner: -- COPY public.scans (id, started_date, completed_date, user_id, status, title, scan_type, scan_text, scan_url, scan_stats, doc_id, error_message, text_id, word_count, api_scan_id, scan_by_email_id, url_id, whitelist_results, whitelist_id, language, watch_words_results, watch_words_id, revision_id, revision_index) FROM stdin; \. -- -- Data for Name: schema_version; Type: TABLE DATA; Schema: public; Owner: -- COPY public.schema_version (installed_rank, version, description, type, script, checksum, installed_by, installed_on, execution_time, success) FROM stdin; 1 1 Init SQL V1__Init.sql 92183757 2018-12-18 14:12:48.028751 22 t 2 2 First Changes SQL V2__First_Changes.sql -1669353398 2018-12-18 14:12:48.061212 20 t 3 2.1 Add AuthToken Table SQL V2.1__Add_AuthToken_Table.sql 1131028042 2018-12-18 14:12:48.090827 20 t 4 2.2 Add Social ID and Flag Email Activiation Flag To UsersTB SQL V2.2__Add_Social_ID_and_Flag_Email_Activiation_Flag_To_UsersTB.sql 1367167878 2018-12-18 14:12:48.118072 21 t 5 2.3 Add Scan and paragraph tables SQL V2.3__Add_Scan_and_paragraph_tables.sql -148933941 2018-12-18 14:12:48.168541 40 t 6 2.4 Add Document table and Add Document ID To Scan SQL V2.4__Add_Document_table_and_Add_Document_ID_To_Scan.sql 2145507003 2018-12-18 14:12:48.196759 20 t 7 2.5 Add Scan Error Message SQL V2.5__Add_Scan_Error_Message.sql 1864351381 2018-12-18 14:12:48.20204 1 t 8 2.6 Add TextScan table and Add TextScan ID To Scan SQL V2.6__Add_TextScan_table_and_Add_TextScan_ID_To_Scan.sql -1583334000 2018-12-18 14:12:48.232323 24 t 9 2.7 Add Usage Tiers Table And FK Users Usage SQL V2.7__Add_Usage_Tiers_Table_And_FK_Users_Usage.sql -1452205815 2018-12-18 14:12:48.267219 28 t 10 2.8 Remove FK Usage Tiers From Users Table And Create Usage Tier Users Table SQL V2.8__Remove_FK_Usage_Tiers_From_Users_Table_And_Create_Usage_Tier_Users_Table.sql 944513728 2018-12-18 14:12:48.284127 11 t 11 2.9 Making User PrimayKey BigSerial SQL V2.9__Making_User_PrimayKey_BigSerial.sql 1499849440 2018-12-18 14:12:48.398594 110 t 12 3 Add User Threshold Settings Table SQL V3__Add_User_Threshold_Settings_Table.sql -1953608297 2018-12-18 14:12:48.423985 21 t 13 3.1 Update User Threshold Settings Table SQL V3.1__Update_User_Threshold_Settings_Table.sql 723498372 2018-12-18 14:12:48.448464 14 t 14 3.2 New Usage Tiers Shceme And Default Flag SQL V3.2__New_Usage_Tiers_Shceme_And_Default_Flag.sql -309209680 2018-12-18 14:12:48.507955 50 t 15 3.3 New Usage Report Table SQL V3.3__New_Usage_Report_Table.sql -827106343 2018-12-18 14:12:48.529106 12 t 16 3.4 Add Grade Level Thresholds With Default Values SQL V3.4__Add_Grade_Level_Thresholds_With_Default_Values.sql -1650478513 2018-12-18 14:12:48.545324 10 t 17 3.5 Add Word Count To Scans Table SQL V3.5__Add_Word_Count_To_Scans_Table.sql 1481696549 2018-12-18 14:12:48.570143 21 t 18 3.6 Add Paragraph Index To Paragraph Table SQL V3.6__Add_Paragraph_Index_To_Paragraph_Table.sql -196536767 2018-12-18 14:12:48.592137 18 t 19 3.7 Altering Paragraph stats From Text To Jsonb SQL V3.7__Altering_Paragraph_stats_From_Text_To_Jsonb.sql -198097928 2018-12-18 14:12:48.618831 22 t 20 3.8 Add Api Scan ID To Scans Table SQL V3.8__Add_Api_Scan_ID_To_Scans_Table.sql -2098960881 2018-12-18 14:12:48.622733 0 t 21 3.9 Changing Paragraphs Column From Jsonb To Text And Add Word Count In Paragraphs SQL V3.9__Changing_Paragraphs_Column_From_Jsonb_To_Text_And_Add_Word_Count_In_Paragraphs.sql -1003206499 2018-12-18 14:12:48.668134 41 t 22 4.0 Setting Jsonb back and populating word count SQL V4.0__Setting_Jsonb_back_and_populating_word_count.sql -703186773 2018-12-18 14:12:48.699917 20 t 23 4.1 Changing usage tier amounts SQL V4.1__Changing_usage_tier_amounts.sql 1831282895 2018-12-18 14:12:48.7057 1 t 24 4.2 Adding price column to usage tiers SQL V4.2__Adding_price_column_to_usage_tiers.sql -518871480 2018-12-18 14:12:48.716682 5 t 25 4.3 Adding db indexes SQL V4.3__Adding_db_indexes.sql -1714968906 2018-12-18 14:12:48.748396 28 t 26 4.4 Adding tier registration email message SQL V4.4__Adding_tier_registration_email_message.sql 1847921285 2018-12-18 14:12:48.752889 1 t 27 4.5 Adding account table and account id col to user SQL V4.5__Adding_account_table_and_account_id_col_to_user.sql 1572450217 2018-12-18 14:12:48.784587 28 t 28 4.6 Add Paragraph Counter To Paragraph Table SQL V4.6__Add_Paragraph_Counter_To_Paragraph_Table.sql -1666239075 2018-12-18 14:12:48.816967 28 t 29 4.7 Adding Subscription Id To Usage Tier User SQL V4.7__Adding_Subscription_Id_To_Usage_Tier_User.sql -116427964 2018-12-18 14:12:48.830493 10 t 30 4.8 Add Customer Id Field To User Table SQL V4.8__Add_Customer_Id_Field_To_User_Table.sql 819291242 2018-12-18 14:12:48.835806 1 t 31 4.9 Change Colunm Name From Customer Id To Payments Customer Id SQL V4.9__Change_Colunm_Name_From_Customer_Id_To_Payments_Customer_Id.sql -1363827815 2018-12-18 14:12:48.842696 2 t 32 5 Adding user roles SQL V5__Adding_user_roles.sql -1049513739 2018-12-18 14:12:48.90242 55 t 33 5.1 Adding Last Login Time To Users Table SQL V5.1__Adding_Last_Login_Time_To_Users_Table.sql 1613442369 2018-12-18 14:12:48.906061 0 t 34 5.2 Add User Activity Table SQL V5.2__Add_User_Activity_Table.sql -2012671005 2018-12-18 14:12:48.930668 21 t 35 5.3 Adding Account Threshold Settings Table SQL V5.3__Adding_Account_Threshold_Settings_Table.sql 123182818 2018-12-18 14:12:48.950067 12 t 36 5.4 Setting Default Roles For Each User SQL V5.4__Setting_Default_Roles_For_Each_User.sql 846586996 2018-12-18 14:12:49.014234 0 t 37 5.5 Adding New Logic Readability Email SQL V5.5__Adding_New_Logic_Readability_Email.sql 1144392085 2018-12-18 14:12:49.029129 11 t 38 5.6 Setting Default Thresholds for account SQL V5.6__Setting_Default_Thresholds_for_account.sql 2147365187 2018-12-18 14:12:49.033138 1 t 39 5.7 Fix Scan Sqs Mapping SQL V5.7__Fix_Scan_Sqs_Mapping.sql -612251214 2018-12-18 14:12:49.0374 1 t 40 5.8 Email Status Table SQL V5.8__Email_Status_Table.sql 1149432739 2018-12-18 14:12:49.060335 20 t 41 5.9 Create View For User Admin SQL V5.9__Create_View_For_User_Admin.sql -1896171465 2018-12-18 14:12:49.068305 4 t 42 6.0 Adding Flag Is Admin User To View SQL V6.0__Adding_Flag_Is_Admin_User_To_View.sql 763963400 2018-12-18 14:12:49.075119 2 t 43 6.1 Delete Account Thresholds WIth Account SQL V6.1__Delete_Account_Thresholds_WIth_Account.sql 2033978769 2018-12-18 14:12:49.080526 2 t 44 6.2 New Trial Usage Tier SQL V6.2__New_Trial_Usage_Tier.sql -442086247 2018-12-18 14:12:49.084377 1 t 45 6.3 New Expire Date For Accounts SQL V6.3__New_Expire_Date_For_Accounts.sql -2031891377 2018-12-18 14:12:49.088464 1 t 46 6.4 Max Users SQL V6.4__Max_Users.sql 1400858280 2018-12-18 14:12:49.120421 29 t 47 6.5 Fix Max Users Mapping SQL V6.5__Fix_Max_Users_Mapping.sql -653815379 2018-12-18 14:12:49.130713 6 t 48 6.6 Unique index Email Domain SQL V6.6__Unique_index_Email_Domain.sql -1654204640 2018-12-18 14:12:49.1449 10 t 49 6.7 Threshold id on account SQL V6.7__Threshold_id_on_account.sql -921400135 2018-12-18 14:12:49.150414 1 t 50 6.8 Fix foreign key scan to doc SQL V6.8__Fix_foreign_key_scan_to_doc.sql 1564187552 2018-12-18 14:12:49.154744 1 t 51 6.9 Count deleted scans in admin SQL V6.9__Count_deleted_scans_in_admin.sql 1125542574 2018-12-18 14:12:49.163759 4 t 52 6.10 Account properties SQL V6.10__Account_properties.sql 1791566690 2018-12-18 14:12:49.19599 29 t 53 7 Added salted expiry to account SQL V7__Added_salted_expiry_to_account.sql 1958040353 2018-12-18 14:12:49.201082 1 t 54 7.1 Added config table SQL V7.1__Added_config_table.sql -1838558594 2018-12-18 14:12:49.216141 11 t 55 7.2 Adding allow unregistered email to Accounts SQL V7.2__Adding_allow_unregistered_email_to_Accounts.sql -1499176214 2018-12-18 14:12:49.249242 28 t 56 7.3 Adding scan url id SQL V7.3__Adding_scan_url_id.sql -1541900667 2018-12-18 14:12:49.25316 0 t 57 7.4 Set Usage Tier Message Uniform SQL V7.4__Set_Usage_Tier_Message_Uniform.sql -1679611898 2018-12-18 14:12:49.264588 1 t 58 7.5 Update FKS To User Id Cascade SQL V7.5__Update_FKS_To_User_Id_Cascade.sql 393445113 2018-12-18 14:12:49.276102 6 t 59 7.6 Adding Account Name To View SQL V7.6__Adding_Account_Name_To_View.sql -1661278991 2018-12-18 14:12:49.28402 3 t 60 7.7 Create Account Admin View SQL V7.7__Create_Account_Admin_View.sql 1399892485 2018-12-18 14:12:49.289693 2 t 61 7.8 Create Account For All Users SQL V7.8__Create _Account_For_All_Users.sql -992315338 2018-12-18 14:12:49.304814 8 t 62 7.9 Resetting the Sequence Number SQL V7.9__Resetting_the_Sequence_Number.sql 1466002730 2018-12-18 14:12:49.320871 7 t 63 8.0 Create Account Whitelist Table SQL V8.0__Create_Account_Whitelist_Table.sql 1254939625 2018-12-18 14:12:49.346728 20 t 64 8.1 Adding language column to scans SQL V8.1__Adding_language_column_to_scans.sql 153909753 2018-12-18 14:12:49.385743 35 t 65 8.2 Adding Lix Columns to Threshold Tables SQL V8.2__Adding_Lix_Columns_to_Threshold_Tables.sql -1975985371 2018-12-18 14:12:49.408428 18 t 66 8.3 Adding Custom Templates Table SQL V8.3__Adding_Custom_Templates_Table.sql -1675988886 2018-12-18 14:12:49.434563 22 t 67 8.4 Adding Last Modified To Threshold Tables SQL V8.4__Adding_Last_Modified_To_Threshold_Tables.sql 1193087093 2018-12-18 14:12:49.439998 1 t 68 8.5 Adding Historical Thresholds Settings Table SQL V8.5__Adding_Historical_Thresholds_Settings_Table.sql 1180477372 2019-03-13 14:07:35.190771 251 t 69 8.6 Adding Watch Words Table SQL V8.6__Adding_Watch_Words_Table.sql 1461406130 2019-03-13 14:07:35.265289 49 t 70 8.7 Adding Whitelist Migration Function SQL V8.7__Adding_Whitelist_Migration_Function.sql -774781638 2019-03-13 14:07:35.280113 6 t 71 8.8 Migrating Whitelist Format To New SQL V8.8__Migrating_Whitelist_Format_To_New.sql -1585041989 2019-03-13 14:07:35.298839 3 t 72 8.9 Delete Historical Thresholds Settings Add Insights Records SQL V8.9__Delete_Historical_Thresholds_Settings_Add_Insights_Records.sql -1539122939 2019-03-13 14:07:35.349491 33 t 73 9.0 Add SMTP Configured Column Accounts Table SQL V9.0__Add_SMTP_Configured_Column_Accounts_Table.sql 943125153 2019-03-13 14:07:35.395317 38 t 74 9.1 Delete old user admin view and create new one SQL V9.1__Delete_old_user_admin_view_and_create_new_one.sql -1202396916 2019-03-13 14:07:35.457291 51 t 75 9.2 Change Activity Record To TimezoneTS SQL V9.2__Change_Activity_Record_To_TimezoneTS.sql 1329783955 2019-03-13 14:07:35.489813 25 t 76 9.3 Update Existing account to use smtp SQL V9.3__Update_Existing_account_to_use_smtp.sql 641946434 2019-03-13 14:07:35.499043 1 t 77 9.4 Adding VTInsights Functionality SQL V9.4__Adding_VTInsights_Functionality.sql -336430315 2019-05-20 11:24:03.646865 277 t 78 9.5 Migration For VTInsights Record Data SQL V9.5__Migration_For_VTInsights_Record_Data.sql 361294785 2019-05-20 11:24:03.740893 77 t 79 9.6 Deleting whitespaces in account watach words SQL V9.6__Deleting_whitespaces_in_account_watach_words.sql -1586580336 2019-05-20 11:24:03.782424 31 t 80 9.7 Fix missing non team account thresholds SQL V9.7__Fix_missing_non_team_account_thresholds.sql 1118913806 2019-05-20 11:24:03.810964 15 t 81 9.8 Add Description Col To Account Watch Words SQL V9.8__Add_Description_Col_To_Account_Watch_Words.sql 413102671 2019-09-04 10:26:12.571693 48 t 82 9.9 Add Support Email Column to Accounts table SQL V9.9__Add_Support_Email_Column_to_Accounts_table.sql 1483165964 2019-09-04 10:26:12.605523 2 t 83 9.10 Add Anon User Names to Accounts SQL V9.10__Add_Anon_User_Names_to_Accounts.sql 1745463820 2019-09-04 10:26:12.949323 333 t 84 9.11 Add default watchword language SQL V9.11__Add_default_watchword_language.sql 1788808738 2019-11-01 12:09:06.556993 84 t 85 9.12 Add Teams Table SQL V9.12__Add_Teams_Table.sql 502967039 2019-11-01 12:09:06.814375 219 t 86 9.13 Add team id to user admin view SQL V9.13__Add_team_id_to_user_admin_view.sql -1102275308 2019-11-01 12:09:06.875442 37 t 87 10.0 Add Team Name to Insights Record SQL V10.0__Add_Team_Name_to_Insights_Record.sql 514029859 2019-11-01 12:09:06.904178 12 t 88 10.4 Drop Teams Constraint Create Index SQL V10.4__Drop_Teams_Constraint_Create_Index.sql 1887472999 2019-11-01 12:09:06.934959 20 t 89 10.5 New Insights Record Format SQL V10.5__New__Insights__Record__Format.sql 1246280928 2019-11-01 12:09:06.97489 30 t 90 10.6 User Activity Nullable User SQL V10.6__User__Activity__Nullable__User.sql 86674677 2019-11-01 12:09:06.993718 7 t 91 10.7 Create Unique Constraint On Teams SQL V10.7__Create_Unique_Constraint_On_Teams.sql 677646408 2019-11-01 12:09:07.019209 17 t 92 10.8 Adding Not Null to User Activity fields SQL V10.8__Adding_Not_Null_to_User_Activity_fields.sql 1836947437 2019-11-01 12:09:07.027333 2 t 93 10.9 Create Case Insensitive Teamname Index SQL V10.9__Create__Case__Insensitive__Teamname__Index.sql 1648557932 2019-11-01 12:09:07.051143 15 t 94 11.0 Adding Record Id Column Insights Record SQL V11.0__Adding_Record_Id_Column_Insights_Record.sql 177928538 2019-11-01 12:09:07.095063 30 t 95 11.1 Adding Revision Structures SQL V11.1__Adding_Revision_Structures.sql -1226724185 2020-06-17 13:50:17.764917 198 t 96 11.2 Change move user to data operation SQL V11.2__Change_move_user_to_data_operation.sql 1194658682 2020-06-17 13:50:17.781735 3 t 97 11.3 Add Analysis Hist for Account SQL V11.3__Add_Analysis_Hist_for_Account.sql -1465376132 2020-06-17 13:50:17.80258 4 t 98 11.4 Update premium amount SQL V11.4__Update__premium__amount.sql -1077893436 2020-06-17 13:50:17.820531 4 t 99 11.5 Set premium scan amounts per month SQL V11.5__Set_premium_scan_amounts_per_month.sql -1348925226 2020-06-17 13:50:17.834006 6 t 100 11.6 Revert free text limit add max rev set column SQL V11.6__Revert_free_text_limit_add_max_rev_set_column.sql -1112900873 2020-06-17 13:50:17.878544 33 t 101 11.7 Authentication Table And SSO Changes SQL V11.7__Authentication__Table__And__SSO__Changes.sql 1948363531 2020-06-17 13:50:17.960404 59 t 102 12 Give Sys Admin role to admins SQL V12__Give_Sys_Admin_role_to_admins.sql 1547082508 2020-06-17 13:50:17.975612 7 t \. -- -- Data for Name: teams; Type: TABLE DATA; Schema: public; Owner: -- COPY public.teams (id, account_id, team_name, team_descriptor, creation_date, deletion_date) FROM stdin; \. -- -- Data for Name: text_scans; Type: TABLE DATA; Schema: public; Owner: -- COPY public.text_scans (id, text_name, text_content) FROM stdin; \. -- -- Data for Name: usage_tiers; Type: TABLE DATA; Schema: public; Owner: -- COPY public.usage_tiers (id, name, url_scans_per_month, text_scans_per_month, doc_scans_per_month, flag_default, pricing_per_month, registration_msg, text_revisions_per_scan) FROM stdin; 3 Unlimited 100000 1000000 100000 f 195 We are sending you this mail because you just signed up for a VT Readability account. 1000000 4 Trial 100 1000000 100 f 0 We are sending you this mail because you just signed up for a VT Readability account. 1000000 2 Premium 1 1000000 1000000 1000000 f 65 We are sending you this mail because you just signed up for a VT Readability account. 1000000 1 FREE 5 1000000 5 t 0 We are sending you this mail because you just signed up for a VT Readability account. 15 \. -- -- Data for Name: usage_tiers_users; Type: TABLE DATA; Schema: public; Owner: -- COPY public.usage_tiers_users (id, start_date, tier_id, user_id, subscription_id) FROM stdin; \. -- -- Data for Name: user_activity; Type: TABLE DATA; Schema: public; Owner: -- COPY public.user_activity (id, user_id, event_type, description, completed_date) FROM stdin; \. -- -- Data for Name: user_threshold_settings; Type: TABLE DATA; Schema: public; Owner: -- COPY public.user_threshold_settings (id, user_id, long_sentence_good, long_sentence_bad, avg_sentence_good, avg_sentence_bad, passive_good, passive_bad, readability_bad, readability_good, long_sentence_cutoff, very_long_sentence_cutoff, grade_level_good, grade_level_bad, lix_good, lix_bad, last_modified) FROM stdin; \. -- -- Data for Name: users; Type: TABLE DATA; Schema: public; Owner: -- COPY public.users (id, user_name, user_email, user_pass, first_name, last_name, last_sign_in, preferences, social_id, is_email_activation_required, account_id, payments_customer_id, last_login_time, team_id, team_modified_date, temp_password) FROM stdin; \. -- -- Data for Name: users_roles; Type: TABLE DATA; Schema: public; Owner: -- COPY public.users_roles (id, user_id, role) FROM stdin; \. -- -- Name: account_threshold_settings_id_seq; Type: SEQUENCE SET; Schema: public; Owner: -- SELECT pg_catalog.setval('public.account_threshold_settings_id_seq', 1, false); -- -- Name: account_watch_words_account_id_seq; Type: SEQUENCE SET; Schema: public; Owner: -- SELECT pg_catalog.setval('public.account_watch_words_account_id_seq', 1, false); -- -- Name: account_watch_words_id_seq; Type: SEQUENCE SET; Schema: public; Owner: -- SELECT pg_catalog.setval('public.account_watch_words_id_seq', 1, false); -- -- Name: account_whitelist_account_id_seq; Type: SEQUENCE SET; Schema: public; Owner: -- SELECT pg_catalog.setval('public.account_whitelist_account_id_seq', 1, false); -- -- Name: account_whitelist_id_seq; Type: SEQUENCE SET; Schema: public; Owner: -- SELECT pg_catalog.setval('public.account_whitelist_id_seq', 1, false); -- -- Name: accounts_id_seq; Type: SEQUENCE SET; Schema: public; Owner: -- SELECT pg_catalog.setval('public.accounts_id_seq', 1, false); -- -- Name: auth_token_id_seq; Type: SEQUENCE SET; Schema: public; Owner: -- SELECT pg_catalog.setval('public.auth_token_id_seq', 16, false); -- -- Name: authentication_settings_id_seq; Type: SEQUENCE SET; Schema: public; Owner: -- SELECT pg_catalog.setval('public.authentication_settings_id_seq', 1, false); -- -- Name: custom_templates_id_seq; Type: SEQUENCE SET; Schema: public; Owner: -- SELECT pg_catalog.setval('public.custom_templates_id_seq', 1, false); -- -- Name: documents_id_seq; Type: SEQUENCE SET; Schema: public; Owner: -- SELECT pg_catalog.setval('public.documents_id_seq', 1, false); -- -- Name: email_config_id_seq; Type: SEQUENCE SET; Schema: public; Owner: -- SELECT pg_catalog.setval('public.email_config_id_seq', 1, false); -- -- Name: email_scan_by_email_status_id_seq; Type: SEQUENCE SET; Schema: public; Owner: -- SELECT pg_catalog.setval('public.email_scan_by_email_status_id_seq', 1, false); -- -- Name: monthly_usage_report_id_seq; Type: SEQUENCE SET; Schema: public; Owner: -- SELECT pg_catalog.setval('public.monthly_usage_report_id_seq', 1, false); -- -- Name: paragraphs_id_seq; Type: SEQUENCE SET; Schema: public; Owner: -- SELECT pg_catalog.setval('public.paragraphs_id_seq', 1, false); -- -- Name: record_id_seq; Type: SEQUENCE SET; Schema: public; Owner: -- SELECT pg_catalog.setval('public.record_id_seq', 1, true); -- -- Name: revisions_id_seq; Type: SEQUENCE SET; Schema: public; Owner: -- SELECT pg_catalog.setval('public.revisions_id_seq', 1, false); -- -- Name: scan_by_email_domain_id_seq; Type: SEQUENCE SET; Schema: public; Owner: -- SELECT pg_catalog.setval('public.scan_by_email_domain_id_seq', 1, false); -- -- Name: scans_id_seq; Type: SEQUENCE SET; Schema: public; Owner: -- SELECT pg_catalog.setval('public.scans_id_seq', 1, true); -- -- Name: teams_id_seq; Type: SEQUENCE SET; Schema: public; Owner: -- SELECT pg_catalog.setval('public.teams_id_seq', 1, false); -- -- Name: text_scans_id_seq; Type: SEQUENCE SET; Schema: public; Owner: -- SELECT pg_catalog.setval('public.text_scans_id_seq', 1, false); -- -- Name: usage_tiers_id_seq; Type: SEQUENCE SET; Schema: public; Owner: -- SELECT pg_catalog.setval('public.usage_tiers_id_seq', 5, true); -- -- Name: usage_tiers_users_id_seq; Type: SEQUENCE SET; Schema: public; Owner: -- SELECT pg_catalog.setval('public.usage_tiers_users_id_seq', 1, false); -- -- Name: user_activity_id_seq; Type: SEQUENCE SET; Schema: public; Owner: -- SELECT pg_catalog.setval('public.user_activity_id_seq', 1, false); -- -- Name: user_threshold_settings_id_seq; Type: SEQUENCE SET; Schema: public; Owner: -- SELECT pg_catalog.setval('public.user_threshold_settings_id_seq', 1, false); -- -- Name: users_id_seq; Type: SEQUENCE SET; Schema: public; Owner: -- SELECT pg_catalog.setval('public.users_id_seq', 1, false); -- -- Name: users_roles_id_seq; Type: SEQUENCE SET; Schema: public; Owner: -- SELECT pg_catalog.setval('public.users_roles_id_seq', 1, false); -- -- Name: account_threshold_settings account_threshold_settings_pk; Type: CONSTRAINT; Schema: public; Owner: -- ALTER TABLE ONLY public.account_threshold_settings ADD CONSTRAINT account_threshold_settings_pk PRIMARY KEY (id); -- -- Name: account_watch_words account_watch_words_pk; Type: CONSTRAINT; Schema: public; Owner: -- ALTER TABLE ONLY public.account_watch_words ADD CONSTRAINT account_watch_words_pk PRIMARY KEY (id); -- -- Name: account_whitelist account_whitelist_pk; Type: CONSTRAINT; Schema: public; Owner: -- ALTER TABLE ONLY public.account_whitelist ADD CONSTRAINT account_whitelist_pk PRIMARY KEY (id); -- -- Name: accounts accounts_pk; Type: CONSTRAINT; Schema: public; Owner: -- ALTER TABLE ONLY public.accounts ADD CONSTRAINT accounts_pk PRIMARY KEY (id); -- -- Name: auth_token auth_token_pkey; Type: CONSTRAINT; Schema: public; Owner: -- ALTER TABLE ONLY public.auth_token ADD CONSTRAINT auth_token_pkey PRIMARY KEY (id); -- -- Name: authentication_settings authentication_settings_pkey; Type: CONSTRAINT; Schema: public; Owner: -- ALTER TABLE ONLY public.authentication_settings ADD CONSTRAINT authentication_settings_pkey PRIMARY KEY (id); -- -- Name: documents documents_pkey; Type: CONSTRAINT; Schema: public; Owner: -- ALTER TABLE ONLY public.documents ADD CONSTRAINT documents_pkey PRIMARY KEY (id); -- -- Name: email_scan_by_email_status email_scan_by_email_status_pkey; Type: CONSTRAINT; Schema: public; Owner: -- ALTER TABLE ONLY public.email_scan_by_email_status ADD CONSTRAINT email_scan_by_email_status_pkey PRIMARY KEY (id); -- -- Name: insights_records insights_records_pk; Type: CONSTRAINT; Schema: public; Owner: -- ALTER TABLE ONLY public.insights_records ADD CONSTRAINT insights_records_pk PRIMARY KEY (record_id); -- -- Name: email_scan_by_email_status message_id_unique; Type: CONSTRAINT; Schema: public; Owner: -- ALTER TABLE ONLY public.email_scan_by_email_status ADD CONSTRAINT message_id_unique UNIQUE (message_id); -- -- Name: monthly_usage_report monthly_usage_report_pkey; Type: CONSTRAINT; Schema: public; Owner: -- ALTER TABLE ONLY public.monthly_usage_report ADD CONSTRAINT monthly_usage_report_pkey PRIMARY KEY (id); -- -- Name: paragraphs paragraphs_pkey; Type: CONSTRAINT; Schema: public; Owner: -- ALTER TABLE ONLY public.paragraphs ADD CONSTRAINT paragraphs_pkey PRIMARY KEY (id); -- -- Name: revisions revisions_pkey; Type: CONSTRAINT; Schema: public; Owner: -- ALTER TABLE ONLY public.revisions ADD CONSTRAINT revisions_pkey PRIMARY KEY (id); -- -- Name: scan_by_email_domain scan_by_email_domain_pkey; Type: CONSTRAINT; Schema: public; Owner: -- ALTER TABLE ONLY public.scan_by_email_domain ADD CONSTRAINT scan_by_email_domain_pkey PRIMARY KEY (id); -- -- Name: scans scans_pkey; Type: CONSTRAINT; Schema: public; Owner: -- ALTER TABLE ONLY public.scans ADD CONSTRAINT scans_pkey PRIMARY KEY (id); -- -- Name: schema_version schema_version_pk; Type: CONSTRAINT; Schema: public; Owner: -- ALTER TABLE ONLY public.schema_version ADD CONSTRAINT schema_version_pk PRIMARY KEY (installed_rank); -- -- Name: teams teams_account_id_team_name_key; Type: CONSTRAINT; Schema: public; Owner: -- ALTER TABLE ONLY public.teams ADD CONSTRAINT teams_account_id_team_name_key UNIQUE (account_id, team_name); -- -- Name: teams teams_pkey; Type: CONSTRAINT; Schema: public; Owner: -- ALTER TABLE ONLY public.teams ADD CONSTRAINT teams_pkey PRIMARY KEY (id); -- -- Name: custom_templates template_pkey; Type: CONSTRAINT; Schema: public; Owner: -- ALTER TABLE ONLY public.custom_templates ADD CONSTRAINT template_pkey PRIMARY KEY (id); -- -- Name: text_scans text_pkey; Type: CONSTRAINT; Schema: public; Owner: -- ALTER TABLE ONLY public.text_scans ADD CONSTRAINT text_pkey PRIMARY KEY (id); -- -- Name: users_roles unique_user_role; Type: CONSTRAINT; Schema: public; Owner: -- ALTER TABLE ONLY public.users_roles ADD CONSTRAINT unique_user_role UNIQUE (user_id, role); -- -- Name: usage_tiers usage_tiers_pkey; Type: CONSTRAINT; Schema: public; Owner: -- ALTER TABLE ONLY public.usage_tiers ADD CONSTRAINT usage_tiers_pkey PRIMARY KEY (id); -- -- Name: usage_tiers_users usage_tiers_users_pkey; Type: CONSTRAINT; Schema: public; Owner: -- ALTER TABLE ONLY public.usage_tiers_users ADD CONSTRAINT usage_tiers_users_pkey PRIMARY KEY (id); -- -- Name: user_activity user_activity_pkey; Type: CONSTRAINT; Schema: public; Owner: -- ALTER TABLE ONLY public.user_activity ADD CONSTRAINT user_activity_pkey PRIMARY KEY (id); -- -- Name: user_threshold_settings user_threshold_settings_pk; Type: CONSTRAINT; Schema: public; Owner: -- ALTER TABLE ONLY public.user_threshold_settings ADD CONSTRAINT user_threshold_settings_pk PRIMARY KEY (id); -- -- Name: users users_pkey; Type: CONSTRAINT; Schema: public; Owner: -- ALTER TABLE ONLY public.users ADD CONSTRAINT users_pkey PRIMARY KEY (id); -- -- Name: users_roles users_roles_pkey; Type: CONSTRAINT; Schema: public; Owner: -- ALTER TABLE ONLY public.users_roles ADD CONSTRAINT users_roles_pkey PRIMARY KEY (id); -- -- Name: account_name_unique_idx; Type: INDEX; Schema: public; Owner: -- CREATE UNIQUE INDEX account_name_unique_idx ON public.accounts USING btree (lower(account_name)); -- -- Name: email_domain_unique_idx; Type: INDEX; Schema: public; Owner: -- CREATE UNIQUE INDEX email_domain_unique_idx ON public.scan_by_email_domain USING btree (lower((domain_name)::text)); -- -- Name: email_unique_idx; Type: INDEX; Schema: public; Owner: -- CREATE UNIQUE INDEX email_unique_idx ON public.users USING btree (lower((user_email)::text)); -- -- Name: mup_user_id_idx; Type: INDEX; Schema: public; Owner: -- CREATE INDEX mup_user_id_idx ON public.monthly_usage_report USING btree (user_id); -- -- Name: paragraphs_scan_id_idx; Type: INDEX; Schema: public; Owner: -- CREATE INDEX paragraphs_scan_id_idx ON public.paragraphs USING btree (scan_id); -- -- Name: scans_user_id_idx; Type: INDEX; Schema: public; Owner: -- CREATE INDEX scans_user_id_idx ON public.scans USING btree (user_id); -- -- Name: schema_version_s_idx; Type: INDEX; Schema: public; Owner: -- CREATE INDEX schema_version_s_idx ON public.schema_version USING btree (success); -- -- Name: teams_account_id_team_name_idx; Type: INDEX; Schema: public; Owner: -- CREATE UNIQUE INDEX teams_account_id_team_name_idx ON public.teams USING btree (account_id, lower((team_name)::text)); -- -- Name: authentication_settings authentication_settings_fkey; Type: FK CONSTRAINT; Schema: public; Owner: -- ALTER TABLE ONLY public.authentication_settings ADD CONSTRAINT authentication_settings_fkey FOREIGN KEY (accountid) REFERENCES public.accounts(id) ON DELETE CASCADE; -- -- Name: account_threshold_settings foreign_account_threshold_settings_to_account; Type: FK CONSTRAINT; Schema: public; Owner: -- ALTER TABLE ONLY public.account_threshold_settings ADD CONSTRAINT foreign_account_threshold_settings_to_account FOREIGN KEY (account_id) REFERENCES public.accounts(id) MATCH FULL ON DELETE CASCADE; -- -- Name: account_watch_words foreign_account_watch_words_to_accounts; Type: FK CONSTRAINT; Schema: public; Owner: -- ALTER TABLE ONLY public.account_watch_words ADD CONSTRAINT foreign_account_watch_words_to_accounts FOREIGN KEY (account_id) REFERENCES public.accounts(id) ON DELETE CASCADE; -- -- Name: account_whitelist foreign_account_whitelist_to_accounts; Type: FK CONSTRAINT; Schema: public; Owner: -- ALTER TABLE ONLY public.account_whitelist ADD CONSTRAINT foreign_account_whitelist_to_accounts FOREIGN KEY (account_id) REFERENCES public.accounts(id) ON DELETE CASCADE; -- -- Name: scans foreign_document_to_scan; Type: FK CONSTRAINT; Schema: public; Owner: -- ALTER TABLE ONLY public.scans ADD CONSTRAINT foreign_document_to_scan FOREIGN KEY (doc_id) REFERENCES public.documents(id) MATCH FULL; -- -- Name: user_activity foreign_key_to_user; Type: FK CONSTRAINT; Schema: public; Owner: -- ALTER TABLE ONLY public.user_activity ADD CONSTRAINT foreign_key_to_user FOREIGN KEY (user_id) REFERENCES public.users(id) MATCH FULL ON DELETE CASCADE; -- -- Name: monthly_usage_report foreign_mothly_report_to_usage_user; Type: FK CONSTRAINT; Schema: public; Owner: -- ALTER TABLE ONLY public.monthly_usage_report ADD CONSTRAINT foreign_mothly_report_to_usage_user FOREIGN KEY (usage_tier_user_id) REFERENCES public.usage_tiers_users(id) MATCH FULL; -- -- Name: monthly_usage_report foreign_mothly_report_to_user; Type: FK CONSTRAINT; Schema: public; Owner: -- ALTER TABLE ONLY public.monthly_usage_report ADD CONSTRAINT foreign_mothly_report_to_user FOREIGN KEY (user_id) REFERENCES public.users(id) MATCH FULL ON DELETE CASCADE; -- -- Name: paragraphs foreign_paragraphs_to_scan; Type: FK CONSTRAINT; Schema: public; Owner: -- ALTER TABLE ONLY public.paragraphs ADD CONSTRAINT foreign_paragraphs_to_scan FOREIGN KEY (scan_id) REFERENCES public.scans(id) MATCH FULL ON DELETE CASCADE; -- -- Name: scan_by_email_domain foreign_scan_by_email_domain_to_account; Type: FK CONSTRAINT; Schema: public; Owner: -- ALTER TABLE ONLY public.scan_by_email_domain ADD CONSTRAINT foreign_scan_by_email_domain_to_account FOREIGN KEY (account_id) REFERENCES public.accounts(id) MATCH FULL ON DELETE CASCADE; -- -- Name: scans foreign_scan_to_user; Type: FK CONSTRAINT; Schema: public; Owner: -- ALTER TABLE ONLY public.scans ADD CONSTRAINT foreign_scan_to_user FOREIGN KEY (user_id) REFERENCES public.users(id) MATCH FULL ON DELETE CASCADE; -- -- Name: scans foreign_scans_to_account_watch_words; Type: FK CONSTRAINT; Schema: public; Owner: -- ALTER TABLE ONLY public.scans ADD CONSTRAINT foreign_scans_to_account_watch_words FOREIGN KEY (watch_words_id) REFERENCES public.account_watch_words(id); -- -- Name: scans foreign_scans_to_account_whitelist; Type: FK CONSTRAINT; Schema: public; Owner: -- ALTER TABLE ONLY public.scans ADD CONSTRAINT foreign_scans_to_account_whitelist FOREIGN KEY (whitelist_id) REFERENCES public.account_whitelist(id); -- -- Name: custom_templates foreign_template_to_account; Type: FK CONSTRAINT; Schema: public; Owner: -- ALTER TABLE ONLY public.custom_templates ADD CONSTRAINT foreign_template_to_account FOREIGN KEY (account_id) REFERENCES public.accounts(id) MATCH FULL ON DELETE CASCADE; -- -- Name: scans foreign_text_to_scan; Type: FK CONSTRAINT; Schema: public; Owner: -- ALTER TABLE ONLY public.scans ADD CONSTRAINT foreign_text_to_scan FOREIGN KEY (text_id) REFERENCES public.text_scans(id) MATCH FULL ON DELETE CASCADE; -- -- Name: usage_tiers_users foreign_usage_tiers_users_to_usage_tiers; Type: FK CONSTRAINT; Schema: public; Owner: -- ALTER TABLE ONLY public.usage_tiers_users ADD CONSTRAINT foreign_usage_tiers_users_to_usage_tiers FOREIGN KEY (tier_id) REFERENCES public.usage_tiers(id) MATCH FULL; -- -- Name: users_roles foreign_user_roles_to_user; Type: FK CONSTRAINT; Schema: public; Owner: -- ALTER TABLE ONLY public.users_roles ADD CONSTRAINT foreign_user_roles_to_user FOREIGN KEY (user_id) REFERENCES public.users(id) MATCH FULL ON DELETE CASCADE; -- -- Name: user_threshold_settings foreign_user_threshold_settings_to_user; Type: FK CONSTRAINT; Schema: public; Owner: -- ALTER TABLE ONLY public.user_threshold_settings ADD CONSTRAINT foreign_user_threshold_settings_to_user FOREIGN KEY (user_id) REFERENCES public.users(id) MATCH FULL ON DELETE CASCADE; -- -- Name: users foreign_user_to_accounts; Type: FK CONSTRAINT; Schema: public; Owner: -- ALTER TABLE ONLY public.users ADD CONSTRAINT foreign_user_to_accounts FOREIGN KEY (account_id) REFERENCES public.accounts(id) ON DELETE CASCADE; -- -- Name: accounts foreign_users_to_usage_tiers; Type: FK CONSTRAINT; Schema: public; Owner: -- ALTER TABLE ONLY public.accounts ADD CONSTRAINT foreign_users_to_usage_tiers FOREIGN KEY (tier_id) REFERENCES public.usage_tiers(id) MATCH FULL; -- -- Name: scans revisions_fk; Type: FK CONSTRAINT; Schema: public; Owner: -- ALTER TABLE ONLY public.scans ADD CONSTRAINT revisions_fk FOREIGN KEY (revision_id) REFERENCES public.revisions(id); -- -- Name: users team_id_fk; Type: FK CONSTRAINT; Schema: public; Owner: -- ALTER TABLE ONLY public.users ADD CONSTRAINT team_id_fk FOREIGN KEY (team_id) REFERENCES public.teams(id); -- -- Name: teams teams_fkey; Type: FK CONSTRAINT; Schema: public; Owner: -- ALTER TABLE ONLY public.teams ADD CONSTRAINT teams_fkey FOREIGN KEY (account_id) REFERENCES public.accounts(id) ON DELETE CASCADE; -- -- Name: usage_tiers_users usage_tiers_users_users_fk; Type: FK CONSTRAINT; Schema: public; Owner: -- ALTER TABLE ONLY public.usage_tiers_users ADD CONSTRAINT usage_tiers_users_users_fk FOREIGN KEY (user_id) REFERENCES public.users(id) MATCH FULL ON DELETE CASCADE; -- -- PostgreSQL database dump complete --