PRAGMA foreign_keys=OFF;
BEGIN TRANSACTION;
CREATE TABLE user_profile (
    id INTEGER PRIMARY KEY AUTOINCREMENT,
    firstname TEXT NOT NULL,
    lastname TEXT NOT NULL,
    email TEXT NOT NULL UNIQUE,
    zipcode TEXT NOT NULL,
    state TEXT NOT NULL,
    area TEXT NOT NULL
, user_id BIGINT, is_premium INTEGER DEFAULT 0, career_situation TEXT, interest_inventory_answers TEXT, is_pro_premium INTEGER DEFAULT 0, resume_optimizations_used INTEGER DEFAULT 0, resume_limit_reset DATE, resume_booster_count INTEGER DEFAULT 0, career_priorities TEXT, career_list TEXT);
INSERT INTO user_profile VALUES(1,'test_1','test_1','testemail@gmail.com','30102','GA','Atlanta-Sandy Springs-Roswell, GA',2338,1,'highSchool','115343151424535134534521315315431344454314351353224411311112',1,8,'2025-05-15T17:32:04.217Z',100,'{"interests":"I know my interests (completed inventory)","meaning":"Somewhat important","stability":"Very important","growth":"Yes, very important","balance":"Yes, very important","recognition":"Somewhat important"}',NULL);
INSERT INTO user_profile VALUES(9,'test2','test2','jhcoak01@gmail.com','30102','GA','Atlanta-Sandy Springs-Roswell, GA',806934892,0,'preparing','425554252413414122242225352255412311341132325443522443414225',0,0,NULL,0,'{"interests":"I know my interests (completed inventory)","meaning":"Somewhat important","stability":"Very important","growth":"Somewhat important","balance":"Yes, very important","recognition":"Somewhat important"}','[{"href":"https://services.onetcenter.org/ws/mnm/careers/17-1011.00/","fit":"Good","code":"17-1011.00","title":"Architects","tags":{"bright_outlook":true,"green":false,"apprenticeship":false},"job_zone":5,"limitedData":false,"jobDescription":"Plan and design structures, such as private residences, office buildings, theaters, factories, and other structural property.","tasks":["Develop final construction plans that include aesthetic representations of the structure or details for its construction.","Prepare scale drawings or architectural designs, using computer-aided design or other tools.","Prepare information regarding design, structure specifications, materials, color, equipment, estimated costs, or construction time."],"economicProjections":{"state":{"area":"United States","baseYear":2022,"base":123700,"projectedYear":2032,"projection":129700,"change":6000,"percentChange":4.9,"annualOpenings":8200,"occupationName":"Architects, Except Landscape and Naval"},"national":{"area":"United States","baseYear":2022,"base":123700,"projectedYear":2032,"projection":129700,"change":6000,"percentChange":4.9,"annualOpenings":8200,"occupationName":"Architects, Except Landscape and Naval"}},"salaryData":[{"percentile":"10th","regionalSalary":0,"nationalSalary":"58870"},{"percentile":"25th","regionalSalary":0,"nationalSalary":"73240"},{"percentile":"Median","regionalSalary":0,"nationalSalary":"93310"},{"percentile":"75th","regionalSalary":0,"nationalSalary":"116780"},{"percentile":"90th","regionalSalary":0,"nationalSalary":"151300"}],"schools":[],"ratings":{"interests":3,"meaning":3,"stability":5,"growth":5,"balance":4,"recognition":4}},{"href":"https://services.onetcenter.org/ws/mnm/careers/15-1255.01/","fit":"Good","code":"15-1255.01","title":"Video Game Designers","tags":{"bright_outlook":true,"green":false,"apprenticeship":true},"job_zone":4,"limitedData":false,"jobDescription":"Design core features of video games. Specify innovative game and role-play mechanics, story lines, and character biographies. Create and maintain design documentation. Guide and collaborate with production staff to produce games as designed.","tasks":["Balance and adjust gameplay experiences to ensure the critical and commercial success of the product.","Devise missions, challenges, or puzzles to be encountered in game play.","Create core game features, including storylines, role-play mechanics, and character biographies for a new video game or game franchise."],"economicProjections":{"state":{"area":"United States","baseYear":2022,"base":117900,"projectedYear":2032,"projection":135800,"change":17900,"percentChange":15.2,"annualOpenings":10700,"occupationName":"Web and Digital Interface Designers"},"national":{"area":"United States","baseYear":2022,"base":117900,"projectedYear":2032,"projection":135800,"change":17900,"percentChange":15.2,"annualOpenings":10700,"occupationName":"Web and Digital Interface Designers"}},"salaryData":[{"percentile":"10th","regionalSalary":0,"nationalSalary":"48210"},{"percentile":"25th","regionalSalary":0,"nationalSalary":"66020"},{"percentile":"Median","regionalSalary":0,"nationalSalary":"98540"},{"percentile":"75th","regionalSalary":0,"nationalSalary":"139500"},{"percentile":"90th","regionalSalary":0,"nationalSalary":"176490"}],"schools":[],"ratings":{"interests":3,"meaning":3,"stability":5,"growth":5,"balance":4,"recognition":3}},{"href":"https://services.onetcenter.org/ws/mnm/careers/27-1022.00/","fit":"Best","code":"27-1022.00","title":"Fashion Designers","tags":{"bright_outlook":false,"green":false,"apprenticeship":true},"job_zone":3,"limitedData":false,"jobDescription":"Design clothing and accessories. Create original designs or adapt fashion trends.","tasks":["Sketch rough and detailed drawings of apparel or accessories, and write specifications such as color schemes, construction, material types, and accessory requirements.","Examine sample garments on and off models, modifying designs to achieve desired effects.","Confer with sales and management executives or with clients to discuss design ideas."],"salaryData":[{"percentile":"10th Percentile","regionalSalary":52050,"nationalSalary":37090},{"percentile":"25th Percentile","regionalSalary":64570,"nationalSalary":58440},{"percentile":"Median","regionalSalary":80510,"nationalSalary":79290},{"percentile":"75th Percentile","regionalSalary":96060,"nationalSalary":107260},{"percentile":"90th Percentile","regionalSalary":127220,"nationalSalary":160850}],"economicProjections":{"state":{"area":"Georgia","baseYear":2022,"base":180,"projectedYear":2032,"projection":220,"change":40,"percentChange":22.2,"annualOpenings":20,"occupationName":"Fashion Designers"},"national":{"area":"United States","baseYear":2022,"base":24900,"projectedYear":2032,"projection":25700,"change":800,"percentChange":3.2,"annualOpenings":2300,"occupationName":"Fashion Designers"}},"ratings":{"interests":5,"meaning":3,"stability":4,"growth":1,"balance":4,"recognition":4}},{"href":"https://services.onetcenter.org/ws/mnm/careers/27-1012.00/","fit":"Best","code":"27-1012.00","title":"Craft Artists","tags":{"bright_outlook":false,"green":false,"apprenticeship":true},"job_zone":3,"limitedData":false,"jobDescription":"Create or reproduce handmade objects for sale and exhibition using a variety of techniques, such as welding, weaving, pottery, and needlecraft.","tasks":["Create functional or decorative objects by hand, using a variety of methods and materials.","Cut, shape, fit, join, mold, or otherwise process materials, using hand tools, power tools, or machinery.","Apply finishes to objects being crafted."],"salaryData":[{"percentile":"10th Percentile","regionalSalary":19680,"nationalSalary":21010},{"percentile":"25th Percentile","regionalSalary":36500,"nationalSalary":29120},{"percentile":"Median","regionalSalary":55820,"nationalSalary":36600},{"percentile":"75th Percentile","regionalSalary":101490,"nationalSalary":49010},{"percentile":"90th Percentile","regionalSalary":168380,"nationalSalary":67980}],"economicProjections":{"state":{"area":"Georgia","baseYear":2022,"base":610,"projectedYear":2032,"projection":690,"change":80,"percentChange":13.1,"annualOpenings":70,"occupationName":"Craft Artists"},"national":{"area":"United States","baseYear":2022,"base":11500,"projectedYear":2032,"projection":12000,"change":500,"percentChange":4.3,"annualOpenings":1100,"occupationName":"Craft Artists"}},"ratings":{"interests":5,"meaning":4,"stability":3,"growth":1,"balance":3,"recognition":2}},{"href":"https://services.onetcenter.org/ws/mnm/careers/47-2043.00/","fit":"Good","code":"47-2043.00","title":"Floor Sanders & Finishers","tags":{"bright_outlook":false,"green":false,"apprenticeship":false},"job_zone":1,"limitedData":false,"jobDescription":"Scrape and sand wooden floors to smooth surfaces using floor scraper and floor sanding machine, and apply coats of finish.","tasks":["Buff and vacuum floors to ensure their cleanliness prior to the application of finish.","Scrape and sand floor edges and areas inaccessible to floor sanders, using scrapers, disk-type sanders, and sandpaper.","Inspect floors for smoothness."],"salaryData":[{"percentile":"10th Percentile","regionalSalary":0,"nationalSalary":33080},{"percentile":"25th Percentile","regionalSalary":0,"nationalSalary":38530},{"percentile":"Median","regionalSalary":0,"nationalSalary":47760},{"percentile":"75th Percentile","regionalSalary":0,"nationalSalary":57520},{"percentile":"90th Percentile","regionalSalary":0,"nationalSalary":69540}],"economicProjections":{"state":{"area":"Georgia","baseYear":2022,"base":200,"projectedYear":2032,"projection":220,"change":20,"percentChange":10,"annualOpenings":20,"occupationName":"Floor Sanders and Finishers"},"national":{"area":"United States","baseYear":2022,"base":6200,"projectedYear":2032,"projection":6200,"change":0,"percentChange":0,"annualOpenings":500,"occupationName":"Floor Sanders and Finishers"}},"ratings":{"interests":3,"meaning":3,"stability":2,"growth":1,"balance":2,"recognition":1}},{"href":"https://services.onetcenter.org/ws/mnm/careers/27-1014.00/","fit":"Best","code":"27-1014.00","title":"Special Effects Artists & Animators","tags":{"bright_outlook":false,"green":false,"apprenticeship":false},"job_zone":4,"limitedData":false,"jobDescription":"Create special effects or animations using film, video, computers, or other electronic tools and media for use in products, such as computer games, movies, music videos, and commercials.","tasks":["Design complex graphics and animation, using independent judgment, creativity, and computer equipment.","Create basic designs, drawings, and illustrations for product labels, cartons, direct mail, or television.","Participate in design and production of multimedia campaigns, handling budgeting and scheduling, and assisting with such responsibilities as production coordination, background design, and progress tracking."],"salaryData":[{"percentile":"10th Percentile","regionalSalary":53040,"nationalSalary":57090},{"percentile":"25th Percentile","regionalSalary":55660,"nationalSalary":71570},{"percentile":"Median","regionalSalary":71570,"nationalSalary":99060},{"percentile":"75th Percentile","regionalSalary":90120,"nationalSalary":133400},{"percentile":"90th Percentile","regionalSalary":123070,"nationalSalary":169580}],"economicProjections":{"state":{"area":"Georgia","baseYear":2022,"base":2040,"projectedYear":2032,"projection":2420,"change":380,"percentChange":18.6,"annualOpenings":250,"occupationName":"Multimedia Artists and Animators"},"national":{"area":"United States","baseYear":2022,"base":89300,"projectedYear":2032,"projection":96600,"change":7300,"percentChange":8.2,"annualOpenings":9400,"occupationName":"Multimedia Artists and Animators"}},"ratings":{"interests":5,"meaning":3,"stability":4,"growth":1,"balance":4,"recognition":3}},{"code":"51-9081.00","title":"Dental Laboratory Technicians","cipCode":[51.0603,51.1006,51.2307,51.2312],"jobDescription":"Construct and repair full or partial dentures or dental appliances.","tasks":["Read prescriptions or specifications and examine models or impressions to determine the design of dental products to be constructed.","Test appliances for conformance to specifications and accuracy of occlusion, using articulators and micrometers.","Fabricate, alter, or repair dental devices, such as dentures, crowns, bridges, inlays, or appliances for straightening teeth."],"salaryData":[{"percentile":"10th Percentile","regionalSalary":31950,"nationalSalary":33940},{"percentile":"25th Percentile","regionalSalary":35710,"nationalSalary":38250},{"percentile":"Median","regionalSalary":45710,"nationalSalary":47690},{"percentile":"75th Percentile","regionalSalary":58830,"nationalSalary":60880},{"percentile":"90th Percentile","regionalSalary":70610,"nationalSalary":77460}],"economicProjections":{"state":{"area":"Georgia","baseYear":2022,"base":1290,"projectedYear":2032,"projection":1250,"change":-40,"percentChange":-3.1,"annualOpenings":140,"occupationName":"Dental Laboratory Technicians"},"national":{"area":"United States","baseYear":2022,"base":35400,"projectedYear":2032,"projection":33800,"change":-1600,"percentChange":-4.5,"annualOpenings":3800,"occupationName":"Dental Laboratory Technicians"}},"ratings":{"interests":3,"meaning":3,"stability":2,"growth":1,"balance":3,"recognition":2}}]');
INSERT INTO user_profile VALUES(10,'test3','test3','test3@gmail.com','30102','GA','Atlanta-Sandy Springs-Roswell, GA',225268832,0,'planning',NULL,0,0,NULL,0,NULL,NULL);
CREATE TABLE user_auth (
    id INTEGER PRIMARY KEY AUTOINCREMENT,
    user_id INTEGER NOT NULL,
    username TEXT UNIQUE NOT NULL,
    hashed_password TEXT NOT NULL,
    FOREIGN KEY (user_id) REFERENCES user_profile (id)
);
INSERT INTO user_auth VALUES(1,2338,'test1','$2b$10$sj16OETunF4Ld4KsUHdZRedFOS4WTTKdqvlulOaI4Bi6B9tk/Gcri');
INSERT INTO user_auth VALUES(9,806934892,'test2','$2b$10$C/YCiukKwlKYeUstLQatyeEzA4tSoUriCo8ANmjrjzaJmUDetK1Qm');
INSERT INTO user_auth VALUES(11,225268832,'test3','$2b$10$49yqfka7fxC9eQ2DLmRUE.6yQn4fwLnap90a0sP174QFeWF8stKbe');
CREATE TABLE retirement_data (
    id INTEGER PRIMARY KEY AUTOINCREMENT,
    user_id INTEGER,
    current_age INTEGER,
    retirement_age INTEGER,
    current_salary DECIMAL(10, 2),
    current_savings DECIMAL(10, 2),
    annual_savings DECIMAL(10, 2),
    return_rate DECIMAL(5, 2),  -- Expected return rate on investments (percentage)
    salary_growth_rate DECIMAL(5, 2),  -- User-defined or calculated salary growth rate
    FOREIGN KEY (user_id) REFERENCES user_info(id)
);
CREATE TABLE financial_projections (
  id INTEGER PRIMARY KEY AUTOINCREMENT,
  user_id INTEGER NOT NULL,             -- references users(id)
  career_path_id INTEGER,               -- references career_paths(id), if you wish
  -- In SQLite, foreign key constraints require PRAGMA foreign_keys=ON and syntax like:
  --  user_id INTEGER NOT NULL REFERENCES users(id),

  projection_data TEXT NOT NULL,        -- store the monthly array or entire projection as JSON

  loan_paid_off_month TEXT,             -- e.g. "2026-05"
  final_emergency_savings NUMERIC(10,2) DEFAULT 0,
  final_retirement_savings NUMERIC(10,2) DEFAULT 0,
  final_loan_balance NUMERIC(10,2) DEFAULT 0,

  created_at DATETIME DEFAULT CURRENT_TIMESTAMP,
  updated_at DATETIME DEFAULT CURRENT_TIMESTAMP
);
CREATE TABLE career_paths (
  id TEXT PRIMARY KEY,
  user_id INTEGER NOT NULL,
  career_name TEXT NOT NULL,
  status TEXT,
  start_date TEXT,
  projected_end_date TEXT,
  college_enrollment_status TEXT,
  currently_working TEXT,
  created_at DATETIME DEFAULT CURRENT_TIMESTAMP,
  updated_at DATETIME DEFAULT CURRENT_TIMESTAMP, planned_monthly_expenses REAL, planned_monthly_debt_payments REAL, planned_monthly_retirement_contribution REAL, planned_monthly_emergency_contribution REAL, planned_surplus_emergency_pct REAL, planned_surplus_retirement_pct REAL, planned_additional_income REAL, scenario_title TEXT,
  UNIQUE(user_id, career_name)
);
INSERT INTO career_paths VALUES('9fda178b-7f3e-49b4-8738-cc1ef914d289',2338,'Blockchain Engineers','Current','2025-04-20','2029-04-20','prospective_student','no','2025-04-11 07:18:02','2025-05-09T18:19:49.095Z',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL);
INSERT INTO career_paths VALUES('582ba2c6-b276-41fe-84e8-290a21e4ebcc',2338,'Blockchain Engineers (Copy)','Current','2025-04-20','2029-04-20','currently_enrolled','yes','2025-04-29T15:52:32.664Z','2025-05-09T18:21:23.412Z',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL);
INSERT INTO career_paths VALUES('ddc5aff3-f048-408b-a0bd-26df67acb4b7',2338,'Computer & Information Research Scientists','planned','2025-05-02T17:42:11.995Z',NULL,NULL,NULL,'2025-05-02T17:42:11.995Z','2025-05-02T17:42:11.995Z',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL);
INSERT INTO career_paths VALUES('804d3724-a8d5-4821-b2ac-1db772edc27a',2338,'Environmental Compliance Inspectors','planned','2025-05-02T17:42:35.243Z',NULL,NULL,NULL,'2025-05-02T17:42:35.243Z','2025-05-02T17:42:35.243Z',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL);
INSERT INTO career_paths VALUES('0114af6d-be42-4329-8c6b-2bda58942c25',2338,'Information Technology Project Managers','planned','2029-01-01',NULL,'currently_enrolled','no','2025-05-09T17:52:40.362Z','2025-05-09T18:06:06.978Z',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL);
INSERT INTO career_paths VALUES('5336b6b0-2d32-4e30-8b40-b533eee15ec3',2338,'Childcare Workers','Current','2025-05-01',NULL,'currently_enrolled','yes','2025-05-09T17:58:18.530Z','2025-05-09T18:01:37.791Z',0.0,0.0,0.0,0.0,0.0,0.0,0.0,NULL);
INSERT INTO career_paths VALUES('09936b67-d74b-414a-a7af-48651960d94f',2338,'Chemistry Teachers, Postsecondary','Planned','2025-05-09T18:12:03.472Z',NULL,'prospective_student','no','2025-05-09T18:10:53.074Z','2025-05-09T18:14:14.966Z',0.0,0.0,0.0,0.0,0.0,0.0,0.0,NULL);
INSERT INTO career_paths VALUES('ffd6990d-e378-4d01-a79d-6166751321ad',166278206,'Information Technology Project Managers','planned','2025-05-10T17:26:33.861Z',NULL,NULL,NULL,'2025-05-10T17:26:33.861Z','2025-05-10T17:26:33.861Z',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL);
CREATE TABLE college_profiles (
  id TEXT PRIMARY KEY,          -- UUID for this table
  user_id INTEGER NOT NULL,     -- numeric user ID
  career_path_id TEXT,          -- references career_paths.id (which is TEXT/UUID)

  -- Basic info about the program
  selected_school TEXT,
  selected_program TEXT,
  program_type TEXT,
  academic_calendar TEXT,

  -- Location / Enrollment details
  is_in_state BOOLEAN,
  is_in_district BOOLEAN,       -- <-- Newly included
  is_online BOOLEAN,
  college_enrollment_status TEXT,

  -- Financial fields
  annual_financial_aid NUMERIC(10,2),
  existing_college_debt NUMERIC(10,2),
  tuition NUMERIC(10,2),
  tuition_paid NUMERIC(10,2),
  loan_deferral_until_graduation BOOLEAN,
  loan_term INTEGER,
  interest_rate NUMERIC(5,2),
  extra_payment NUMERIC(10,2),

  -- Academic progress
  credit_hours_per_year NUMERIC(5,2),
  hours_completed NUMERIC(5,1),
  program_length NUMERIC(5,2),
  credit_hours_required NUMERIC(5,2),
  expected_graduation DATETIME,

  -- Career outcome
  expected_salary NUMERIC(10,2),

  -- Timestamps
  created_at DATETIME DEFAULT CURRENT_TIMESTAMP,
  updated_at DATETIME DEFAULT CURRENT_TIMESTAMP);
INSERT INTO college_profiles VALUES('3b971127-5735-4e21-9c58-28c128c872ae',2338,'9fda178b-7f3e-49b4-8738-cc1ef914d289','Emory University','Communication and Media Studies.','Bachelor''s Degree','semester',1,0,0,'prospective_student',0,0,57431,10000,0,10,8,0,22,20,5,0,'2029-04-20',105000,'2025-04-17 16:13:04','2025-05-09 18:19:49');
INSERT INTO college_profiles VALUES('be7de70c-bbc5-4670-ae12-2bfb350ab6af',2338,'582ba2c6-b276-41fe-84e8-290a21e4ebcc','Emory University','Communication and Media Studies.','Bachelor''s Degree','semester',1,0,0,'currently_enrolled',0,0,57430,0,1,10,8,0,22,22,4,0,'2029-04-20',80000,'2025-04-29 15:52:32','2025-05-09 18:21:23');
INSERT INTO college_profiles VALUES('8acfb6ae-f55a-46bc-a378-5dce57261076',2338,'5336b6b0-2d32-4e30-8b40-b533eee15ec3','University of North Georgia','Special Education and Teaching.','Bachelor''s Degree','semester',1,0,0,'currently_enrolled',4000,0,4230,0,0,10,0,0,30,15,4,0,'2028-12-09',50000,'2025-05-09 17:58:18','2025-05-09 17:58:18');
INSERT INTO college_profiles VALUES('91f8e07a-e211-41f1-9535-57d109fa7dd1',2338,'5336b6b0-2d32-4e30-8b40-b533eee15ec3','University of North Georgia','Computer/Information Technology Administration and Management.','Bachelor''s Degree','semester',1,0,0,'currently_enrolled',4000,0,4230,0,0,10,0,0,30,15,3.5,0,'2028-12-09',65000,'2025-05-09 18:01:37','2025-05-09 18:01:37');
INSERT INTO college_profiles VALUES('2f66f7e0-9043-4bc2-af06-2e8f18df544a',2338,'0114af6d-be42-4329-8c6b-2bda58942c25',NULL,NULL,NULL,'monthly',1,0,0,'currently_enrolled',0,0,0,0,0,10,5,0,0,0,0,0,NULL,0,'2025-05-09 18:06:07','2025-05-09 18:06:07');
INSERT INTO college_profiles VALUES('b0fadc8f-42b8-4536-b02e-5b89e8f723b8',2338,'09936b67-d74b-414a-a7af-48651960d94f','University of West Georgia','Teacher Education and Professional Development, Specific Subject Areas.','Bachelor''s Degree','semester',1,0,0,'prospective_student',0,0,4371,0,0,10,0,0,24,0,0,0,'2030-05-09',55000,'2025-05-09 18:14:15','2025-05-09 18:14:15');
CREATE TABLE financial_profiles (
  user_id INTEGER PRIMARY KEY,
  current_salary NUMERIC(10,2) DEFAULT 0,
  additional_income NUMERIC(10,2) DEFAULT 0,
  monthly_expenses NUMERIC(10,2) DEFAULT 0,
  monthly_debt_payments NUMERIC(10,2) DEFAULT 0,
  retirement_savings NUMERIC(10,2) DEFAULT 0,
  emergency_fund NUMERIC(10,2) DEFAULT 0,
  retirement_contribution NUMERIC(10,2) DEFAULT 0,
  emergency_contribution NUMERIC(10,2) DEFAULT 0,
  extra_cash_emergency_pct NUMERIC(5,2) DEFAULT 0,
  extra_cash_retirement_pct NUMERIC(5,2) DEFAULT 0,
  created_at DATETIME DEFAULT CURRENT_TIMESTAMP,
  updated_at DATETIME DEFAULT CURRENT_TIMESTAMP
);
INSERT INTO financial_profiles VALUES(2338,0,0,0,0,0,0,0,0,0,0,'2025-04-11 07:49:22','2025-05-09 18:14:15');
CREATE TABLE tasks (
  id TEXT PRIMARY KEY,          -- e.g. a UUID
  milestone_id TEXT NOT NULL,   -- foreign key to milestones.id
  user_id INTEGER NOT NULL,     -- or you can infer from milestone if you like
  title TEXT NOT NULL,
  description TEXT,
  due_date DATE,
  status TEXT DEFAULT 'not_started',  -- e.g. 'not_started', 'in_progress', 'completed'
  created_at TIMESTAMP DEFAULT CURRENT_TIMESTAMP,
  updated_at TIMESTAMP DEFAULT CURRENT_TIMESTAMP
);
INSERT INTO tasks VALUES('b717c4ac-f900-48ef-af64-68b20d91fb44','78a002c7-9358-4bc6-8d30-9e34e93edf51',2338,'Test Task 1','Blockchain Entry task','2025-04-18','not_started','2025-04-14T17:15:21.928Z','2025-04-14T17:15:21.928Z');
INSERT INTO tasks VALUES('2b893e90-a6da-49ed-ab51-ab584216974a','5df0805a-f601-44ab-9f2a-c02dd69212af',2338,'Test Task 1','','2026-02-17','not_started','2025-05-02T13:10:56.622Z','2025-05-02T13:10:56.622Z');
CREATE TABLE milestones (
  id TEXT PRIMARY KEY,
  user_id INTEGER NOT NULL,
  milestone_type TEXT NOT NULL,
  title TEXT NOT NULL,
  description TEXT,
  date TEXT,
  progress INTEGER DEFAULT 0,
  status TEXT DEFAULT 'planned',
  new_salary DECIMAL,
  career_path_id TEXT,
  -- Now add your timestamps with defaults:
  created_at TEXT DEFAULT CURRENT_TIMESTAMP,
  updated_at TEXT DEFAULT CURRENT_TIMESTAMP
, is_universal BOOLEAN DEFAULT false, origin_milestone_id TEXT);
INSERT INTO milestones VALUES('3965bebf-8ad8-4f7d-ac10-6cc962678876',2338,'Career','Test1','','2029-12-05',0,'planned',NULL,'9fda178b-7f3e-49b4-8738-cc1ef914d289','2025-05-09T19:08:06.081Z','2025-05-09T19:08:06.081Z',0,NULL);
CREATE TABLE milestone_impacts (
  id            TEXT PRIMARY KEY,
  milestone_id  TEXT NOT NULL,
  impact_type   TEXT NOT NULL,
  direction     TEXT NOT NULL,
  amount        REAL NOT NULL DEFAULT 0,
  start_date    TEXT,
  end_date      TEXT,
  created_at    TEXT,
  updated_at    TEXT
);
INSERT INTO milestone_impacts VALUES('62f37b78-4593-41b9-803a-bb4fd2dc6133','4699c46d-2bd0-4966-a9de-9db79d7e1421','ONE_TIME','subtract',10000.0,'2025-04-22',NULL,'2025-04-22T13:13:19.722Z','2025-04-23T12:50:14.830Z');
INSERT INTO milestone_impacts VALUES('2dfb7794-a0aa-4edd-901f-45bbee8d7b2a','d829cf70-c986-42fb-a649-0d06c16ea7e0','ONE_TIME','subtract',10000.0,'2025-04-22',NULL,'2025-04-23T12:49:01.397Z','2025-04-23T12:49:01.397Z');
INSERT INTO milestone_impacts VALUES('923b07f5-4cf8-4e5e-b690-61011578dc8e','6d0cbcc7-8619-450b-95aa-d5b7b228a54c','ONE_TIME','subtract',10000.0,'2025-04-22',NULL,'2025-04-23T13:12:40.246Z','2025-04-23T13:12:40.246Z');
INSERT INTO milestone_impacts VALUES('f823b303-2e52-4c5b-aeac-08b0f89b0e5d','684bded6-0ef0-4394-9ff4-99c56cbec5e4','ONE_TIME','subtract',10000.0,'2025-04-25',NULL,'2025-04-23T13:46:43.809Z','2025-04-23T13:46:43.809Z');
INSERT INTO milestone_impacts VALUES('963fc672-54ea-43f3-be54-b782e1b7a82c','17514ef0-1701-4d87-a654-63314ab1b3d8','ONE_TIME','subtract',10000.0,'2025-04-25',NULL,'2025-04-23T13:46:57.220Z','2025-04-23T13:46:57.220Z');
INSERT INTO milestone_impacts VALUES('ccd658a2-df0d-4847-9e52-42c74f2c0f1e','f78f1e18-30ac-45d9-973a-24fdf8c39010','ONE_TIME','subtract',10000.0,'2025-04-25',NULL,'2025-04-23T13:46:57.220Z','2025-04-23T13:46:57.220Z');
INSERT INTO milestone_impacts VALUES('b01a32cb-e762-415c-80ef-bb6979951d36','f1d1ed77-e1cb-40c0-87e7-ba3c0215afca','ONE_TIME','subtract',10000.0,'2025-04-25',NULL,'2025-04-23T13:46:57.220Z','2025-04-23T13:46:57.220Z');
INSERT INTO milestone_impacts VALUES('53080489-05c5-4f14-b497-40e09ea3f39d','68568d27-4f66-4448-9667-9b09dab0b1e6','ONE_TIME','subtract',10000.0,'2025-05-09',NULL,'2025-04-23T13:48:09.522Z','2025-04-23T13:48:09.522Z');
INSERT INTO milestone_impacts VALUES('3a6efd7e-02db-472b-83ec-ce67776de80d','3003e808-e8d4-44fb-8c5c-47bb53aa1c63','ONE_TIME','subtract',10000.0,'2025-05-09',NULL,'2025-04-23T13:48:30.085Z','2025-04-23T13:48:30.085Z');
INSERT INTO milestone_impacts VALUES('084edf94-bba2-49aa-ab30-d116b9fa992d','81c96b43-ed97-47a4-bf43-f34990957bac','ONE_TIME','subtract',10000.0,'2025-05-09',NULL,'2025-04-23T13:48:30.085Z','2025-04-23T13:48:30.085Z');
INSERT INTO milestone_impacts VALUES('2043e5a6-9c9c-4a0f-a574-81c888ae2c05','4b9f2da2-f819-42a1-841c-9f75aca37f80','ONE_TIME','subtract',10000.0,'2025-05-09',NULL,'2025-04-23T13:48:30.085Z','2025-04-23T13:48:30.085Z');
INSERT INTO milestone_impacts VALUES('6cc90841-e412-43c7-b79a-ea45e195b4ae','cf9b0162-e178-4d9a-b5f3-0cfcc04a204e','ONE_TIME','subtract',15000.0,'2025-08-04',NULL,'2025-04-28T17:33:03.275Z','2025-04-28T17:33:21.002Z');
INSERT INTO milestone_impacts VALUES('b689ddff-32a5-4b94-8bbd-0ce8fb2e650b','a5fa60ef-6808-422c-930f-060d441a4f7d','ONE_TIME','subtract',15000.0,'2025-06-12',NULL,'2025-04-29T12:07:15.185Z','2025-04-29T12:07:15.185Z');
INSERT INTO milestone_impacts VALUES('b75dc193-398a-478a-949a-1beedf8e2e72','5bac007c-536a-44c3-b3cf-72289323684b','ONE_TIME','subtract',15000.0,'2025-06-12',NULL,'2025-04-29T15:28:13.707Z','2025-04-29T15:28:13.707Z');
INSERT INTO milestone_impacts VALUES('fbfa457d-1050-4876-82af-9c82b987cf0e','5df0805a-f601-44ab-9f2a-c02dd69212af','ONE_TIME','add',7000.0,'2026-02-17',NULL,'2025-04-29T15:29:56.248Z','2025-05-02T12:44:18.990Z');
CREATE TABLE ai_suggested_milestones (
  id TEXT PRIMARY KEY,
  user_id TEXT NOT NULL,
  career_path_id TEXT NOT NULL,
  suggested_milestones TEXT NOT NULL,
  created_at TIMESTAMP DEFAULT CURRENT_TIMESTAMP,
  updated_at TIMESTAMP DEFAULT CURRENT_TIMESTAMP,
  UNIQUE(user_id, career_path_id)
);
INSERT INTO ai_suggested_milestones VALUES('2bbcd044-b5c1-442e-a930-dca0ee59f6f2','2338','9fda178b-7f3e-49b4-8738-cc1ef914d289','[{"title":"Assess Loan Repayment Plan","date":"2025-05-01","description":"Review and potentially restructure your loan to manage the increasing balance effectively."},{"title":"Develop Emergency Fund Strategy","date":"2025-06-01","description":"Start setting aside a monthly amount towards building an emergency fund."},{"title":"Evaluate Financial Health","date":"2025-08-01","description":"Conduct a thorough review of personal finances and adjust budgets and savings plans as necessary."},{"title":"Plan for Retirement Contributions","date":"2025-10-01","description":"Begin contributing to a retirement savings plan or optimize existing contributions."},{"title":"Prepare Year-End Financial Summary","date":"2025-12-01","description":"Compile a comprehensive summary of your financial progress and setbacks over the year."}]','2025-05-09 14:39:38','2025-05-09 14:39:38');
INSERT INTO ai_suggested_milestones VALUES('daef4ac7-666c-4e9d-af1e-eadd0dac5c3e','2338','ddc5aff3-f048-408b-a0bd-26df67acb4b7','[{"title":"Loan Balance Review","date":"2025-05-01","description":"Evaluate the current loan balance and explore refinancing options to reduce interest rates."},{"title":"Develop Emergency Fund","date":"2025-06-01","description":"Initiate monthly savings to establish an emergency fund covering at least three months of expenses."},{"title":"Loan Repayment Strategy","date":"2025-07-01","description":"Create a detailed plan to accelerate loan repayment by increasing monthly payments."},{"title":"Retirement Savings Plan","date":"2025-08-01","description":"Start contributing to a retirement savings account, aiming for a minimum of 5% of monthly income."},{"title":"Financial Health Check-up","date":"2025-12-01","description":"Review financial progress, reassess goals, and adjust financial plans accordingly."}]','2025-05-09 14:39:54','2025-05-09 14:39:54');
DELETE FROM sqlite_sequence;
INSERT INTO sqlite_sequence VALUES('user_profile',10);
INSERT INTO sqlite_sequence VALUES('user_auth',11);
CREATE TRIGGER update_financial_projections_updated_at
AFTER UPDATE ON financial_projections
FOR EACH ROW
BEGIN
  UPDATE financial_projections
  SET updated_at = CURRENT_TIMESTAMP
  WHERE id = OLD.id;
END;
CREATE UNIQUE INDEX idx_college_profiles_unique
ON college_profiles(user_id, career_path_id, selected_school, selected_program, program_type);
COMMIT;
