annotate base/database/datasets-setup.lisp @ 288:d1e5bbcc5ea4

Rationalise base and geerdes classes, constructors and methods. Ignore-this: d9d4d88566a6d110844d91d4c70513cd Towards a more standardised interface. Some of these changes (generalised constructors and reader functions) are necessary for amuse-database-admin functionality and some other CHARM-like things. darcs-hash:20090716154406-16a00-8a9b4fb1fc1f5ba75af66a1bbd87e1bb68e02493.gz
author j.forth <j.forth@gold.ac.uk>
date Thu, 16 Jul 2009 16:44:06 +0100
parents 00d35eb70ef9
children
rev   line source
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))