Mercurial > hg > egg-tcls
view create_tj_db.tcl @ 613:ea6ebcf42b47
TJ: Initial commit of the TJ2.0 refactoring effort. Instead of using Eggdrop
XTRA user flags for storing data, we now employ a SQLite3 database. The
database schema is probably not yet "final", so maybe beware of deploying
this script yet. Also add example configuration file and script for creating
the empty database tables.
author | Matti Hamalainen <ccr@tnsp.org> |
---|---|
date | Wed, 10 Feb 2021 11:12:13 +0200 |
parents | |
children | 9596cd122639 |
line wrap: on
line source
#!/usr/bin/tclsh # TCL script for creating (empty) TJ 2 SQLite3 database # # Written by Matti 'ccr' Hamalainen <ccr@tnsp.org> # (C) Copyright 2021 Tecnic Software productions (TNSP) # package require sqlite3 source [file dirname [info script]]/utillib.tcl set db_create_desc "Creates tables for tj.tcl in target SQLite3 file" set db_table_list {tj} proc db_create_table { dbh utable } { set sch {} lappend sch "id INTEGER PRIMARY KEY AUTOINCREMENT" # username this item belongs to lappend sch "uuser VARCHAR(32)" # created timestamp lappend sch "ucreated INT" # description lappend sch "udesc VARCHAR(1024)" # 0 = TJ, 1 = one-time reminder, 2 = repeat reminder lappend sch "utype INT" # unique identifier for type 0 lappend sch "uid VARCHAR(32)" # target date/time lappend sch "utarget DATETIME" utl_create_table dbh "$utable" [join $sch ","] } proc db_drop_table { dbh utable } { utl_drop_table dbh "$utable" } proc db_get_table_list { utable } { return [list $utable] } source [file dirname [info script]]/utilcreate.tcl