-- CloudVault Initial Schema - Devices Table
CREATE TABLE IF NOT EXISTS `devices` (
  `id` int AUTO_INCREMENT NOT NULL,
  `device_id` varchar(255) NOT NULL,
  `name` varchar(255) NOT NULL,
  `model` varchar(255),
  `android_version` varchar(50),
  `pairing_token` varchar(255),
  `is_connected` boolean DEFAULT false,
  `last_seen` timestamp,
  `storage_total` int,
  `storage_used` int,
  `encryption_key` text,
  `created_at` timestamp DEFAULT (now()),
  `updated_at` timestamp DEFAULT (now()),
  CONSTRAINT `devices_id` PRIMARY KEY(`id`),
  CONSTRAINT `devices_device_id_unique` UNIQUE(`device_id`)
);
