From 494f53bd62d39c2a420e554a106a9c40a189b7ac Mon Sep 17 00:00:00 2001
From: W1CDN <matthew.burtonkelly@gmail.com>
Date: Sat, 13 May 2023 20:59:38 -0500
Subject: [PATCH] Add created_unix field to frames table.

---
 constants.py   | 1 +
 kiss_and_db.py | 2 ++
 schema.sql     | 1 +
 3 files changed, 4 insertions(+)

diff --git a/constants.py b/constants.py
index 3bd8420..8689d11 100644
--- a/constants.py
+++ b/constants.py
@@ -6,6 +6,7 @@ db_frames_fields = ("id",
 "comment",
 "course",
 "created",
+"created_unix",
 "format",
 "frame",
 "from",
diff --git a/kiss_and_db.py b/kiss_and_db.py
index 5e23ef9..bfb5d9b 100644
--- a/kiss_and_db.py
+++ b/kiss_and_db.py
@@ -5,6 +5,7 @@ import aprs
 import json
 import aprslib
 import configparser
+import time
 
 def read_config():
     config = configparser.ConfigParser()
@@ -46,6 +47,7 @@ def main():
                 a['station_call'] = config['Settings']['station_call']
                 a['station_lat'] = config['Settings']['station_lat']
                 a['station_lon'] = config['Settings']['station_lon']
+                a['created_unix'] = int(time.time())
                 print(a)
                 # Make this a string and deal with it later (probably a mistake)
                 a['path'] = str(a['path'])
diff --git a/schema.sql b/schema.sql
index b329b89..4a64402 100644
--- a/schema.sql
+++ b/schema.sql
@@ -8,6 +8,7 @@ CREATE TABLE frames (
     comment TEXT,
     course REAL,
     created TIMESTAMP NOT NULL DEFAULT CURRENT_TIMESTAMP,
+    created_unix INT,
     format TEXT,
     frame TEXT,
     "from" TEXT,