CREATE TABLE `delegation_bundles` (
	`id` text PRIMARY KEY NOT NULL,
	`task_id` text NOT NULL,
	`claim_id` text NOT NULL,
	`partner_id` text NOT NULL,
	`label` text NOT NULL,
	`share_token` text NOT NULL,
	`quantity` integer NOT NULL,
	`status` text DEFAULT 'active' NOT NULL,
	`created_at` text DEFAULT CURRENT_TIMESTAMP NOT NULL,
	`updated_at` text DEFAULT CURRENT_TIMESTAMP NOT NULL,
	`revoked_at` text
);
--> statement-breakpoint
CREATE UNIQUE INDEX `delegation_bundles_share_token_idx` ON `delegation_bundles` (`share_token`);--> statement-breakpoint
CREATE INDEX `delegation_bundles_claim_created_idx` ON `delegation_bundles` (`claim_id`,`created_at`);--> statement-breakpoint
ALTER TABLE `distributions` ADD `delegation_bundle_id` text;