Files
honeyDueAPI/migrations/000001_init.sql
T
Trey t 12b2f9d43b
Backend CI / Test (push) Has been cancelled
Backend CI / Contract Tests (push) Has been cancelled
Backend CI / Build (push) Has been cancelled
Backend CI / Lint (push) Has been cancelled
Backend CI / Secret Scanning (push) Has been cancelled
Adopt pressly/goose for schema migrations
Replaces the previous hand-rolled MigrateWithLock + GORM AutoMigrate path,
which had two compounding problems:
- AutoMigrate ran on every pod startup (~5 min over the transatlantic
  link) even when no schema changes had landed
- pg_advisory_lock is session-scoped, which silently fails through
  Neon's pgbouncer transaction-mode pooler — turns out this is a
  known and documented limitation that bites golang-migrate too

Goose was chosen over golang-migrate (the other heavyweight) because:
- Goose wraps each migration file in a transaction by default, so a
  failure rolls back cleanly instead of leaving a "dirty" version
  state requiring manual force-reset (golang-migrate's known
  weakness, per its own issue tracker — see #1001 + Atlas's writeup)
- Goose's locking is opt-in. We don't opt in: migrations run as a
  single Kubernetes Job, which IS the singleton process. No advisory
  lock needed at all.

Layout:
- migrations/000001_init.sql — schema-only pg_dump of the live Neon
  DB at adoption, stripped of psql-only directives that block goose's
  bookkeeping insert. Pre-goose hand-numbered migrations 002-022 had
  their effects folded into this baseline; deleted from the live tree
  but preserved in git history at 58e6997.
- Dockerfile installs `goose v3.22.1` at build time and copies the
  binary into the api image. The migrate Job reuses the api image with
  command=goose, so no separate image to build/push/version.
- deploy-k3s/manifests/migrate/job.yaml: a one-shot Job that strips
  the -pooler segment from DB_HOST (advisory lock won't survive
  pgbouncer transaction-mode), runs `goose up`, exits.
- deploy-k3s/scripts/03-deploy.sh: deletes any prior Job, applies the
  fresh one, `kubectl wait --for=condition=complete --timeout=10m`,
  then proceeds with api/worker rollout. Job failure aborts the deploy
  before any new app pod sees a stale schema.
- internal/database/database.go::RequireSchemaApplied checks
  goose_db_version on startup. api/worker refuse to boot if the
  table is missing or its latest row has is_applied=false — the
  fail-fast for "operator forgot to run migrate."
- Makefile: migrate-up / migrate-down / migrate-status / migrate-new
  for local workflow.

Production DB was bootstrapped manually:
  $ goose -dir migrations postgres "$DSN" version  # creates table
  $ psql ... -c "INSERT INTO goose_db_version (version_id, is_applied, tstamp) VALUES (1, true, NOW());"

Smoke test against fresh Postgres locally: 50 user tables created in
284ms via `goose up`, version_id=1 + is_applied=t recorded.

Verified the local goose CLI talks to prod successfully:
  $ goose ... status
  Applied At                  Migration
  =======================================
  Mon Apr 27 03:43:55 2026 -- 000001_init.sql

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
2026-04-26 22:46:36 -05:00

3457 lines
91 KiB
SQL
Raw Blame History

This file contains ambiguous Unicode characters
This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
-- +goose Up
-- Initial schema baseline. Captures every table/index/sequence as it
-- existed at the moment of the goose adoption commit. Effects of the
-- pre-goose hand-numbered migrations (002022 in git history at
-- 58e6997) are folded in via pg_dump --schema-only.
--
-- Production DB already has this schema applied; bootstrap by inserting
-- (1, false, NOW()) into goose_db_version so goose treats v1 as done
-- without re-running this file. See deploy/bootstrap-goose.sh.
--
-- PostgreSQL database dump (schema-only)
-- Original header from pg_dump 17.9 (server 17.8)
--
-- The original dump's SET statements are intentionally omitted here —
-- particularly `SELECT pg_catalog.set_config('search_path', '', false)`,
-- which would prevent goose from inserting into goose_db_version inside
-- the same transaction. The defaults are fine for a fresh DB.
--
-- Name: admin_users; Type: TABLE; Schema: public; Owner: -
--
CREATE TABLE public.admin_users (
id bigint NOT NULL,
email character varying(254) NOT NULL,
password character varying(128) NOT NULL,
first_name character varying(100),
last_name character varying(100),
role character varying(20) DEFAULT 'admin'::character varying,
is_active boolean DEFAULT true,
last_login timestamp with time zone,
created_at timestamp with time zone,
updated_at timestamp with time zone
);
--
-- Name: admin_users_id_seq; Type: SEQUENCE; Schema: public; Owner: -
--
CREATE SEQUENCE public.admin_users_id_seq
START WITH 1
INCREMENT BY 1
NO MINVALUE
NO MAXVALUE
CACHE 1;
--
-- Name: admin_users_id_seq; Type: SEQUENCE OWNED BY; Schema: public; Owner: -
--
ALTER SEQUENCE public.admin_users_id_seq OWNED BY public.admin_users.id;
--
-- Name: auth_user; Type: TABLE; Schema: public; Owner: -
--
CREATE TABLE public.auth_user (
id bigint NOT NULL,
password character varying(128) NOT NULL,
last_login timestamp with time zone,
is_superuser boolean DEFAULT false,
username character varying(150) NOT NULL,
first_name character varying(150),
last_name character varying(150),
email character varying(254),
is_staff boolean DEFAULT false,
is_active boolean DEFAULT true,
date_joined timestamp with time zone
);
--
-- Name: auth_user_id_seq; Type: SEQUENCE; Schema: public; Owner: -
--
CREATE SEQUENCE public.auth_user_id_seq
START WITH 1
INCREMENT BY 1
NO MINVALUE
NO MAXVALUE
CACHE 1;
--
-- Name: auth_user_id_seq; Type: SEQUENCE OWNED BY; Schema: public; Owner: -
--
ALTER SEQUENCE public.auth_user_id_seq OWNED BY public.auth_user.id;
--
-- Name: data_migrations; Type: TABLE; Schema: public; Owner: -
--
CREATE TABLE public.data_migrations (
id bigint NOT NULL,
name character varying(255) NOT NULL,
applied_at timestamp with time zone NOT NULL
);
--
-- Name: data_migrations_id_seq; Type: SEQUENCE; Schema: public; Owner: -
--
CREATE SEQUENCE public.data_migrations_id_seq
START WITH 1
INCREMENT BY 1
NO MINVALUE
NO MAXVALUE
CACHE 1;
--
-- Name: data_migrations_id_seq; Type: SEQUENCE OWNED BY; Schema: public; Owner: -
--
ALTER SEQUENCE public.data_migrations_id_seq OWNED BY public.data_migrations.id;
--
-- Name: goadmin_menu; Type: TABLE; Schema: public; Owner: -
--
CREATE TABLE public.goadmin_menu (
id integer NOT NULL,
parent_id integer DEFAULT 0 NOT NULL,
type integer DEFAULT 0 NOT NULL,
"order" integer DEFAULT 0 NOT NULL,
title character varying(50) DEFAULT ''::character varying NOT NULL,
icon character varying(50) DEFAULT ''::character varying NOT NULL,
uri character varying(3000) DEFAULT ''::character varying NOT NULL,
header character varying(150) DEFAULT ''::character varying,
plugin_name character varying(150) DEFAULT ''::character varying NOT NULL,
uuid character varying(150) DEFAULT ''::character varying,
created_at timestamp without time zone DEFAULT CURRENT_TIMESTAMP,
updated_at timestamp without time zone DEFAULT CURRENT_TIMESTAMP
);
--
-- Name: goadmin_menu_id_seq; Type: SEQUENCE; Schema: public; Owner: -
--
CREATE SEQUENCE public.goadmin_menu_id_seq
AS integer
START WITH 1
INCREMENT BY 1
NO MINVALUE
NO MAXVALUE
CACHE 1;
--
-- Name: goadmin_menu_id_seq; Type: SEQUENCE OWNED BY; Schema: public; Owner: -
--
ALTER SEQUENCE public.goadmin_menu_id_seq OWNED BY public.goadmin_menu.id;
--
-- Name: goadmin_operation_log; Type: TABLE; Schema: public; Owner: -
--
CREATE TABLE public.goadmin_operation_log (
id integer NOT NULL,
user_id integer NOT NULL,
path character varying(255) DEFAULT ''::character varying NOT NULL,
method character varying(10) DEFAULT ''::character varying NOT NULL,
ip character varying(15) DEFAULT ''::character varying NOT NULL,
input text NOT NULL,
created_at timestamp without time zone DEFAULT CURRENT_TIMESTAMP,
updated_at timestamp without time zone DEFAULT CURRENT_TIMESTAMP
);
--
-- Name: goadmin_operation_log_id_seq; Type: SEQUENCE; Schema: public; Owner: -
--
CREATE SEQUENCE public.goadmin_operation_log_id_seq
AS integer
START WITH 1
INCREMENT BY 1
NO MINVALUE
NO MAXVALUE
CACHE 1;
--
-- Name: goadmin_operation_log_id_seq; Type: SEQUENCE OWNED BY; Schema: public; Owner: -
--
ALTER SEQUENCE public.goadmin_operation_log_id_seq OWNED BY public.goadmin_operation_log.id;
--
-- Name: goadmin_permissions; Type: TABLE; Schema: public; Owner: -
--
CREATE TABLE public.goadmin_permissions (
id integer NOT NULL,
name character varying(50) DEFAULT ''::character varying NOT NULL,
slug character varying(50) DEFAULT ''::character varying NOT NULL,
http_method character varying(255) DEFAULT ''::character varying,
http_path text NOT NULL,
created_at timestamp without time zone DEFAULT CURRENT_TIMESTAMP,
updated_at timestamp without time zone DEFAULT CURRENT_TIMESTAMP
);
--
-- Name: goadmin_permissions_id_seq; Type: SEQUENCE; Schema: public; Owner: -
--
CREATE SEQUENCE public.goadmin_permissions_id_seq
AS integer
START WITH 1
INCREMENT BY 1
NO MINVALUE
NO MAXVALUE
CACHE 1;
--
-- Name: goadmin_permissions_id_seq; Type: SEQUENCE OWNED BY; Schema: public; Owner: -
--
ALTER SEQUENCE public.goadmin_permissions_id_seq OWNED BY public.goadmin_permissions.id;
--
-- Name: goadmin_role_menu; Type: TABLE; Schema: public; Owner: -
--
CREATE TABLE public.goadmin_role_menu (
id integer NOT NULL,
role_id integer NOT NULL,
menu_id integer NOT NULL,
created_at timestamp without time zone DEFAULT CURRENT_TIMESTAMP,
updated_at timestamp without time zone DEFAULT CURRENT_TIMESTAMP
);
--
-- Name: goadmin_role_menu_id_seq; Type: SEQUENCE; Schema: public; Owner: -
--
CREATE SEQUENCE public.goadmin_role_menu_id_seq
AS integer
START WITH 1
INCREMENT BY 1
NO MINVALUE
NO MAXVALUE
CACHE 1;
--
-- Name: goadmin_role_menu_id_seq; Type: SEQUENCE OWNED BY; Schema: public; Owner: -
--
ALTER SEQUENCE public.goadmin_role_menu_id_seq OWNED BY public.goadmin_role_menu.id;
--
-- Name: goadmin_role_permissions; Type: TABLE; Schema: public; Owner: -
--
CREATE TABLE public.goadmin_role_permissions (
id integer NOT NULL,
role_id integer NOT NULL,
permission_id integer NOT NULL,
created_at timestamp without time zone DEFAULT CURRENT_TIMESTAMP,
updated_at timestamp without time zone DEFAULT CURRENT_TIMESTAMP
);
--
-- Name: goadmin_role_permissions_id_seq; Type: SEQUENCE; Schema: public; Owner: -
--
CREATE SEQUENCE public.goadmin_role_permissions_id_seq
AS integer
START WITH 1
INCREMENT BY 1
NO MINVALUE
NO MAXVALUE
CACHE 1;
--
-- Name: goadmin_role_permissions_id_seq; Type: SEQUENCE OWNED BY; Schema: public; Owner: -
--
ALTER SEQUENCE public.goadmin_role_permissions_id_seq OWNED BY public.goadmin_role_permissions.id;
--
-- Name: goadmin_role_users; Type: TABLE; Schema: public; Owner: -
--
CREATE TABLE public.goadmin_role_users (
id integer NOT NULL,
role_id integer NOT NULL,
user_id integer NOT NULL,
created_at timestamp without time zone DEFAULT CURRENT_TIMESTAMP,
updated_at timestamp without time zone DEFAULT CURRENT_TIMESTAMP
);
--
-- Name: goadmin_role_users_id_seq; Type: SEQUENCE; Schema: public; Owner: -
--
CREATE SEQUENCE public.goadmin_role_users_id_seq
AS integer
START WITH 1
INCREMENT BY 1
NO MINVALUE
NO MAXVALUE
CACHE 1;
--
-- Name: goadmin_role_users_id_seq; Type: SEQUENCE OWNED BY; Schema: public; Owner: -
--
ALTER SEQUENCE public.goadmin_role_users_id_seq OWNED BY public.goadmin_role_users.id;
--
-- Name: goadmin_roles; Type: TABLE; Schema: public; Owner: -
--
CREATE TABLE public.goadmin_roles (
id integer NOT NULL,
name character varying(50) DEFAULT ''::character varying NOT NULL,
slug character varying(50) DEFAULT ''::character varying NOT NULL,
created_at timestamp without time zone DEFAULT CURRENT_TIMESTAMP,
updated_at timestamp without time zone DEFAULT CURRENT_TIMESTAMP
);
--
-- Name: goadmin_roles_id_seq; Type: SEQUENCE; Schema: public; Owner: -
--
CREATE SEQUENCE public.goadmin_roles_id_seq
AS integer
START WITH 1
INCREMENT BY 1
NO MINVALUE
NO MAXVALUE
CACHE 1;
--
-- Name: goadmin_roles_id_seq; Type: SEQUENCE OWNED BY; Schema: public; Owner: -
--
ALTER SEQUENCE public.goadmin_roles_id_seq OWNED BY public.goadmin_roles.id;
--
-- Name: goadmin_session; Type: TABLE; Schema: public; Owner: -
--
CREATE TABLE public.goadmin_session (
id integer NOT NULL,
sid character varying(50) DEFAULT ''::character varying NOT NULL,
"values" text NOT NULL,
created_at timestamp without time zone DEFAULT CURRENT_TIMESTAMP,
updated_at timestamp without time zone DEFAULT CURRENT_TIMESTAMP
);
--
-- Name: goadmin_session_id_seq; Type: SEQUENCE; Schema: public; Owner: -
--
CREATE SEQUENCE public.goadmin_session_id_seq
AS integer
START WITH 1
INCREMENT BY 1
NO MINVALUE
NO MAXVALUE
CACHE 1;
--
-- Name: goadmin_session_id_seq; Type: SEQUENCE OWNED BY; Schema: public; Owner: -
--
ALTER SEQUENCE public.goadmin_session_id_seq OWNED BY public.goadmin_session.id;
--
-- Name: goadmin_site; Type: TABLE; Schema: public; Owner: -
--
CREATE TABLE public.goadmin_site (
id integer NOT NULL,
key character varying(100) DEFAULT ''::character varying NOT NULL,
value text NOT NULL,
description character varying(3000) DEFAULT ''::character varying,
state integer DEFAULT 0 NOT NULL,
created_at timestamp without time zone DEFAULT CURRENT_TIMESTAMP,
updated_at timestamp without time zone DEFAULT CURRENT_TIMESTAMP
);
--
-- Name: goadmin_site_id_seq; Type: SEQUENCE; Schema: public; Owner: -
--
CREATE SEQUENCE public.goadmin_site_id_seq
AS integer
START WITH 1
INCREMENT BY 1
NO MINVALUE
NO MAXVALUE
CACHE 1;
--
-- Name: goadmin_site_id_seq; Type: SEQUENCE OWNED BY; Schema: public; Owner: -
--
ALTER SEQUENCE public.goadmin_site_id_seq OWNED BY public.goadmin_site.id;
--
-- Name: goadmin_user_permissions; Type: TABLE; Schema: public; Owner: -
--
CREATE TABLE public.goadmin_user_permissions (
id integer NOT NULL,
user_id integer NOT NULL,
permission_id integer NOT NULL,
created_at timestamp without time zone DEFAULT CURRENT_TIMESTAMP,
updated_at timestamp without time zone DEFAULT CURRENT_TIMESTAMP
);
--
-- Name: goadmin_user_permissions_id_seq; Type: SEQUENCE; Schema: public; Owner: -
--
CREATE SEQUENCE public.goadmin_user_permissions_id_seq
AS integer
START WITH 1
INCREMENT BY 1
NO MINVALUE
NO MAXVALUE
CACHE 1;
--
-- Name: goadmin_user_permissions_id_seq; Type: SEQUENCE OWNED BY; Schema: public; Owner: -
--
ALTER SEQUENCE public.goadmin_user_permissions_id_seq OWNED BY public.goadmin_user_permissions.id;
--
-- Name: goadmin_users; Type: TABLE; Schema: public; Owner: -
--
CREATE TABLE public.goadmin_users (
id integer NOT NULL,
username character varying(100) DEFAULT ''::character varying NOT NULL,
password character varying(100) DEFAULT ''::character varying NOT NULL,
name character varying(100) DEFAULT ''::character varying NOT NULL,
avatar character varying(255) DEFAULT ''::character varying,
remember_token character varying(100) DEFAULT ''::character varying,
created_at timestamp without time zone DEFAULT CURRENT_TIMESTAMP,
updated_at timestamp without time zone DEFAULT CURRENT_TIMESTAMP
);
--
-- Name: goadmin_users_id_seq; Type: SEQUENCE; Schema: public; Owner: -
--
CREATE SEQUENCE public.goadmin_users_id_seq
AS integer
START WITH 1
INCREMENT BY 1
NO MINVALUE
NO MAXVALUE
CACHE 1;
--
-- Name: goadmin_users_id_seq; Type: SEQUENCE OWNED BY; Schema: public; Owner: -
--
ALTER SEQUENCE public.goadmin_users_id_seq OWNED BY public.goadmin_users.id;
--
-- Name: notifications_notification; Type: TABLE; Schema: public; Owner: -
--
CREATE TABLE public.notifications_notification (
id bigint NOT NULL,
created_at timestamp with time zone,
updated_at timestamp with time zone,
user_id bigint NOT NULL,
notification_type character varying(50) NOT NULL,
title character varying(200) NOT NULL,
body text NOT NULL,
task_id bigint,
data jsonb DEFAULT '{}'::jsonb,
sent boolean DEFAULT false,
sent_at timestamp with time zone,
read boolean DEFAULT false,
read_at timestamp with time zone,
error_message text
);
--
-- Name: notifications_notification_id_seq; Type: SEQUENCE; Schema: public; Owner: -
--
CREATE SEQUENCE public.notifications_notification_id_seq
START WITH 1
INCREMENT BY 1
NO MINVALUE
NO MAXVALUE
CACHE 1;
--
-- Name: notifications_notification_id_seq; Type: SEQUENCE OWNED BY; Schema: public; Owner: -
--
ALTER SEQUENCE public.notifications_notification_id_seq OWNED BY public.notifications_notification.id;
--
-- Name: notifications_notificationpreference; Type: TABLE; Schema: public; Owner: -
--
CREATE TABLE public.notifications_notificationpreference (
id bigint NOT NULL,
created_at timestamp with time zone,
updated_at timestamp with time zone,
user_id bigint NOT NULL,
task_due_soon boolean DEFAULT true,
task_overdue boolean DEFAULT true,
task_completed boolean DEFAULT true,
task_assigned boolean DEFAULT true,
residence_shared boolean DEFAULT true,
warranty_expiring boolean DEFAULT true,
daily_digest boolean DEFAULT true,
email_task_completed boolean DEFAULT true,
task_due_soon_hour bigint,
task_overdue_hour bigint,
warranty_expiring_hour bigint,
daily_digest_hour bigint,
timezone character varying(50)
);
--
-- Name: notifications_notificationpreference_id_seq; Type: SEQUENCE; Schema: public; Owner: -
--
CREATE SEQUENCE public.notifications_notificationpreference_id_seq
START WITH 1
INCREMENT BY 1
NO MINVALUE
NO MAXVALUE
CACHE 1;
--
-- Name: notifications_notificationpreference_id_seq; Type: SEQUENCE OWNED BY; Schema: public; Owner: -
--
ALTER SEQUENCE public.notifications_notificationpreference_id_seq OWNED BY public.notifications_notificationpreference.id;
--
-- Name: onboarding_emails; Type: TABLE; Schema: public; Owner: -
--
CREATE TABLE public.onboarding_emails (
id bigint NOT NULL,
user_id bigint NOT NULL,
email_type character varying(50) NOT NULL,
sent_at timestamp with time zone NOT NULL,
opened_at timestamp with time zone,
tracking_id character varying(64),
created_at timestamp with time zone,
updated_at timestamp with time zone
);
--
-- Name: onboarding_emails_id_seq; Type: SEQUENCE; Schema: public; Owner: -
--
CREATE SEQUENCE public.onboarding_emails_id_seq
START WITH 1
INCREMENT BY 1
NO MINVALUE
NO MAXVALUE
CACHE 1;
--
-- Name: onboarding_emails_id_seq; Type: SEQUENCE OWNED BY; Schema: public; Owner: -
--
ALTER SEQUENCE public.onboarding_emails_id_seq OWNED BY public.onboarding_emails.id;
--
-- Name: push_notifications_apnsdevice; Type: TABLE; Schema: public; Owner: -
--
CREATE TABLE public.push_notifications_apnsdevice (
id bigint NOT NULL,
name character varying(255),
active boolean DEFAULT true,
user_id bigint,
device_id character varying(255),
registration_id character varying(255),
date_created timestamp with time zone
);
--
-- Name: push_notifications_apnsdevice_id_seq; Type: SEQUENCE; Schema: public; Owner: -
--
CREATE SEQUENCE public.push_notifications_apnsdevice_id_seq
START WITH 1
INCREMENT BY 1
NO MINVALUE
NO MAXVALUE
CACHE 1;
--
-- Name: push_notifications_apnsdevice_id_seq; Type: SEQUENCE OWNED BY; Schema: public; Owner: -
--
ALTER SEQUENCE public.push_notifications_apnsdevice_id_seq OWNED BY public.push_notifications_apnsdevice.id;
--
-- Name: push_notifications_gcmdevice; Type: TABLE; Schema: public; Owner: -
--
CREATE TABLE public.push_notifications_gcmdevice (
id bigint NOT NULL,
name character varying(255),
active boolean DEFAULT true,
user_id bigint,
device_id character varying(255),
registration_id character varying(255),
cloud_message_type character varying(3) DEFAULT 'FCM'::character varying,
date_created timestamp with time zone
);
--
-- Name: push_notifications_gcmdevice_id_seq; Type: SEQUENCE; Schema: public; Owner: -
--
CREATE SEQUENCE public.push_notifications_gcmdevice_id_seq
START WITH 1
INCREMENT BY 1
NO MINVALUE
NO MAXVALUE
CACHE 1;
--
-- Name: push_notifications_gcmdevice_id_seq; Type: SEQUENCE OWNED BY; Schema: public; Owner: -
--
ALTER SEQUENCE public.push_notifications_gcmdevice_id_seq OWNED BY public.push_notifications_gcmdevice.id;
--
-- Name: residence_residence; Type: TABLE; Schema: public; Owner: -
--
CREATE TABLE public.residence_residence (
id bigint NOT NULL,
created_at timestamp with time zone,
updated_at timestamp with time zone,
owner_id bigint NOT NULL,
name character varying(200) NOT NULL,
property_type_id bigint,
street_address character varying(255),
apartment_unit character varying(50),
city character varying(100),
state_province character varying(100),
postal_code character varying(20),
country character varying(100) DEFAULT 'USA'::character varying,
bedrooms bigint,
bathrooms numeric(3,1),
square_footage bigint,
lot_size numeric(10,2),
year_built bigint,
description text,
purchase_date date,
purchase_price numeric(12,2),
heating_type character varying(50),
cooling_type character varying(50),
water_heater_type character varying(50),
roof_type character varying(50),
has_pool boolean DEFAULT false,
has_sprinkler_system boolean DEFAULT false,
has_septic boolean DEFAULT false,
has_fireplace boolean DEFAULT false,
has_garage boolean DEFAULT false,
has_basement boolean DEFAULT false,
has_attic boolean DEFAULT false,
exterior_type character varying(50),
flooring_primary character varying(50),
landscaping_type character varying(50),
is_primary boolean DEFAULT true,
is_active boolean DEFAULT true
);
--
-- Name: residence_residence_id_seq; Type: SEQUENCE; Schema: public; Owner: -
--
CREATE SEQUENCE public.residence_residence_id_seq
START WITH 1
INCREMENT BY 1
NO MINVALUE
NO MAXVALUE
CACHE 1;
--
-- Name: residence_residence_id_seq; Type: SEQUENCE OWNED BY; Schema: public; Owner: -
--
ALTER SEQUENCE public.residence_residence_id_seq OWNED BY public.residence_residence.id;
--
-- Name: residence_residence_users; Type: TABLE; Schema: public; Owner: -
--
CREATE TABLE public.residence_residence_users (
user_id bigint NOT NULL,
residence_id bigint NOT NULL
);
--
-- Name: residence_residencesharecode; Type: TABLE; Schema: public; Owner: -
--
CREATE TABLE public.residence_residencesharecode (
id bigint NOT NULL,
created_at timestamp with time zone,
updated_at timestamp with time zone,
residence_id bigint NOT NULL,
code character varying(6) NOT NULL,
created_by_id bigint NOT NULL,
is_active boolean DEFAULT true,
expires_at timestamp with time zone
);
--
-- Name: residence_residencesharecode_id_seq; Type: SEQUENCE; Schema: public; Owner: -
--
CREATE SEQUENCE public.residence_residencesharecode_id_seq
START WITH 1
INCREMENT BY 1
NO MINVALUE
NO MAXVALUE
CACHE 1;
--
-- Name: residence_residencesharecode_id_seq; Type: SEQUENCE OWNED BY; Schema: public; Owner: -
--
ALTER SEQUENCE public.residence_residencesharecode_id_seq OWNED BY public.residence_residencesharecode.id;
--
-- Name: residence_residencetype; Type: TABLE; Schema: public; Owner: -
--
CREATE TABLE public.residence_residencetype (
id bigint NOT NULL,
created_at timestamp with time zone,
updated_at timestamp with time zone,
name character varying(20) NOT NULL
);
--
-- Name: residence_residencetype_id_seq; Type: SEQUENCE; Schema: public; Owner: -
--
CREATE SEQUENCE public.residence_residencetype_id_seq
START WITH 1
INCREMENT BY 1
NO MINVALUE
NO MAXVALUE
CACHE 1;
--
-- Name: residence_residencetype_id_seq; Type: SEQUENCE OWNED BY; Schema: public; Owner: -
--
ALTER SEQUENCE public.residence_residencetype_id_seq OWNED BY public.residence_residencetype.id;
--
-- Name: subscription_featurebenefit; Type: TABLE; Schema: public; Owner: -
--
CREATE TABLE public.subscription_featurebenefit (
id bigint NOT NULL,
created_at timestamp with time zone,
updated_at timestamp with time zone,
feature_name character varying(200) NOT NULL,
free_tier_text character varying(200) NOT NULL,
pro_tier_text character varying(200) NOT NULL,
display_order bigint DEFAULT 0,
is_active boolean DEFAULT true
);
--
-- Name: subscription_featurebenefit_id_seq; Type: SEQUENCE; Schema: public; Owner: -
--
CREATE SEQUENCE public.subscription_featurebenefit_id_seq
START WITH 1
INCREMENT BY 1
NO MINVALUE
NO MAXVALUE
CACHE 1;
--
-- Name: subscription_featurebenefit_id_seq; Type: SEQUENCE OWNED BY; Schema: public; Owner: -
--
ALTER SEQUENCE public.subscription_featurebenefit_id_seq OWNED BY public.subscription_featurebenefit.id;
--
-- Name: subscription_promotion; Type: TABLE; Schema: public; Owner: -
--
CREATE TABLE public.subscription_promotion (
id bigint NOT NULL,
created_at timestamp with time zone,
updated_at timestamp with time zone,
promotion_id character varying(50) NOT NULL,
title character varying(200) NOT NULL,
message text NOT NULL,
link character varying(200),
start_date timestamp with time zone NOT NULL,
end_date timestamp with time zone NOT NULL,
target_tier character varying(10) DEFAULT 'free'::character varying,
is_active boolean DEFAULT true
);
--
-- Name: subscription_promotion_id_seq; Type: SEQUENCE; Schema: public; Owner: -
--
CREATE SEQUENCE public.subscription_promotion_id_seq
START WITH 1
INCREMENT BY 1
NO MINVALUE
NO MAXVALUE
CACHE 1;
--
-- Name: subscription_promotion_id_seq; Type: SEQUENCE OWNED BY; Schema: public; Owner: -
--
ALTER SEQUENCE public.subscription_promotion_id_seq OWNED BY public.subscription_promotion.id;
--
-- Name: subscription_subscriptionsettings; Type: TABLE; Schema: public; Owner: -
--
CREATE TABLE public.subscription_subscriptionsettings (
id bigint NOT NULL,
enable_limitations boolean DEFAULT false,
enable_monitoring boolean DEFAULT true,
trial_enabled boolean DEFAULT true,
trial_duration_days bigint DEFAULT 14
);
--
-- Name: subscription_subscriptionsettings_id_seq; Type: SEQUENCE; Schema: public; Owner: -
--
CREATE SEQUENCE public.subscription_subscriptionsettings_id_seq
START WITH 1
INCREMENT BY 1
NO MINVALUE
NO MAXVALUE
CACHE 1;
--
-- Name: subscription_subscriptionsettings_id_seq; Type: SEQUENCE OWNED BY; Schema: public; Owner: -
--
ALTER SEQUENCE public.subscription_subscriptionsettings_id_seq OWNED BY public.subscription_subscriptionsettings.id;
--
-- Name: subscription_tierlimits; Type: TABLE; Schema: public; Owner: -
--
CREATE TABLE public.subscription_tierlimits (
id bigint NOT NULL,
created_at timestamp with time zone,
updated_at timestamp with time zone,
tier character varying(10) NOT NULL,
properties_limit bigint,
tasks_limit bigint,
contractors_limit bigint,
documents_limit bigint
);
--
-- Name: subscription_tierlimits_id_seq; Type: SEQUENCE; Schema: public; Owner: -
--
CREATE SEQUENCE public.subscription_tierlimits_id_seq
START WITH 1
INCREMENT BY 1
NO MINVALUE
NO MAXVALUE
CACHE 1;
--
-- Name: subscription_tierlimits_id_seq; Type: SEQUENCE OWNED BY; Schema: public; Owner: -
--
ALTER SEQUENCE public.subscription_tierlimits_id_seq OWNED BY public.subscription_tierlimits.id;
--
-- Name: subscription_upgradetrigger; Type: TABLE; Schema: public; Owner: -
--
CREATE TABLE public.subscription_upgradetrigger (
id bigint NOT NULL,
created_at timestamp with time zone,
updated_at timestamp with time zone,
trigger_key character varying(50) NOT NULL,
title character varying(200) NOT NULL,
message text NOT NULL,
promo_html text,
button_text character varying(50) DEFAULT 'Upgrade to Pro'::character varying,
is_active boolean DEFAULT true
);
--
-- Name: subscription_upgradetrigger_id_seq; Type: SEQUENCE; Schema: public; Owner: -
--
CREATE SEQUENCE public.subscription_upgradetrigger_id_seq
START WITH 1
INCREMENT BY 1
NO MINVALUE
NO MAXVALUE
CACHE 1;
--
-- Name: subscription_upgradetrigger_id_seq; Type: SEQUENCE OWNED BY; Schema: public; Owner: -
--
ALTER SEQUENCE public.subscription_upgradetrigger_id_seq OWNED BY public.subscription_upgradetrigger.id;
--
-- Name: subscription_usersubscription; Type: TABLE; Schema: public; Owner: -
--
CREATE TABLE public.subscription_usersubscription (
id bigint NOT NULL,
created_at timestamp with time zone,
updated_at timestamp with time zone,
user_id bigint NOT NULL,
tier character varying(10) DEFAULT 'free'::character varying,
apple_receipt_data text,
google_purchase_token text,
stripe_customer_id character varying(255),
stripe_subscription_id character varying(255),
stripe_price_id character varying(255),
subscribed_at timestamp with time zone,
expires_at timestamp with time zone,
auto_renew boolean DEFAULT true,
trial_start timestamp with time zone,
trial_end timestamp with time zone,
trial_used boolean DEFAULT false,
cancelled_at timestamp with time zone,
platform character varying(10),
is_free boolean DEFAULT false
);
--
-- Name: subscription_usersubscription_id_seq; Type: SEQUENCE; Schema: public; Owner: -
--
CREATE SEQUENCE public.subscription_usersubscription_id_seq
START WITH 1
INCREMENT BY 1
NO MINVALUE
NO MAXVALUE
CACHE 1;
--
-- Name: subscription_usersubscription_id_seq; Type: SEQUENCE OWNED BY; Schema: public; Owner: -
--
ALTER SEQUENCE public.subscription_usersubscription_id_seq OWNED BY public.subscription_usersubscription.id;
--
-- Name: task_climateregion; Type: TABLE; Schema: public; Owner: -
--
CREATE TABLE public.task_climateregion (
id bigint NOT NULL,
created_at timestamp with time zone,
updated_at timestamp with time zone,
name character varying(100) NOT NULL,
zone_number bigint NOT NULL,
description text,
is_active boolean DEFAULT true
);
--
-- Name: task_climateregion_id_seq; Type: SEQUENCE; Schema: public; Owner: -
--
CREATE SEQUENCE public.task_climateregion_id_seq
START WITH 1
INCREMENT BY 1
NO MINVALUE
NO MAXVALUE
CACHE 1;
--
-- Name: task_climateregion_id_seq; Type: SEQUENCE OWNED BY; Schema: public; Owner: -
--
ALTER SEQUENCE public.task_climateregion_id_seq OWNED BY public.task_climateregion.id;
--
-- Name: task_contractor; Type: TABLE; Schema: public; Owner: -
--
CREATE TABLE public.task_contractor (
id bigint NOT NULL,
created_at timestamp with time zone,
updated_at timestamp with time zone,
residence_id bigint,
created_by_id bigint NOT NULL,
name character varying(200) NOT NULL,
company character varying(200),
phone character varying(20),
email character varying(254),
website character varying(200),
notes text,
street_address character varying(255),
city character varying(100),
state_province character varying(100),
postal_code character varying(20),
rating numeric(2,1),
is_favorite boolean DEFAULT false,
is_active boolean DEFAULT true
);
--
-- Name: task_contractor_id_seq; Type: SEQUENCE; Schema: public; Owner: -
--
CREATE SEQUENCE public.task_contractor_id_seq
START WITH 1
INCREMENT BY 1
NO MINVALUE
NO MAXVALUE
CACHE 1;
--
-- Name: task_contractor_id_seq; Type: SEQUENCE OWNED BY; Schema: public; Owner: -
--
ALTER SEQUENCE public.task_contractor_id_seq OWNED BY public.task_contractor.id;
--
-- Name: task_contractor_specialties; Type: TABLE; Schema: public; Owner: -
--
CREATE TABLE public.task_contractor_specialties (
contractor_id bigint NOT NULL,
contractor_specialty_id bigint NOT NULL
);
--
-- Name: task_contractorspecialty; Type: TABLE; Schema: public; Owner: -
--
CREATE TABLE public.task_contractorspecialty (
id bigint NOT NULL,
created_at timestamp with time zone,
updated_at timestamp with time zone,
name character varying(50) NOT NULL,
description text,
icon character varying(50),
display_order bigint DEFAULT 0
);
--
-- Name: task_contractorspecialty_id_seq; Type: SEQUENCE; Schema: public; Owner: -
--
CREATE SEQUENCE public.task_contractorspecialty_id_seq
START WITH 1
INCREMENT BY 1
NO MINVALUE
NO MAXVALUE
CACHE 1;
--
-- Name: task_contractorspecialty_id_seq; Type: SEQUENCE OWNED BY; Schema: public; Owner: -
--
ALTER SEQUENCE public.task_contractorspecialty_id_seq OWNED BY public.task_contractorspecialty.id;
--
-- Name: task_document; Type: TABLE; Schema: public; Owner: -
--
CREATE TABLE public.task_document (
id bigint NOT NULL,
created_at timestamp with time zone,
updated_at timestamp with time zone,
residence_id bigint NOT NULL,
created_by_id bigint NOT NULL,
title character varying(200) NOT NULL,
description text,
document_type character varying(20) DEFAULT 'general'::character varying,
file_url character varying(500),
file_name character varying(255),
file_size bigint,
mime_type character varying(100),
purchase_date date,
expiry_date date,
purchase_price numeric(10,2),
vendor character varying(200),
serial_number character varying(100),
model_number character varying(100),
provider character varying(200),
provider_contact character varying(200),
claim_phone character varying(50),
claim_email character varying(200),
claim_website character varying(500),
notes text,
task_id bigint,
is_active boolean DEFAULT true
);
--
-- Name: task_document_id_seq; Type: SEQUENCE; Schema: public; Owner: -
--
CREATE SEQUENCE public.task_document_id_seq
START WITH 1
INCREMENT BY 1
NO MINVALUE
NO MAXVALUE
CACHE 1;
--
-- Name: task_document_id_seq; Type: SEQUENCE OWNED BY; Schema: public; Owner: -
--
ALTER SEQUENCE public.task_document_id_seq OWNED BY public.task_document.id;
--
-- Name: task_documentimage; Type: TABLE; Schema: public; Owner: -
--
CREATE TABLE public.task_documentimage (
id bigint NOT NULL,
created_at timestamp with time zone,
updated_at timestamp with time zone,
document_id bigint NOT NULL,
image_url character varying(500) NOT NULL,
caption character varying(255)
);
--
-- Name: task_documentimage_id_seq; Type: SEQUENCE; Schema: public; Owner: -
--
CREATE SEQUENCE public.task_documentimage_id_seq
START WITH 1
INCREMENT BY 1
NO MINVALUE
NO MAXVALUE
CACHE 1;
--
-- Name: task_documentimage_id_seq; Type: SEQUENCE OWNED BY; Schema: public; Owner: -
--
ALTER SEQUENCE public.task_documentimage_id_seq OWNED BY public.task_documentimage.id;
--
-- Name: task_reminderlog; Type: TABLE; Schema: public; Owner: -
--
CREATE TABLE public.task_reminderlog (
id bigint NOT NULL,
task_id bigint NOT NULL,
user_id bigint NOT NULL,
due_date date NOT NULL,
reminder_stage character varying(20) NOT NULL,
sent_at timestamp with time zone DEFAULT CURRENT_TIMESTAMP,
notification_id bigint
);
--
-- Name: task_reminderlog_id_seq; Type: SEQUENCE; Schema: public; Owner: -
--
CREATE SEQUENCE public.task_reminderlog_id_seq
START WITH 1
INCREMENT BY 1
NO MINVALUE
NO MAXVALUE
CACHE 1;
--
-- Name: task_reminderlog_id_seq; Type: SEQUENCE OWNED BY; Schema: public; Owner: -
--
ALTER SEQUENCE public.task_reminderlog_id_seq OWNED BY public.task_reminderlog.id;
--
-- Name: task_task; Type: TABLE; Schema: public; Owner: -
--
CREATE TABLE public.task_task (
id bigint NOT NULL,
created_at timestamp with time zone,
updated_at timestamp with time zone,
residence_id bigint NOT NULL,
created_by_id bigint NOT NULL,
assigned_to_id bigint,
title character varying(200) NOT NULL,
description text,
category_id bigint,
priority_id bigint,
frequency_id bigint,
custom_interval_days bigint,
in_progress boolean DEFAULT false,
due_date date,
next_due_date date,
estimated_cost numeric(10,2),
actual_cost numeric(10,2),
contractor_id bigint,
is_cancelled boolean DEFAULT false,
is_archived boolean DEFAULT false,
version bigint DEFAULT 1 NOT NULL,
parent_task_id bigint,
task_template_id bigint
);
--
-- Name: task_task_id_seq; Type: SEQUENCE; Schema: public; Owner: -
--
CREATE SEQUENCE public.task_task_id_seq
START WITH 1
INCREMENT BY 1
NO MINVALUE
NO MAXVALUE
CACHE 1;
--
-- Name: task_task_id_seq; Type: SEQUENCE OWNED BY; Schema: public; Owner: -
--
ALTER SEQUENCE public.task_task_id_seq OWNED BY public.task_task.id;
--
-- Name: task_taskcategory; Type: TABLE; Schema: public; Owner: -
--
CREATE TABLE public.task_taskcategory (
id bigint NOT NULL,
created_at timestamp with time zone,
updated_at timestamp with time zone,
name character varying(50) NOT NULL,
description text,
icon character varying(50),
color character varying(7),
display_order bigint DEFAULT 0
);
--
-- Name: task_taskcategory_id_seq; Type: SEQUENCE; Schema: public; Owner: -
--
CREATE SEQUENCE public.task_taskcategory_id_seq
START WITH 1
INCREMENT BY 1
NO MINVALUE
NO MAXVALUE
CACHE 1;
--
-- Name: task_taskcategory_id_seq; Type: SEQUENCE OWNED BY; Schema: public; Owner: -
--
ALTER SEQUENCE public.task_taskcategory_id_seq OWNED BY public.task_taskcategory.id;
--
-- Name: task_taskcompletion; Type: TABLE; Schema: public; Owner: -
--
CREATE TABLE public.task_taskcompletion (
id bigint NOT NULL,
created_at timestamp with time zone,
updated_at timestamp with time zone,
task_id bigint NOT NULL,
completed_by_id bigint NOT NULL,
completed_at timestamp with time zone NOT NULL,
notes text,
actual_cost numeric(10,2),
rating bigint,
completed_from_column character varying(50) DEFAULT 'completed_tasks'::character varying
);
--
-- Name: task_taskcompletion_id_seq; Type: SEQUENCE; Schema: public; Owner: -
--
CREATE SEQUENCE public.task_taskcompletion_id_seq
START WITH 1
INCREMENT BY 1
NO MINVALUE
NO MAXVALUE
CACHE 1;
--
-- Name: task_taskcompletion_id_seq; Type: SEQUENCE OWNED BY; Schema: public; Owner: -
--
ALTER SEQUENCE public.task_taskcompletion_id_seq OWNED BY public.task_taskcompletion.id;
--
-- Name: task_taskcompletionimage; Type: TABLE; Schema: public; Owner: -
--
CREATE TABLE public.task_taskcompletionimage (
id bigint NOT NULL,
created_at timestamp with time zone,
updated_at timestamp with time zone,
completion_id bigint NOT NULL,
image_url character varying(500) NOT NULL,
caption character varying(255)
);
--
-- Name: task_taskcompletionimage_id_seq; Type: SEQUENCE; Schema: public; Owner: -
--
CREATE SEQUENCE public.task_taskcompletionimage_id_seq
START WITH 1
INCREMENT BY 1
NO MINVALUE
NO MAXVALUE
CACHE 1;
--
-- Name: task_taskcompletionimage_id_seq; Type: SEQUENCE OWNED BY; Schema: public; Owner: -
--
ALTER SEQUENCE public.task_taskcompletionimage_id_seq OWNED BY public.task_taskcompletionimage.id;
--
-- Name: task_taskfrequency; Type: TABLE; Schema: public; Owner: -
--
CREATE TABLE public.task_taskfrequency (
id bigint NOT NULL,
created_at timestamp with time zone,
updated_at timestamp with time zone,
name character varying(20) NOT NULL,
days bigint,
display_order bigint DEFAULT 0
);
--
-- Name: task_taskfrequency_id_seq; Type: SEQUENCE; Schema: public; Owner: -
--
CREATE SEQUENCE public.task_taskfrequency_id_seq
START WITH 1
INCREMENT BY 1
NO MINVALUE
NO MAXVALUE
CACHE 1;
--
-- Name: task_taskfrequency_id_seq; Type: SEQUENCE OWNED BY; Schema: public; Owner: -
--
ALTER SEQUENCE public.task_taskfrequency_id_seq OWNED BY public.task_taskfrequency.id;
--
-- Name: task_taskpriority; Type: TABLE; Schema: public; Owner: -
--
CREATE TABLE public.task_taskpriority (
id bigint NOT NULL,
created_at timestamp with time zone,
updated_at timestamp with time zone,
name character varying(20) NOT NULL,
level bigint NOT NULL,
color character varying(7),
display_order bigint DEFAULT 0
);
--
-- Name: task_taskpriority_id_seq; Type: SEQUENCE; Schema: public; Owner: -
--
CREATE SEQUENCE public.task_taskpriority_id_seq
START WITH 1
INCREMENT BY 1
NO MINVALUE
NO MAXVALUE
CACHE 1;
--
-- Name: task_taskpriority_id_seq; Type: SEQUENCE OWNED BY; Schema: public; Owner: -
--
ALTER SEQUENCE public.task_taskpriority_id_seq OWNED BY public.task_taskpriority.id;
--
-- Name: task_tasktemplate; Type: TABLE; Schema: public; Owner: -
--
CREATE TABLE public.task_tasktemplate (
id bigint NOT NULL,
created_at timestamp with time zone,
updated_at timestamp with time zone,
title character varying(200) NOT NULL,
description text,
category_id bigint,
frequency_id bigint,
icon_ios character varying(100),
icon_android character varying(100),
tags text,
display_order bigint DEFAULT 0,
is_active boolean DEFAULT true,
conditions jsonb DEFAULT '{}'::jsonb
);
--
-- Name: task_tasktemplate_id_seq; Type: SEQUENCE; Schema: public; Owner: -
--
CREATE SEQUENCE public.task_tasktemplate_id_seq
START WITH 1
INCREMENT BY 1
NO MINVALUE
NO MAXVALUE
CACHE 1;
--
-- Name: task_tasktemplate_id_seq; Type: SEQUENCE OWNED BY; Schema: public; Owner: -
--
ALTER SEQUENCE public.task_tasktemplate_id_seq OWNED BY public.task_tasktemplate.id;
--
-- Name: task_zipclimateregion; Type: TABLE; Schema: public; Owner: -
--
CREATE TABLE public.task_zipclimateregion (
id bigint NOT NULL,
created_at timestamp with time zone,
updated_at timestamp with time zone,
zip_code character varying(10) NOT NULL,
climate_region_id bigint NOT NULL
);
--
-- Name: task_zipclimateregion_id_seq; Type: SEQUENCE; Schema: public; Owner: -
--
CREATE SEQUENCE public.task_zipclimateregion_id_seq
START WITH 1
INCREMENT BY 1
NO MINVALUE
NO MAXVALUE
CACHE 1;
--
-- Name: task_zipclimateregion_id_seq; Type: SEQUENCE OWNED BY; Schema: public; Owner: -
--
ALTER SEQUENCE public.task_zipclimateregion_id_seq OWNED BY public.task_zipclimateregion.id;
--
-- Name: user_applesocialauth; Type: TABLE; Schema: public; Owner: -
--
CREATE TABLE public.user_applesocialauth (
id bigint NOT NULL,
user_id bigint NOT NULL,
apple_id character varying(255) NOT NULL,
email character varying(254),
is_private_email boolean DEFAULT false,
created_at timestamp with time zone,
updated_at timestamp with time zone
);
--
-- Name: user_applesocialauth_id_seq; Type: SEQUENCE; Schema: public; Owner: -
--
CREATE SEQUENCE public.user_applesocialauth_id_seq
START WITH 1
INCREMENT BY 1
NO MINVALUE
NO MAXVALUE
CACHE 1;
--
-- Name: user_applesocialauth_id_seq; Type: SEQUENCE OWNED BY; Schema: public; Owner: -
--
ALTER SEQUENCE public.user_applesocialauth_id_seq OWNED BY public.user_applesocialauth.id;
--
-- Name: user_authtoken; Type: TABLE; Schema: public; Owner: -
--
CREATE TABLE public.user_authtoken (
key character varying(40) NOT NULL,
user_id bigint NOT NULL,
created timestamp with time zone
);
--
-- Name: user_confirmationcode; Type: TABLE; Schema: public; Owner: -
--
CREATE TABLE public.user_confirmationcode (
id bigint NOT NULL,
created_at timestamp with time zone,
updated_at timestamp with time zone,
user_id bigint NOT NULL,
code character varying(6) NOT NULL,
expires_at timestamp with time zone NOT NULL,
is_used boolean DEFAULT false
);
--
-- Name: user_confirmationcode_id_seq; Type: SEQUENCE; Schema: public; Owner: -
--
CREATE SEQUENCE public.user_confirmationcode_id_seq
START WITH 1
INCREMENT BY 1
NO MINVALUE
NO MAXVALUE
CACHE 1;
--
-- Name: user_confirmationcode_id_seq; Type: SEQUENCE OWNED BY; Schema: public; Owner: -
--
ALTER SEQUENCE public.user_confirmationcode_id_seq OWNED BY public.user_confirmationcode.id;
--
-- Name: user_googlesocialauth; Type: TABLE; Schema: public; Owner: -
--
CREATE TABLE public.user_googlesocialauth (
id bigint NOT NULL,
user_id bigint NOT NULL,
google_id character varying(255) NOT NULL,
email character varying(254),
name character varying(255),
picture character varying(512),
created_at timestamp with time zone,
updated_at timestamp with time zone
);
--
-- Name: user_googlesocialauth_id_seq; Type: SEQUENCE; Schema: public; Owner: -
--
CREATE SEQUENCE public.user_googlesocialauth_id_seq
START WITH 1
INCREMENT BY 1
NO MINVALUE
NO MAXVALUE
CACHE 1;
--
-- Name: user_googlesocialauth_id_seq; Type: SEQUENCE OWNED BY; Schema: public; Owner: -
--
ALTER SEQUENCE public.user_googlesocialauth_id_seq OWNED BY public.user_googlesocialauth.id;
--
-- Name: user_passwordresetcode; Type: TABLE; Schema: public; Owner: -
--
CREATE TABLE public.user_passwordresetcode (
id bigint NOT NULL,
created_at timestamp with time zone,
updated_at timestamp with time zone,
user_id bigint NOT NULL,
code_hash character varying(128) NOT NULL,
reset_token character varying(64) NOT NULL,
expires_at timestamp with time zone NOT NULL,
used boolean DEFAULT false,
attempts bigint DEFAULT 0,
max_attempts bigint DEFAULT 5
);
--
-- Name: user_passwordresetcode_id_seq; Type: SEQUENCE; Schema: public; Owner: -
--
CREATE SEQUENCE public.user_passwordresetcode_id_seq
START WITH 1
INCREMENT BY 1
NO MINVALUE
NO MAXVALUE
CACHE 1;
--
-- Name: user_passwordresetcode_id_seq; Type: SEQUENCE OWNED BY; Schema: public; Owner: -
--
ALTER SEQUENCE public.user_passwordresetcode_id_seq OWNED BY public.user_passwordresetcode.id;
--
-- Name: user_userprofile; Type: TABLE; Schema: public; Owner: -
--
CREATE TABLE public.user_userprofile (
id bigint NOT NULL,
created_at timestamp with time zone,
updated_at timestamp with time zone,
user_id bigint NOT NULL,
verified boolean DEFAULT false,
bio text,
phone_number character varying(15),
date_of_birth date,
profile_picture character varying(100)
);
--
-- Name: user_userprofile_id_seq; Type: SEQUENCE; Schema: public; Owner: -
--
CREATE SEQUENCE public.user_userprofile_id_seq
START WITH 1
INCREMENT BY 1
NO MINVALUE
NO MAXVALUE
CACHE 1;
--
-- Name: user_userprofile_id_seq; Type: SEQUENCE OWNED BY; Schema: public; Owner: -
--
ALTER SEQUENCE public.user_userprofile_id_seq OWNED BY public.user_userprofile.id;
--
-- Name: admin_users id; Type: DEFAULT; Schema: public; Owner: -
--
ALTER TABLE ONLY public.admin_users ALTER COLUMN id SET DEFAULT nextval('public.admin_users_id_seq'::regclass);
--
-- Name: auth_user id; Type: DEFAULT; Schema: public; Owner: -
--
ALTER TABLE ONLY public.auth_user ALTER COLUMN id SET DEFAULT nextval('public.auth_user_id_seq'::regclass);
--
-- Name: data_migrations id; Type: DEFAULT; Schema: public; Owner: -
--
ALTER TABLE ONLY public.data_migrations ALTER COLUMN id SET DEFAULT nextval('public.data_migrations_id_seq'::regclass);
--
-- Name: goadmin_menu id; Type: DEFAULT; Schema: public; Owner: -
--
ALTER TABLE ONLY public.goadmin_menu ALTER COLUMN id SET DEFAULT nextval('public.goadmin_menu_id_seq'::regclass);
--
-- Name: goadmin_operation_log id; Type: DEFAULT; Schema: public; Owner: -
--
ALTER TABLE ONLY public.goadmin_operation_log ALTER COLUMN id SET DEFAULT nextval('public.goadmin_operation_log_id_seq'::regclass);
--
-- Name: goadmin_permissions id; Type: DEFAULT; Schema: public; Owner: -
--
ALTER TABLE ONLY public.goadmin_permissions ALTER COLUMN id SET DEFAULT nextval('public.goadmin_permissions_id_seq'::regclass);
--
-- Name: goadmin_role_menu id; Type: DEFAULT; Schema: public; Owner: -
--
ALTER TABLE ONLY public.goadmin_role_menu ALTER COLUMN id SET DEFAULT nextval('public.goadmin_role_menu_id_seq'::regclass);
--
-- Name: goadmin_role_permissions id; Type: DEFAULT; Schema: public; Owner: -
--
ALTER TABLE ONLY public.goadmin_role_permissions ALTER COLUMN id SET DEFAULT nextval('public.goadmin_role_permissions_id_seq'::regclass);
--
-- Name: goadmin_role_users id; Type: DEFAULT; Schema: public; Owner: -
--
ALTER TABLE ONLY public.goadmin_role_users ALTER COLUMN id SET DEFAULT nextval('public.goadmin_role_users_id_seq'::regclass);
--
-- Name: goadmin_roles id; Type: DEFAULT; Schema: public; Owner: -
--
ALTER TABLE ONLY public.goadmin_roles ALTER COLUMN id SET DEFAULT nextval('public.goadmin_roles_id_seq'::regclass);
--
-- Name: goadmin_session id; Type: DEFAULT; Schema: public; Owner: -
--
ALTER TABLE ONLY public.goadmin_session ALTER COLUMN id SET DEFAULT nextval('public.goadmin_session_id_seq'::regclass);
--
-- Name: goadmin_site id; Type: DEFAULT; Schema: public; Owner: -
--
ALTER TABLE ONLY public.goadmin_site ALTER COLUMN id SET DEFAULT nextval('public.goadmin_site_id_seq'::regclass);
--
-- Name: goadmin_user_permissions id; Type: DEFAULT; Schema: public; Owner: -
--
ALTER TABLE ONLY public.goadmin_user_permissions ALTER COLUMN id SET DEFAULT nextval('public.goadmin_user_permissions_id_seq'::regclass);
--
-- Name: goadmin_users id; Type: DEFAULT; Schema: public; Owner: -
--
ALTER TABLE ONLY public.goadmin_users ALTER COLUMN id SET DEFAULT nextval('public.goadmin_users_id_seq'::regclass);
--
-- Name: notifications_notification id; Type: DEFAULT; Schema: public; Owner: -
--
ALTER TABLE ONLY public.notifications_notification ALTER COLUMN id SET DEFAULT nextval('public.notifications_notification_id_seq'::regclass);
--
-- Name: notifications_notificationpreference id; Type: DEFAULT; Schema: public; Owner: -
--
ALTER TABLE ONLY public.notifications_notificationpreference ALTER COLUMN id SET DEFAULT nextval('public.notifications_notificationpreference_id_seq'::regclass);
--
-- Name: onboarding_emails id; Type: DEFAULT; Schema: public; Owner: -
--
ALTER TABLE ONLY public.onboarding_emails ALTER COLUMN id SET DEFAULT nextval('public.onboarding_emails_id_seq'::regclass);
--
-- Name: push_notifications_apnsdevice id; Type: DEFAULT; Schema: public; Owner: -
--
ALTER TABLE ONLY public.push_notifications_apnsdevice ALTER COLUMN id SET DEFAULT nextval('public.push_notifications_apnsdevice_id_seq'::regclass);
--
-- Name: push_notifications_gcmdevice id; Type: DEFAULT; Schema: public; Owner: -
--
ALTER TABLE ONLY public.push_notifications_gcmdevice ALTER COLUMN id SET DEFAULT nextval('public.push_notifications_gcmdevice_id_seq'::regclass);
--
-- Name: residence_residence id; Type: DEFAULT; Schema: public; Owner: -
--
ALTER TABLE ONLY public.residence_residence ALTER COLUMN id SET DEFAULT nextval('public.residence_residence_id_seq'::regclass);
--
-- Name: residence_residencesharecode id; Type: DEFAULT; Schema: public; Owner: -
--
ALTER TABLE ONLY public.residence_residencesharecode ALTER COLUMN id SET DEFAULT nextval('public.residence_residencesharecode_id_seq'::regclass);
--
-- Name: residence_residencetype id; Type: DEFAULT; Schema: public; Owner: -
--
ALTER TABLE ONLY public.residence_residencetype ALTER COLUMN id SET DEFAULT nextval('public.residence_residencetype_id_seq'::regclass);
--
-- Name: subscription_featurebenefit id; Type: DEFAULT; Schema: public; Owner: -
--
ALTER TABLE ONLY public.subscription_featurebenefit ALTER COLUMN id SET DEFAULT nextval('public.subscription_featurebenefit_id_seq'::regclass);
--
-- Name: subscription_promotion id; Type: DEFAULT; Schema: public; Owner: -
--
ALTER TABLE ONLY public.subscription_promotion ALTER COLUMN id SET DEFAULT nextval('public.subscription_promotion_id_seq'::regclass);
--
-- Name: subscription_subscriptionsettings id; Type: DEFAULT; Schema: public; Owner: -
--
ALTER TABLE ONLY public.subscription_subscriptionsettings ALTER COLUMN id SET DEFAULT nextval('public.subscription_subscriptionsettings_id_seq'::regclass);
--
-- Name: subscription_tierlimits id; Type: DEFAULT; Schema: public; Owner: -
--
ALTER TABLE ONLY public.subscription_tierlimits ALTER COLUMN id SET DEFAULT nextval('public.subscription_tierlimits_id_seq'::regclass);
--
-- Name: subscription_upgradetrigger id; Type: DEFAULT; Schema: public; Owner: -
--
ALTER TABLE ONLY public.subscription_upgradetrigger ALTER COLUMN id SET DEFAULT nextval('public.subscription_upgradetrigger_id_seq'::regclass);
--
-- Name: subscription_usersubscription id; Type: DEFAULT; Schema: public; Owner: -
--
ALTER TABLE ONLY public.subscription_usersubscription ALTER COLUMN id SET DEFAULT nextval('public.subscription_usersubscription_id_seq'::regclass);
--
-- Name: task_climateregion id; Type: DEFAULT; Schema: public; Owner: -
--
ALTER TABLE ONLY public.task_climateregion ALTER COLUMN id SET DEFAULT nextval('public.task_climateregion_id_seq'::regclass);
--
-- Name: task_contractor id; Type: DEFAULT; Schema: public; Owner: -
--
ALTER TABLE ONLY public.task_contractor ALTER COLUMN id SET DEFAULT nextval('public.task_contractor_id_seq'::regclass);
--
-- Name: task_contractorspecialty id; Type: DEFAULT; Schema: public; Owner: -
--
ALTER TABLE ONLY public.task_contractorspecialty ALTER COLUMN id SET DEFAULT nextval('public.task_contractorspecialty_id_seq'::regclass);
--
-- Name: task_document id; Type: DEFAULT; Schema: public; Owner: -
--
ALTER TABLE ONLY public.task_document ALTER COLUMN id SET DEFAULT nextval('public.task_document_id_seq'::regclass);
--
-- Name: task_documentimage id; Type: DEFAULT; Schema: public; Owner: -
--
ALTER TABLE ONLY public.task_documentimage ALTER COLUMN id SET DEFAULT nextval('public.task_documentimage_id_seq'::regclass);
--
-- Name: task_reminderlog id; Type: DEFAULT; Schema: public; Owner: -
--
ALTER TABLE ONLY public.task_reminderlog ALTER COLUMN id SET DEFAULT nextval('public.task_reminderlog_id_seq'::regclass);
--
-- Name: task_task id; Type: DEFAULT; Schema: public; Owner: -
--
ALTER TABLE ONLY public.task_task ALTER COLUMN id SET DEFAULT nextval('public.task_task_id_seq'::regclass);
--
-- Name: task_taskcategory id; Type: DEFAULT; Schema: public; Owner: -
--
ALTER TABLE ONLY public.task_taskcategory ALTER COLUMN id SET DEFAULT nextval('public.task_taskcategory_id_seq'::regclass);
--
-- Name: task_taskcompletion id; Type: DEFAULT; Schema: public; Owner: -
--
ALTER TABLE ONLY public.task_taskcompletion ALTER COLUMN id SET DEFAULT nextval('public.task_taskcompletion_id_seq'::regclass);
--
-- Name: task_taskcompletionimage id; Type: DEFAULT; Schema: public; Owner: -
--
ALTER TABLE ONLY public.task_taskcompletionimage ALTER COLUMN id SET DEFAULT nextval('public.task_taskcompletionimage_id_seq'::regclass);
--
-- Name: task_taskfrequency id; Type: DEFAULT; Schema: public; Owner: -
--
ALTER TABLE ONLY public.task_taskfrequency ALTER COLUMN id SET DEFAULT nextval('public.task_taskfrequency_id_seq'::regclass);
--
-- Name: task_taskpriority id; Type: DEFAULT; Schema: public; Owner: -
--
ALTER TABLE ONLY public.task_taskpriority ALTER COLUMN id SET DEFAULT nextval('public.task_taskpriority_id_seq'::regclass);
--
-- Name: task_tasktemplate id; Type: DEFAULT; Schema: public; Owner: -
--
ALTER TABLE ONLY public.task_tasktemplate ALTER COLUMN id SET DEFAULT nextval('public.task_tasktemplate_id_seq'::regclass);
--
-- Name: task_zipclimateregion id; Type: DEFAULT; Schema: public; Owner: -
--
ALTER TABLE ONLY public.task_zipclimateregion ALTER COLUMN id SET DEFAULT nextval('public.task_zipclimateregion_id_seq'::regclass);
--
-- Name: user_applesocialauth id; Type: DEFAULT; Schema: public; Owner: -
--
ALTER TABLE ONLY public.user_applesocialauth ALTER COLUMN id SET DEFAULT nextval('public.user_applesocialauth_id_seq'::regclass);
--
-- Name: user_confirmationcode id; Type: DEFAULT; Schema: public; Owner: -
--
ALTER TABLE ONLY public.user_confirmationcode ALTER COLUMN id SET DEFAULT nextval('public.user_confirmationcode_id_seq'::regclass);
--
-- Name: user_googlesocialauth id; Type: DEFAULT; Schema: public; Owner: -
--
ALTER TABLE ONLY public.user_googlesocialauth ALTER COLUMN id SET DEFAULT nextval('public.user_googlesocialauth_id_seq'::regclass);
--
-- Name: user_passwordresetcode id; Type: DEFAULT; Schema: public; Owner: -
--
ALTER TABLE ONLY public.user_passwordresetcode ALTER COLUMN id SET DEFAULT nextval('public.user_passwordresetcode_id_seq'::regclass);
--
-- Name: user_userprofile id; Type: DEFAULT; Schema: public; Owner: -
--
ALTER TABLE ONLY public.user_userprofile ALTER COLUMN id SET DEFAULT nextval('public.user_userprofile_id_seq'::regclass);
--
-- Name: admin_users admin_users_pkey; Type: CONSTRAINT; Schema: public; Owner: -
--
ALTER TABLE ONLY public.admin_users
ADD CONSTRAINT admin_users_pkey PRIMARY KEY (id);
--
-- Name: auth_user auth_user_pkey; Type: CONSTRAINT; Schema: public; Owner: -
--
ALTER TABLE ONLY public.auth_user
ADD CONSTRAINT auth_user_pkey PRIMARY KEY (id);
--
-- Name: data_migrations data_migrations_pkey; Type: CONSTRAINT; Schema: public; Owner: -
--
ALTER TABLE ONLY public.data_migrations
ADD CONSTRAINT data_migrations_pkey PRIMARY KEY (id);
--
-- Name: goadmin_menu goadmin_menu_pkey; Type: CONSTRAINT; Schema: public; Owner: -
--
ALTER TABLE ONLY public.goadmin_menu
ADD CONSTRAINT goadmin_menu_pkey PRIMARY KEY (id);
--
-- Name: goadmin_operation_log goadmin_operation_log_pkey; Type: CONSTRAINT; Schema: public; Owner: -
--
ALTER TABLE ONLY public.goadmin_operation_log
ADD CONSTRAINT goadmin_operation_log_pkey PRIMARY KEY (id);
--
-- Name: goadmin_permissions goadmin_permissions_pkey; Type: CONSTRAINT; Schema: public; Owner: -
--
ALTER TABLE ONLY public.goadmin_permissions
ADD CONSTRAINT goadmin_permissions_pkey PRIMARY KEY (id);
--
-- Name: goadmin_role_menu goadmin_role_menu_pkey; Type: CONSTRAINT; Schema: public; Owner: -
--
ALTER TABLE ONLY public.goadmin_role_menu
ADD CONSTRAINT goadmin_role_menu_pkey PRIMARY KEY (id);
--
-- Name: goadmin_role_permissions goadmin_role_permissions_pkey; Type: CONSTRAINT; Schema: public; Owner: -
--
ALTER TABLE ONLY public.goadmin_role_permissions
ADD CONSTRAINT goadmin_role_permissions_pkey PRIMARY KEY (id);
--
-- Name: goadmin_role_users goadmin_role_users_pkey; Type: CONSTRAINT; Schema: public; Owner: -
--
ALTER TABLE ONLY public.goadmin_role_users
ADD CONSTRAINT goadmin_role_users_pkey PRIMARY KEY (id);
--
-- Name: goadmin_roles goadmin_roles_pkey; Type: CONSTRAINT; Schema: public; Owner: -
--
ALTER TABLE ONLY public.goadmin_roles
ADD CONSTRAINT goadmin_roles_pkey PRIMARY KEY (id);
--
-- Name: goadmin_session goadmin_session_pkey; Type: CONSTRAINT; Schema: public; Owner: -
--
ALTER TABLE ONLY public.goadmin_session
ADD CONSTRAINT goadmin_session_pkey PRIMARY KEY (id);
--
-- Name: goadmin_site goadmin_site_pkey; Type: CONSTRAINT; Schema: public; Owner: -
--
ALTER TABLE ONLY public.goadmin_site
ADD CONSTRAINT goadmin_site_pkey PRIMARY KEY (id);
--
-- Name: goadmin_user_permissions goadmin_user_permissions_pkey; Type: CONSTRAINT; Schema: public; Owner: -
--
ALTER TABLE ONLY public.goadmin_user_permissions
ADD CONSTRAINT goadmin_user_permissions_pkey PRIMARY KEY (id);
--
-- Name: goadmin_users goadmin_users_pkey; Type: CONSTRAINT; Schema: public; Owner: -
--
ALTER TABLE ONLY public.goadmin_users
ADD CONSTRAINT goadmin_users_pkey PRIMARY KEY (id);
--
-- Name: notifications_notification notifications_notification_pkey; Type: CONSTRAINT; Schema: public; Owner: -
--
ALTER TABLE ONLY public.notifications_notification
ADD CONSTRAINT notifications_notification_pkey PRIMARY KEY (id);
--
-- Name: notifications_notificationpreference notifications_notificationpreference_pkey; Type: CONSTRAINT; Schema: public; Owner: -
--
ALTER TABLE ONLY public.notifications_notificationpreference
ADD CONSTRAINT notifications_notificationpreference_pkey PRIMARY KEY (id);
--
-- Name: onboarding_emails onboarding_emails_pkey; Type: CONSTRAINT; Schema: public; Owner: -
--
ALTER TABLE ONLY public.onboarding_emails
ADD CONSTRAINT onboarding_emails_pkey PRIMARY KEY (id);
--
-- Name: push_notifications_apnsdevice push_notifications_apnsdevice_pkey; Type: CONSTRAINT; Schema: public; Owner: -
--
ALTER TABLE ONLY public.push_notifications_apnsdevice
ADD CONSTRAINT push_notifications_apnsdevice_pkey PRIMARY KEY (id);
--
-- Name: push_notifications_gcmdevice push_notifications_gcmdevice_pkey; Type: CONSTRAINT; Schema: public; Owner: -
--
ALTER TABLE ONLY public.push_notifications_gcmdevice
ADD CONSTRAINT push_notifications_gcmdevice_pkey PRIMARY KEY (id);
--
-- Name: residence_residence residence_residence_pkey; Type: CONSTRAINT; Schema: public; Owner: -
--
ALTER TABLE ONLY public.residence_residence
ADD CONSTRAINT residence_residence_pkey PRIMARY KEY (id);
--
-- Name: residence_residence_users residence_residence_users_pkey; Type: CONSTRAINT; Schema: public; Owner: -
--
ALTER TABLE ONLY public.residence_residence_users
ADD CONSTRAINT residence_residence_users_pkey PRIMARY KEY (user_id, residence_id);
--
-- Name: residence_residencesharecode residence_residencesharecode_pkey; Type: CONSTRAINT; Schema: public; Owner: -
--
ALTER TABLE ONLY public.residence_residencesharecode
ADD CONSTRAINT residence_residencesharecode_pkey PRIMARY KEY (id);
--
-- Name: residence_residencetype residence_residencetype_pkey; Type: CONSTRAINT; Schema: public; Owner: -
--
ALTER TABLE ONLY public.residence_residencetype
ADD CONSTRAINT residence_residencetype_pkey PRIMARY KEY (id);
--
-- Name: subscription_featurebenefit subscription_featurebenefit_pkey; Type: CONSTRAINT; Schema: public; Owner: -
--
ALTER TABLE ONLY public.subscription_featurebenefit
ADD CONSTRAINT subscription_featurebenefit_pkey PRIMARY KEY (id);
--
-- Name: subscription_promotion subscription_promotion_pkey; Type: CONSTRAINT; Schema: public; Owner: -
--
ALTER TABLE ONLY public.subscription_promotion
ADD CONSTRAINT subscription_promotion_pkey PRIMARY KEY (id);
--
-- Name: subscription_subscriptionsettings subscription_subscriptionsettings_pkey; Type: CONSTRAINT; Schema: public; Owner: -
--
ALTER TABLE ONLY public.subscription_subscriptionsettings
ADD CONSTRAINT subscription_subscriptionsettings_pkey PRIMARY KEY (id);
--
-- Name: subscription_tierlimits subscription_tierlimits_pkey; Type: CONSTRAINT; Schema: public; Owner: -
--
ALTER TABLE ONLY public.subscription_tierlimits
ADD CONSTRAINT subscription_tierlimits_pkey PRIMARY KEY (id);
--
-- Name: subscription_upgradetrigger subscription_upgradetrigger_pkey; Type: CONSTRAINT; Schema: public; Owner: -
--
ALTER TABLE ONLY public.subscription_upgradetrigger
ADD CONSTRAINT subscription_upgradetrigger_pkey PRIMARY KEY (id);
--
-- Name: subscription_usersubscription subscription_usersubscription_pkey; Type: CONSTRAINT; Schema: public; Owner: -
--
ALTER TABLE ONLY public.subscription_usersubscription
ADD CONSTRAINT subscription_usersubscription_pkey PRIMARY KEY (id);
--
-- Name: task_climateregion task_climateregion_pkey; Type: CONSTRAINT; Schema: public; Owner: -
--
ALTER TABLE ONLY public.task_climateregion
ADD CONSTRAINT task_climateregion_pkey PRIMARY KEY (id);
--
-- Name: task_contractor task_contractor_pkey; Type: CONSTRAINT; Schema: public; Owner: -
--
ALTER TABLE ONLY public.task_contractor
ADD CONSTRAINT task_contractor_pkey PRIMARY KEY (id);
--
-- Name: task_contractor_specialties task_contractor_specialties_pkey; Type: CONSTRAINT; Schema: public; Owner: -
--
ALTER TABLE ONLY public.task_contractor_specialties
ADD CONSTRAINT task_contractor_specialties_pkey PRIMARY KEY (contractor_id, contractor_specialty_id);
--
-- Name: task_contractorspecialty task_contractorspecialty_pkey; Type: CONSTRAINT; Schema: public; Owner: -
--
ALTER TABLE ONLY public.task_contractorspecialty
ADD CONSTRAINT task_contractorspecialty_pkey PRIMARY KEY (id);
--
-- Name: task_document task_document_pkey; Type: CONSTRAINT; Schema: public; Owner: -
--
ALTER TABLE ONLY public.task_document
ADD CONSTRAINT task_document_pkey PRIMARY KEY (id);
--
-- Name: task_documentimage task_documentimage_pkey; Type: CONSTRAINT; Schema: public; Owner: -
--
ALTER TABLE ONLY public.task_documentimage
ADD CONSTRAINT task_documentimage_pkey PRIMARY KEY (id);
--
-- Name: task_reminderlog task_reminderlog_pkey; Type: CONSTRAINT; Schema: public; Owner: -
--
ALTER TABLE ONLY public.task_reminderlog
ADD CONSTRAINT task_reminderlog_pkey PRIMARY KEY (id);
--
-- Name: task_task task_task_pkey; Type: CONSTRAINT; Schema: public; Owner: -
--
ALTER TABLE ONLY public.task_task
ADD CONSTRAINT task_task_pkey PRIMARY KEY (id);
--
-- Name: task_taskcategory task_taskcategory_pkey; Type: CONSTRAINT; Schema: public; Owner: -
--
ALTER TABLE ONLY public.task_taskcategory
ADD CONSTRAINT task_taskcategory_pkey PRIMARY KEY (id);
--
-- Name: task_taskcompletion task_taskcompletion_pkey; Type: CONSTRAINT; Schema: public; Owner: -
--
ALTER TABLE ONLY public.task_taskcompletion
ADD CONSTRAINT task_taskcompletion_pkey PRIMARY KEY (id);
--
-- Name: task_taskcompletionimage task_taskcompletionimage_pkey; Type: CONSTRAINT; Schema: public; Owner: -
--
ALTER TABLE ONLY public.task_taskcompletionimage
ADD CONSTRAINT task_taskcompletionimage_pkey PRIMARY KEY (id);
--
-- Name: task_taskfrequency task_taskfrequency_pkey; Type: CONSTRAINT; Schema: public; Owner: -
--
ALTER TABLE ONLY public.task_taskfrequency
ADD CONSTRAINT task_taskfrequency_pkey PRIMARY KEY (id);
--
-- Name: task_taskpriority task_taskpriority_pkey; Type: CONSTRAINT; Schema: public; Owner: -
--
ALTER TABLE ONLY public.task_taskpriority
ADD CONSTRAINT task_taskpriority_pkey PRIMARY KEY (id);
--
-- Name: task_tasktemplate task_tasktemplate_pkey; Type: CONSTRAINT; Schema: public; Owner: -
--
ALTER TABLE ONLY public.task_tasktemplate
ADD CONSTRAINT task_tasktemplate_pkey PRIMARY KEY (id);
--
-- Name: task_zipclimateregion task_zipclimateregion_pkey; Type: CONSTRAINT; Schema: public; Owner: -
--
ALTER TABLE ONLY public.task_zipclimateregion
ADD CONSTRAINT task_zipclimateregion_pkey PRIMARY KEY (id);
--
-- Name: user_applesocialauth user_applesocialauth_pkey; Type: CONSTRAINT; Schema: public; Owner: -
--
ALTER TABLE ONLY public.user_applesocialauth
ADD CONSTRAINT user_applesocialauth_pkey PRIMARY KEY (id);
--
-- Name: user_authtoken user_authtoken_pkey; Type: CONSTRAINT; Schema: public; Owner: -
--
ALTER TABLE ONLY public.user_authtoken
ADD CONSTRAINT user_authtoken_pkey PRIMARY KEY (key);
--
-- Name: user_confirmationcode user_confirmationcode_pkey; Type: CONSTRAINT; Schema: public; Owner: -
--
ALTER TABLE ONLY public.user_confirmationcode
ADD CONSTRAINT user_confirmationcode_pkey PRIMARY KEY (id);
--
-- Name: user_googlesocialauth user_googlesocialauth_pkey; Type: CONSTRAINT; Schema: public; Owner: -
--
ALTER TABLE ONLY public.user_googlesocialauth
ADD CONSTRAINT user_googlesocialauth_pkey PRIMARY KEY (id);
--
-- Name: user_passwordresetcode user_passwordresetcode_pkey; Type: CONSTRAINT; Schema: public; Owner: -
--
ALTER TABLE ONLY public.user_passwordresetcode
ADD CONSTRAINT user_passwordresetcode_pkey PRIMARY KEY (id);
--
-- Name: user_userprofile user_userprofile_pkey; Type: CONSTRAINT; Schema: public; Owner: -
--
ALTER TABLE ONLY public.user_userprofile
ADD CONSTRAINT user_userprofile_pkey PRIMARY KEY (id);
--
-- Name: idx_admin_users_email; Type: INDEX; Schema: public; Owner: -
--
CREATE UNIQUE INDEX idx_admin_users_email ON public.admin_users USING btree (email);
--
-- Name: idx_auth_user_email; Type: INDEX; Schema: public; Owner: -
--
CREATE UNIQUE INDEX idx_auth_user_email ON public.auth_user USING btree (email);
--
-- Name: idx_auth_user_username; Type: INDEX; Schema: public; Owner: -
--
CREATE UNIQUE INDEX idx_auth_user_username ON public.auth_user USING btree (username);
--
-- Name: idx_data_migrations_name; Type: INDEX; Schema: public; Owner: -
--
CREATE UNIQUE INDEX idx_data_migrations_name ON public.data_migrations USING btree (name);
--
-- Name: idx_goadmin_menu_parent_id; Type: INDEX; Schema: public; Owner: -
--
CREATE INDEX idx_goadmin_menu_parent_id ON public.goadmin_menu USING btree (parent_id);
--
-- Name: idx_goadmin_operation_log_user_id; Type: INDEX; Schema: public; Owner: -
--
CREATE INDEX idx_goadmin_operation_log_user_id ON public.goadmin_operation_log USING btree (user_id);
--
-- Name: idx_goadmin_permissions_slug; Type: INDEX; Schema: public; Owner: -
--
CREATE UNIQUE INDEX idx_goadmin_permissions_slug ON public.goadmin_permissions USING btree (slug);
--
-- Name: idx_goadmin_role_menu_menu_id; Type: INDEX; Schema: public; Owner: -
--
CREATE INDEX idx_goadmin_role_menu_menu_id ON public.goadmin_role_menu USING btree (menu_id);
--
-- Name: idx_goadmin_role_menu_role_id; Type: INDEX; Schema: public; Owner: -
--
CREATE INDEX idx_goadmin_role_menu_role_id ON public.goadmin_role_menu USING btree (role_id);
--
-- Name: idx_goadmin_role_permissions_permission_id; Type: INDEX; Schema: public; Owner: -
--
CREATE INDEX idx_goadmin_role_permissions_permission_id ON public.goadmin_role_permissions USING btree (permission_id);
--
-- Name: idx_goadmin_role_permissions_role_id; Type: INDEX; Schema: public; Owner: -
--
CREATE INDEX idx_goadmin_role_permissions_role_id ON public.goadmin_role_permissions USING btree (role_id);
--
-- Name: idx_goadmin_role_users_role_id; Type: INDEX; Schema: public; Owner: -
--
CREATE INDEX idx_goadmin_role_users_role_id ON public.goadmin_role_users USING btree (role_id);
--
-- Name: idx_goadmin_role_users_user_id; Type: INDEX; Schema: public; Owner: -
--
CREATE INDEX idx_goadmin_role_users_user_id ON public.goadmin_role_users USING btree (user_id);
--
-- Name: idx_goadmin_roles_slug; Type: INDEX; Schema: public; Owner: -
--
CREATE UNIQUE INDEX idx_goadmin_roles_slug ON public.goadmin_roles USING btree (slug);
--
-- Name: idx_goadmin_session_sid; Type: INDEX; Schema: public; Owner: -
--
CREATE INDEX idx_goadmin_session_sid ON public.goadmin_session USING btree (sid);
--
-- Name: idx_goadmin_site_key; Type: INDEX; Schema: public; Owner: -
--
CREATE INDEX idx_goadmin_site_key ON public.goadmin_site USING btree (key);
--
-- Name: idx_goadmin_user_permissions_permission_id; Type: INDEX; Schema: public; Owner: -
--
CREATE INDEX idx_goadmin_user_permissions_permission_id ON public.goadmin_user_permissions USING btree (permission_id);
--
-- Name: idx_goadmin_user_permissions_user_id; Type: INDEX; Schema: public; Owner: -
--
CREATE INDEX idx_goadmin_user_permissions_user_id ON public.goadmin_user_permissions USING btree (user_id);
--
-- Name: idx_goadmin_users_username; Type: INDEX; Schema: public; Owner: -
--
CREATE UNIQUE INDEX idx_goadmin_users_username ON public.goadmin_users USING btree (username);
--
-- Name: idx_notifications_notification_user_id; Type: INDEX; Schema: public; Owner: -
--
CREATE INDEX idx_notifications_notification_user_id ON public.notifications_notification USING btree (user_id);
--
-- Name: idx_notifications_notificationpreference_user_id; Type: INDEX; Schema: public; Owner: -
--
CREATE UNIQUE INDEX idx_notifications_notificationpreference_user_id ON public.notifications_notificationpreference USING btree (user_id);
--
-- Name: idx_onboarding_emails_email_type; Type: INDEX; Schema: public; Owner: -
--
CREATE INDEX idx_onboarding_emails_email_type ON public.onboarding_emails USING btree (email_type);
--
-- Name: idx_onboarding_emails_tracking_id; Type: INDEX; Schema: public; Owner: -
--
CREATE UNIQUE INDEX idx_onboarding_emails_tracking_id ON public.onboarding_emails USING btree (tracking_id);
--
-- Name: idx_onboarding_emails_user_id; Type: INDEX; Schema: public; Owner: -
--
CREATE INDEX idx_onboarding_emails_user_id ON public.onboarding_emails USING btree (user_id);
--
-- Name: idx_onboarding_emails_user_type; Type: INDEX; Schema: public; Owner: -
--
CREATE UNIQUE INDEX idx_onboarding_emails_user_type ON public.onboarding_emails USING btree (user_id, email_type);
--
-- Name: idx_push_notifications_apnsdevice_registration_id; Type: INDEX; Schema: public; Owner: -
--
CREATE UNIQUE INDEX idx_push_notifications_apnsdevice_registration_id ON public.push_notifications_apnsdevice USING btree (registration_id);
--
-- Name: idx_push_notifications_apnsdevice_user_id; Type: INDEX; Schema: public; Owner: -
--
CREATE INDEX idx_push_notifications_apnsdevice_user_id ON public.push_notifications_apnsdevice USING btree (user_id);
--
-- Name: idx_push_notifications_gcmdevice_registration_id; Type: INDEX; Schema: public; Owner: -
--
CREATE UNIQUE INDEX idx_push_notifications_gcmdevice_registration_id ON public.push_notifications_gcmdevice USING btree (registration_id);
--
-- Name: idx_push_notifications_gcmdevice_user_id; Type: INDEX; Schema: public; Owner: -
--
CREATE INDEX idx_push_notifications_gcmdevice_user_id ON public.push_notifications_gcmdevice USING btree (user_id);
--
-- Name: idx_reminderlog_sent_at; Type: INDEX; Schema: public; Owner: -
--
CREATE INDEX idx_reminderlog_sent_at ON public.task_reminderlog USING btree (sent_at);
--
-- Name: idx_reminderlog_task_user_date; Type: INDEX; Schema: public; Owner: -
--
CREATE INDEX idx_reminderlog_task_user_date ON public.task_reminderlog USING btree (task_id, user_id, due_date);
--
-- Name: idx_residence_residence_is_active; Type: INDEX; Schema: public; Owner: -
--
CREATE INDEX idx_residence_residence_is_active ON public.residence_residence USING btree (is_active);
--
-- Name: idx_residence_residence_owner_id; Type: INDEX; Schema: public; Owner: -
--
CREATE INDEX idx_residence_residence_owner_id ON public.residence_residence USING btree (owner_id);
--
-- Name: idx_residence_residencesharecode_code; Type: INDEX; Schema: public; Owner: -
--
CREATE UNIQUE INDEX idx_residence_residencesharecode_code ON public.residence_residencesharecode USING btree (code);
--
-- Name: idx_residence_residencesharecode_is_active; Type: INDEX; Schema: public; Owner: -
--
CREATE INDEX idx_residence_residencesharecode_is_active ON public.residence_residencesharecode USING btree (is_active);
--
-- Name: idx_residence_residencesharecode_residence_id; Type: INDEX; Schema: public; Owner: -
--
CREATE INDEX idx_residence_residencesharecode_residence_id ON public.residence_residencesharecode USING btree (residence_id);
--
-- Name: idx_subscription_promotion_promotion_id; Type: INDEX; Schema: public; Owner: -
--
CREATE UNIQUE INDEX idx_subscription_promotion_promotion_id ON public.subscription_promotion USING btree (promotion_id);
--
-- Name: idx_subscription_tierlimits_tier; Type: INDEX; Schema: public; Owner: -
--
CREATE UNIQUE INDEX idx_subscription_tierlimits_tier ON public.subscription_tierlimits USING btree (tier);
--
-- Name: idx_subscription_upgradetrigger_trigger_key; Type: INDEX; Schema: public; Owner: -
--
CREATE UNIQUE INDEX idx_subscription_upgradetrigger_trigger_key ON public.subscription_upgradetrigger USING btree (trigger_key);
--
-- Name: idx_subscription_usersubscription_user_id; Type: INDEX; Schema: public; Owner: -
--
CREATE UNIQUE INDEX idx_subscription_usersubscription_user_id ON public.subscription_usersubscription USING btree (user_id);
--
-- Name: idx_task_climateregion_is_active; Type: INDEX; Schema: public; Owner: -
--
CREATE INDEX idx_task_climateregion_is_active ON public.task_climateregion USING btree (is_active);
--
-- Name: idx_task_climateregion_name; Type: INDEX; Schema: public; Owner: -
--
CREATE UNIQUE INDEX idx_task_climateregion_name ON public.task_climateregion USING btree (name);
--
-- Name: idx_task_climateregion_zone_number; Type: INDEX; Schema: public; Owner: -
--
CREATE INDEX idx_task_climateregion_zone_number ON public.task_climateregion USING btree (zone_number);
--
-- Name: idx_task_contractor_created_by_id; Type: INDEX; Schema: public; Owner: -
--
CREATE INDEX idx_task_contractor_created_by_id ON public.task_contractor USING btree (created_by_id);
--
-- Name: idx_task_contractor_is_active; Type: INDEX; Schema: public; Owner: -
--
CREATE INDEX idx_task_contractor_is_active ON public.task_contractor USING btree (is_active);
--
-- Name: idx_task_contractor_residence_id; Type: INDEX; Schema: public; Owner: -
--
CREATE INDEX idx_task_contractor_residence_id ON public.task_contractor USING btree (residence_id);
--
-- Name: idx_task_document_created_by_id; Type: INDEX; Schema: public; Owner: -
--
CREATE INDEX idx_task_document_created_by_id ON public.task_document USING btree (created_by_id);
--
-- Name: idx_task_document_expiry_date; Type: INDEX; Schema: public; Owner: -
--
CREATE INDEX idx_task_document_expiry_date ON public.task_document USING btree (expiry_date);
--
-- Name: idx_task_document_is_active; Type: INDEX; Schema: public; Owner: -
--
CREATE INDEX idx_task_document_is_active ON public.task_document USING btree (is_active);
--
-- Name: idx_task_document_residence_id; Type: INDEX; Schema: public; Owner: -
--
CREATE INDEX idx_task_document_residence_id ON public.task_document USING btree (residence_id);
--
-- Name: idx_task_document_task_id; Type: INDEX; Schema: public; Owner: -
--
CREATE INDEX idx_task_document_task_id ON public.task_document USING btree (task_id);
--
-- Name: idx_task_documentimage_document_id; Type: INDEX; Schema: public; Owner: -
--
CREATE INDEX idx_task_documentimage_document_id ON public.task_documentimage USING btree (document_id);
--
-- Name: idx_task_task_assigned_to_id; Type: INDEX; Schema: public; Owner: -
--
CREATE INDEX idx_task_task_assigned_to_id ON public.task_task USING btree (assigned_to_id);
--
-- Name: idx_task_task_category_id; Type: INDEX; Schema: public; Owner: -
--
CREATE INDEX idx_task_task_category_id ON public.task_task USING btree (category_id);
--
-- Name: idx_task_task_contractor_id; Type: INDEX; Schema: public; Owner: -
--
CREATE INDEX idx_task_task_contractor_id ON public.task_task USING btree (contractor_id);
--
-- Name: idx_task_task_created_by_id; Type: INDEX; Schema: public; Owner: -
--
CREATE INDEX idx_task_task_created_by_id ON public.task_task USING btree (created_by_id);
--
-- Name: idx_task_task_due_date; Type: INDEX; Schema: public; Owner: -
--
CREATE INDEX idx_task_task_due_date ON public.task_task USING btree (due_date);
--
-- Name: idx_task_task_frequency_id; Type: INDEX; Schema: public; Owner: -
--
CREATE INDEX idx_task_task_frequency_id ON public.task_task USING btree (frequency_id);
--
-- Name: idx_task_task_in_progress; Type: INDEX; Schema: public; Owner: -
--
CREATE INDEX idx_task_task_in_progress ON public.task_task USING btree (in_progress);
--
-- Name: idx_task_task_is_archived; Type: INDEX; Schema: public; Owner: -
--
CREATE INDEX idx_task_task_is_archived ON public.task_task USING btree (is_archived);
--
-- Name: idx_task_task_is_cancelled; Type: INDEX; Schema: public; Owner: -
--
CREATE INDEX idx_task_task_is_cancelled ON public.task_task USING btree (is_cancelled);
--
-- Name: idx_task_task_next_due_date; Type: INDEX; Schema: public; Owner: -
--
CREATE INDEX idx_task_task_next_due_date ON public.task_task USING btree (next_due_date);
--
-- Name: idx_task_task_parent_task_id; Type: INDEX; Schema: public; Owner: -
--
CREATE INDEX idx_task_task_parent_task_id ON public.task_task USING btree (parent_task_id);
--
-- Name: idx_task_task_priority_id; Type: INDEX; Schema: public; Owner: -
--
CREATE INDEX idx_task_task_priority_id ON public.task_task USING btree (priority_id);
--
-- Name: idx_task_task_residence_id; Type: INDEX; Schema: public; Owner: -
--
CREATE INDEX idx_task_task_residence_id ON public.task_task USING btree (residence_id);
--
-- Name: idx_task_task_task_template_id; Type: INDEX; Schema: public; Owner: -
--
CREATE INDEX idx_task_task_task_template_id ON public.task_task USING btree (task_template_id);
--
-- Name: idx_task_taskcompletion_completed_by_id; Type: INDEX; Schema: public; Owner: -
--
CREATE INDEX idx_task_taskcompletion_completed_by_id ON public.task_taskcompletion USING btree (completed_by_id);
--
-- Name: idx_task_taskcompletion_task_id; Type: INDEX; Schema: public; Owner: -
--
CREATE INDEX idx_task_taskcompletion_task_id ON public.task_taskcompletion USING btree (task_id);
--
-- Name: idx_task_taskcompletionimage_completion_id; Type: INDEX; Schema: public; Owner: -
--
CREATE INDEX idx_task_taskcompletionimage_completion_id ON public.task_taskcompletionimage USING btree (completion_id);
--
-- Name: idx_task_tasktemplate_category_id; Type: INDEX; Schema: public; Owner: -
--
CREATE INDEX idx_task_tasktemplate_category_id ON public.task_tasktemplate USING btree (category_id);
--
-- Name: idx_task_tasktemplate_frequency_id; Type: INDEX; Schema: public; Owner: -
--
CREATE INDEX idx_task_tasktemplate_frequency_id ON public.task_tasktemplate USING btree (frequency_id);
--
-- Name: idx_task_tasktemplate_is_active; Type: INDEX; Schema: public; Owner: -
--
CREATE INDEX idx_task_tasktemplate_is_active ON public.task_tasktemplate USING btree (is_active);
--
-- Name: idx_task_zipclimateregion_climate_region_id; Type: INDEX; Schema: public; Owner: -
--
CREATE INDEX idx_task_zipclimateregion_climate_region_id ON public.task_zipclimateregion USING btree (climate_region_id);
--
-- Name: idx_task_zipclimateregion_zip_code; Type: INDEX; Schema: public; Owner: -
--
CREATE UNIQUE INDEX idx_task_zipclimateregion_zip_code ON public.task_zipclimateregion USING btree (zip_code);
--
-- Name: idx_user_applesocialauth_apple_id; Type: INDEX; Schema: public; Owner: -
--
CREATE UNIQUE INDEX idx_user_applesocialauth_apple_id ON public.user_applesocialauth USING btree (apple_id);
--
-- Name: idx_user_applesocialauth_user_id; Type: INDEX; Schema: public; Owner: -
--
CREATE UNIQUE INDEX idx_user_applesocialauth_user_id ON public.user_applesocialauth USING btree (user_id);
--
-- Name: idx_user_authtoken_user_id; Type: INDEX; Schema: public; Owner: -
--
CREATE UNIQUE INDEX idx_user_authtoken_user_id ON public.user_authtoken USING btree (user_id);
--
-- Name: idx_user_confirmationcode_user_id; Type: INDEX; Schema: public; Owner: -
--
CREATE INDEX idx_user_confirmationcode_user_id ON public.user_confirmationcode USING btree (user_id);
--
-- Name: idx_user_googlesocialauth_google_id; Type: INDEX; Schema: public; Owner: -
--
CREATE UNIQUE INDEX idx_user_googlesocialauth_google_id ON public.user_googlesocialauth USING btree (google_id);
--
-- Name: idx_user_googlesocialauth_user_id; Type: INDEX; Schema: public; Owner: -
--
CREATE UNIQUE INDEX idx_user_googlesocialauth_user_id ON public.user_googlesocialauth USING btree (user_id);
--
-- Name: idx_user_passwordresetcode_reset_token; Type: INDEX; Schema: public; Owner: -
--
CREATE UNIQUE INDEX idx_user_passwordresetcode_reset_token ON public.user_passwordresetcode USING btree (reset_token);
--
-- Name: idx_user_passwordresetcode_user_id; Type: INDEX; Schema: public; Owner: -
--
CREATE INDEX idx_user_passwordresetcode_user_id ON public.user_passwordresetcode USING btree (user_id);
--
-- Name: idx_user_userprofile_user_id; Type: INDEX; Schema: public; Owner: -
--
CREATE UNIQUE INDEX idx_user_userprofile_user_id ON public.user_userprofile USING btree (user_id);
--
-- Name: user_authtoken fk_auth_user_auth_token; Type: FK CONSTRAINT; Schema: public; Owner: -
--
ALTER TABLE ONLY public.user_authtoken
ADD CONSTRAINT fk_auth_user_auth_token FOREIGN KEY (user_id) REFERENCES public.auth_user(id);
--
-- Name: notifications_notificationpreference fk_auth_user_notification_pref; Type: FK CONSTRAINT; Schema: public; Owner: -
--
ALTER TABLE ONLY public.notifications_notificationpreference
ADD CONSTRAINT fk_auth_user_notification_pref FOREIGN KEY (user_id) REFERENCES public.auth_user(id);
--
-- Name: residence_residence fk_auth_user_owned_residences; Type: FK CONSTRAINT; Schema: public; Owner: -
--
ALTER TABLE ONLY public.residence_residence
ADD CONSTRAINT fk_auth_user_owned_residences FOREIGN KEY (owner_id) REFERENCES public.auth_user(id);
--
-- Name: user_userprofile fk_auth_user_profile; Type: FK CONSTRAINT; Schema: public; Owner: -
--
ALTER TABLE ONLY public.user_userprofile
ADD CONSTRAINT fk_auth_user_profile FOREIGN KEY (user_id) REFERENCES public.auth_user(id);
--
-- Name: subscription_usersubscription fk_auth_user_subscription; Type: FK CONSTRAINT; Schema: public; Owner: -
--
ALTER TABLE ONLY public.subscription_usersubscription
ADD CONSTRAINT fk_auth_user_subscription FOREIGN KEY (user_id) REFERENCES public.auth_user(id);
--
-- Name: notifications_notification fk_notifications_notification_user; Type: FK CONSTRAINT; Schema: public; Owner: -
--
ALTER TABLE ONLY public.notifications_notification
ADD CONSTRAINT fk_notifications_notification_user FOREIGN KEY (user_id) REFERENCES public.auth_user(id);
--
-- Name: onboarding_emails fk_onboarding_emails_user; Type: FK CONSTRAINT; Schema: public; Owner: -
--
ALTER TABLE ONLY public.onboarding_emails
ADD CONSTRAINT fk_onboarding_emails_user FOREIGN KEY (user_id) REFERENCES public.auth_user(id);
--
-- Name: push_notifications_apnsdevice fk_push_notifications_apnsdevice_user; Type: FK CONSTRAINT; Schema: public; Owner: -
--
ALTER TABLE ONLY public.push_notifications_apnsdevice
ADD CONSTRAINT fk_push_notifications_apnsdevice_user FOREIGN KEY (user_id) REFERENCES public.auth_user(id);
--
-- Name: push_notifications_gcmdevice fk_push_notifications_gcmdevice_user; Type: FK CONSTRAINT; Schema: public; Owner: -
--
ALTER TABLE ONLY public.push_notifications_gcmdevice
ADD CONSTRAINT fk_push_notifications_gcmdevice_user FOREIGN KEY (user_id) REFERENCES public.auth_user(id);
--
-- Name: residence_residence fk_residence_residence_property_type; Type: FK CONSTRAINT; Schema: public; Owner: -
--
ALTER TABLE ONLY public.residence_residence
ADD CONSTRAINT fk_residence_residence_property_type FOREIGN KEY (property_type_id) REFERENCES public.residence_residencetype(id);
--
-- Name: residence_residence_users fk_residence_residence_users_residence; Type: FK CONSTRAINT; Schema: public; Owner: -
--
ALTER TABLE ONLY public.residence_residence_users
ADD CONSTRAINT fk_residence_residence_users_residence FOREIGN KEY (residence_id) REFERENCES public.residence_residence(id);
--
-- Name: residence_residence_users fk_residence_residence_users_user; Type: FK CONSTRAINT; Schema: public; Owner: -
--
ALTER TABLE ONLY public.residence_residence_users
ADD CONSTRAINT fk_residence_residence_users_user FOREIGN KEY (user_id) REFERENCES public.auth_user(id);
--
-- Name: residence_residencesharecode fk_residence_residencesharecode_created_by; Type: FK CONSTRAINT; Schema: public; Owner: -
--
ALTER TABLE ONLY public.residence_residencesharecode
ADD CONSTRAINT fk_residence_residencesharecode_created_by FOREIGN KEY (created_by_id) REFERENCES public.auth_user(id);
--
-- Name: residence_residencesharecode fk_residence_residencesharecode_residence; Type: FK CONSTRAINT; Schema: public; Owner: -
--
ALTER TABLE ONLY public.residence_residencesharecode
ADD CONSTRAINT fk_residence_residencesharecode_residence FOREIGN KEY (residence_id) REFERENCES public.residence_residence(id);
--
-- Name: task_contractor fk_task_contractor_created_by; Type: FK CONSTRAINT; Schema: public; Owner: -
--
ALTER TABLE ONLY public.task_contractor
ADD CONSTRAINT fk_task_contractor_created_by FOREIGN KEY (created_by_id) REFERENCES public.auth_user(id);
--
-- Name: task_contractor fk_task_contractor_residence; Type: FK CONSTRAINT; Schema: public; Owner: -
--
ALTER TABLE ONLY public.task_contractor
ADD CONSTRAINT fk_task_contractor_residence FOREIGN KEY (residence_id) REFERENCES public.residence_residence(id);
--
-- Name: task_contractor_specialties fk_task_contractor_specialties_contractor; Type: FK CONSTRAINT; Schema: public; Owner: -
--
ALTER TABLE ONLY public.task_contractor_specialties
ADD CONSTRAINT fk_task_contractor_specialties_contractor FOREIGN KEY (contractor_id) REFERENCES public.task_contractor(id);
--
-- Name: task_contractor_specialties fk_task_contractor_specialties_contractor_specialty; Type: FK CONSTRAINT; Schema: public; Owner: -
--
ALTER TABLE ONLY public.task_contractor_specialties
ADD CONSTRAINT fk_task_contractor_specialties_contractor_specialty FOREIGN KEY (contractor_specialty_id) REFERENCES public.task_contractorspecialty(id);
--
-- Name: task_task fk_task_contractor_tasks; Type: FK CONSTRAINT; Schema: public; Owner: -
--
ALTER TABLE ONLY public.task_task
ADD CONSTRAINT fk_task_contractor_tasks FOREIGN KEY (contractor_id) REFERENCES public.task_contractor(id);
--
-- Name: task_document fk_task_document_created_by; Type: FK CONSTRAINT; Schema: public; Owner: -
--
ALTER TABLE ONLY public.task_document
ADD CONSTRAINT fk_task_document_created_by FOREIGN KEY (created_by_id) REFERENCES public.auth_user(id);
--
-- Name: task_documentimage fk_task_document_images; Type: FK CONSTRAINT; Schema: public; Owner: -
--
ALTER TABLE ONLY public.task_documentimage
ADD CONSTRAINT fk_task_document_images FOREIGN KEY (document_id) REFERENCES public.task_document(id);
--
-- Name: task_document fk_task_document_residence; Type: FK CONSTRAINT; Schema: public; Owner: -
--
ALTER TABLE ONLY public.task_document
ADD CONSTRAINT fk_task_document_residence FOREIGN KEY (residence_id) REFERENCES public.residence_residence(id);
--
-- Name: task_document fk_task_document_task; Type: FK CONSTRAINT; Schema: public; Owner: -
--
ALTER TABLE ONLY public.task_document
ADD CONSTRAINT fk_task_document_task FOREIGN KEY (task_id) REFERENCES public.task_task(id);
--
-- Name: task_reminderlog fk_task_reminderlog_notification; Type: FK CONSTRAINT; Schema: public; Owner: -
--
ALTER TABLE ONLY public.task_reminderlog
ADD CONSTRAINT fk_task_reminderlog_notification FOREIGN KEY (notification_id) REFERENCES public.notifications_notification(id);
--
-- Name: task_reminderlog fk_task_reminderlog_task; Type: FK CONSTRAINT; Schema: public; Owner: -
--
ALTER TABLE ONLY public.task_reminderlog
ADD CONSTRAINT fk_task_reminderlog_task FOREIGN KEY (task_id) REFERENCES public.task_task(id);
--
-- Name: task_reminderlog fk_task_reminderlog_user; Type: FK CONSTRAINT; Schema: public; Owner: -
--
ALTER TABLE ONLY public.task_reminderlog
ADD CONSTRAINT fk_task_reminderlog_user FOREIGN KEY (user_id) REFERENCES public.auth_user(id);
--
-- Name: task_task fk_task_task_assigned_to; Type: FK CONSTRAINT; Schema: public; Owner: -
--
ALTER TABLE ONLY public.task_task
ADD CONSTRAINT fk_task_task_assigned_to FOREIGN KEY (assigned_to_id) REFERENCES public.auth_user(id);
--
-- Name: task_task fk_task_task_category; Type: FK CONSTRAINT; Schema: public; Owner: -
--
ALTER TABLE ONLY public.task_task
ADD CONSTRAINT fk_task_task_category FOREIGN KEY (category_id) REFERENCES public.task_taskcategory(id);
--
-- Name: task_taskcompletion fk_task_task_completions; Type: FK CONSTRAINT; Schema: public; Owner: -
--
ALTER TABLE ONLY public.task_taskcompletion
ADD CONSTRAINT fk_task_task_completions FOREIGN KEY (task_id) REFERENCES public.task_task(id);
--
-- Name: task_task fk_task_task_created_by; Type: FK CONSTRAINT; Schema: public; Owner: -
--
ALTER TABLE ONLY public.task_task
ADD CONSTRAINT fk_task_task_created_by FOREIGN KEY (created_by_id) REFERENCES public.auth_user(id);
--
-- Name: task_task fk_task_task_frequency; Type: FK CONSTRAINT; Schema: public; Owner: -
--
ALTER TABLE ONLY public.task_task
ADD CONSTRAINT fk_task_task_frequency FOREIGN KEY (frequency_id) REFERENCES public.task_taskfrequency(id);
--
-- Name: task_task fk_task_task_parent_task; Type: FK CONSTRAINT; Schema: public; Owner: -
--
ALTER TABLE ONLY public.task_task
ADD CONSTRAINT fk_task_task_parent_task FOREIGN KEY (parent_task_id) REFERENCES public.task_task(id);
--
-- Name: task_task fk_task_task_priority; Type: FK CONSTRAINT; Schema: public; Owner: -
--
ALTER TABLE ONLY public.task_task
ADD CONSTRAINT fk_task_task_priority FOREIGN KEY (priority_id) REFERENCES public.task_taskpriority(id);
--
-- Name: task_task fk_task_task_residence; Type: FK CONSTRAINT; Schema: public; Owner: -
--
ALTER TABLE ONLY public.task_task
ADD CONSTRAINT fk_task_task_residence FOREIGN KEY (residence_id) REFERENCES public.residence_residence(id);
--
-- Name: task_task fk_task_task_task_template; Type: FK CONSTRAINT; Schema: public; Owner: -
--
ALTER TABLE ONLY public.task_task
ADD CONSTRAINT fk_task_task_task_template FOREIGN KEY (task_template_id) REFERENCES public.task_tasktemplate(id);
--
-- Name: task_taskcompletion fk_task_taskcompletion_completed_by; Type: FK CONSTRAINT; Schema: public; Owner: -
--
ALTER TABLE ONLY public.task_taskcompletion
ADD CONSTRAINT fk_task_taskcompletion_completed_by FOREIGN KEY (completed_by_id) REFERENCES public.auth_user(id);
--
-- Name: task_taskcompletionimage fk_task_taskcompletion_images; Type: FK CONSTRAINT; Schema: public; Owner: -
--
ALTER TABLE ONLY public.task_taskcompletionimage
ADD CONSTRAINT fk_task_taskcompletion_images FOREIGN KEY (completion_id) REFERENCES public.task_taskcompletion(id);
--
-- Name: task_tasktemplate fk_task_tasktemplate_category; Type: FK CONSTRAINT; Schema: public; Owner: -
--
ALTER TABLE ONLY public.task_tasktemplate
ADD CONSTRAINT fk_task_tasktemplate_category FOREIGN KEY (category_id) REFERENCES public.task_taskcategory(id);
--
-- Name: task_tasktemplate fk_task_tasktemplate_frequency; Type: FK CONSTRAINT; Schema: public; Owner: -
--
ALTER TABLE ONLY public.task_tasktemplate
ADD CONSTRAINT fk_task_tasktemplate_frequency FOREIGN KEY (frequency_id) REFERENCES public.task_taskfrequency(id);
--
-- Name: task_zipclimateregion fk_task_zipclimateregion_climate_region; Type: FK CONSTRAINT; Schema: public; Owner: -
--
ALTER TABLE ONLY public.task_zipclimateregion
ADD CONSTRAINT fk_task_zipclimateregion_climate_region FOREIGN KEY (climate_region_id) REFERENCES public.task_climateregion(id);
--
-- Name: user_applesocialauth fk_user_applesocialauth_user; Type: FK CONSTRAINT; Schema: public; Owner: -
--
ALTER TABLE ONLY public.user_applesocialauth
ADD CONSTRAINT fk_user_applesocialauth_user FOREIGN KEY (user_id) REFERENCES public.auth_user(id);
--
-- Name: user_confirmationcode fk_user_confirmationcode_user; Type: FK CONSTRAINT; Schema: public; Owner: -
--
ALTER TABLE ONLY public.user_confirmationcode
ADD CONSTRAINT fk_user_confirmationcode_user FOREIGN KEY (user_id) REFERENCES public.auth_user(id);
--
-- Name: user_googlesocialauth fk_user_googlesocialauth_user; Type: FK CONSTRAINT; Schema: public; Owner: -
--
ALTER TABLE ONLY public.user_googlesocialauth
ADD CONSTRAINT fk_user_googlesocialauth_user FOREIGN KEY (user_id) REFERENCES public.auth_user(id);
--
-- Name: user_passwordresetcode fk_user_passwordresetcode_user; Type: FK CONSTRAINT; Schema: public; Owner: -
--
ALTER TABLE ONLY public.user_passwordresetcode
ADD CONSTRAINT fk_user_passwordresetcode_user FOREIGN KEY (user_id) REFERENCES public.auth_user(id);
--
-- PostgreSQL database dump complete
--
-- +goose Down
-- Initial schema rollback is intentionally unimplemented.
--
-- Reverting migration 000001 means dropping every table in the database.
-- That's not a "down migration" — it's a database wipe. If you genuinely
-- need to redo the schema from scratch, drop the database and re-run
-- `migrate up` against an empty target.
--
-- Any future migrations (000002, 000003, …) MUST provide working .down.sql
-- files that revert their specific changes (DROP COLUMN, DROP INDEX, etc).