CREATE TABLE `reserve_allocations` (
  `id` integer PRIMARY KEY AUTOINCREMENT NOT NULL,
  `company_id` text NOT NULL REFERENCES `companies`(`id`),
  `bank_account_id` integer NOT NULL REFERENCES `bank_accounts`(`id`),
  `category` text NOT NULL,
  `label` text NOT NULL,
  `amount` real NOT NULL,
  `transfer_date` text NOT NULL,
  `included_in_treasury` integer NOT NULL DEFAULT 0,
  `note` text,
  `active` integer NOT NULL DEFAULT 1,
  `created_at` text NOT NULL
);
--> statement-breakpoint
CREATE INDEX `idx_reserve_allocations_bank_active` ON `reserve_allocations` (`bank_account_id`,`active`);
--> statement-breakpoint
CREATE INDEX `idx_reserve_allocations_company_date` ON `reserve_allocations` (`company_id`,`transfer_date`);
--> statement-breakpoint
PRAGMA optimize;
