j@286
|
1 (cl:in-package #:amuse-meredith)
|
j@286
|
2
|
j@286
|
3 (defun create-meredith-tables (database)
|
j@286
|
4 (%create-compositions-table database)
|
j@286
|
5 (%create-events-table database))
|
j@286
|
6
|
j@286
|
7 (defun drop-meredith-tables (database)
|
j@286
|
8 (%drop-compositions-table database)
|
j@286
|
9 (%drop-events-table database))
|
j@286
|
10
|
j@286
|
11
|
j@286
|
12 ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
|
j@286
|
13 ;;; Helper functions
|
j@286
|
14
|
j@286
|
15 (defun %create-compositions-table (database)
|
j@286
|
16 #.(clsql:locally-enable-sql-reader-syntax)
|
j@286
|
17 (clsql:create-table "meredith_compositions"
|
j@286
|
18 '(([|composition-id|] clsql:smallint :unsigned
|
j@286
|
19 :not-null :auto-increment :primary-key)
|
j@286
|
20 ([|description|] (clsql:varchar 255)
|
j@286
|
21 :not-null))
|
j@286
|
22 :database database
|
j@286
|
23 :transactions t)
|
j@286
|
24 #.(clsql:locally-disable-sql-reader-syntax))
|
j@286
|
25
|
j@286
|
26 (defun %create-events-table (database)
|
j@286
|
27 #.(clsql:locally-enable-sql-reader-syntax)
|
j@286
|
28 (clsql:create-table "meredith_events"
|
j@286
|
29 '(([|composition-id|] clsql:smallint :unsigned
|
j@286
|
30 :not-null)
|
j@286
|
31 ([|event-id|] clsql:smallint :unsigned
|
j@286
|
32 :not-null :auto-increment :unique)
|
j@286
|
33 ([|tatum-on|] clsql:smallint :unsigned :not-null)
|
j@286
|
34 ([|pitch-name|] (clsql:varchar 32) :not-null)
|
j@286
|
35 ([|tatum-dur|] clsql:smallint :unsigned :not-null)
|
j@286
|
36 ([|voice|] clsql:smallint :unsigned :not-null)
|
j@286
|
37 ([|tactus-on|] clsql::float :unsigned :not-null)
|
j@286
|
38 ([|tactus-dur|] clsql::float :unsigned :not-null)
|
j@286
|
39 ([|crot-on|] clsql::float :unsigned :not-null)
|
j@286
|
40 ([|crot-dur|] clsql::float :unsigned :not-null)
|
j@286
|
41 ([|midi-note-number|] clsql:smallint :unsigned :not-null)
|
j@286
|
42 ([|chrom-pitch|] clsql:smallint :unsigned :not-null)
|
j@286
|
43 ([|morph-pitch|] clsql:smallint :unsigned :not-null)
|
j@286
|
44 ([|tatum-on-ms|] clsql:smallint :unsigned :not-null)
|
j@286
|
45 ([|tatum-dur-ms|] clsql:smallint :unsigned :not-null)
|
j@286
|
46 ([|beat-on-ms|] clsql:smallint :unsigned :not-null)
|
j@286
|
47 ([|beat-dur-ms|] clsql:smallint :unsigned :not-null)
|
j@286
|
48 ([|crot-on-ms|] clsql:smallint :unsigned :not-null)
|
j@286
|
49 ([|crot-dur-ms|] clsql:smallint :unsigned :not-null))
|
j@286
|
50 :constraints '("PRIMARY KEY (composition_id, event_id)")
|
j@286
|
51 :database database
|
j@286
|
52 :transactions t)
|
j@286
|
53 #.(clsql:locally-disable-sql-reader-syntax))
|
j@286
|
54
|
j@286
|
55 (defun %drop-compositions-table (database)
|
j@286
|
56 (clsql:drop-table "meredith_compositions"
|
j@286
|
57 :database database))
|
j@286
|
58
|
j@286
|
59 (defun %drop-events-table (database)
|
j@286
|
60 (clsql:drop-table "meredith_events"
|
j@286
|
61 :database database))
|