Skip to content

Commit 173c2b8

Browse files
authored
many updates (#174)
* many updates * fix versions
1 parent bf3bf43 commit 173c2b8

23 files changed

Lines changed: 1389 additions & 549 deletions

File tree

install-database.sql

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -412,9 +412,11 @@ CREATE TRIGGER update_qsl_images_updated_at
412412
FOR EACH ROW EXECUTE FUNCTION update_updated_at_column();
413413

414414
-- Create LoTW credentials table for certificate management
415+
-- Create LoTW credentials table
415416
CREATE TABLE lotw_credentials (
416417
id SERIAL PRIMARY KEY,
417418
station_id INTEGER NOT NULL REFERENCES stations(id) ON DELETE CASCADE,
419+
name VARCHAR(255) NOT NULL,
418420
callsign VARCHAR(50) NOT NULL,
419421
p12_cert BYTEA NOT NULL,
420422
cert_created_at TIMESTAMP DEFAULT CURRENT_TIMESTAMP,
@@ -424,6 +426,9 @@ CREATE TABLE lotw_credentials (
424426
updated_at TIMESTAMP DEFAULT CURRENT_TIMESTAMP
425427
);
426428

429+
-- Create index for active certificates lookup
430+
CREATE INDEX idx_lotw_credentials_station_active ON lotw_credentials(station_id, is_active);
431+
427432
-- Create LoTW upload logs table
428433
CREATE TABLE lotw_upload_logs (
429434
id SERIAL PRIMARY KEY,
Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
-- Migration: Add name column to lotw_credentials table
2+
-- This migration adds the 'name' column to the lotw_credentials table
3+
4+
-- Add name column (allow NULL initially for existing records)
5+
ALTER TABLE lotw_credentials ADD COLUMN IF NOT EXISTS name VARCHAR(255);
6+
7+
-- Update existing records with a default name
8+
UPDATE lotw_credentials
9+
SET name = 'old K1AF Certificate ' || id
10+
WHERE name IS NULL;
11+
12+
-- Make the column NOT NULL after populating existing records
13+
ALTER TABLE lotw_credentials ALTER COLUMN name SET NOT NULL;

0 commit comments

Comments
 (0)