CREATE TABLE `award_progress` ( `id` integer PRIMARY KEY AUTOINCREMENT NOT NULL, `user_id` integer NOT NULL, `award_id` text NOT NULL, `worked_count` integer DEFAULT 0 NOT NULL, `confirmed_count` integer DEFAULT 0 NOT NULL, `total_required` integer NOT NULL, `worked_entities` text, `confirmed_entities` text, `last_calculated_at` integer, `last_qso_sync_at` integer, `updated_at` integer NOT NULL, FOREIGN KEY (`user_id`) REFERENCES `users`(`id`) ON UPDATE no action ON DELETE no action, FOREIGN KEY (`award_id`) REFERENCES `awards`(`id`) ON UPDATE no action ON DELETE no action ); --> statement-breakpoint CREATE TABLE `awards` ( `id` text PRIMARY KEY NOT NULL, `name` text NOT NULL, `description` text, `definition` text NOT NULL, `is_active` integer DEFAULT true NOT NULL, `created_at` integer NOT NULL ); --> statement-breakpoint CREATE TABLE `qsos` ( `id` integer PRIMARY KEY AUTOINCREMENT NOT NULL, `user_id` integer NOT NULL, `callsign` text NOT NULL, `qso_date` text NOT NULL, `time_on` text NOT NULL, `band` text, `mode` text, `freq` integer, `freq_rx` integer, `entity` text, `entity_id` integer, `grid` text, `grid_source` text, `continent` text, `cq_zone` integer, `itu_zone` integer, `state` text, `county` text, `sat_name` text, `sat_mode` text, `lotw_qsl_rdate` text, `lotw_qsl_rstatus` text, `lotw_synced_at` integer, `created_at` integer NOT NULL, FOREIGN KEY (`user_id`) REFERENCES `users`(`id`) ON UPDATE no action ON DELETE no action ); --> statement-breakpoint CREATE TABLE `users` ( `id` integer PRIMARY KEY AUTOINCREMENT NOT NULL, `email` text NOT NULL, `password_hash` text NOT NULL, `callsign` text NOT NULL, `lotw_username` text, `lotw_password` text, `created_at` integer NOT NULL, `updated_at` integer NOT NULL ); --> statement-breakpoint CREATE UNIQUE INDEX `users_email_unique` ON `users` (`email`);