integratedhub/drizzle/0002_powerful_justin_hammer.sql

20 lines
876 B
SQL

CREATE TABLE "property_expenses" (
"id" text PRIMARY KEY NOT NULL,
"property_id" text,
"category" text,
"amount" double precision,
"description" text,
"expense_date" bigint,
"payment_method" text,
"vendor" text,
"receipt_url" text,
"is_recurring" boolean DEFAULT false,
"recurring_frequency" text,
"created_on" bigint,
"updated_on" bigint
);
--> statement-breakpoint
ALTER TABLE "messages" DROP CONSTRAINT "messages_lease_id_leases_id_fk";
--> statement-breakpoint
ALTER TABLE "property_expenses" ADD CONSTRAINT "property_expenses_property_id_properties_id_fk" FOREIGN KEY ("property_id") REFERENCES "public"."properties"("id") ON DELETE no action ON UPDATE no action;--> statement-breakpoint
ALTER TABLE "messages" ADD CONSTRAINT "messages_lease_id_leases_id_fk" FOREIGN KEY ("lease_id") REFERENCES "public"."leases"("id") ON DELETE set null ON UPDATE no action;