From 6c3559c51bf01ab10346d575e8b26903028c7251 Mon Sep 17 00:00:00 2001
From: Jonathan Bradley <jcb@pikum.xyz>
Date: Wed, 10 Dec 2025 15:01:13 -0500
Subject: pke-at: import, re-import avoid duplicates

---
 src/sql/schema-000-000.sql | 22 +++++++++++++++++++---
 1 file changed, 19 insertions(+), 3 deletions(-)

(limited to 'src/sql/schema-000-000.sql')

diff --git a/src/sql/schema-000-000.sql b/src/sql/schema-000-000.sql
index 3e96dcf..b57b977 100644
--- a/src/sql/schema-000-000.sql
+++ b/src/sql/schema-000-000.sql
@@ -9,7 +9,7 @@ CREATE TABLE [db_version] (
 
 CREATE TABLE [at_setlist] (
 	uuid NCHAR(56) PRIMARY KEY
-	,title nvarchar(128) DEFAULT ''
+	,title NVARCHAR(128) DEFAULT ''
 	,is_deleted INTEGER NOT NULL DEFAULT 0
 	,creation_dt INTEGER DEFAULT (unixepoch('now'))
 	,modification_dt INTEGER DEFAULT (unixepoch('now'))
@@ -18,8 +18,8 @@ CREATE TABLE [at_setlist] (
 CREATE TABLE [at_song] (
 	uuid NCHAR(56) PRIMARY KEY
 	,ccli INTEGER
-	,title nvarchar(128) DEFAULT ''
-	,arrangement nvarchar(128) DEFAULT ''
+	,title NVARCHAR(128) DEFAULT ''
+	,arrangement NVARCHAR(128) DEFAULT ''
 	,beats_per_minute INTEGER
 	,is_deleted INTEGER NOT NULL DEFAULT 0
 	,creation_dt INTEGER DEFAULT (unixepoch('now'))
@@ -46,4 +46,20 @@ CREATE TABLE [at_section] (
 	,modification_dt INTEGER DEFAULT (unixepoch('now'))
 );
 
+CREATE TABLE [ext_source] (
+	id INTEGER PRIMARY KEY
+	,title NVARCHAR(255) NOT NULL
+);
+
+CREATE TABLE [ext_mapping] (
+	source_id INTEGER
+	,id_external_integer INTEGER NOT NULL DEFAULT 0
+	,uuid NCHAR(56) NOT NULL
+	,is_deleted INTEGER NOT NULL DEFAULT 0
+	,creation_dt INTEGER DEFAULT (unixepoch('now'))
+	,modification_dt INTEGER DEFAULT (unixepoch('now'))
+	,PRIMARY KEY (source_id, id_external_integer)
+);
+
+INSERT INTO [ext_source](id,title) VALUES(1,'Planning Center Services');
 INSERT INTO [db_version](id,version_maj,version_min) VALUES(0,1,0);
-- 
cgit v1.2.3

