0% found this document useful (0 votes)
28 views

Sto DB SQL

Uploaded by

RízwànMànzoor
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as TXT, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
28 views

Sto DB SQL

Uploaded by

RízwànMànzoor
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as TXT, PDF, TXT or read online on Scribd
You are on page 1/ 45

-- This script was generated by the ERD tool in pgAdmin 4.

-- Please log an issue at https://github.com/pgadmin-org/pgadmin4/issues/new/choose


if you find any bugs, including reproduction steps.
BEGIN;

CREATE TABLE IF NOT EXISTS public.auth_group


(
id serial NOT NULL,
name character varying(150) COLLATE pg_catalog."default" NOT NULL,
CONSTRAINT auth_group_pkey PRIMARY KEY (id),
CONSTRAINT auth_group_name_key UNIQUE (name)
);

CREATE TABLE IF NOT EXISTS public.auth_group_permissions


(
id bigserial NOT NULL,
group_id integer NOT NULL,
permission_id integer NOT NULL,
CONSTRAINT auth_group_permissions_pkey PRIMARY KEY (id),
CONSTRAINT auth_group_permissions_group_id_permission_id_0cd325b0_uniq UNIQUE
(group_id, permission_id)
);

CREATE TABLE IF NOT EXISTS public.auth_permission


(
id serial NOT NULL,
name character varying(255) COLLATE pg_catalog."default" NOT NULL,
content_type_id integer NOT NULL,
codename character varying(100) COLLATE pg_catalog."default" NOT NULL,
CONSTRAINT auth_permission_pkey PRIMARY KEY (id),
CONSTRAINT auth_permission_content_type_id_codename_01ab375a_uniq UNIQUE
(content_type_id, codename)
);

CREATE TABLE IF NOT EXISTS public.bidder


(
id bigserial NOT NULL,
created_at timestamp with time zone NOT NULL,
modified_at timestamp with time zone NOT NULL,
bidder_number character varying(20) COLLATE pg_catalog."default" NOT NULL,
ssn character varying(20) COLLATE pg_catalog."default" NOT NULL,
name character varying(255) COLLATE pg_catalog."default" NOT NULL,
status integer NOT NULL,
city character varying(255) COLLATE pg_catalog."default",
state character varying(255) COLLATE pg_catalog."default",
zipcode character varying(20) COLLATE pg_catalog."default",
address character varying(255) COLLATE pg_catalog."default",
primary_contact character varying(20) COLLATE pg_catalog."default" NOT NULL,
secondary_contact character varying(20) COLLATE pg_catalog."default",
email character varying(254) COLLATE pg_catalog."default",
CONSTRAINT bidder_pkey PRIMARY KEY (id)
);

CREATE TABLE IF NOT EXISTS public.change_order


(
id bigserial NOT NULL,
created_at timestamp with time zone NOT NULL,
modified_at timestamp with time zone NOT NULL,
type integer NOT NULL,
change_order_number character varying(255) COLLATE pg_catalog."default" NOT
NULL,
parcel_number character varying(255) COLLATE pg_catalog."default",
year character varying(4) COLLATE pg_catalog."default" NOT NULL,
reason text COLLATE pg_catalog."default",
value_adjustment numeric(15, 5) NOT NULL,
homestead_adjustment numeric(15, 5) NOT NULL,
units_adjustment numeric(15, 5) NOT NULL,
is_processed boolean NOT NULL,
created_by_id bigint,
tax_account_id bigint,
change_order_category_id bigint,
change_order_file_id bigint,
is_property_details_change_order boolean NOT NULL,
new_property_type_id integer,
old_property_type_id integer,
co_detail_id character varying(255) COLLATE pg_catalog."default",
CONSTRAINT change_order_pkey PRIMARY KEY (id),
CONSTRAINT change_order_change_order_number_key UNIQUE (change_order_number)
);

CREATE TABLE IF NOT EXISTS public.change_order_category


(
id bigserial NOT NULL,
created_at timestamp with time zone NOT NULL,
modified_at timestamp with time zone NOT NULL,
category_name character varying(255) COLLATE pg_catalog."default" NOT NULL,
CONSTRAINT change_order_category_pkey PRIMARY KEY (id),
CONSTRAINT change_order_category_category_name_key UNIQUE (category_name)
);

CREATE TABLE IF NOT EXISTS public.change_order_raw_data


(
id bigserial NOT NULL,
created_at timestamp with time zone NOT NULL,
modified_at timestamp with time zone NOT NULL,
year character varying(1000) COLLATE pg_catalog."default",
assessment_no character varying(1000) COLLATE pg_catalog."default",
batch_no character varying(1000) COLLATE pg_catalog."default",
co_detail_id character varying(1000) COLLATE pg_catalog."default",
fk_co_master character varying(1000) COLLATE pg_catalog."default",
"Status_cod" character varying(1000) COLLATE pg_catalog."default",
"batch_Item_no" character varying(1000) COLLATE pg_catalog."default",
ward character varying(1000) COLLATE pg_catalog."default",
assessment_type character varying(1000) COLLATE pg_catalog."default",
taxpayer_name character varying(1000) COLLATE pg_catalog."default",
contact_name character varying(1000) COLLATE pg_catalog."default",
taxpayer_addr1 character varying(5000) COLLATE pg_catalog."default",
taxpayer_addr2 character varying(5000) COLLATE pg_catalog."default",
taxpayer_addr3 character varying(5000) COLLATE pg_catalog."default",
tc_fee_pd character varying(5000) COLLATE pg_catalog."default",
reason character varying(5000) COLLATE pg_catalog."default",
chk_no character varying(5000) COLLATE pg_catalog."default",
chk_amt character varying(5000) COLLATE pg_catalog."default",
prop_desc character varying(5000) COLLATE pg_catalog."default",
parcel_add character varying(5000) COLLATE pg_catalog."default",
assessor_ref_no character varying(5000) COLLATE pg_catalog."default",
assessment_status character varying(1000) COLLATE pg_catalog."default",
homestead_exempt character varying(1000) COLLATE pg_catalog."default",
homestead_percent character varying(1000) COLLATE pg_catalog."default",
restoration_tax_expmt character varying(1000) COLLATE pg_catalog."default",
co_submitted_by character varying(1000) COLLATE pg_catalog."default",
id_cav character varying(1000) COLLATE pg_catalog."default",
change_orders_details_id character varying(1000) COLLATE pg_catalog."default",
present_description character varying(5000) COLLATE pg_catalog."default",
present_exempt character varying(1000) COLLATE pg_catalog."default",
present_total_assessed character varying(1000) COLLATE pg_catalog."default",
present_homestead_credit character varying(1000) COLLATE pg_catalog."default",
present_tax_payer_share character varying(1000) COLLATE pg_catalog."default",
present_quantity character varying(1000) COLLATE pg_catalog."default",
present_units character varying(1000) COLLATE pg_catalog."default",
revised_description character varying(5000) COLLATE pg_catalog."default",
revised_exempt character varying(1000) COLLATE pg_catalog."default",
revised_total_assessed character varying(1000) COLLATE pg_catalog."default",
revised_homestead_credit character varying(1000) COLLATE pg_catalog."default",
revised_tax_payer_share character varying(1000) COLLATE pg_catalog."default",
revised_units character varying(1000) COLLATE pg_catalog."default",
revised_quantity character varying(1000) COLLATE pg_catalog."default",
property_id character varying(1000) COLLATE pg_catalog."default",
status integer NOT NULL,
import_change_order_logs_id bigint,
updated_by_id bigint,
CONSTRAINT change_order_raw_data_pkey PRIMARY KEY (id)
);

CREATE TABLE IF NOT EXISTS public.check_distribution


(
id bigserial NOT NULL,
created_at timestamp with time zone NOT NULL,
modified_at timestamp with time zone NOT NULL,
receiving_entity_amount numeric(15, 5) NOT NULL,
year character varying(4) COLLATE pg_catalog."default" NOT NULL,
check_amount_distribution numeric(15, 5) NOT NULL,
check_no integer,
check_date date NOT NULL,
distributed_by_id bigint NOT NULL,
receiving_entity_id bigint,
closing_month_id bigint,
is_active boolean NOT NULL,
CONSTRAINT check_distribution_pkey PRIMARY KEY (id)
);

CREATE TABLE IF NOT EXISTS public.closing_month


(
id bigserial NOT NULL,
created_at timestamp with time zone NOT NULL,
modified_at timestamp with time zone NOT NULL,
status integer NOT NULL,
month integer NOT NULL,
year character varying(4) COLLATE pg_catalog."default" NOT NULL,
title character varying(255) COLLATE pg_catalog."default" NOT NULL,
distribution_control_no character varying(255) COLLATE pg_catalog."default" NOT
NULL,
modified_by_id bigint,
refund_batch_id bigint,
CONSTRAINT closing_month_pkey PRIMARY KEY (id),
CONSTRAINT closing_month_distribution_control_no_key UNIQUE
(distribution_control_no),
CONSTRAINT closing_month_title_key UNIQUE (title)
);

CREATE TABLE IF NOT EXISTS public.cost_administration


(
id bigserial NOT NULL,
created_at timestamp with time zone NOT NULL,
modified_at timestamp with time zone NOT NULL,
date timestamp with time zone NOT NULL,
year character varying(4) COLLATE pg_catalog."default" NOT NULL,
transaction_type_id bigint,
user_id bigint,
scheduled_task_name character varying(255) COLLATE pg_catalog."default",
status integer NOT NULL,
data jsonb NOT NULL,
CONSTRAINT cost_administration_pkey PRIMARY KEY (id)
);

CREATE TABLE IF NOT EXISTS public.distribution


(
id bigserial NOT NULL,
created_at timestamp with time zone NOT NULL,
modified_at timestamp with time zone NOT NULL,
tax_roll_year character varying(4) COLLATE pg_catalog."default" NOT NULL,
amount numeric(15, 5) NOT NULL,
type integer NOT NULL,
date date NOT NULL,
closing_month_id bigint,
distributed_by_id bigint,
distribution_type_id bigint,
tax_code_by_year_id bigint,
CONSTRAINT distribution_pkey PRIMARY KEY (id)
);

CREATE TABLE IF NOT EXISTS public.distribution_type


(
id bigserial NOT NULL,
created_at timestamp with time zone NOT NULL,
modified_at timestamp with time zone NOT NULL,
type character varying(255) COLLATE pg_catalog."default" NOT NULL,
CONSTRAINT distribution_type_pkey PRIMARY KEY (id),
CONSTRAINT distribution_type_type_key UNIQUE (type)
);

CREATE TABLE IF NOT EXISTS public.django_admin_log


(
id serial NOT NULL,
action_time timestamp with time zone NOT NULL,
object_id text COLLATE pg_catalog."default",
object_repr character varying(200) COLLATE pg_catalog."default" NOT NULL,
action_flag smallint NOT NULL,
change_message text COLLATE pg_catalog."default" NOT NULL,
content_type_id integer,
user_id bigint NOT NULL,
CONSTRAINT django_admin_log_pkey PRIMARY KEY (id)
);

CREATE TABLE IF NOT EXISTS public.django_celery_beat_clockedschedule


(
id serial NOT NULL,
clocked_time timestamp with time zone NOT NULL,
CONSTRAINT django_celery_beat_clockedschedule_pkey PRIMARY KEY (id)
);

CREATE TABLE IF NOT EXISTS public.django_celery_beat_crontabschedule


(
id serial NOT NULL,
minute character varying(240) COLLATE pg_catalog."default" NOT NULL,
hour character varying(96) COLLATE pg_catalog."default" NOT NULL,
day_of_week character varying(64) COLLATE pg_catalog."default" NOT NULL,
day_of_month character varying(124) COLLATE pg_catalog."default" NOT NULL,
month_of_year character varying(64) COLLATE pg_catalog."default" NOT NULL,
timezone character varying(63) COLLATE pg_catalog."default" NOT NULL,
CONSTRAINT django_celery_beat_crontabschedule_pkey PRIMARY KEY (id)
);

CREATE TABLE IF NOT EXISTS public.django_celery_beat_intervalschedule


(
id serial NOT NULL,
every integer NOT NULL,
period character varying(24) COLLATE pg_catalog."default" NOT NULL,
CONSTRAINT django_celery_beat_intervalschedule_pkey PRIMARY KEY (id)
);

CREATE TABLE IF NOT EXISTS public.django_celery_beat_periodictask


(
id serial NOT NULL,
name character varying(200) COLLATE pg_catalog."default" NOT NULL,
task character varying(200) COLLATE pg_catalog."default" NOT NULL,
args text COLLATE pg_catalog."default" NOT NULL,
kwargs text COLLATE pg_catalog."default" NOT NULL,
queue character varying(200) COLLATE pg_catalog."default",
exchange character varying(200) COLLATE pg_catalog."default",
routing_key character varying(200) COLLATE pg_catalog."default",
expires timestamp with time zone,
enabled boolean NOT NULL,
last_run_at timestamp with time zone,
total_run_count integer NOT NULL,
date_changed timestamp with time zone NOT NULL,
description text COLLATE pg_catalog."default" NOT NULL,
crontab_id integer,
interval_id integer,
solar_id integer,
one_off boolean NOT NULL,
start_time timestamp with time zone,
priority integer,
headers text COLLATE pg_catalog."default" NOT NULL,
clocked_id integer,
expire_seconds integer,
CONSTRAINT django_celery_beat_periodictask_pkey PRIMARY KEY (id),
CONSTRAINT django_celery_beat_periodictask_name_key UNIQUE (name)
);

CREATE TABLE IF NOT EXISTS public.django_celery_beat_periodictasks


(
ident smallint NOT NULL,
last_update timestamp with time zone NOT NULL,
CONSTRAINT django_celery_beat_periodictasks_pkey PRIMARY KEY (ident)
);

CREATE TABLE IF NOT EXISTS public.django_celery_beat_solarschedule


(
id serial NOT NULL,
event character varying(24) COLLATE pg_catalog."default" NOT NULL,
latitude numeric(9, 6) NOT NULL,
longitude numeric(9, 6) NOT NULL,
CONSTRAINT django_celery_beat_solarschedule_pkey PRIMARY KEY (id),
CONSTRAINT django_celery_beat_solar_event_latitude_longitude_ba64999a_uniq
UNIQUE (event, latitude, longitude)
);

CREATE TABLE IF NOT EXISTS public.django_content_type


(
id serial NOT NULL,
app_label character varying(100) COLLATE pg_catalog."default" NOT NULL,
model character varying(100) COLLATE pg_catalog."default" NOT NULL,
CONSTRAINT django_content_type_pkey PRIMARY KEY (id),
CONSTRAINT django_content_type_app_label_model_76bd3d3b_uniq UNIQUE (app_label,
model)
);

CREATE TABLE IF NOT EXISTS public.django_migrations


(
id bigserial NOT NULL,
app character varying(255) COLLATE pg_catalog."default" NOT NULL,
name character varying(255) COLLATE pg_catalog."default" NOT NULL,
applied timestamp with time zone NOT NULL,
CONSTRAINT django_migrations_pkey PRIMARY KEY (id)
);

CREATE TABLE IF NOT EXISTS public.django_rest_passwordreset_resetpasswordtoken


(
created_at timestamp with time zone NOT NULL,
key character varying(64) COLLATE pg_catalog."default" NOT NULL,
ip_address inet,
user_agent character varying(256) COLLATE pg_catalog."default" NOT NULL,
user_id bigint NOT NULL,
id serial NOT NULL,
CONSTRAINT django_rest_passwordreset_resetpasswordtoken_pkey PRIMARY KEY (id),
CONSTRAINT django_rest_passwordreset_resetpasswordtoken_key_f1b65873_uniq
UNIQUE (key)
);

CREATE TABLE IF NOT EXISTS public.django_session


(
session_key character varying(40) COLLATE pg_catalog."default" NOT NULL,
session_data text COLLATE pg_catalog."default" NOT NULL,
expire_date timestamp with time zone NOT NULL,
CONSTRAINT django_session_pkey PRIMARY KEY (session_key)
);

CREATE TABLE IF NOT EXISTS public.file_payment_logs


(
id bigserial NOT NULL,
created_at timestamp with time zone NOT NULL,
modified_at timestamp with time zone NOT NULL,
status integer NOT NULL,
log_description character varying(500) COLLATE pg_catalog."default" NOT NULL,
import_check_processing_logs_id bigint,
tax_account_id bigint NOT NULL,
check_no character varying(255) COLLATE pg_catalog."default",
overpayment_overage numeric(15, 2),
remitter_address character varying(255) COLLATE pg_catalog."default",
remitter_name character varying(255) COLLATE pg_catalog."default",
tax_account_status integer,
total_balance_due numeric(15, 2),
total_paid numeric(15, 2),
CONSTRAINT file_payment_logs_pkey PRIMARY KEY (id)
);

CREATE TABLE IF NOT EXISTS public.import_address_logs


(
id bigserial NOT NULL,
created_at timestamp with time zone NOT NULL,
modified_at timestamp with time zone NOT NULL,
year character varying(4) COLLATE pg_catalog."default" NOT NULL,
updated_by_id bigint,
file character varying(100) COLLATE pg_catalog."default" NOT NULL,
status integer NOT NULL,
CONSTRAINT import_address_logs_pkey PRIMARY KEY (id)
);

CREATE TABLE IF NOT EXISTS public.import_change_order_logs


(
id bigserial NOT NULL,
created_at timestamp with time zone NOT NULL,
modified_at timestamp with time zone NOT NULL,
file character varying(100) COLLATE pg_catalog."default" NOT NULL,
status integer NOT NULL,
updated_by_id bigint,
CONSTRAINT import_change_order_logs_pkey PRIMARY KEY (id)
);

CREATE TABLE IF NOT EXISTS public.import_check_processing_logs


(
id bigserial NOT NULL,
created_at timestamp with time zone NOT NULL,
modified_at timestamp with time zone NOT NULL,
file character varying(100) COLLATE pg_catalog."default" NOT NULL,
year character varying(4) COLLATE pg_catalog."default" NOT NULL,
status integer NOT NULL,
updated_by_id bigint,
file_log text COLLATE pg_catalog."default",
batch_id bigint,
CONSTRAINT import_check_processing_logs_pkey PRIMARY KEY (id)
);

CREATE TABLE IF NOT EXISTS public.import_tax_sale_logs


(
id bigserial NOT NULL,
created_at timestamp with time zone NOT NULL,
modified_at timestamp with time zone NOT NULL,
file character varying(100) COLLATE pg_catalog."default" NOT NULL,
year character varying(4) COLLATE pg_catalog."default" NOT NULL,
status integer NOT NULL,
updated_by_id bigint,
exception_log text COLLATE pg_catalog."default",
tax_sale_company_id bigint,
CONSTRAINT import_tax_sale_logs_pkey PRIMARY KEY (id)
);

CREATE TABLE IF NOT EXISTS public.interest_change_logs


(
id bigserial NOT NULL,
created_at timestamp with time zone NOT NULL,
modified_at timestamp with time zone NOT NULL,
status integer NOT NULL,
due_date timestamp with time zone NOT NULL,
year character varying(4) COLLATE pg_catalog."default" NOT NULL,
scheduled_task_name character varying(255) COLLATE pg_catalog."default",
user_id bigint,
CONSTRAINT interest_change_logs_pkey PRIMARY KEY (id)
);

CREATE TABLE IF NOT EXISTS public.log_type


(
id bigserial NOT NULL,
created_at timestamp with time zone NOT NULL,
modified_at timestamp with time zone NOT NULL,
name character varying(255) COLLATE pg_catalog."default" NOT NULL,
CONSTRAINT log_type_pkey PRIMARY KEY (id),
CONSTRAINT log_type_name_d1e0f5fa_uniq UNIQUE (name)
);

CREATE TABLE IF NOT EXISTS public.mortgage_company


(
id bigserial NOT NULL,
created_at timestamp with time zone NOT NULL,
modified_at timestamp with time zone NOT NULL,
name character varying(255) COLLATE pg_catalog."default" NOT NULL,
full_name character varying(255) COLLATE pg_catalog."default" NOT NULL,
address character varying(500) COLLATE pg_catalog."default" NOT NULL,
notes text COLLATE pg_catalog."default",
address_line_2 text COLLATE pg_catalog."default",
city character varying(255) COLLATE pg_catalog."default",
contact_person_name character varying(255) COLLATE pg_catalog."default",
email character varying(255) COLLATE pg_catalog."default",
phone character varying(255) COLLATE pg_catalog."default",
state character varying(255) COLLATE pg_catalog."default",
status integer NOT NULL,
zipcode character varying(255) COLLATE pg_catalog."default",
CONSTRAINT mortgage_company_pkey PRIMARY KEY (id)
);

CREATE TABLE IF NOT EXISTS public.mortgage_file_logs


(
id bigserial NOT NULL,
created_at timestamp with time zone NOT NULL,
modified_at timestamp with time zone NOT NULL,
year character varying(4) COLLATE pg_catalog."default" NOT NULL,
file character varying(100) COLLATE pg_catalog."default" NOT NULL,
status integer NOT NULL,
notes text COLLATE pg_catalog."default",
exception_log character varying(500) COLLATE pg_catalog."default",
added_by_id bigint NOT NULL,
mortgage_company_id bigint NOT NULL,
receipt_id bigint,
batch integer,
is_technology_fee boolean NOT NULL,
CONSTRAINT mortgage_file_logs_pkey PRIMARY KEY (id),
CONSTRAINT mortgage_file_logs_receipt_id_key UNIQUE (receipt_id)
);

CREATE TABLE IF NOT EXISTS public.mortgage_payment_logs


(
id bigserial NOT NULL,
created_at timestamp with time zone NOT NULL,
modified_at timestamp with time zone NOT NULL,
log_description character varying(500) COLLATE pg_catalog."default" NOT NULL,
mortgage_file_logs_id bigint NOT NULL,
tax_account_id bigint NOT NULL,
status integer NOT NULL,
CONSTRAINT mortgage_payment_logs_pkey PRIMARY KEY (id)
);

CREATE TABLE IF NOT EXISTS public.nmi_request_logs


(
id serial NOT NULL,
request jsonb NOT NULL,
response text COLLATE pg_catalog."default" NOT NULL,
api_call integer NOT NULL,
http_status_code integer NOT NULL,
transaction_id_1 character varying(255) COLLATE pg_catalog."default",
added_at timestamp with time zone,
updated_at timestamp with time zone,
CONSTRAINT nmi_request_logs_pkey PRIMARY KEY (id)
);

CREATE TABLE IF NOT EXISTS public.payment


(
id bigserial NOT NULL,
created_at timestamp with time zone NOT NULL,
modified_at timestamp with time zone NOT NULL,
type integer NOT NULL,
amount numeric(15, 2) NOT NULL,
receipt_id bigint,
tax_account_id bigint NOT NULL,
refund_id bigint,
cost numeric(15, 2) NOT NULL,
interest numeric(15, 2) NOT NULL,
other numeric(15, 2) NOT NULL,
amount_received_from_cheque numeric(15, 2) NOT NULL,
protested boolean NOT NULL,
is_refunded boolean NOT NULL,
convenience_fee numeric(15, 2) NOT NULL,
is_reflect_convenience_fee boolean NOT NULL,
CONSTRAINT payment_pkey PRIMARY KEY (id)
);

CREATE TABLE IF NOT EXISTS public.payment_batch


(
id bigserial NOT NULL,
created_at timestamp with time zone NOT NULL,
modified_at timestamp with time zone NOT NULL,
status integer NOT NULL,
opening_date date NOT NULL,
closing_date date,
notes text COLLATE pg_catalog."default",
opened_by_id bigint NOT NULL,
verified_by_id bigint,
report character varying(100) COLLATE pg_catalog."default",
closing_month_id bigint,
is_refund_batch boolean NOT NULL,
is_cc_portal_batch boolean NOT NULL,
batch_name character varying(255) COLLATE pg_catalog."default",
CONSTRAINT payment_batch_pkey PRIMARY KEY (id)
);

CREATE TABLE IF NOT EXISTS public.pdf_attachment


(
id bigserial NOT NULL,
created_at timestamp with time zone NOT NULL,
modified_at timestamp with time zone NOT NULL,
name character varying(255) COLLATE pg_catalog."default" NOT NULL,
file character varying(100) COLLATE pg_catalog."default" NOT NULL,
user_id bigint NOT NULL,
CONSTRAINT pdf_attachment_pkey PRIMARY KEY (id)
);

CREATE TABLE IF NOT EXISTS public.prior_year_paid_parcel


(
id bigserial NOT NULL,
created_at timestamp with time zone NOT NULL,
modified_at timestamp with time zone NOT NULL,
year character varying(4) COLLATE pg_catalog."default" NOT NULL,
status integer NOT NULL,
parcel_number character varying(255) COLLATE pg_catalog."default" NOT NULL,
tax_notice_number character varying(255) COLLATE pg_catalog."default" NOT NULL,
tax_bill_number character varying(255) COLLATE pg_catalog."default" NOT NULL,
ward_id character varying(255) COLLATE pg_catalog."default",
total_balance_due numeric(15, 2) NOT NULL,
total_paid numeric(15, 2) NOT NULL,
tax_amount numeric(15, 2) NOT NULL,
property_type_name character varying(255) COLLATE pg_catalog."default",
owner_name character varying(255) COLLATE pg_catalog."default" NOT NULL,
owner_address character varying(255) COLLATE pg_catalog."default",
legal_description text[] COLLATE pg_catalog."default" NOT NULL,
transaction_types jsonb NOT NULL,
property_items jsonb NOT NULL,
transaction_breakdown jsonb NOT NULL,
check_number character varying(255) COLLATE pg_catalog."default",
payment_method character varying(20) COLLATE pg_catalog."default",
remitter_name character varying(255) COLLATE pg_catalog."default",
receipt_number character varying(100) COLLATE pg_catalog."default",
cost numeric(15, 2),
interest numeric(15, 2),
is_cost boolean NOT NULL,
tax_due numeric(15, 2),
batch_number character varying(20) COLLATE pg_catalog."default",
cc_authorization_no character varying(255) COLLATE pg_catalog."default",
cc_reference_no character varying(255) COLLATE pg_catalog."default",
cc_transaction_id character varying(255) COLLATE pg_catalog."default",
lein_info jsonb,
notes text COLLATE pg_catalog."default",
is_loaded boolean NOT NULL,
CONSTRAINT prior_year_paid_parcel_pkey PRIMARY KEY (id),
CONSTRAINT unique_tax_notice_number_year UNIQUE (tax_notice_number, year)
);

CREATE TABLE IF NOT EXISTS public.property_class


(
id bigserial NOT NULL,
created_at timestamp with time zone NOT NULL,
modified_at timestamp with time zone NOT NULL,
name character varying(255) COLLATE pg_catalog."default" NOT NULL,
description text COLLATE pg_catalog."default",
year character varying(4) COLLATE pg_catalog."default",
type integer NOT NULL,
CONSTRAINT property_class_pkey PRIMARY KEY (id),
CONSTRAINT property_class_name_key UNIQUE (name)
);

CREATE TABLE IF NOT EXISTS public.property_detail


(
id bigserial NOT NULL,
created_at timestamp with time zone NOT NULL,
modified_at timestamp with time zone NOT NULL,
name character varying(255) COLLATE pg_catalog."default",
description text COLLATE pg_catalog."default",
address text COLLATE pg_catalog."default",
parcel_number character varying(255) COLLATE pg_catalog."default" NOT NULL,
tax_notice_number character varying(255) COLLATE pg_catalog."default" NOT NULL,
ward_id bigint,
CONSTRAINT property_detail_pkey PRIMARY KEY (id),
CONSTRAINT property_detail_tax_notice_number_key UNIQUE (tax_notice_number)
);

CREATE TABLE IF NOT EXISTS public.property_item


(
id bigserial NOT NULL,
created_at timestamp with time zone NOT NULL,
modified_at timestamp with time zone NOT NULL,
value numeric(100, 5) NOT NULL,
homestead_amount numeric(100, 5) NOT NULL,
units numeric(10, 2) NOT NULL,
property_class_id bigint,
tax_account_id bigint,
change_order_id bigint,
disable_vet_hs numeric(10, 2) NOT NULL,
CONSTRAINT property_item_pkey PRIMARY KEY (id)
);

CREATE TABLE IF NOT EXISTS public.property_item_tax_code


(
id bigserial NOT NULL,
created_at timestamp with time zone NOT NULL,
modified_at timestamp with time zone NOT NULL,
amount numeric(15, 5) NOT NULL,
tax_code_year_id bigint,
type integer NOT NULL,
property_item_id bigint,
CONSTRAINT property_item_tax_code_pkey PRIMARY KEY (id)
);

CREATE TABLE IF NOT EXISTS public.property_type


(
id bigserial NOT NULL,
created_at timestamp with time zone NOT NULL,
modified_at timestamp with time zone NOT NULL,
name character varying(255) COLLATE pg_catalog."default" NOT NULL,
allow_payments boolean NOT NULL,
allow_online_payments boolean NOT NULL,
allow_redemption_payments boolean NOT NULL,
is_movable boolean NOT NULL,
state integer NOT NULL,
include_in_auction boolean NOT NULL,
can_add_lien boolean NOT NULL,
CONSTRAINT property_type_pkey PRIMARY KEY (id),
CONSTRAINT property_type_name_key UNIQUE (name)
);

CREATE TABLE IF NOT EXISTS public.receipt


(
id bigserial NOT NULL,
created_at timestamp with time zone NOT NULL,
modified_at timestamp with time zone NOT NULL,
method integer NOT NULL,
cc_authorization_no character varying(255) COLLATE pg_catalog."default",
cc_reference_no integer,
distribution_control_no integer,
check_no character varying(255) COLLATE pg_catalog."default",
cc_transaction_id character varying(255) COLLATE pg_catalog."default",
total_amount numeric(15, 2) NOT NULL,
paid_amount numeric(15, 2) NOT NULL,
transaction_date timestamp with time zone NOT NULL,
remitter_name character varying(255) COLLATE pg_catalog."default" NOT NULL,
remitter_contact character varying(255) COLLATE pg_catalog."default",
remitter_address text COLLATE pg_catalog."default" NOT NULL,
change_due numeric(15, 2) NOT NULL,
notes text COLLATE pg_catalog."default",
receipt_no integer,
batch_id bigint NOT NULL,
state integer NOT NULL,
reversed_date timestamp with time zone,
cover_letter character varying(100) COLLATE pg_catalog."default",
type integer NOT NULL,
refund_batch_id bigint,
total_convenience_fee numeric(15, 2) NOT NULL,
conv_fee_transaction_id character varying(255) COLLATE pg_catalog."default",
is_swiper boolean NOT NULL,
CONSTRAINT receipt_pkey PRIMARY KEY (id)
);

CREATE TABLE IF NOT EXISTS public.receipt_dummy


(
id bigserial NOT NULL,
created_at timestamp with time zone NOT NULL,
modified_at timestamp with time zone NOT NULL,
year character varying(4) COLLATE pg_catalog."default" NOT NULL,
parcel_no integer NOT NULL,
receipt_data jsonb,
receipt_pdf character varying(100) COLLATE pg_catalog."default",
user_id bigint,
CONSTRAINT receipt_dummy_pkey PRIMARY KEY (id)
);

CREATE TABLE IF NOT EXISTS public.receipt_logs


(
id bigserial NOT NULL,
created_at timestamp with time zone NOT NULL,
modified_at timestamp with time zone NOT NULL,
state integer NOT NULL,
logged_by_id bigint NOT NULL,
receipt_id bigint NOT NULL,
tax_accounts integer[] NOT NULL,
CONSTRAINT receipt_logs_pkey PRIMARY KEY (id)
);

CREATE TABLE IF NOT EXISTS public.receiving_entity


(
id bigserial NOT NULL,
created_at timestamp with time zone NOT NULL,
modified_at timestamp with time zone NOT NULL,
name character varying(255) COLLATE pg_catalog."default" NOT NULL,
address text COLLATE pg_catalog."default",
city character varying(255) COLLATE pg_catalog."default" NOT NULL,
state character varying(255) COLLATE pg_catalog."default" NOT NULL,
zip_code integer,
year character varying(4) COLLATE pg_catalog."default",
partial_gl_account integer,
category character varying(255) COLLATE pg_catalog."default" NOT NULL,
CONSTRAINT receiving_entity_pkey PRIMARY KEY (id),
CONSTRAINT receiving_entity_name_key UNIQUE (name)
);

CREATE TABLE IF NOT EXISTS public.refund


(
id bigserial NOT NULL,
created_at timestamp with time zone NOT NULL,
modified_at timestamp with time zone NOT NULL,
type integer NOT NULL,
date_time timestamp with time zone NOT NULL,
refunded_by_id bigint,
amount numeric(15, 2) NOT NULL,
reason text COLLATE pg_catalog."default",
refunded_receipt_id bigint,
status integer NOT NULL,
year character varying(4) COLLATE pg_catalog."default" NOT NULL,
check_no character varying(255) COLLATE pg_catalog."default",
check_paid_to character varying(255) COLLATE pg_catalog."default",
check_address text COLLATE pg_catalog."default",
distribution_control_no integer,
change_order_id bigint,
refund_batch_id bigint,
void_date_time timestamp with time zone,
voided_by_id bigint,
voided_refund_closing_month_id bigint,
CONSTRAINT refund_pkey PRIMARY KEY (id)
);
CREATE TABLE IF NOT EXISTS public.report
(
id bigserial NOT NULL,
created_at timestamp with time zone NOT NULL,
modified_at timestamp with time zone NOT NULL,
name character varying(255) COLLATE pg_catalog."default" NOT NULL,
report_group_id bigint,
last_generated timestamp with time zone,
report character varying(100) COLLATE pg_catalog."default",
generated_by_id bigint,
CONSTRAINT report_pkey PRIMARY KEY (id),
CONSTRAINT report_name_key UNIQUE (name)
);

CREATE TABLE IF NOT EXISTS public.report_group


(
id bigserial NOT NULL,
created_at timestamp with time zone NOT NULL,
modified_at timestamp with time zone NOT NULL,
name character varying(255) COLLATE pg_catalog."default" NOT NULL,
CONSTRAINT report_group_pkey PRIMARY KEY (id),
CONSTRAINT report_group_name_key UNIQUE (name)
);

CREATE TABLE IF NOT EXISTS public.report_section


(
id bigserial NOT NULL,
created_at timestamp with time zone NOT NULL,
modified_at timestamp with time zone NOT NULL,
"order" integer,
report_id bigint NOT NULL,
section_id bigint NOT NULL,
CONSTRAINT report_section_pkey PRIMARY KEY (id)
);

CREATE TABLE IF NOT EXISTS public.report_section_transaction_type


(
id bigserial NOT NULL,
created_at timestamp with time zone NOT NULL,
modified_at timestamp with time zone NOT NULL,
report_section_id bigint NOT NULL,
transaction_type_id bigint NOT NULL,
CONSTRAINT report_section_transaction_type_pkey PRIMARY KEY (id)
);

CREATE TABLE IF NOT EXISTS public.rest_framework_api_key_apikey


(
id character varying(100) COLLATE pg_catalog."default" NOT NULL,
created timestamp with time zone NOT NULL,
name character varying(50) COLLATE pg_catalog."default" NOT NULL,
revoked boolean NOT NULL,
expiry_date timestamp with time zone,
hashed_key character varying(100) COLLATE pg_catalog."default" NOT NULL,
prefix character varying(8) COLLATE pg_catalog."default" NOT NULL,
CONSTRAINT rest_framework_api_key_apikey_pkey PRIMARY KEY (id),
CONSTRAINT rest_framework_api_key_apikey_prefix_key UNIQUE (prefix)
);
CREATE TABLE IF NOT EXISTS public.section
(
id bigserial NOT NULL,
created_at timestamp with time zone NOT NULL,
modified_at timestamp with time zone NOT NULL,
name character varying(255) COLLATE pg_catalog."default" NOT NULL,
CONSTRAINT section_pkey PRIMARY KEY (id),
CONSTRAINT section_name_key UNIQUE (name)
);

CREATE TABLE IF NOT EXISTS public.site_settings


(
id bigserial NOT NULL,
created_at timestamp with time zone NOT NULL,
modified_at timestamp with time zone NOT NULL,
title character varying(255) COLLATE pg_catalog."default" NOT NULL,
address character varying(255) COLLATE pg_catalog."default",
logo character varying(100) COLLATE pg_catalog."default",
supervisor_designation character varying(255) COLLATE pg_catalog."default",
email character varying(254) COLLATE pg_catalog."default",
fax character varying(20) COLLATE pg_catalog."default",
parish_logo character varying(100) COLLATE pg_catalog."default",
phone character varying(20) COLLATE pg_catalog."default",
sheriff character varying(255) COLLATE pg_catalog."default",
interest_rate numeric(15, 5) NOT NULL,
supervisor_name character varying(255) COLLATE pg_catalog."default",
nmi_public_key character varying(255) COLLATE pg_catalog."default",
options jsonb NOT NULL,
flat_nsf_fee numeric(15, 2) NOT NULL,
use_flat_nsf_fee boolean NOT NULL,
new_interest_rate numeric(10, 2) NOT NULL,
deputy character varying(255) COLLATE pg_catalog."default",
deputy_designation character varying(255) COLLATE pg_catalog."default",
first_tax_sale_add_date date,
parish_city character varying(255) COLLATE pg_catalog."default",
parish_state character varying(255) COLLATE pg_catalog."default",
parish_street character varying(255) COLLATE pg_catalog."default",
parish_zip character varying(255) COLLATE pg_catalog."default",
second_tax_sale_add_date date,
sheriff_designation character varying(255) COLLATE pg_catalog."default",
tax_sale_date date,
witnesse1 character varying(255) COLLATE pg_catalog."default",
witnesse2 character varying(255) COLLATE pg_catalog."default",
city_first_name character varying(255) COLLATE pg_catalog."default",
newspaper character varying(255) COLLATE pg_catalog."default",
parish_first_name character varying(255) COLLATE pg_catalog."default",
adjudication_buyer_address character varying(255) COLLATE pg_catalog."default",
adjudication_buyer_name character varying(255) COLLATE pg_catalog."default",
convenience_rate numeric(15, 5) NOT NULL,
convenience_fee_tax_codes jsonb NOT NULL,
reflect_convenience_fee boolean NOT NULL,
parish_website character varying(200) COLLATE pg_catalog."default",
is_bulk_check_overpayment boolean NOT NULL,
is_bulk_check_partial_payment boolean NOT NULL,
signee_designation character varying(255) COLLATE pg_catalog."default",
signee_name character varying(255) COLLATE pg_catalog."default",
is_multi_parcel_tax_sale_payment boolean NOT NULL,
show_convenience_fee boolean NOT NULL,
add_forestry_tax_code boolean NOT NULL,
show_title_in_payment_receipt boolean NOT NULL,
technology_fee numeric(15, 2) NOT NULL,
paid_stamp_image character varying(100) COLLATE pg_catalog."default",
new_payment_hierarchy boolean NOT NULL,
remove_exempted_balance boolean NOT NULL,
CONSTRAINT site_settings_pkey PRIMARY KEY (id),
CONSTRAINT site_settings_email_key UNIQUE (email)
);

CREATE TABLE IF NOT EXISTS public.sto_cc_logs


(
created_at timestamp with time zone NOT NULL,
modified_at timestamp with time zone NOT NULL,
id serial NOT NULL,
request jsonb NOT NULL,
request_at timestamp with time zone,
response jsonb,
response_at timestamp with time zone,
CONSTRAINT sto_cc_logs_pkey PRIMARY KEY (id)
);

CREATE TABLE IF NOT EXISTS public.tax_account


(
id bigserial NOT NULL,
created_at timestamp with time zone NOT NULL,
modified_at timestamp with time zone NOT NULL,
total_balance_due numeric(15, 2) NOT NULL,
status integer NOT NULL,
tax_amount numeric(15, 2) NOT NULL,
due_date date,
year character varying(4) COLLATE pg_catalog."default" NOT NULL,
owner_name character varying(255) COLLATE pg_catalog."default" NOT NULL,
owner_address character varying(255) COLLATE pg_catalog."default",
owner_old_address character varying(255) COLLATE pg_catalog."default",
owner_contact character varying(20) COLLATE pg_catalog."default",
legal_description text[] COLLATE pg_catalog."default" NOT NULL,
notes text COLLATE pg_catalog."default",
tax_percentage numeric(15, 2),
homestead_tax numeric(15, 2) NOT NULL,
property_detail_id bigint,
property_type_id bigint,
bad_address boolean NOT NULL,
total_paid numeric(15, 2) NOT NULL,
cost numeric(15, 2) NOT NULL,
interest numeric(15, 2) NOT NULL,
other numeric(15, 2) NOT NULL,
owner_old_name character varying(255) COLLATE pg_catalog."default",
remaining_tax_amount numeric(15, 2) NOT NULL,
eligible_for_sale boolean NOT NULL,
updated_by_id bigint,
bankrupted boolean NOT NULL,
city character varying(100) COLLATE pg_catalog."default",
state character varying(100) COLLATE pg_catalog."default",
street character varying(255) COLLATE pg_catalog."default",
zip_code character varying(100) COLLATE pg_catalog."default",
tax_account_number character varying(255) COLLATE pg_catalog."default",
mortgage_company_id bigint,
is_industrial_exempted boolean NOT NULL,
redemption_linked boolean NOT NULL,
CONSTRAINT tax_account_pkey PRIMARY KEY (id),
CONSTRAINT unique_property_detail_year UNIQUE (property_detail_id, year)
);

CREATE TABLE IF NOT EXISTS public.tax_account_address_history


(
id bigserial NOT NULL,
created_at timestamp with time zone NOT NULL,
modified_at timestamp with time zone NOT NULL,
date date,
reason character varying(255) COLLATE pg_catalog."default",
owner_address text COLLATE pg_catalog."default",
owner_old_address text COLLATE pg_catalog."default",
tax_account_id bigint NOT NULL,
updated_by_id bigint,
owner_name character varying(255) COLLATE pg_catalog."default",
owner_old_name character varying(255) COLLATE pg_catalog."default",
import_address_log_id bigint,
bad_address boolean NOT NULL,
CONSTRAINT tax_account_address_history_pkey PRIMARY KEY (id)
);

CREATE TABLE IF NOT EXISTS public.tax_account_attachment


(
id bigserial NOT NULL,
created_at timestamp with time zone NOT NULL,
modified_at timestamp with time zone NOT NULL,
file character varying(100) COLLATE pg_catalog."default",
description character varying(255) COLLATE pg_catalog."default" NOT NULL,
date date,
apply_all boolean NOT NULL,
added_by_id bigint NOT NULL,
CONSTRAINT tax_account_attachment_pkey PRIMARY KEY (id)
);

CREATE TABLE IF NOT EXISTS public.tax_account_attachment_tax_accounts


(
id bigserial NOT NULL,
taxaccountattachment_id bigint NOT NULL,
taxaccount_id bigint NOT NULL,
CONSTRAINT tax_account_attachment_tax_accounts_pkey PRIMARY KEY (id),
CONSTRAINT tax_account_attachment_t_taxaccountattachment_id__e5154b55_uniq
UNIQUE (taxaccountattachment_id, taxaccount_id)
);

CREATE TABLE IF NOT EXISTS public.tax_account_delinquents_tracking


(
id bigserial NOT NULL,
created_at timestamp with time zone NOT NULL,
modified_at timestamp with time zone NOT NULL,
date_mailed date NOT NULL,
date_signed date,
certified_no character varying(100) COLLATE pg_catalog."default" NOT NULL,
signee character varying(255) COLLATE pg_catalog."default",
status integer NOT NULL,
reason text COLLATE pg_catalog."default",
created_by_id bigint NOT NULL,
tax_account_id bigint NOT NULL,
CONSTRAINT tax_account_delinquents_tracking_pkey PRIMARY KEY (id)
);

CREATE TABLE IF NOT EXISTS public.tax_account_log


(
id bigserial NOT NULL,
created_at timestamp with time zone NOT NULL,
modified_at timestamp with time zone NOT NULL,
comment text COLLATE pg_catalog."default",
created_by_id bigint NOT NULL,
log_type_id bigint NOT NULL,
tax_account_id bigint NOT NULL,
CONSTRAINT tax_account_log_pkey PRIMARY KEY (id)
);

CREATE TABLE IF NOT EXISTS public.tax_account_note


(
id bigserial NOT NULL,
created_at timestamp with time zone NOT NULL,
modified_at timestamp with time zone NOT NULL,
note text COLLATE pg_catalog."default" NOT NULL,
created_by_id bigint NOT NULL,
tax_account_id bigint NOT NULL,
deleted boolean NOT NULL,
label integer NOT NULL,
CONSTRAINT tax_account_note_pkey PRIMARY KEY (id)
);

CREATE TABLE IF NOT EXISTS public.tax_account_other_owner


(
id bigserial NOT NULL,
created_at timestamp with time zone NOT NULL,
modified_at timestamp with time zone NOT NULL,
name character varying(255) COLLATE pg_catalog."default" NOT NULL,
address text COLLATE pg_catalog."default",
created_by_id bigint NOT NULL,
tax_account_id bigint NOT NULL,
CONSTRAINT tax_account_other_owner_pkey PRIMARY KEY (id)
);

CREATE TABLE IF NOT EXISTS public.tax_account_prior_year_logs


(
id bigserial NOT NULL,
created_at timestamp with time zone NOT NULL,
modified_at timestamp with time zone NOT NULL,
tax_bill_number character varying(255) COLLATE pg_catalog."default",
parcel_number character varying(255) COLLATE pg_catalog."default",
year character varying(4) COLLATE pg_catalog."default" NOT NULL,
is_normal boolean NOT NULL,
tax_account_id bigint NOT NULL,
CONSTRAINT tax_account_prior_year_logs_pkey PRIMARY KEY (id)
);

CREATE TABLE IF NOT EXISTS public.tax_account_redemption_linked


(
id bigserial NOT NULL,
created_at timestamp with time zone NOT NULL,
modified_at timestamp with time zone NOT NULL,
lien_tax_account_id bigint,
linked_by_id bigint,
linked_tax_account_id bigint,
CONSTRAINT tax_account_redemption_linked_pkey PRIMARY KEY (id)
);

CREATE TABLE IF NOT EXISTS public.tax_account_refund


(
id bigserial NOT NULL,
created_at timestamp with time zone NOT NULL,
modified_at timestamp with time zone NOT NULL,
amount numeric(15, 5) NOT NULL,
refund_id bigint NOT NULL,
tax_account_id bigint NOT NULL,
CONSTRAINT tax_account_refund_pkey PRIMARY KEY (id)
);

CREATE TABLE IF NOT EXISTS public.tax_account_sale


(
id bigserial NOT NULL,
created_at timestamp with time zone NOT NULL,
modified_at timestamp with time zone NOT NULL,
status integer NOT NULL,
sold_date date,
deed_filed_date date,
book character varying(255) COLLATE pg_catalog."default",
page character varying(250) COLLATE pg_catalog."default",
purchased_percentage numeric(15, 2) NOT NULL,
ack_number text COLLATE pg_catalog."default",
buyer text COLLATE pg_catalog."default",
deed_comments text COLLATE pg_catalog."default",
other_comments text COLLATE pg_catalog."default",
payment_id bigint,
tax_account_id bigint NOT NULL,
bidder_id bigint,
first_tax_sale_add_date date,
second_tax_sale_add_date date,
seller_address character varying(255) COLLATE pg_catalog."default",
seller_name character varying(255) COLLATE pg_catalog."default",
register integer,
expiration_date timestamp with time zone,
cancel_date date,
CONSTRAINT tax_account_sale_pkey PRIMARY KEY (id),
CONSTRAINT tax_account_sale_payment_id_key UNIQUE (payment_id)
);

CREATE TABLE IF NOT EXISTS public.tax_code


(
id bigserial NOT NULL,
created_at timestamp with time zone NOT NULL,
modified_at timestamp with time zone NOT NULL,
name character varying(255) COLLATE pg_catalog."default" NOT NULL,
city_tax_code boolean NOT NULL,
is_cost boolean NOT NULL,
is_other boolean NOT NULL,
distribution_order integer,
gl_entity integer,
gl_sequence integer,
refund_to_tax_buyer boolean NOT NULL,
tax_buyer_refund_code boolean NOT NULL,
receiving_entity_id bigint,
tax_code_group_id bigint,
is_regular boolean NOT NULL,
is_sheriff boolean NOT NULL,
is_removable_fee boolean NOT NULL,
gl_account character varying(50) COLLATE pg_catalog."default",
gl_account_interest character varying(50) COLLATE pg_catalog."default",
is_fixed_cost boolean NOT NULL,
CONSTRAINT tax_code_pkey PRIMARY KEY (id),
CONSTRAINT tax_code_name_key UNIQUE (name)
);

CREATE TABLE IF NOT EXISTS public.tax_code_by_year


(
id bigserial NOT NULL,
created_at timestamp with time zone NOT NULL,
modified_at timestamp with time zone NOT NULL,
millage numeric(100, 5) NOT NULL,
year character varying(4) COLLATE pg_catalog."default",
tax_code_id bigint NOT NULL,
millage_key character varying(255) COLLATE pg_catalog."default",
agency_code character varying(255) COLLATE pg_catalog."default",
CONSTRAINT tax_code_by_year_pkey PRIMARY KEY (id)
);

CREATE TABLE IF NOT EXISTS public.tax_code_group


(
id bigserial NOT NULL,
created_at timestamp with time zone NOT NULL,
modified_at timestamp with time zone NOT NULL,
name character varying(255) COLLATE pg_catalog."default" NOT NULL,
CONSTRAINT tax_code_group_pkey PRIMARY KEY (id)
);

CREATE TABLE IF NOT EXISTS public.tax_log_view


(
id bigserial NOT NULL,
created_at timestamp with time zone NOT NULL,
modified_at timestamp with time zone NOT NULL,
name character varying(255) COLLATE pg_catalog."default" NOT NULL,
log_type character varying(100) COLLATE pg_catalog."default",
file_path character varying(100) COLLATE pg_catalog."default",
text_message text COLLATE pg_catalog."default",
parcel_numbers text COLLATE pg_catalog."default",
generated_by_id bigint,
CONSTRAINT tax_log_view_pkey PRIMARY KEY (id)
);

CREATE TABLE IF NOT EXISTS public.tax_roll_logs


(
id bigserial NOT NULL,
created_at timestamp with time zone NOT NULL,
modified_at timestamp with time zone NOT NULL,
year character varying(4) COLLATE pg_catalog."default" NOT NULL,
file character varying(100) COLLATE pg_catalog."default" NOT NULL,
added_by_id bigint NOT NULL,
notes text COLLATE pg_catalog."default",
status integer NOT NULL,
CONSTRAINT tax_roll_logs_pkey PRIMARY KEY (id)
);
CREATE TABLE IF NOT EXISTS public.tax_sale_bidder
(
id bigserial NOT NULL,
created_at timestamp with time zone NOT NULL,
modified_at timestamp with time zone NOT NULL,
year character varying(4) COLLATE pg_catalog."default" NOT NULL,
bidder_id bigint NOT NULL,
CONSTRAINT tax_sale_bidder_pkey PRIMARY KEY (id)
);

CREATE TABLE IF NOT EXISTS public.tax_sale_company


(
id bigserial NOT NULL,
created_at timestamp with time zone NOT NULL,
modified_at timestamp with time zone NOT NULL,
name character varying(255) COLLATE pg_catalog."default" NOT NULL,
full_name character varying(255) COLLATE pg_catalog."default" NOT NULL,
CONSTRAINT tax_sale_company_pkey PRIMARY KEY (id)
);

CREATE TABLE IF NOT EXISTS public.tax_sale_payment_log


(
id bigserial NOT NULL,
created_at timestamp with time zone NOT NULL,
modified_at timestamp with time zone NOT NULL,
reason text COLLATE pg_catalog."default",
created_by_id bigint NOT NULL,
tax_account_id bigint,
CONSTRAINT tax_sale_payment_log_pkey PRIMARY KEY (id)
);

CREATE TABLE IF NOT EXISTS public.transaction_breakdown


(
id bigserial NOT NULL,
created_at timestamp with time zone NOT NULL,
modified_at timestamp with time zone NOT NULL,
type integer NOT NULL,
amount numeric(15, 5) NOT NULL,
payment_id bigint,
tax_account_id bigint NOT NULL,
tax_code_year_id bigint,
transaction_type_id bigint,
date date NOT NULL,
change_order_id bigint,
excluded boolean NOT NULL,
CONSTRAINT transaction_breakdown_pkey PRIMARY KEY (id)
);

CREATE TABLE IF NOT EXISTS public.transaction_type


(
id bigserial NOT NULL,
created_at timestamp with time zone NOT NULL,
modified_at timestamp with time zone NOT NULL,
name character varying(255) COLLATE pg_catalog."default" NOT NULL,
tax_code_year_id bigint,
amount numeric(15, 5) NOT NULL,
display_order integer NOT NULL,
include_in_checks boolean NOT NULL,
include_in_reports boolean NOT NULL,
adjustable_by_user boolean NOT NULL,
is_tax_sale_fee boolean NOT NULL,
is_town_taxes boolean NOT NULL,
is_redemption_fee boolean NOT NULL,
CONSTRAINT transaction_type_pkey PRIMARY KEY (id),
CONSTRAINT transaction_type_name_5a73d30f_uniq UNIQUE (name)
);

CREATE TABLE IF NOT EXISTS public.user_defined_type


(
id bigserial NOT NULL,
created_at timestamp with time zone NOT NULL,
modified_at timestamp with time zone NOT NULL,
name character varying(255) COLLATE pg_catalog."default" NOT NULL,
data_type integer NOT NULL,
is_dropdown boolean NOT NULL,
options jsonb NOT NULL,
CONSTRAINT user_defined_type_pkey PRIMARY KEY (id),
CONSTRAINT user_defined_type_name_key UNIQUE (name)
);

CREATE TABLE IF NOT EXISTS public.user_defined_value


(
id bigserial NOT NULL,
created_at timestamp with time zone NOT NULL,
modified_at timestamp with time zone NOT NULL,
value character varying(255) COLLATE pg_catalog."default" NOT NULL,
tax_account_id bigint NOT NULL,
user_defined_type_id bigint NOT NULL,
CONSTRAINT user_defined_value_pkey PRIMARY KEY (id)
);

CREATE TABLE IF NOT EXISTS public.users_user


(
id bigserial NOT NULL,
password character varying(128) COLLATE pg_catalog."default" NOT NULL,
last_login timestamp with time zone,
is_superuser boolean NOT NULL,
username character varying(150) COLLATE pg_catalog."default" NOT NULL,
first_name character varying(150) COLLATE pg_catalog."default" NOT NULL,
last_name character varying(150) COLLATE pg_catalog."default" NOT NULL,
is_staff boolean NOT NULL,
is_active boolean NOT NULL,
date_joined timestamp with time zone NOT NULL,
email character varying(254) COLLATE pg_catalog."default" NOT NULL,
role integer NOT NULL,
phone character varying(20) COLLATE pg_catalog."default",
photo character varying(100) COLLATE pg_catalog."default",
address text COLLATE pg_catalog."default",
CONSTRAINT users_user_pkey PRIMARY KEY (id),
CONSTRAINT users_user_email_key UNIQUE (email),
CONSTRAINT users_user_username_key UNIQUE (username)
);

CREATE TABLE IF NOT EXISTS public.users_user_groups


(
id bigserial NOT NULL,
user_id bigint NOT NULL,
group_id integer NOT NULL,
CONSTRAINT users_user_groups_pkey PRIMARY KEY (id),
CONSTRAINT users_user_groups_user_id_group_id_b88eab82_uniq UNIQUE (user_id,
group_id)
);

CREATE TABLE IF NOT EXISTS public.users_user_user_permissions


(
id bigserial NOT NULL,
user_id bigint NOT NULL,
permission_id integer NOT NULL,
CONSTRAINT users_user_user_permissions_pkey PRIMARY KEY (id),
CONSTRAINT users_user_user_permissions_user_id_permission_id_43338c45_uniq
UNIQUE (user_id, permission_id)
);

CREATE TABLE IF NOT EXISTS public.ward


(
id bigserial NOT NULL,
created_at timestamp with time zone NOT NULL,
modified_at timestamp with time zone NOT NULL,
name character varying(255) COLLATE pg_catalog."default" NOT NULL,
CONSTRAINT ward_pkey PRIMARY KEY (id),
CONSTRAINT ward_name_key UNIQUE (name)
);

ALTER TABLE IF EXISTS public.auth_group_permissions


ADD CONSTRAINT auth_group_permissio_permission_id_84c5c92e_fk_auth_perm FOREIGN
KEY (permission_id)
REFERENCES public.auth_permission (id) MATCH SIMPLE
ON UPDATE NO ACTION
ON DELETE NO ACTION
DEFERRABLE INITIALLY DEFERRED;
CREATE INDEX IF NOT EXISTS auth_group_permissions_permission_id_84c5c92e
ON public.auth_group_permissions(permission_id);

ALTER TABLE IF EXISTS public.auth_group_permissions


ADD CONSTRAINT auth_group_permissions_group_id_b120cbf9_fk_auth_group_id
FOREIGN KEY (group_id)
REFERENCES public.auth_group (id) MATCH SIMPLE
ON UPDATE NO ACTION
ON DELETE NO ACTION
DEFERRABLE INITIALLY DEFERRED;
CREATE INDEX IF NOT EXISTS auth_group_permissions_group_id_b120cbf9
ON public.auth_group_permissions(group_id);

ALTER TABLE IF EXISTS public.auth_permission


ADD CONSTRAINT auth_permission_content_type_id_2f476e4b_fk_django_co FOREIGN
KEY (content_type_id)
REFERENCES public.django_content_type (id) MATCH SIMPLE
ON UPDATE NO ACTION
ON DELETE NO ACTION
DEFERRABLE INITIALLY DEFERRED;
CREATE INDEX IF NOT EXISTS auth_permission_content_type_id_2f476e4b
ON public.auth_permission(content_type_id);
ALTER TABLE IF EXISTS public.change_order
ADD CONSTRAINT change_order_change_order_categor_5a5b37a3_fk_change_or FOREIGN
KEY (change_order_category_id)
REFERENCES public.change_order_category (id) MATCH SIMPLE
ON UPDATE NO ACTION
ON DELETE NO ACTION
DEFERRABLE INITIALLY DEFERRED;
CREATE INDEX IF NOT EXISTS change_order_change_order_category_id_5a5b37a3
ON public.change_order(change_order_category_id);

ALTER TABLE IF EXISTS public.change_order


ADD CONSTRAINT change_order_change_order_file_id_3b607d0e_fk_import_ch FOREIGN
KEY (change_order_file_id)
REFERENCES public.import_change_order_logs (id) MATCH SIMPLE
ON UPDATE NO ACTION
ON DELETE NO ACTION
DEFERRABLE INITIALLY DEFERRED;
CREATE INDEX IF NOT EXISTS change_order_change_order_file_id_3b607d0e
ON public.change_order(change_order_file_id);

ALTER TABLE IF EXISTS public.change_order


ADD CONSTRAINT change_order_created_by_id_7615de12_fk_users_user_id FOREIGN KEY
(created_by_id)
REFERENCES public.users_user (id) MATCH SIMPLE
ON UPDATE NO ACTION
ON DELETE NO ACTION
DEFERRABLE INITIALLY DEFERRED;
CREATE INDEX IF NOT EXISTS change_order_created_by_id_7615de12
ON public.change_order(created_by_id);

ALTER TABLE IF EXISTS public.change_order


ADD CONSTRAINT change_order_tax_account_id_c657e3fe_fk_tax_account_id FOREIGN
KEY (tax_account_id)
REFERENCES public.tax_account (id) MATCH SIMPLE
ON UPDATE NO ACTION
ON DELETE NO ACTION
DEFERRABLE INITIALLY DEFERRED;
CREATE INDEX IF NOT EXISTS change_order_tax_account_id_c657e3fe
ON public.change_order(tax_account_id);

ALTER TABLE IF EXISTS public.change_order_raw_data


ADD CONSTRAINT change_order_raw_dat_import_change_order__60ab471e_fk_import_ch
FOREIGN KEY (import_change_order_logs_id)
REFERENCES public.import_change_order_logs (id) MATCH SIMPLE
ON UPDATE NO ACTION
ON DELETE NO ACTION
DEFERRABLE INITIALLY DEFERRED;
CREATE INDEX IF NOT EXISTS
change_order_raw_data_import_change_order_logs_id_60ab471e
ON public.change_order_raw_data(import_change_order_logs_id);

ALTER TABLE IF EXISTS public.change_order_raw_data


ADD CONSTRAINT change_order_raw_data_updated_by_id_337c24cd_fk_users_user_id
FOREIGN KEY (updated_by_id)
REFERENCES public.users_user (id) MATCH SIMPLE
ON UPDATE NO ACTION
ON DELETE NO ACTION
DEFERRABLE INITIALLY DEFERRED;
CREATE INDEX IF NOT EXISTS change_order_raw_data_updated_by_id_337c24cd
ON public.change_order_raw_data(updated_by_id);

ALTER TABLE IF EXISTS public.check_distribution


ADD CONSTRAINT check_distribution_closing_month_id_9e7d3324_fk_closing_m
FOREIGN KEY (closing_month_id)
REFERENCES public.closing_month (id) MATCH SIMPLE
ON UPDATE NO ACTION
ON DELETE NO ACTION
DEFERRABLE INITIALLY DEFERRED;
CREATE INDEX IF NOT EXISTS check_distribution_closing_month_id_9e7d3324
ON public.check_distribution(closing_month_id);

ALTER TABLE IF EXISTS public.check_distribution


ADD CONSTRAINT check_distribution_distributed_by_id_f13f9184_fk_users_user_id
FOREIGN KEY (distributed_by_id)
REFERENCES public.users_user (id) MATCH SIMPLE
ON UPDATE NO ACTION
ON DELETE NO ACTION
DEFERRABLE INITIALLY DEFERRED;
CREATE INDEX IF NOT EXISTS check_distribution_distributed_by_id_f13f9184
ON public.check_distribution(distributed_by_id);

ALTER TABLE IF EXISTS public.check_distribution


ADD CONSTRAINT check_distribution_receiving_entity_id_3695d2dc_fk_receiving
FOREIGN KEY (receiving_entity_id)
REFERENCES public.receiving_entity (id) MATCH SIMPLE
ON UPDATE NO ACTION
ON DELETE NO ACTION
DEFERRABLE INITIALLY DEFERRED;
CREATE INDEX IF NOT EXISTS check_distribution_receiving_entity_id_3695d2dc
ON public.check_distribution(receiving_entity_id);

ALTER TABLE IF EXISTS public.closing_month


ADD CONSTRAINT closing_month_modified_by_id_00d24f8b_fk_users_user_id FOREIGN
KEY (modified_by_id)
REFERENCES public.users_user (id) MATCH SIMPLE
ON UPDATE NO ACTION
ON DELETE NO ACTION
DEFERRABLE INITIALLY DEFERRED;
CREATE INDEX IF NOT EXISTS closing_month_modified_by_id_00d24f8b
ON public.closing_month(modified_by_id);

ALTER TABLE IF EXISTS public.closing_month


ADD CONSTRAINT closing_month_refund_batch_id_9b04f811_fk_payment_batch_id
FOREIGN KEY (refund_batch_id)
REFERENCES public.payment_batch (id) MATCH SIMPLE
ON UPDATE NO ACTION
ON DELETE NO ACTION
DEFERRABLE INITIALLY DEFERRED;
CREATE INDEX IF NOT EXISTS closing_month_refund_batch_id_9b04f811
ON public.closing_month(refund_batch_id);

ALTER TABLE IF EXISTS public.cost_administration


ADD CONSTRAINT cost_administration_transaction_type_id_43a7096d_fk_transacti
FOREIGN KEY (transaction_type_id)
REFERENCES public.transaction_type (id) MATCH SIMPLE
ON UPDATE NO ACTION
ON DELETE NO ACTION
DEFERRABLE INITIALLY DEFERRED;
CREATE INDEX IF NOT EXISTS cost_administration_transaction_type_id_43a7096d
ON public.cost_administration(transaction_type_id);

ALTER TABLE IF EXISTS public.cost_administration


ADD CONSTRAINT cost_administration_user_id_feee709b_fk_users_user_id FOREIGN
KEY (user_id)
REFERENCES public.users_user (id) MATCH SIMPLE
ON UPDATE NO ACTION
ON DELETE NO ACTION
DEFERRABLE INITIALLY DEFERRED;
CREATE INDEX IF NOT EXISTS cost_administration_user_id_feee709b
ON public.cost_administration(user_id);

ALTER TABLE IF EXISTS public.distribution


ADD CONSTRAINT distribution_closing_month_id_6b997b03_fk_closing_month_id
FOREIGN KEY (closing_month_id)
REFERENCES public.closing_month (id) MATCH SIMPLE
ON UPDATE NO ACTION
ON DELETE NO ACTION
DEFERRABLE INITIALLY DEFERRED;
CREATE INDEX IF NOT EXISTS distribution_closing_month_id_6b997b03
ON public.distribution(closing_month_id);

ALTER TABLE IF EXISTS public.distribution


ADD CONSTRAINT distribution_distributed_by_id_6c6e580b_fk_users_user_id FOREIGN
KEY (distributed_by_id)
REFERENCES public.users_user (id) MATCH SIMPLE
ON UPDATE NO ACTION
ON DELETE NO ACTION
DEFERRABLE INITIALLY DEFERRED;
CREATE INDEX IF NOT EXISTS distribution_distributed_by_id_6c6e580b
ON public.distribution(distributed_by_id);

ALTER TABLE IF EXISTS public.distribution


ADD CONSTRAINT distribution_distribution_type_id_c5445ed1_fk_distribut FOREIGN
KEY (distribution_type_id)
REFERENCES public.distribution_type (id) MATCH SIMPLE
ON UPDATE NO ACTION
ON DELETE NO ACTION
DEFERRABLE INITIALLY DEFERRED;
CREATE INDEX IF NOT EXISTS distribution_distribution_type_id_c5445ed1
ON public.distribution(distribution_type_id);
ALTER TABLE IF EXISTS public.distribution
ADD CONSTRAINT distribution_tax_code_by_year_id_1714e473_fk_tax_code_ FOREIGN
KEY (tax_code_by_year_id)
REFERENCES public.tax_code_by_year (id) MATCH SIMPLE
ON UPDATE NO ACTION
ON DELETE NO ACTION
DEFERRABLE INITIALLY DEFERRED;
CREATE INDEX IF NOT EXISTS distribution_tax_code_by_year_id_1714e473
ON public.distribution(tax_code_by_year_id);

ALTER TABLE IF EXISTS public.django_admin_log


ADD CONSTRAINT django_admin_log_content_type_id_c4bce8eb_fk_django_co FOREIGN
KEY (content_type_id)
REFERENCES public.django_content_type (id) MATCH SIMPLE
ON UPDATE NO ACTION
ON DELETE NO ACTION
DEFERRABLE INITIALLY DEFERRED;
CREATE INDEX IF NOT EXISTS django_admin_log_content_type_id_c4bce8eb
ON public.django_admin_log(content_type_id);

ALTER TABLE IF EXISTS public.django_admin_log


ADD CONSTRAINT django_admin_log_user_id_c564eba6_fk_users_user_id FOREIGN KEY
(user_id)
REFERENCES public.users_user (id) MATCH SIMPLE
ON UPDATE NO ACTION
ON DELETE NO ACTION
DEFERRABLE INITIALLY DEFERRED;
CREATE INDEX IF NOT EXISTS django_admin_log_user_id_c564eba6
ON public.django_admin_log(user_id);

ALTER TABLE IF EXISTS public.django_celery_beat_periodictask


ADD CONSTRAINT django_celery_beat_p_clocked_id_47a69f82_fk_django_ce FOREIGN
KEY (clocked_id)
REFERENCES public.django_celery_beat_clockedschedule (id) MATCH SIMPLE
ON UPDATE NO ACTION
ON DELETE NO ACTION
DEFERRABLE INITIALLY DEFERRED;
CREATE INDEX IF NOT EXISTS django_celery_beat_periodictask_clocked_id_47a69f82
ON public.django_celery_beat_periodictask(clocked_id);

ALTER TABLE IF EXISTS public.django_celery_beat_periodictask


ADD CONSTRAINT django_celery_beat_p_crontab_id_d3cba168_fk_django_ce FOREIGN
KEY (crontab_id)
REFERENCES public.django_celery_beat_crontabschedule (id) MATCH SIMPLE
ON UPDATE NO ACTION
ON DELETE NO ACTION
DEFERRABLE INITIALLY DEFERRED;
CREATE INDEX IF NOT EXISTS django_celery_beat_periodictask_crontab_id_d3cba168
ON public.django_celery_beat_periodictask(crontab_id);

ALTER TABLE IF EXISTS public.django_celery_beat_periodictask


ADD CONSTRAINT django_celery_beat_p_interval_id_a8ca27da_fk_django_ce FOREIGN
KEY (interval_id)
REFERENCES public.django_celery_beat_intervalschedule (id) MATCH SIMPLE
ON UPDATE NO ACTION
ON DELETE NO ACTION
DEFERRABLE INITIALLY DEFERRED;
CREATE INDEX IF NOT EXISTS django_celery_beat_periodictask_interval_id_a8ca27da
ON public.django_celery_beat_periodictask(interval_id);

ALTER TABLE IF EXISTS public.django_celery_beat_periodictask


ADD CONSTRAINT django_celery_beat_p_solar_id_a87ce72c_fk_django_ce FOREIGN KEY
(solar_id)
REFERENCES public.django_celery_beat_solarschedule (id) MATCH SIMPLE
ON UPDATE NO ACTION
ON DELETE NO ACTION
DEFERRABLE INITIALLY DEFERRED;
CREATE INDEX IF NOT EXISTS django_celery_beat_periodictask_solar_id_a87ce72c
ON public.django_celery_beat_periodictask(solar_id);

ALTER TABLE IF EXISTS public.django_rest_passwordreset_resetpasswordtoken


ADD CONSTRAINT django_rest_password_user_id_e8015b11_fk_users_use FOREIGN KEY
(user_id)
REFERENCES public.users_user (id) MATCH SIMPLE
ON UPDATE NO ACTION
ON DELETE NO ACTION
DEFERRABLE INITIALLY DEFERRED;
CREATE INDEX IF NOT EXISTS
django_rest_passwordreset_resetpasswordtoken_user_id_e8015b11
ON public.django_rest_passwordreset_resetpasswordtoken(user_id);

ALTER TABLE IF EXISTS public.file_payment_logs


ADD CONSTRAINT file_payment_logs_import_check_process_585c0ffd_fk_import_ch
FOREIGN KEY (import_check_processing_logs_id)
REFERENCES public.import_check_processing_logs (id) MATCH SIMPLE
ON UPDATE NO ACTION
ON DELETE NO ACTION
DEFERRABLE INITIALLY DEFERRED;
CREATE INDEX IF NOT EXISTS
file_payment_logs_import_check_processing_logs_id_585c0ffd
ON public.file_payment_logs(import_check_processing_logs_id);

ALTER TABLE IF EXISTS public.file_payment_logs


ADD CONSTRAINT file_payment_logs_tax_account_id_c23d3bf4_fk_tax_account_id
FOREIGN KEY (tax_account_id)
REFERENCES public.tax_account (id) MATCH SIMPLE
ON UPDATE NO ACTION
ON DELETE NO ACTION
DEFERRABLE INITIALLY DEFERRED;
CREATE INDEX IF NOT EXISTS file_payment_logs_tax_account_id_c23d3bf4
ON public.file_payment_logs(tax_account_id);

ALTER TABLE IF EXISTS public.import_address_logs


ADD CONSTRAINT import_address_logs_updated_by_id_3b1876ff_fk_users_user_id
FOREIGN KEY (updated_by_id)
REFERENCES public.users_user (id) MATCH SIMPLE
ON UPDATE NO ACTION
ON DELETE NO ACTION
DEFERRABLE INITIALLY DEFERRED;
CREATE INDEX IF NOT EXISTS import_address_logs_updated_by_id_3b1876ff
ON public.import_address_logs(updated_by_id);

ALTER TABLE IF EXISTS public.import_change_order_logs


ADD CONSTRAINT import_change_order__updated_by_id_9cdce649_fk_users_use FOREIGN
KEY (updated_by_id)
REFERENCES public.users_user (id) MATCH SIMPLE
ON UPDATE NO ACTION
ON DELETE NO ACTION
DEFERRABLE INITIALLY DEFERRED;
CREATE INDEX IF NOT EXISTS import_change_order_logs_updated_by_id_9cdce649
ON public.import_change_order_logs(updated_by_id);

ALTER TABLE IF EXISTS public.import_check_processing_logs


ADD CONSTRAINT import_check_process_batch_id_7c2405a4_fk_payment_b FOREIGN KEY
(batch_id)
REFERENCES public.payment_batch (id) MATCH SIMPLE
ON UPDATE NO ACTION
ON DELETE NO ACTION
DEFERRABLE INITIALLY DEFERRED;
CREATE INDEX IF NOT EXISTS import_check_processing_logs_batch_id_7c2405a4
ON public.import_check_processing_logs(batch_id);

ALTER TABLE IF EXISTS public.import_check_processing_logs


ADD CONSTRAINT import_check_process_updated_by_id_e353a022_fk_users_use FOREIGN
KEY (updated_by_id)
REFERENCES public.users_user (id) MATCH SIMPLE
ON UPDATE NO ACTION
ON DELETE NO ACTION
DEFERRABLE INITIALLY DEFERRED;
CREATE INDEX IF NOT EXISTS import_check_processing_logs_updated_by_id_e353a022
ON public.import_check_processing_logs(updated_by_id);

ALTER TABLE IF EXISTS public.import_tax_sale_logs


ADD CONSTRAINT import_tax_sale_logs_tax_sale_company_id_e85d91bf_fk_tax_sale_
FOREIGN KEY (tax_sale_company_id)
REFERENCES public.tax_sale_company (id) MATCH SIMPLE
ON UPDATE NO ACTION
ON DELETE NO ACTION
DEFERRABLE INITIALLY DEFERRED;
CREATE INDEX IF NOT EXISTS import_tax_sale_logs_tax_sale_company_id_e85d91bf
ON public.import_tax_sale_logs(tax_sale_company_id);

ALTER TABLE IF EXISTS public.import_tax_sale_logs


ADD CONSTRAINT import_tax_sale_logs_updated_by_id_6e23d456_fk_users_user_id
FOREIGN KEY (updated_by_id)
REFERENCES public.users_user (id) MATCH SIMPLE
ON UPDATE NO ACTION
ON DELETE NO ACTION
DEFERRABLE INITIALLY DEFERRED;
CREATE INDEX IF NOT EXISTS import_tax_sale_logs_updated_by_id_6e23d456
ON public.import_tax_sale_logs(updated_by_id);
ALTER TABLE IF EXISTS public.interest_change_logs
ADD CONSTRAINT interest_change_logs_user_id_d87ea2a4_fk_users_user_id FOREIGN
KEY (user_id)
REFERENCES public.users_user (id) MATCH SIMPLE
ON UPDATE NO ACTION
ON DELETE NO ACTION
DEFERRABLE INITIALLY DEFERRED;
CREATE INDEX IF NOT EXISTS interest_change_logs_user_id_d87ea2a4
ON public.interest_change_logs(user_id);

ALTER TABLE IF EXISTS public.mortgage_file_logs


ADD CONSTRAINT mortgage_file_logs_added_by_id_343d3ef7_fk_users_user_id FOREIGN
KEY (added_by_id)
REFERENCES public.users_user (id) MATCH SIMPLE
ON UPDATE NO ACTION
ON DELETE NO ACTION
DEFERRABLE INITIALLY DEFERRED;
CREATE INDEX IF NOT EXISTS mortgage_file_logs_added_by_id_343d3ef7
ON public.mortgage_file_logs(added_by_id);

ALTER TABLE IF EXISTS public.mortgage_file_logs


ADD CONSTRAINT mortgage_file_logs_mortgage_company_id_6a2fa675_fk_mortgage_
FOREIGN KEY (mortgage_company_id)
REFERENCES public.mortgage_company (id) MATCH SIMPLE
ON UPDATE NO ACTION
ON DELETE NO ACTION
DEFERRABLE INITIALLY DEFERRED;
CREATE INDEX IF NOT EXISTS mortgage_file_logs_mortgage_company_id_6a2fa675
ON public.mortgage_file_logs(mortgage_company_id);

ALTER TABLE IF EXISTS public.mortgage_file_logs


ADD CONSTRAINT mortgage_file_logs_receipt_id_418969eb_fk_receipt_id FOREIGN KEY
(receipt_id)
REFERENCES public.receipt (id) MATCH SIMPLE
ON UPDATE NO ACTION
ON DELETE NO ACTION
DEFERRABLE INITIALLY DEFERRED;
CREATE INDEX IF NOT EXISTS mortgage_file_logs_receipt_id_key
ON public.mortgage_file_logs(receipt_id);

ALTER TABLE IF EXISTS public.mortgage_payment_logs


ADD CONSTRAINT mortgage_payment_log_mortgage_file_logs_i_e22be35e_fk_mortgage_
FOREIGN KEY (mortgage_file_logs_id)
REFERENCES public.mortgage_file_logs (id) MATCH SIMPLE
ON UPDATE NO ACTION
ON DELETE NO ACTION
DEFERRABLE INITIALLY DEFERRED;
CREATE INDEX IF NOT EXISTS mortgage_payment_logs_mortgage_file_logs_id_e22be35e
ON public.mortgage_payment_logs(mortgage_file_logs_id);

ALTER TABLE IF EXISTS public.mortgage_payment_logs


ADD CONSTRAINT mortgage_payment_logs_tax_account_id_a375f74a_fk_tax_account_id
FOREIGN KEY (tax_account_id)
REFERENCES public.tax_account (id) MATCH SIMPLE
ON UPDATE NO ACTION
ON DELETE NO ACTION
DEFERRABLE INITIALLY DEFERRED;
CREATE INDEX IF NOT EXISTS mortgage_payment_logs_tax_account_id_a375f74a
ON public.mortgage_payment_logs(tax_account_id);

ALTER TABLE IF EXISTS public.payment


ADD CONSTRAINT payment_receipt_id_2cd29326_fk_receipt_id FOREIGN KEY
(receipt_id)
REFERENCES public.receipt (id) MATCH SIMPLE
ON UPDATE NO ACTION
ON DELETE NO ACTION
DEFERRABLE INITIALLY DEFERRED;
CREATE INDEX IF NOT EXISTS payment_receipt_id_2cd29326
ON public.payment(receipt_id);

ALTER TABLE IF EXISTS public.payment


ADD CONSTRAINT payment_refund_id_2c69f882_fk_refund_id FOREIGN KEY (refund_id)
REFERENCES public.refund (id) MATCH SIMPLE
ON UPDATE NO ACTION
ON DELETE NO ACTION
DEFERRABLE INITIALLY DEFERRED;
CREATE INDEX IF NOT EXISTS payment_refund_id_2c69f882
ON public.payment(refund_id);

ALTER TABLE IF EXISTS public.payment


ADD CONSTRAINT payment_tax_account_id_91a49394_fk_tax_account_id FOREIGN KEY
(tax_account_id)
REFERENCES public.tax_account (id) MATCH SIMPLE
ON UPDATE NO ACTION
ON DELETE NO ACTION
DEFERRABLE INITIALLY DEFERRED;
CREATE INDEX IF NOT EXISTS payment_tax_account_id_91a49394
ON public.payment(tax_account_id);

ALTER TABLE IF EXISTS public.payment_batch


ADD CONSTRAINT payment_batch_closing_month_id_512453ca_fk_closing_month_id
FOREIGN KEY (closing_month_id)
REFERENCES public.closing_month (id) MATCH SIMPLE
ON UPDATE NO ACTION
ON DELETE NO ACTION
DEFERRABLE INITIALLY DEFERRED;
CREATE INDEX IF NOT EXISTS payment_batch_closing_month_id_512453ca
ON public.payment_batch(closing_month_id);

ALTER TABLE IF EXISTS public.payment_batch


ADD CONSTRAINT payment_batch_opened_by_id_6a2ab9af_fk_users_user_id FOREIGN KEY
(opened_by_id)
REFERENCES public.users_user (id) MATCH SIMPLE
ON UPDATE NO ACTION
ON DELETE NO ACTION
DEFERRABLE INITIALLY DEFERRED;
CREATE INDEX IF NOT EXISTS payment_batch_opened_by_id_6a2ab9af
ON public.payment_batch(opened_by_id);

ALTER TABLE IF EXISTS public.payment_batch


ADD CONSTRAINT payment_batch_verified_by_id_d11ced47_fk_users_user_id FOREIGN
KEY (verified_by_id)
REFERENCES public.users_user (id) MATCH SIMPLE
ON UPDATE NO ACTION
ON DELETE NO ACTION
DEFERRABLE INITIALLY DEFERRED;
CREATE INDEX IF NOT EXISTS payment_batch_verified_by_id_d11ced47
ON public.payment_batch(verified_by_id);

ALTER TABLE IF EXISTS public.pdf_attachment


ADD CONSTRAINT pdf_attachment_user_id_486b2510_fk_users_user_id FOREIGN KEY
(user_id)
REFERENCES public.users_user (id) MATCH SIMPLE
ON UPDATE NO ACTION
ON DELETE NO ACTION
DEFERRABLE INITIALLY DEFERRED;
CREATE INDEX IF NOT EXISTS pdf_attachment_user_id_486b2510
ON public.pdf_attachment(user_id);

ALTER TABLE IF EXISTS public.property_detail


ADD CONSTRAINT property_detail_ward_id_1c62883e_fk_ward_id FOREIGN KEY
(ward_id)
REFERENCES public.ward (id) MATCH SIMPLE
ON UPDATE NO ACTION
ON DELETE NO ACTION
DEFERRABLE INITIALLY DEFERRED;
CREATE INDEX IF NOT EXISTS property_detail_ward_id_1c62883e
ON public.property_detail(ward_id);

ALTER TABLE IF EXISTS public.property_item


ADD CONSTRAINT property_item_change_order_id_f1527cd1_fk_change_order_id
FOREIGN KEY (change_order_id)
REFERENCES public.change_order (id) MATCH SIMPLE
ON UPDATE NO ACTION
ON DELETE NO ACTION
DEFERRABLE INITIALLY DEFERRED;
CREATE INDEX IF NOT EXISTS property_item_change_order_id_f1527cd1
ON public.property_item(change_order_id);

ALTER TABLE IF EXISTS public.property_item


ADD CONSTRAINT property_item_property_class_id_1ae72d34_fk_property_class_id
FOREIGN KEY (property_class_id)
REFERENCES public.property_class (id) MATCH SIMPLE
ON UPDATE NO ACTION
ON DELETE NO ACTION
DEFERRABLE INITIALLY DEFERRED;
CREATE INDEX IF NOT EXISTS property_item_property_class_id_1ae72d34
ON public.property_item(property_class_id);

ALTER TABLE IF EXISTS public.property_item


ADD CONSTRAINT property_item_tax_account_id_39b57844_fk_tax_account_id FOREIGN
KEY (tax_account_id)
REFERENCES public.tax_account (id) MATCH SIMPLE
ON UPDATE NO ACTION
ON DELETE NO ACTION
DEFERRABLE INITIALLY DEFERRED;
CREATE INDEX IF NOT EXISTS property_item_tax_account_id_39b57844
ON public.property_item(tax_account_id);

ALTER TABLE IF EXISTS public.property_item_tax_code


ADD CONSTRAINT property_item_tax_co_property_item_id_3560168b_fk_property_
FOREIGN KEY (property_item_id)
REFERENCES public.property_item (id) MATCH SIMPLE
ON UPDATE NO ACTION
ON DELETE NO ACTION
DEFERRABLE INITIALLY DEFERRED;
CREATE INDEX IF NOT EXISTS property_item_tax_code_property_item_id_3560168b
ON public.property_item_tax_code(property_item_id);

ALTER TABLE IF EXISTS public.property_item_tax_code


ADD CONSTRAINT property_item_tax_co_tax_code_year_id_7545bd01_fk_tax_code_
FOREIGN KEY (tax_code_year_id)
REFERENCES public.tax_code_by_year (id) MATCH SIMPLE
ON UPDATE NO ACTION
ON DELETE NO ACTION
DEFERRABLE INITIALLY DEFERRED;
CREATE INDEX IF NOT EXISTS property_item_tax_code_tax_code_year_id_7545bd01
ON public.property_item_tax_code(tax_code_year_id);

ALTER TABLE IF EXISTS public.receipt


ADD CONSTRAINT receipt_batch_id_0f8bcef5_fk_payment_batch_id FOREIGN KEY
(batch_id)
REFERENCES public.payment_batch (id) MATCH SIMPLE
ON UPDATE NO ACTION
ON DELETE NO ACTION
DEFERRABLE INITIALLY DEFERRED;
CREATE INDEX IF NOT EXISTS receipt_batch_id_0f8bcef5
ON public.receipt(batch_id);

ALTER TABLE IF EXISTS public.receipt


ADD CONSTRAINT receipt_refund_batch_id_911d1a25_fk_payment_batch_id FOREIGN KEY
(refund_batch_id)
REFERENCES public.payment_batch (id) MATCH SIMPLE
ON UPDATE NO ACTION
ON DELETE NO ACTION
DEFERRABLE INITIALLY DEFERRED;
CREATE INDEX IF NOT EXISTS receipt_refund_batch_id_911d1a25
ON public.receipt(refund_batch_id);

ALTER TABLE IF EXISTS public.receipt_dummy


ADD CONSTRAINT receipt_dummy_user_id_d1214cba_fk_users_user_id FOREIGN KEY
(user_id)
REFERENCES public.users_user (id) MATCH SIMPLE
ON UPDATE NO ACTION
ON DELETE NO ACTION
DEFERRABLE INITIALLY DEFERRED;
CREATE INDEX IF NOT EXISTS receipt_dummy_user_id_d1214cba
ON public.receipt_dummy(user_id);

ALTER TABLE IF EXISTS public.receipt_logs


ADD CONSTRAINT receipt_logs_logged_by_id_f39ce3a8_fk_users_user_id FOREIGN KEY
(logged_by_id)
REFERENCES public.users_user (id) MATCH SIMPLE
ON UPDATE NO ACTION
ON DELETE NO ACTION
DEFERRABLE INITIALLY DEFERRED;
CREATE INDEX IF NOT EXISTS receipt_logs_logged_by_id_f39ce3a8
ON public.receipt_logs(logged_by_id);

ALTER TABLE IF EXISTS public.receipt_logs


ADD CONSTRAINT receipt_logs_receipt_id_ac0c37f4_fk_receipt_id FOREIGN KEY
(receipt_id)
REFERENCES public.receipt (id) MATCH SIMPLE
ON UPDATE NO ACTION
ON DELETE NO ACTION
DEFERRABLE INITIALLY DEFERRED;
CREATE INDEX IF NOT EXISTS receipt_logs_receipt_id_ac0c37f4
ON public.receipt_logs(receipt_id);

ALTER TABLE IF EXISTS public.refund


ADD CONSTRAINT refund_change_order_id_5923caa9_fk_change_order_id FOREIGN KEY
(change_order_id)
REFERENCES public.change_order (id) MATCH SIMPLE
ON UPDATE NO ACTION
ON DELETE NO ACTION
DEFERRABLE INITIALLY DEFERRED;
CREATE INDEX IF NOT EXISTS refund_change_order_id_5923caa9
ON public.refund(change_order_id);

ALTER TABLE IF EXISTS public.refund


ADD CONSTRAINT refund_refund_batch_id_f5708396_fk_payment_batch_id FOREIGN KEY
(refund_batch_id)
REFERENCES public.payment_batch (id) MATCH SIMPLE
ON UPDATE NO ACTION
ON DELETE NO ACTION
DEFERRABLE INITIALLY DEFERRED;
CREATE INDEX IF NOT EXISTS refund_refund_batch_id_f5708396
ON public.refund(refund_batch_id);

ALTER TABLE IF EXISTS public.refund


ADD CONSTRAINT refund_refunded_by_id_a8205c77_fk_users_user_id FOREIGN KEY
(refunded_by_id)
REFERENCES public.users_user (id) MATCH SIMPLE
ON UPDATE NO ACTION
ON DELETE NO ACTION
DEFERRABLE INITIALLY DEFERRED;
CREATE INDEX IF NOT EXISTS refund_refunded_by_id_a8205c77
ON public.refund(refunded_by_id);
ALTER TABLE IF EXISTS public.refund
ADD CONSTRAINT refund_refunded_receipt_id_4fecf38e_fk_receipt_id FOREIGN KEY
(refunded_receipt_id)
REFERENCES public.receipt (id) MATCH SIMPLE
ON UPDATE NO ACTION
ON DELETE NO ACTION
DEFERRABLE INITIALLY DEFERRED;
CREATE INDEX IF NOT EXISTS refund_refunded_receipt_id_4fecf38e
ON public.refund(refunded_receipt_id);

ALTER TABLE IF EXISTS public.refund


ADD CONSTRAINT refund_voided_by_id_db33b6bc_fk_users_user_id FOREIGN KEY
(voided_by_id)
REFERENCES public.users_user (id) MATCH SIMPLE
ON UPDATE NO ACTION
ON DELETE NO ACTION
DEFERRABLE INITIALLY DEFERRED;
CREATE INDEX IF NOT EXISTS refund_voided_by_id_db33b6bc
ON public.refund(voided_by_id);

ALTER TABLE IF EXISTS public.refund


ADD CONSTRAINT refund_voided_refund_closin_12abfcea_fk_closing_m FOREIGN KEY
(voided_refund_closing_month_id)
REFERENCES public.closing_month (id) MATCH SIMPLE
ON UPDATE NO ACTION
ON DELETE NO ACTION
DEFERRABLE INITIALLY DEFERRED;
CREATE INDEX IF NOT EXISTS refund_voided_refund_closing_month_id_12abfcea
ON public.refund(voided_refund_closing_month_id);

ALTER TABLE IF EXISTS public.report


ADD CONSTRAINT report_generated_by_id_56877108_fk_users_user_id FOREIGN KEY
(generated_by_id)
REFERENCES public.users_user (id) MATCH SIMPLE
ON UPDATE NO ACTION
ON DELETE NO ACTION
DEFERRABLE INITIALLY DEFERRED;
CREATE INDEX IF NOT EXISTS report_user_id_07ece6b6
ON public.report(generated_by_id);

ALTER TABLE IF EXISTS public.report


ADD CONSTRAINT report_report_group_id_479b0fc6_fk_report_group_id FOREIGN KEY
(report_group_id)
REFERENCES public.report_group (id) MATCH SIMPLE
ON UPDATE NO ACTION
ON DELETE NO ACTION
DEFERRABLE INITIALLY DEFERRED;
CREATE INDEX IF NOT EXISTS report_report_group_id_479b0fc6
ON public.report(report_group_id);

ALTER TABLE IF EXISTS public.report_section


ADD CONSTRAINT report_section_report_id_808e5930_fk_report_id FOREIGN KEY
(report_id)
REFERENCES public.report (id) MATCH SIMPLE
ON UPDATE NO ACTION
ON DELETE NO ACTION
DEFERRABLE INITIALLY DEFERRED;
CREATE INDEX IF NOT EXISTS report_section_report_id_808e5930
ON public.report_section(report_id);

ALTER TABLE IF EXISTS public.report_section


ADD CONSTRAINT report_section_section_id_1a46f580_fk_section_id FOREIGN KEY
(section_id)
REFERENCES public.section (id) MATCH SIMPLE
ON UPDATE NO ACTION
ON DELETE NO ACTION
DEFERRABLE INITIALLY DEFERRED;
CREATE INDEX IF NOT EXISTS report_section_section_id_1a46f580
ON public.report_section(section_id);

ALTER TABLE IF EXISTS public.report_section_transaction_type


ADD CONSTRAINT report_section_trans_report_section_id_c26a1fa2_fk_report_se
FOREIGN KEY (report_section_id)
REFERENCES public.report_section (id) MATCH SIMPLE
ON UPDATE NO ACTION
ON DELETE NO ACTION
DEFERRABLE INITIALLY DEFERRED;
CREATE INDEX IF NOT EXISTS
report_section_transaction_type_report_section_id_c26a1fa2
ON public.report_section_transaction_type(report_section_id);

ALTER TABLE IF EXISTS public.report_section_transaction_type


ADD CONSTRAINT report_section_trans_transaction_type_id_ea6a2322_fk_transacti
FOREIGN KEY (transaction_type_id)
REFERENCES public.transaction_type (id) MATCH SIMPLE
ON UPDATE NO ACTION
ON DELETE NO ACTION
DEFERRABLE INITIALLY DEFERRED;
CREATE INDEX IF NOT EXISTS
report_section_transaction_type_transaction_type_id_ea6a2322
ON public.report_section_transaction_type(transaction_type_id);

ALTER TABLE IF EXISTS public.tax_account


ADD CONSTRAINT tax_account_mortgage_company_id_bf1a7c5d_fk_mortgage_company_id
FOREIGN KEY (mortgage_company_id)
REFERENCES public.mortgage_company (id) MATCH SIMPLE
ON UPDATE NO ACTION
ON DELETE NO ACTION
DEFERRABLE INITIALLY DEFERRED;
CREATE INDEX IF NOT EXISTS tax_account_mortgage_company_id_bf1a7c5d
ON public.tax_account(mortgage_company_id);

ALTER TABLE IF EXISTS public.tax_account


ADD CONSTRAINT tax_account_property_detail_id_7d9a851d_fk_property_detail_id
FOREIGN KEY (property_detail_id)
REFERENCES public.property_detail (id) MATCH SIMPLE
ON UPDATE NO ACTION
ON DELETE NO ACTION
DEFERRABLE INITIALLY DEFERRED;
CREATE INDEX IF NOT EXISTS tax_account_property_detail_id_7d9a851d
ON public.tax_account(property_detail_id);

ALTER TABLE IF EXISTS public.tax_account


ADD CONSTRAINT tax_account_property_type_id_e60baeb8_fk_property_type_id
FOREIGN KEY (property_type_id)
REFERENCES public.property_type (id) MATCH SIMPLE
ON UPDATE NO ACTION
ON DELETE NO ACTION
DEFERRABLE INITIALLY DEFERRED;
CREATE INDEX IF NOT EXISTS tax_account_property_type_id_e60baeb8
ON public.tax_account(property_type_id);

ALTER TABLE IF EXISTS public.tax_account


ADD CONSTRAINT tax_account_updated_by_id_f80bf39f_fk_users_user_id FOREIGN KEY
(updated_by_id)
REFERENCES public.users_user (id) MATCH SIMPLE
ON UPDATE NO ACTION
ON DELETE NO ACTION
DEFERRABLE INITIALLY DEFERRED;
CREATE INDEX IF NOT EXISTS tax_account_updated_by_id_f80bf39f
ON public.tax_account(updated_by_id);

ALTER TABLE IF EXISTS public.tax_account_address_history


ADD CONSTRAINT tax_account_address__import_address_log_i_c8747b28_fk_import_ad
FOREIGN KEY (import_address_log_id)
REFERENCES public.import_address_logs (id) MATCH SIMPLE
ON UPDATE NO ACTION
ON DELETE NO ACTION
DEFERRABLE INITIALLY DEFERRED;
CREATE INDEX IF NOT EXISTS
tax_account_address_history_import_address_log_id_c8747b28
ON public.tax_account_address_history(import_address_log_id);

ALTER TABLE IF EXISTS public.tax_account_address_history


ADD CONSTRAINT tax_account_address__tax_account_id_efeb2e18_fk_tax_accou
FOREIGN KEY (tax_account_id)
REFERENCES public.tax_account (id) MATCH SIMPLE
ON UPDATE NO ACTION
ON DELETE NO ACTION
DEFERRABLE INITIALLY DEFERRED;
CREATE INDEX IF NOT EXISTS tax_account_address_history_tax_account_id_efeb2e18
ON public.tax_account_address_history(tax_account_id);

ALTER TABLE IF EXISTS public.tax_account_address_history


ADD CONSTRAINT tax_account_address__updated_by_id_0a5b5287_fk_users_use FOREIGN
KEY (updated_by_id)
REFERENCES public.users_user (id) MATCH SIMPLE
ON UPDATE NO ACTION
ON DELETE NO ACTION
DEFERRABLE INITIALLY DEFERRED;
CREATE INDEX IF NOT EXISTS tax_account_address_history_updated_by_id_0a5b5287
ON public.tax_account_address_history(updated_by_id);

ALTER TABLE IF EXISTS public.tax_account_attachment


ADD CONSTRAINT tax_account_attachment_added_by_id_584fe11a_fk_users_user_id
FOREIGN KEY (added_by_id)
REFERENCES public.users_user (id) MATCH SIMPLE
ON UPDATE NO ACTION
ON DELETE NO ACTION
DEFERRABLE INITIALLY DEFERRED;
CREATE INDEX IF NOT EXISTS tax_account_attachment_added_by_id_584fe11a
ON public.tax_account_attachment(added_by_id);

ALTER TABLE IF EXISTS public.tax_account_attachment_tax_accounts


ADD CONSTRAINT tax_account_attachme_taxaccount_id_c262e496_fk_tax_accou FOREIGN
KEY (taxaccount_id)
REFERENCES public.tax_account (id) MATCH SIMPLE
ON UPDATE NO ACTION
ON DELETE NO ACTION
DEFERRABLE INITIALLY DEFERRED;
CREATE INDEX IF NOT EXISTS
tax_account_attachment_tax_accounts_taxaccount_id_c262e496
ON public.tax_account_attachment_tax_accounts(taxaccount_id);

ALTER TABLE IF EXISTS public.tax_account_attachment_tax_accounts


ADD CONSTRAINT tax_account_attachme_taxaccountattachment_1ac5f714_fk_tax_accou
FOREIGN KEY (taxaccountattachment_id)
REFERENCES public.tax_account_attachment (id) MATCH SIMPLE
ON UPDATE NO ACTION
ON DELETE NO ACTION
DEFERRABLE INITIALLY DEFERRED;
CREATE INDEX IF NOT EXISTS
tax_account_attachment_tax_taxaccountattachment_id_1ac5f714
ON public.tax_account_attachment_tax_accounts(taxaccountattachment_id);

ALTER TABLE IF EXISTS public.tax_account_delinquents_tracking


ADD CONSTRAINT tax_account_delinque_created_by_id_eb97d600_fk_users_use FOREIGN
KEY (created_by_id)
REFERENCES public.users_user (id) MATCH SIMPLE
ON UPDATE NO ACTION
ON DELETE NO ACTION
DEFERRABLE INITIALLY DEFERRED;
CREATE INDEX IF NOT EXISTS tax_account_delinquents_tracking_created_by_id_eb97d600
ON public.tax_account_delinquents_tracking(created_by_id);

ALTER TABLE IF EXISTS public.tax_account_delinquents_tracking


ADD CONSTRAINT tax_account_delinque_tax_account_id_8b9ffa84_fk_tax_accou
FOREIGN KEY (tax_account_id)
REFERENCES public.tax_account (id) MATCH SIMPLE
ON UPDATE NO ACTION
ON DELETE NO ACTION
DEFERRABLE INITIALLY DEFERRED;
CREATE INDEX IF NOT EXISTS tax_account_delinquents_tracking_tax_account_id_8b9ffa84
ON public.tax_account_delinquents_tracking(tax_account_id);
ALTER TABLE IF EXISTS public.tax_account_log
ADD CONSTRAINT tax_account_log_created_by_id_2aab9da1_fk_users_user_id FOREIGN
KEY (created_by_id)
REFERENCES public.users_user (id) MATCH SIMPLE
ON UPDATE NO ACTION
ON DELETE NO ACTION
DEFERRABLE INITIALLY DEFERRED;
CREATE INDEX IF NOT EXISTS tax_account_log_created_by_id_2aab9da1
ON public.tax_account_log(created_by_id);

ALTER TABLE IF EXISTS public.tax_account_log


ADD CONSTRAINT tax_account_log_log_type_id_2ea1c8ae_fk_log_type_id FOREIGN KEY
(log_type_id)
REFERENCES public.log_type (id) MATCH SIMPLE
ON UPDATE NO ACTION
ON DELETE NO ACTION
DEFERRABLE INITIALLY DEFERRED;
CREATE INDEX IF NOT EXISTS tax_account_log_log_type_id_2ea1c8ae
ON public.tax_account_log(log_type_id);

ALTER TABLE IF EXISTS public.tax_account_log


ADD CONSTRAINT tax_account_log_tax_account_id_4d7d0c4c_fk_tax_account_id
FOREIGN KEY (tax_account_id)
REFERENCES public.tax_account (id) MATCH SIMPLE
ON UPDATE NO ACTION
ON DELETE NO ACTION
DEFERRABLE INITIALLY DEFERRED;
CREATE INDEX IF NOT EXISTS tax_account_log_tax_account_id_4d7d0c4c
ON public.tax_account_log(tax_account_id);

ALTER TABLE IF EXISTS public.tax_account_note


ADD CONSTRAINT tax_account_note_created_by_id_ee668eb6_fk_users_user_id FOREIGN
KEY (created_by_id)
REFERENCES public.users_user (id) MATCH SIMPLE
ON UPDATE NO ACTION
ON DELETE NO ACTION
DEFERRABLE INITIALLY DEFERRED;
CREATE INDEX IF NOT EXISTS tax_account_note_created_by_id_ee668eb6
ON public.tax_account_note(created_by_id);

ALTER TABLE IF EXISTS public.tax_account_note


ADD CONSTRAINT tax_account_note_tax_account_id_6b8c3f18_fk_tax_account_id
FOREIGN KEY (tax_account_id)
REFERENCES public.tax_account (id) MATCH SIMPLE
ON UPDATE NO ACTION
ON DELETE NO ACTION
DEFERRABLE INITIALLY DEFERRED;
CREATE INDEX IF NOT EXISTS tax_account_note_tax_account_id_6b8c3f18
ON public.tax_account_note(tax_account_id);

ALTER TABLE IF EXISTS public.tax_account_other_owner


ADD CONSTRAINT tax_account_other_ow_tax_account_id_6f895618_fk_tax_accou
FOREIGN KEY (tax_account_id)
REFERENCES public.tax_account (id) MATCH SIMPLE
ON UPDATE NO ACTION
ON DELETE NO ACTION
DEFERRABLE INITIALLY DEFERRED;
CREATE INDEX IF NOT EXISTS tax_account_other_owner_tax_account_id_6f895618
ON public.tax_account_other_owner(tax_account_id);

ALTER TABLE IF EXISTS public.tax_account_other_owner


ADD CONSTRAINT tax_account_other_owner_created_by_id_a648ce54_fk_users_user_id
FOREIGN KEY (created_by_id)
REFERENCES public.users_user (id) MATCH SIMPLE
ON UPDATE NO ACTION
ON DELETE NO ACTION
DEFERRABLE INITIALLY DEFERRED;
CREATE INDEX IF NOT EXISTS tax_account_other_owner_created_by_id_a648ce54
ON public.tax_account_other_owner(created_by_id);

ALTER TABLE IF EXISTS public.tax_account_prior_year_logs


ADD CONSTRAINT tax_account_prior_ye_tax_account_id_264c19a5_fk_tax_accou
FOREIGN KEY (tax_account_id)
REFERENCES public.tax_account (id) MATCH SIMPLE
ON UPDATE NO ACTION
ON DELETE NO ACTION
DEFERRABLE INITIALLY DEFERRED;
CREATE INDEX IF NOT EXISTS tax_account_prior_year_logs_tax_account_id_264c19a5
ON public.tax_account_prior_year_logs(tax_account_id);

ALTER TABLE IF EXISTS public.tax_account_redemption_linked


ADD CONSTRAINT tax_account_redempti_lien_tax_account_id_52a1c961_fk_tax_accou
FOREIGN KEY (lien_tax_account_id)
REFERENCES public.tax_account (id) MATCH SIMPLE
ON UPDATE NO ACTION
ON DELETE NO ACTION
DEFERRABLE INITIALLY DEFERRED;
CREATE INDEX IF NOT EXISTS
tax_account_redemption_linked_lien_tax_account_id_52a1c961
ON public.tax_account_redemption_linked(lien_tax_account_id);

ALTER TABLE IF EXISTS public.tax_account_redemption_linked


ADD CONSTRAINT tax_account_redempti_linked_by_id_7826e7b1_fk_users_use FOREIGN
KEY (linked_by_id)
REFERENCES public.users_user (id) MATCH SIMPLE
ON UPDATE NO ACTION
ON DELETE NO ACTION
DEFERRABLE INITIALLY DEFERRED;
CREATE INDEX IF NOT EXISTS tax_account_redemption_linked_linked_by_id_7826e7b1
ON public.tax_account_redemption_linked(linked_by_id);

ALTER TABLE IF EXISTS public.tax_account_redemption_linked


ADD CONSTRAINT tax_account_redempti_linked_tax_account_i_18f7b165_fk_tax_accou
FOREIGN KEY (linked_tax_account_id)
REFERENCES public.tax_account (id) MATCH SIMPLE
ON UPDATE NO ACTION
ON DELETE NO ACTION
DEFERRABLE INITIALLY DEFERRED;
CREATE INDEX IF NOT EXISTS
tax_account_redemption_linked_linked_tax_account_id_18f7b165
ON public.tax_account_redemption_linked(linked_tax_account_id);

ALTER TABLE IF EXISTS public.tax_account_refund


ADD CONSTRAINT tax_account_refund_refund_id_851f0621_fk_refund_id FOREIGN KEY
(refund_id)
REFERENCES public.refund (id) MATCH SIMPLE
ON UPDATE NO ACTION
ON DELETE NO ACTION
DEFERRABLE INITIALLY DEFERRED;
CREATE INDEX IF NOT EXISTS tax_account_refund_refund_id_851f0621
ON public.tax_account_refund(refund_id);

ALTER TABLE IF EXISTS public.tax_account_refund


ADD CONSTRAINT tax_account_refund_tax_account_id_a2c64acc_fk_tax_account_id
FOREIGN KEY (tax_account_id)
REFERENCES public.tax_account (id) MATCH SIMPLE
ON UPDATE NO ACTION
ON DELETE NO ACTION
DEFERRABLE INITIALLY DEFERRED;
CREATE INDEX IF NOT EXISTS tax_account_refund_tax_account_id_a2c64acc
ON public.tax_account_refund(tax_account_id);

ALTER TABLE IF EXISTS public.tax_account_sale


ADD CONSTRAINT tax_account_sale_bidder_id_b565ce68_fk_bidder_id FOREIGN KEY
(bidder_id)
REFERENCES public.bidder (id) MATCH SIMPLE
ON UPDATE NO ACTION
ON DELETE NO ACTION
DEFERRABLE INITIALLY DEFERRED;
CREATE INDEX IF NOT EXISTS tax_account_sale_bidder_id_b565ce68
ON public.tax_account_sale(bidder_id);

ALTER TABLE IF EXISTS public.tax_account_sale


ADD CONSTRAINT tax_account_sale_payment_id_e5243547_fk_payment_id FOREIGN KEY
(payment_id)
REFERENCES public.payment (id) MATCH SIMPLE
ON UPDATE NO ACTION
ON DELETE NO ACTION
DEFERRABLE INITIALLY DEFERRED;
CREATE INDEX IF NOT EXISTS tax_account_sale_payment_id_key
ON public.tax_account_sale(payment_id);

ALTER TABLE IF EXISTS public.tax_account_sale


ADD CONSTRAINT tax_account_sale_tax_account_id_9f44a2b1_fk_tax_account_id
FOREIGN KEY (tax_account_id)
REFERENCES public.tax_account (id) MATCH SIMPLE
ON UPDATE NO ACTION
ON DELETE NO ACTION
DEFERRABLE INITIALLY DEFERRED;
CREATE INDEX IF NOT EXISTS tax_account_sale_tax_account_id_9f44a2b1
ON public.tax_account_sale(tax_account_id);

ALTER TABLE IF EXISTS public.tax_code


ADD CONSTRAINT tax_code_receiving_entity_id_01522f31_fk_receiving_entity_id
FOREIGN KEY (receiving_entity_id)
REFERENCES public.receiving_entity (id) MATCH SIMPLE
ON UPDATE NO ACTION
ON DELETE NO ACTION
DEFERRABLE INITIALLY DEFERRED;
CREATE INDEX IF NOT EXISTS tax_code_receiving_entity_id_01522f31
ON public.tax_code(receiving_entity_id);

ALTER TABLE IF EXISTS public.tax_code


ADD CONSTRAINT tax_code_tax_code_group_id_5cd794a9_fk_tax_code_group_id FOREIGN
KEY (tax_code_group_id)
REFERENCES public.tax_code_group (id) MATCH SIMPLE
ON UPDATE NO ACTION
ON DELETE NO ACTION
DEFERRABLE INITIALLY DEFERRED;
CREATE INDEX IF NOT EXISTS tax_code_tax_code_group_id_5cd794a9
ON public.tax_code(tax_code_group_id);

ALTER TABLE IF EXISTS public.tax_code_by_year


ADD CONSTRAINT tax_code_by_year_tax_code_id_701e630b_fk_tax_code_id FOREIGN KEY
(tax_code_id)
REFERENCES public.tax_code (id) MATCH SIMPLE
ON UPDATE NO ACTION
ON DELETE NO ACTION
DEFERRABLE INITIALLY DEFERRED;
CREATE INDEX IF NOT EXISTS tax_code_by_year_tax_code_id_701e630b
ON public.tax_code_by_year(tax_code_id);

ALTER TABLE IF EXISTS public.tax_log_view


ADD CONSTRAINT tax_log_view_generated_by_id_86b16126_fk_users_user_id FOREIGN
KEY (generated_by_id)
REFERENCES public.users_user (id) MATCH SIMPLE
ON UPDATE NO ACTION
ON DELETE NO ACTION
DEFERRABLE INITIALLY DEFERRED;
CREATE INDEX IF NOT EXISTS tax_log_view_generated_by_id_86b16126
ON public.tax_log_view(generated_by_id);

ALTER TABLE IF EXISTS public.tax_roll_logs


ADD CONSTRAINT tax_roll_logs_added_by_id_c7f54c74_fk_users_user_id FOREIGN KEY
(added_by_id)
REFERENCES public.users_user (id) MATCH SIMPLE
ON UPDATE NO ACTION
ON DELETE NO ACTION
DEFERRABLE INITIALLY DEFERRED;
CREATE INDEX IF NOT EXISTS tax_roll_logs_added_by_id_c7f54c74
ON public.tax_roll_logs(added_by_id);

ALTER TABLE IF EXISTS public.tax_sale_bidder


ADD CONSTRAINT tax_sale_bidder_bidder_id_d5460a9b_fk_bidder_id FOREIGN KEY
(bidder_id)
REFERENCES public.bidder (id) MATCH SIMPLE
ON UPDATE NO ACTION
ON DELETE NO ACTION
DEFERRABLE INITIALLY DEFERRED;
CREATE INDEX IF NOT EXISTS tax_sale_bidder_bidder_id_d5460a9b
ON public.tax_sale_bidder(bidder_id);

ALTER TABLE IF EXISTS public.tax_sale_payment_log


ADD CONSTRAINT tax_sale_payment_log_created_by_id_101b3b55_fk_users_user_id
FOREIGN KEY (created_by_id)
REFERENCES public.users_user (id) MATCH SIMPLE
ON UPDATE NO ACTION
ON DELETE NO ACTION
DEFERRABLE INITIALLY DEFERRED;
CREATE INDEX IF NOT EXISTS tax_sale_payment_log_created_by_id_101b3b55
ON public.tax_sale_payment_log(created_by_id);

ALTER TABLE IF EXISTS public.tax_sale_payment_log


ADD CONSTRAINT tax_sale_payment_log_tax_account_id_278455bc_fk_tax_account_id
FOREIGN KEY (tax_account_id)
REFERENCES public.tax_account (id) MATCH SIMPLE
ON UPDATE NO ACTION
ON DELETE NO ACTION
DEFERRABLE INITIALLY DEFERRED;
CREATE INDEX IF NOT EXISTS tax_sale_payment_log_tax_account_id_278455bc
ON public.tax_sale_payment_log(tax_account_id);

ALTER TABLE IF EXISTS public.transaction_breakdown


ADD CONSTRAINT transaction_breakdow_change_order_id_d3bc1338_fk_change_or
FOREIGN KEY (change_order_id)
REFERENCES public.change_order (id) MATCH SIMPLE
ON UPDATE NO ACTION
ON DELETE NO ACTION
DEFERRABLE INITIALLY DEFERRED;
CREATE INDEX IF NOT EXISTS transaction_breakdown_change_order_id_d3bc1338
ON public.transaction_breakdown(change_order_id);

ALTER TABLE IF EXISTS public.transaction_breakdown


ADD CONSTRAINT transaction_breakdow_tax_code_year_id_2d7db36a_fk_tax_code_
FOREIGN KEY (tax_code_year_id)
REFERENCES public.tax_code_by_year (id) MATCH SIMPLE
ON UPDATE NO ACTION
ON DELETE NO ACTION
DEFERRABLE INITIALLY DEFERRED;
CREATE INDEX IF NOT EXISTS transaction_breakdown_tax_code_year_id_2d7db36a
ON public.transaction_breakdown(tax_code_year_id);

ALTER TABLE IF EXISTS public.transaction_breakdown


ADD CONSTRAINT transaction_breakdow_transaction_type_id_c1d225dd_fk_transacti
FOREIGN KEY (transaction_type_id)
REFERENCES public.transaction_type (id) MATCH SIMPLE
ON UPDATE NO ACTION
ON DELETE NO ACTION
DEFERRABLE INITIALLY DEFERRED;
CREATE INDEX IF NOT EXISTS transaction_breakdown_transaction_type_id_c1d225dd
ON public.transaction_breakdown(transaction_type_id);

ALTER TABLE IF EXISTS public.transaction_breakdown


ADD CONSTRAINT transaction_breakdown_payment_id_3425eab2_fk_payment_id FOREIGN
KEY (payment_id)
REFERENCES public.payment (id) MATCH SIMPLE
ON UPDATE NO ACTION
ON DELETE NO ACTION
DEFERRABLE INITIALLY DEFERRED;
CREATE INDEX IF NOT EXISTS transaction_breakdown_payment_id_3425eab2
ON public.transaction_breakdown(payment_id);

ALTER TABLE IF EXISTS public.transaction_breakdown


ADD CONSTRAINT transaction_breakdown_tax_account_id_c19ccb66_fk_tax_account_id
FOREIGN KEY (tax_account_id)
REFERENCES public.tax_account (id) MATCH SIMPLE
ON UPDATE NO ACTION
ON DELETE NO ACTION
DEFERRABLE INITIALLY DEFERRED;
CREATE INDEX IF NOT EXISTS transaction_breakdown_tax_account_id_c19ccb66
ON public.transaction_breakdown(tax_account_id);

ALTER TABLE IF EXISTS public.transaction_type


ADD CONSTRAINT transaction_type_tax_code_year_id_6af8463f_fk_tax_code_ FOREIGN
KEY (tax_code_year_id)
REFERENCES public.tax_code_by_year (id) MATCH SIMPLE
ON UPDATE NO ACTION
ON DELETE NO ACTION
DEFERRABLE INITIALLY DEFERRED;
CREATE INDEX IF NOT EXISTS transaction_type_tax_code_year_id_6af8463f
ON public.transaction_type(tax_code_year_id);

ALTER TABLE IF EXISTS public.user_defined_value


ADD CONSTRAINT user_defined_value_tax_account_id_93f03364_fk_tax_account_id
FOREIGN KEY (tax_account_id)
REFERENCES public.tax_account (id) MATCH SIMPLE
ON UPDATE NO ACTION
ON DELETE NO ACTION
DEFERRABLE INITIALLY DEFERRED;
CREATE INDEX IF NOT EXISTS user_defined_value_tax_account_id_93f03364
ON public.user_defined_value(tax_account_id);

ALTER TABLE IF EXISTS public.user_defined_value


ADD CONSTRAINT user_defined_value_user_defined_type_id_b764ee66_fk_user_defi
FOREIGN KEY (user_defined_type_id)
REFERENCES public.user_defined_type (id) MATCH SIMPLE
ON UPDATE NO ACTION
ON DELETE NO ACTION
DEFERRABLE INITIALLY DEFERRED;
CREATE INDEX IF NOT EXISTS user_defined_value_user_defined_type_id_b764ee66
ON public.user_defined_value(user_defined_type_id);
ALTER TABLE IF EXISTS public.users_user_groups
ADD CONSTRAINT users_user_groups_group_id_9afc8d0e_fk_auth_group_id FOREIGN KEY
(group_id)
REFERENCES public.auth_group (id) MATCH SIMPLE
ON UPDATE NO ACTION
ON DELETE NO ACTION
DEFERRABLE INITIALLY DEFERRED;
CREATE INDEX IF NOT EXISTS users_user_groups_group_id_9afc8d0e
ON public.users_user_groups(group_id);

ALTER TABLE IF EXISTS public.users_user_groups


ADD CONSTRAINT users_user_groups_user_id_5f6f5a90_fk_users_user_id FOREIGN KEY
(user_id)
REFERENCES public.users_user (id) MATCH SIMPLE
ON UPDATE NO ACTION
ON DELETE NO ACTION
DEFERRABLE INITIALLY DEFERRED;
CREATE INDEX IF NOT EXISTS users_user_groups_user_id_5f6f5a90
ON public.users_user_groups(user_id);

ALTER TABLE IF EXISTS public.users_user_user_permissions


ADD CONSTRAINT users_user_user_perm_permission_id_0b93982e_fk_auth_perm FOREIGN
KEY (permission_id)
REFERENCES public.auth_permission (id) MATCH SIMPLE
ON UPDATE NO ACTION
ON DELETE NO ACTION
DEFERRABLE INITIALLY DEFERRED;
CREATE INDEX IF NOT EXISTS users_user_user_permissions_permission_id_0b93982e
ON public.users_user_user_permissions(permission_id);

ALTER TABLE IF EXISTS public.users_user_user_permissions


ADD CONSTRAINT users_user_user_permissions_user_id_20aca447_fk_users_user_id
FOREIGN KEY (user_id)
REFERENCES public.users_user (id) MATCH SIMPLE
ON UPDATE NO ACTION
ON DELETE NO ACTION
DEFERRABLE INITIALLY DEFERRED;
CREATE INDEX IF NOT EXISTS users_user_user_permissions_user_id_20aca447
ON public.users_user_user_permissions(user_id);

END;

You might also like