#lang racket/base (require db sql) (provide (all-defined-out)) ; Assumption: Each connection gets its own database (define current-database (make-parameter #f)) (define (db-init) (query-exec (current-database) (create-table #:if-not-exists users #:columns [name varchar #:not-null] [power integer #:not-null] [data varchar #:not-null] #:constraints (primary-key name))) (query-exec (current-database) (create-table #:if-not-exists channels #:columns [name varchar #:not-null] [autojoin boolean #:not-null] [data varchar #:not-null] #:constraints (primary-key name))) (query-exec (current-database) (create-table #:if-not-exists network #:columns [name varchar #:not-null] [data varchar #:not-null] #:constraints (primary-key name))))