Merge pull request #229 from Hestia-Homes/debug/only_migration_files

Debug/only migration files
This commit is contained in:
KhalimCK 2026-04-17 21:08:11 +01:00 committed by GitHub
commit 388823d561
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
13 changed files with 27234 additions and 2 deletions

View file

@ -5,10 +5,11 @@
"remoteUser": "vscode",
"workspaceFolder": "/workspaces/assessment-model",
"postStartCommand": "bash .devcontainer/post-install.sh",
"forwardPorts": [3000],
"forwardPorts": [3000], # For vscode
"appPort": ["3000:3000"], # For devcontainer shell
"mounts": [
// Optional, just makes getting from Downloads (local env) easier
// "source=${localEnv:HOME},target=/workspaces/home,type=bind"
"source=${localEnv:HOME},target=/workspaces/home,type=bind"
],
"customizations": {
"vscode": {

102
devcontainer.sh Normal file
View file

@ -0,0 +1,102 @@
#!/usr/bin/env bash
#
# devcontainer.sh — devcontainer helper for this repo
#
# Usage:
# ./devcontainer.sh <command>
#
# Commands:
# up build + start the devcontainer (idempotent)
# shell attach a bash shell; auto-ups if not running
# down stop the devcontainer
# rebuild remove + rebuild from scratch, no cache
#
# Examples:
# ./devcontainer.sh shell # one-shot: up if needed, then bash
# ./devcontainer.sh rebuild
set -euo pipefail
SCRIPT_DIR="$(cd -- "$(dirname -- "${BASH_SOURCE[0]}")" &>/dev/null && pwd)"
REPO_ROOT="${SCRIPT_DIR}"
CONFIG_PATH="${REPO_ROOT}/.devcontainer/devcontainer.json"
VALID_COMMANDS=(up shell down rebuild)
# --- helpers ---------------------------------------------------------------
usage() {
sed -n '3,15p' "${BASH_SOURCE[0]}" | sed 's/^# \{0,1\}//'
exit "${1:-0}"
}
die() {
echo "error: $*" >&2
exit 1
}
in_list() {
local needle="$1"
shift
local item
for item in "$@"; do
[[ "${item}" == "${needle}" ]] && return 0
done
return 1
}
container_id() {
# Find the running container for this repo via devcontainer labels.
docker ps -q \
--filter "label=devcontainer.local_folder=${REPO_ROOT}" \
--filter "label=devcontainer.config_file=${CONFIG_PATH}"
}
# --- argument parsing ------------------------------------------------------
[[ $# -eq 1 ]] || usage 1
COMMAND="$1"
in_list "${COMMAND}" "${VALID_COMMANDS[@]}" \
|| die "invalid command '${COMMAND}' (expected: ${VALID_COMMANDS[*]})"
[[ -f "${CONFIG_PATH}" ]] || die "config not found: ${CONFIG_PATH}"
DC_ARGS=(--workspace-folder "${REPO_ROOT}")
# --- dispatch --------------------------------------------------------------
case "${COMMAND}" in
up)
echo ">> bringing up devcontainer"
devcontainer up "${DC_ARGS[@]}"
;;
shell)
# Auto-up if not already running. `devcontainer up` is idempotent —
# it reuses an existing container, so this is cheap on warm starts.
if [[ -z "$(container_id)" ]]; then
echo ">> devcontainer not running, bringing it up first"
devcontainer up "${DC_ARGS[@]}"
fi
echo ">> attaching shell"
devcontainer exec "${DC_ARGS[@]}" bash 2>/dev/null \
|| devcontainer exec "${DC_ARGS[@]}" sh
;;
down)
cid="$(container_id)"
if [[ -z "${cid}" ]]; then
echo ">> devcontainer not running, nothing to stop"
exit 0
fi
echo ">> stopping devcontainer"
docker stop "${cid}"
;;
rebuild)
echo ">> rebuilding devcontainer from scratch"
devcontainer up "${DC_ARGS[@]}" --remove-existing-container --build-no-cache
;;
esac

View file

@ -0,0 +1,59 @@
CREATE TYPE "public"."portfolio_capability" AS ENUM('approver', 'contractor');--> statement-breakpoint
ALTER TYPE "public"."measure_type" ADD VALUE 'damp_mould';--> statement-breakpoint
ALTER TYPE "public"."measure_type" ADD VALUE 'door_undercut';--> statement-breakpoint
ALTER TYPE "public"."measure_type" ADD VALUE 'extractor_fan';--> statement-breakpoint
ALTER TYPE "public"."measure_type" ADD VALUE 'loft_board';--> statement-breakpoint
ALTER TYPE "public"."measure_type" ADD VALUE 'trickle_vent';--> statement-breakpoint
ALTER TYPE "public"."file_source" ADD VALUE 'contractor';--> statement-breakpoint
ALTER TYPE "public"."file_type" ADD VALUE 'pre_photo';--> statement-breakpoint
ALTER TYPE "public"."file_type" ADD VALUE 'mid_photo';--> statement-breakpoint
ALTER TYPE "public"."file_type" ADD VALUE 'post_photo';--> statement-breakpoint
ALTER TYPE "public"."file_type" ADD VALUE 'pre_installation_building_inspection';--> statement-breakpoint
ALTER TYPE "public"."file_type" ADD VALUE 'claim_of_compliance';--> statement-breakpoint
ALTER TYPE "public"."file_type" ADD VALUE 'handover_pack';--> statement-breakpoint
ALTER TYPE "public"."file_type" ADD VALUE 'insurance_guarantee';--> statement-breakpoint
ALTER TYPE "public"."file_type" ADD VALUE 'installer_qualifications';--> statement-breakpoint
ALTER TYPE "public"."file_type" ADD VALUE 'mcs_compliance_certificate';--> statement-breakpoint
ALTER TYPE "public"."file_type" ADD VALUE 'minor_works_electrical_certificate';--> statement-breakpoint
ALTER TYPE "public"."file_type" ADD VALUE 'point_of_work_risk_assessment';--> statement-breakpoint
ALTER TYPE "public"."file_type" ADD VALUE 'installer_feedback';--> statement-breakpoint
ALTER TYPE "public"."file_type" ADD VALUE 'workmanship_warranty';--> statement-breakpoint
ALTER TYPE "public"."file_type" ADD VALUE 'g98_notification';--> statement-breakpoint
ALTER TYPE "public"."file_type" ADD VALUE 'certificate_of_conformity';--> statement-breakpoint
ALTER TYPE "public"."file_type" ADD VALUE 'ventilation_assessment_checklist';--> statement-breakpoint
ALTER TYPE "public"."file_type" ADD VALUE 'contractor_other';--> statement-breakpoint
CREATE TABLE "deal_approvals" (
"id" bigserial PRIMARY KEY NOT NULL,
"hubspot_deal_id" text NOT NULL,
"approved_by" bigint NOT NULL,
"approved_at" timestamp with time zone DEFAULT now() NOT NULL,
"notes" text,
"created_at" timestamp with time zone DEFAULT now() NOT NULL
);
--> statement-breakpoint
CREATE TABLE "deal_approved_measures" (
"id" bigserial PRIMARY KEY NOT NULL,
"deal_approval_id" bigint NOT NULL,
"measure_name" text NOT NULL,
"created_at" timestamp with time zone DEFAULT now() NOT NULL
);
--> statement-breakpoint
CREATE TABLE "portfolio_capabilities" (
"id" bigserial PRIMARY KEY NOT NULL,
"user_id" bigint NOT NULL,
"portfolio_id" bigint NOT NULL,
"capability" "portfolio_capability" NOT NULL,
"created_at" timestamp (6) with time zone DEFAULT now() NOT NULL,
"updated_at" timestamp (6) with time zone DEFAULT now() NOT NULL,
CONSTRAINT "portfolio_capabilities_user_id_portfolio_id_capability_unique" UNIQUE("user_id","portfolio_id","capability")
);
--> statement-breakpoint
ALTER TABLE "uploaded_files" ADD COLUMN "measure_name" text;--> statement-breakpoint
ALTER TABLE "uploaded_files" ADD COLUMN "uploaded_by" bigint;--> statement-breakpoint
ALTER TABLE "deal_approvals" ADD CONSTRAINT "deal_approvals_approved_by_user_id_fk" FOREIGN KEY ("approved_by") REFERENCES "public"."user"("id") ON DELETE no action ON UPDATE no action;--> statement-breakpoint
ALTER TABLE "deal_approved_measures" ADD CONSTRAINT "deal_approved_measures_deal_approval_id_deal_approvals_id_fk" FOREIGN KEY ("deal_approval_id") REFERENCES "public"."deal_approvals"("id") ON DELETE cascade ON UPDATE no action;--> statement-breakpoint
ALTER TABLE "portfolio_capabilities" ADD CONSTRAINT "portfolio_capabilities_user_id_user_id_fk" FOREIGN KEY ("user_id") REFERENCES "public"."user"("id") ON DELETE no action ON UPDATE no action;--> statement-breakpoint
ALTER TABLE "portfolio_capabilities" ADD CONSTRAINT "portfolio_capabilities_portfolio_id_portfolio_id_fk" FOREIGN KEY ("portfolio_id") REFERENCES "public"."portfolio"("id") ON DELETE no action ON UPDATE no action;--> statement-breakpoint
CREATE INDEX "idx_deal_approvals_deal_id" ON "deal_approvals" USING btree ("hubspot_deal_id");--> statement-breakpoint
CREATE INDEX "idx_deal_approved_measures_approval_id" ON "deal_approved_measures" USING btree ("deal_approval_id");--> statement-breakpoint
ALTER TABLE "uploaded_files" ADD CONSTRAINT "uploaded_files_uploaded_by_user_id_fk" FOREIGN KEY ("uploaded_by") REFERENCES "public"."user"("id") ON DELETE no action ON UPDATE no action;

View file

@ -0,0 +1,26 @@
CREATE TABLE "deal_measure_approval_events" (
"id" bigserial PRIMARY KEY NOT NULL,
"hubspot_deal_id" text NOT NULL,
"measure_name" text NOT NULL,
"action" text NOT NULL,
"acted_by" bigint NOT NULL,
"acted_at" timestamp with time zone DEFAULT now() NOT NULL
);
--> statement-breakpoint
CREATE TABLE "deal_measure_approvals" (
"id" bigserial PRIMARY KEY NOT NULL,
"hubspot_deal_id" text NOT NULL,
"measure_name" text NOT NULL,
"is_approved" boolean DEFAULT true NOT NULL,
"approved_by" bigint NOT NULL,
"approved_at" timestamp with time zone DEFAULT now() NOT NULL,
CONSTRAINT "uq_deal_measure" UNIQUE("hubspot_deal_id","measure_name")
);
--> statement-breakpoint
DROP TABLE "deal_approvals" CASCADE;--> statement-breakpoint
DROP TABLE "deal_approved_measures" CASCADE;--> statement-breakpoint
ALTER TABLE "deal_measure_approval_events" ADD CONSTRAINT "deal_measure_approval_events_acted_by_user_id_fk" FOREIGN KEY ("acted_by") REFERENCES "public"."user"("id") ON DELETE no action ON UPDATE no action;--> statement-breakpoint
ALTER TABLE "deal_measure_approvals" ADD CONSTRAINT "deal_measure_approvals_approved_by_user_id_fk" FOREIGN KEY ("approved_by") REFERENCES "public"."user"("id") ON DELETE no action ON UPDATE no action;--> statement-breakpoint
CREATE INDEX "idx_deal_measure_events_deal_id" ON "deal_measure_approval_events" USING btree ("hubspot_deal_id");--> statement-breakpoint
CREATE INDEX "idx_deal_measure_events_acted_at" ON "deal_measure_approval_events" USING btree ("acted_at");--> statement-breakpoint
CREATE INDEX "idx_deal_measure_approvals_deal_id" ON "deal_measure_approvals" USING btree ("hubspot_deal_id");

View file

@ -0,0 +1 @@
ALTER TABLE "bulk_address_uploads" ADD COLUMN "task_id" uuid;

View file

@ -0,0 +1 @@
ALTER TABLE "bulk_address_uploads" ADD COLUMN "task_id" uuid;

View file

@ -0,0 +1 @@
ALTER TABLE "bulk_address_uploads" ADD COLUMN "combined_output_s3_uri" text;

View file

@ -0,0 +1 @@
ALTER TABLE "bulk_address_uploads" ADD COLUMN "combined_output_s3_uri" text;

File diff suppressed because it is too large Load diff

File diff suppressed because it is too large Load diff

File diff suppressed because it is too large Load diff

File diff suppressed because it is too large Load diff

View file

@ -1205,6 +1205,48 @@
"when": 1776361262258,
"tag": "0171_chunky_wallow",
"breakpoints": true
},
{
"idx": 172,
"version": "7",
"when": 1776374085626,
"tag": "0172_kind_eddie_brock",
"breakpoints": true
},
{
"idx": 173,
"version": "7",
"when": 1776378570612,
"tag": "0173_neat_bastion",
"breakpoints": true
},
{
"idx": 174,
"version": "7",
"when": 1776900000000,
"tag": "0174_bulk_upload_task_id",
"breakpoints": true
},
{
"idx": 175,
"version": "7",
"when": 1776434096854,
"tag": "0175_sweet_otto_octavius",
"breakpoints": true
},
{
"idx": 176,
"version": "7",
"when": 1776900120000,
"tag": "0176_bulk_upload_combined_output",
"breakpoints": true
},
{
"idx": 177,
"version": "7",
"when": 1776451871348,
"tag": "0177_wooden_dexter_bennett",
"breakpoints": true
}
]
}