CREATE TYPE "public"."account_kind" AS ENUM('water', 'electricity', 'gas', 'internet', 'phone', 'cable', 'waste', 'other');--> statement-breakpoint CREATE TABLE "property_accounts" ( "id" uuid PRIMARY KEY DEFAULT gen_random_uuid() NOT NULL, "property_id" uuid NOT NULL, "kind" "account_kind" NOT NULL, "provider" varchar(128), "label" varchar(128), "account_number" varchar(128), "meter_number" varchar(128), "notes" text, "order" integer DEFAULT 0 NOT NULL, "created_at" timestamp with time zone DEFAULT now() NOT NULL, "updated_at" timestamp with time zone DEFAULT now() NOT NULL ); --> statement-breakpoint ALTER TABLE "property_accounts" ADD CONSTRAINT "property_accounts_property_id_properties_id_fk" FOREIGN KEY ("property_id") REFERENCES "public"."properties"("id") ON DELETE cascade ON UPDATE no action;--> statement-breakpoint CREATE INDEX "accounts_by_property" ON "property_accounts" USING btree ("property_id","kind","order");