register/mkdb.tcl

26 lines
839 B
Tcl

#/bin/env wapptclsh
sqlite3 db register.db
# This prevents machines from the same public IP from submitting data twice in
# the same 24 hour period. To prevent spookiness, the server will run on GMT and
# clients will submit at 9 AM their time.
db eval {CREATE TABLE hits
( ip_address_hash TEXT NOT NULL
, arch TEXT NOT NULL
, date TEXT NOT NULL
)}
db eval {CREATE UNIQUE INDEX hits_unique_daily ON hits(ip_address_hash, date)}
# Keep track of the packages installed by date. This will end up being a big
# table, but databases have indexes for a reason.
db eval {CREATE TABLE package_installs
( package_name TEXT NOT NULL
, arch TEXT NOT NULL
, date TEXT NOT NULL
)}
db eval {CREATE INDEX package_installs_name ON package_installs(package_name)}