CREATE TABLE "router_v1.7"."transfers" (
	"event_id" varchar(128) PRIMARY KEY NOT NULL,
	"chain_id" bigint NOT NULL,
	"contract" varchar(42) NOT NULL,
	"from" varchar(42) NOT NULL,
	"to" varchar(42) NOT NULL,
	"value" numeric(78, 0) NOT NULL,
	"block_number" bigint NOT NULL,
	"created_at" timestamp DEFAULT now() NOT NULL
);
--> statement-breakpoint
ALTER TABLE "router_v1.7"."transfers" ADD CONSTRAINT "transfers_positions_from_fk" FOREIGN KEY ("chain_id","contract","from") REFERENCES "router_v1.7"."positions"("chain_id","contract","user") ON DELETE cascade ON UPDATE no action;--> statement-breakpoint
ALTER TABLE "router_v1.7"."transfers" ADD CONSTRAINT "transfers_positions_to_fk" FOREIGN KEY ("chain_id","contract","to") REFERENCES "router_v1.7"."positions"("chain_id","contract","user") ON DELETE cascade ON UPDATE no action;--> statement-breakpoint
CREATE INDEX "transfers_chain_contract_user_idx" ON "router_v1.7"."transfers" USING btree ("chain_id","contract","from","to","block_number");