compobot/lib/initDb.sql
J. Elfring (x) 4bf3fb5dad First small refactoring :)
With these tings:
- Create db during runtime
- Better generation of psv
- Lower case symbol descriptions
- Some Readme fixes
- ...
2020-09-21 21:05:46 +02:00

40 lines
804 B
SQL

-- A table for the sequences
CREATE TABLE "keySequences" (
"keySequence" TEXT NOT NULL,
"utfCharacter" TEXT NOT NULL,
"desc1" TEXT,
"desc2" TEXT
);
-- A table for characters we already sent.
CREATE TABLE "alreadySent" (
"keySequenceROWID" INTEGER,
"timestamp" INTEGER
);
-- A view with yet unsent characters
CREATE VIEW stillAvailable (
keySequenceROWID,
keySequence,
utfCharacter,
desc1,
desc2
)
AS
SELECT ROWID, keySequence, utfCharacter, desc1, desc2
FROM keySequences
WHERE ROWID NOT IN (
SELECT keySequenceROWID
FROM alreadySent
);
-- A table with some entry-phrases:
CREATE TABLE "phrases" (
"phrase" TEXT
);
-- Load Data
.mode csv
.separator "+"
.import lib/phrases.txt phrases
.import /tmp/compose.psv keySequences