-- ClearBank MySQL Export (Fixed)
-- Generated: 2026-08-26 19:38:07


-- --------------------------------------------------------

CREATE TABLE `savings_accounts` (`id` INT PRIMARY KEY AUTO_INCREMENT not null, `user_id` int not null, `account_id` int not null, `interest_rate` numeric not null default '4.5', `balance` numeric not null default '0', `status` varchar(255) not null default 'inactive', `created_at` datetime, `updated_at` datetime, foreign key(`user_id`) references `users`(`id`) on delete cascade, foreign key(`account_id`) references `accounts`(`id`) on delete cascade);

-- --------------------------------------------------------

CREATE TABLE `failed_jobs` (`id` INT PRIMARY KEY AUTO_INCREMENT not null, `uuid` varchar(255) not null, `connection` text not null, `queue` text not null, `payload` text not null, `exception` text not null, `failed_at` datetime not null default CURRENT_TIMESTAMP);

-- --------------------------------------------------------

CREATE TABLE `job_batches` (`id` varchar(255) not null, `name` varchar(255) not null, `total_jobs` int not null, `pending_jobs` int not null, `failed_jobs` int not null, `failed_job_ids` text not null, `options` text, `cancelled_at` int, `created_at` int not null, `finished_at` int, primary key (`id`));

-- --------------------------------------------------------

CREATE TABLE `jobs` (`id` INT PRIMARY KEY AUTO_INCREMENT not null, `queue` varchar(255) not null, `payload` text not null, `attempts` int not null, `reserved_at` int, `available_at` int not null, `created_at` int not null);

-- --------------------------------------------------------

CREATE TABLE `migrations` (`id` INT PRIMARY KEY AUTO_INCREMENT not null, `migration` varchar(255) not null, `batch` int not null);

-- --------------------------------------------------------

CREATE TABLE `sessions` (`id` varchar(255) not null, `user_id` int, `ip_address` varchar(255), `user_agent` text, `payload` text not null, `last_activity` int not null, primary key (`id`));

-- --------------------------------------------------------

CREATE TABLE `support_tickets` (`id` INT PRIMARY KEY AUTO_INCREMENT not null, `user_id` int not null, `subject` varchar(255) not null, `message` text not null, `status` varchar(255) not null default 'open', `priority` varchar(255) not null default 'medium', `created_at` datetime, `updated_at` datetime, foreign key(`user_id`) references `users`(`id`) on delete cascade);

-- --------------------------------------------------------
-- Admin user: admin@clearb.org / password
-- Change password after first login!
