another schema update
authorDan White <dan@whiteaudio.com>
Thu, 2 Mar 2023 18:03:17 +0000 (12:03 -0600)
committerDan White <dan@whiteaudio.com>
Thu, 2 Mar 2023 18:03:17 +0000 (12:03 -0600)
TODO.md
upgrade-db-schema_2023-03-01.sql [new file with mode: 0644]

diff --git a/TODO.md b/TODO.md
index fc8a499f616ecb15f23c6dc36b50e5bc4eafeb3e..579b3143c3edcea5dfbec4bee01d9a24abecaaf3 100644 (file)
--- a/TODO.md
+++ b/TODO.md
@@ -1,14 +1,3 @@
+# Tasks and notes
 
-Also get other items:
-
-db.satnogs.org
-
-* artifacts
-* tle ?
-
-network.satnogs.org
-
-* stations.  Station metadata.  Band capabilities
-* jobs.  These are future observations but not a "done deal", so transient information only.
-
-
+- [ ] 
diff --git a/upgrade-db-schema_2023-03-01.sql b/upgrade-db-schema_2023-03-01.sql
new file mode 100644 (file)
index 0000000..210fa09
--- /dev/null
@@ -0,0 +1,156 @@
+-- 2023-03-01 notes
+--   (adding transmitter_status TEXT column)
+-- Rename table observations to observations_v1_102.
+-- Create new observations table with same columns as get-observations.py.
+-- Copy the table, implicitly leaving the new columns as NULL.
+-- Drop the old renamed table.
+-- Vacuum to cleanup.
+-- Runs of get-observations.py will fill in the NULL column.
+
+.echo on
+
+ALTER TABLE observations RENAME TO observations_V1_102;
+
+CREATE TABLE observations
+    (id INTEGER PRIMARY KEY,
+    start TEXT,
+    end TEXT,
+    ground_station INTEGER,
+    transmitter TEXT,
+    norad_cat_id INTEGER,
+    payload TEXT,
+    waterfall TEXT,
+    demoddata TEXT,
+    station_name TEXT,
+    station_lat REAL,
+    station_lng REAL,
+    station_alt REAL,
+    vetted_status TEXT,
+    vetted_user INTEGER,
+    vetted_datetime TEXT,
+    archived INTEGER,
+    archive_url TEXT,
+    client_version TEXT,
+    client_metadata TEXT,
+    status TEXT,
+    waterfall_status TEXT,
+    waterfall_status_user INTEGER,
+    waterfall_status_datetime TEXT,
+    rise_azimuth REAL,
+    set_azimuth REAL,
+    max_altitude REAL,
+    transmitter_uuid TEXT,
+    transmitter_description TEXT,
+    transmitter_type TEXT,
+    transmitter_uplink_low INTEGER,
+    transmitter_uplink_high INTEGER,
+    transmitter_uplink_drift INTEGER,
+    transmitter_downlink_low INTEGER,
+    transmitter_downlink_high INTEGER,
+    transmitter_downlink_drift INTEGER,
+    transmitter_mode TEXT,
+    transmitter_invert INTEGER,
+    transmitter_baud REAL,
+    transmitter_updated TEXT,
+    transmitter_status TEXT,
+    tle0 TEXT,
+    tle1 TEXT,
+    tle2 TEXT,
+    center_frequency INTEGER,
+    observer INTEGER,
+    observation_frequency INTEGER);
+
+INSERT INTO observations(
+    id,
+    start,
+    end,
+    ground_station,
+    transmitter,
+    norad_cat_id,
+    payload,
+    waterfall,
+    demoddata,
+    station_name,
+    station_lat,
+    station_lng,
+    station_alt,
+    vetted_status,
+    vetted_user,
+    vetted_datetime,
+    archived,
+    archive_url,
+    client_version,
+    client_metadata,
+    status,
+    waterfall_status,
+    waterfall_status_user,
+    waterfall_status_datetime,
+    rise_azimuth,
+    set_azimuth,
+    max_altitude,
+    transmitter_uuid,
+    transmitter_description,
+    transmitter_type,
+    transmitter_uplink_low,
+    transmitter_uplink_high,
+    transmitter_uplink_drift,
+    transmitter_downlink_low,
+    transmitter_downlink_high,
+    transmitter_downlink_drift,
+    transmitter_mode,
+    transmitter_invert,
+    transmitter_baud,
+    transmitter_updated,
+    tle0,
+    tle1,
+    tle2)
+SELECT
+    id,
+    start,
+    end,
+    ground_station,
+    transmitter,
+    norad_cat_id,
+    payload,
+    waterfall,
+    demoddata,
+    station_name,
+    station_lat,
+    station_lng,
+    station_alt,
+    vetted_status,
+    vetted_user,
+    vetted_datetime,
+    archived,
+    archive_url,
+    client_version,
+    client_metadata,
+    status,
+    waterfall_status,
+    waterfall_status_user,
+    waterfall_status_datetime,
+    rise_azimuth,
+    set_azimuth,
+    max_altitude,
+    transmitter_uuid,
+    transmitter_description,
+    transmitter_type,
+    transmitter_uplink_low,
+    transmitter_uplink_high,
+    transmitter_uplink_drift,
+    transmitter_downlink_low,
+    transmitter_downlink_high,
+    transmitter_downlink_drift,
+    transmitter_mode,
+    transmitter_invert,
+    transmitter_baud,
+    transmitter_updated,
+    tle0,
+    tle1,
+    tle2
+FROM observations_v1_102;
+
+DROP TABLE observations_v1_102;
+
+VACUUM;
+