ALTER TABLE "credit_histories" ALTER COLUMN "user_id" TYPE uuid USING "user_id"::uuid;--> statement-breakpoint
ALTER TABLE "payment_provider_transactions" ALTER COLUMN "user_id" TYPE uuid USING "user_id"::uuid;--> statement-breakpoint
ALTER TABLE "notifications" ALTER COLUMN "user_id" TYPE uuid USING "user_id"::uuid;--> statement-breakpoint
ALTER TABLE "devices" ALTER COLUMN "user_id" TYPE uuid USING "user_id"::uuid;--> statement-breakpoint
ALTER TABLE "orders" ALTER COLUMN "user_id" TYPE uuid USING "user_id"::uuid;--> statement-breakpoint
ALTER TABLE "payments" ALTER COLUMN "user_id" TYPE uuid USING "user_id"::uuid;--> statement-breakpoint
ALTER TABLE "identities" ALTER COLUMN "user_id" TYPE uuid USING "user_id"::uuid;--> statement-breakpoint

ALTER TABLE "credit_histories" ADD CONSTRAINT "credit_histories_user_id_users_id_fk" FOREIGN KEY ("user_id") REFERENCES "public"."users"("id") ON DELETE cascade ON UPDATE cascade;--> statement-breakpoint
ALTER TABLE "payment_provider_transactions" ADD CONSTRAINT "payment_provider_transactions_user_id_users_id_fk" FOREIGN KEY ("user_id") REFERENCES "public"."users"("id") ON DELETE cascade ON UPDATE cascade;--> statement-breakpoint
ALTER TABLE "notifications" ADD CONSTRAINT "notifications_user_id_users_id_fk" FOREIGN KEY ("user_id") REFERENCES "public"."users"("id") ON DELETE cascade ON UPDATE cascade;--> statement-breakpoint
ALTER TABLE "devices" ADD CONSTRAINT "devices_user_id_users_id_fk" FOREIGN KEY ("user_id") REFERENCES "public"."users"("id") ON DELETE cascade ON UPDATE cascade;--> statement-breakpoint
ALTER TABLE "orders" ADD CONSTRAINT "orders_user_id_users_id_fk" FOREIGN KEY ("user_id") REFERENCES "public"."users"("id") ON DELETE cascade ON UPDATE cascade;--> statement-breakpoint
ALTER TABLE "payments" ADD CONSTRAINT "payments_user_id_users_id_fk" FOREIGN KEY ("user_id") REFERENCES "public"."users"("id") ON DELETE cascade ON UPDATE cascade;--> statement-breakpoint
ALTER TABLE "identities" ADD CONSTRAINT "identities_user_id_users_id_fk" FOREIGN KEY ("user_id") REFERENCES "public"."users"("id") ON DELETE cascade ON UPDATE cascade;
