j@287
|
1 (cl:in-package #:amuse-database-admin)
|
j@287
|
2
|
j@287
|
3 (defun create-datasets-table (&optional (database *amuse-database*))
|
j@287
|
4 (%create-datasets-table database)
|
j@287
|
5 (%create-datasets-join-table database))
|
j@287
|
6
|
j@287
|
7 (defun drop-datasets-table (&optional (database *amuse-database*))
|
j@287
|
8 (%drop-datasets-table database)
|
j@287
|
9 (%drop-datasets-join-table database))
|
j@287
|
10
|
j@287
|
11 ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
|
j@287
|
12 ;;; Helper functions
|
j@287
|
13
|
j@287
|
14 (defun %create-datasets-table (database)
|
j@287
|
15 #.(clsql:locally-enable-sql-reader-syntax)
|
j@287
|
16 (clsql:create-table "amuse_datasets"
|
j@287
|
17 '(([|dataset-id|] clsql:smallint :unsigned
|
j@287
|
18 :not-null :auto-increment :primary-key)
|
j@287
|
19 ([|description|] (clsql:varchar 255)
|
j@287
|
20 :not-null))
|
j@287
|
21 :database database
|
j@287
|
22 :transactions t)
|
j@287
|
23 #.(clsql:locally-disable-sql-reader-syntax))
|
j@287
|
24
|
j@287
|
25 (defun %create-datasets-join-table (database)
|
j@287
|
26 #.(clsql:locally-enable-sql-reader-syntax)
|
j@287
|
27 (clsql:create-table "amuse_datasets_join"
|
j@287
|
28 '(([|dataset-id|] clsql:smallint :unsigned
|
j@287
|
29 :not-null)
|
j@287
|
30 ([|implementation-id|] clsql:smallint
|
j@287
|
31 :unsigned :not-null)
|
j@287
|
32 ([|composition-id|] clsql:smallint :not-null))
|
j@287
|
33 :constraints '("KEY (dataset_id)")
|
j@287
|
34 :database database
|
j@287
|
35 :transactions t)
|
j@287
|
36 #.(clsql:locally-disable-sql-reader-syntax))
|
j@287
|
37
|
j@287
|
38 (defun %drop-datasets-table (database)
|
j@287
|
39 (clsql:drop-table "amuse_datasets"
|
j@287
|
40 :database database
|
j@287
|
41 :if-does-not-exist :ignore))
|
j@287
|
42
|
j@287
|
43 (defun %drop-datasets-join-table (database)
|
j@287
|
44 (clsql:drop-table "amuse_datasets_join"
|
j@287
|
45 :database database
|
j@287
|
46 :if-does-not-exist :ignore))
|