blob: d2700b1e2f67f121246d1f2091f83df914b97c7d (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
|
#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))))
|