annotate base/database/datasets-setup.lisp @ 242:66f9c2913ac7

twiddle midi-db import example Ignore-this: cf975529b1d8ad8af507e7dd2144ccea darcs-hash:20100416180846-16a00-a91855cc12370a9198448353f4438647d4cdfdae.gz committer: Jamie Forth <j.forth@gold.ac.uk>
author j.forth <j.forth@gold.ac.uk>
date Thu, 24 Feb 2011 11:23:18 +0000
parents e1842efb1dd4
children
rev   line source
j@216 1 (cl:in-package #:amuse-database-admin)
j@216 2
j@216 3 (defun create-datasets-table (&optional (database *amuse-database*))
j@216 4 (%create-datasets-table database)
j@216 5 (%create-datasets-join-table database))
j@216 6
j@216 7 (defun drop-datasets-table (&optional (database *amuse-database*))
j@216 8 (%drop-datasets-table database)
j@216 9 (%drop-datasets-join-table database))
j@216 10
j@216 11 ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
j@216 12 ;;; Helper functions
j@216 13
j@216 14 (defun %create-datasets-table (database)
j@216 15 #.(clsql:locally-enable-sql-reader-syntax)
j@216 16 (clsql:create-table "amuse_datasets"
j@216 17 '(([|dataset-id|] clsql:smallint :unsigned
j@216 18 :not-null :auto-increment :primary-key)
j@216 19 ([|description|] (clsql:varchar 255)
j@216 20 :not-null))
j@216 21 :database database
j@216 22 :transactions t)
j@216 23 #.(clsql:locally-disable-sql-reader-syntax))
j@216 24
j@216 25 (defun %create-datasets-join-table (database)
j@216 26 #.(clsql:locally-enable-sql-reader-syntax)
j@216 27 (clsql:create-table "amuse_datasets_join"
j@216 28 '(([|dataset-id|] clsql:smallint :unsigned
j@216 29 :not-null)
j@216 30 ([|implementation-id|] clsql:smallint
j@216 31 :unsigned :not-null)
j@216 32 ([|composition-id|] clsql:smallint :not-null))
j@216 33 :constraints '("KEY (dataset_id)")
j@216 34 :database database
j@216 35 :transactions t)
j@216 36 #.(clsql:locally-disable-sql-reader-syntax))
j@216 37
j@216 38 (defun %drop-datasets-table (database)
j@216 39 (clsql:drop-table "amuse_datasets"
j@216 40 :database database
j@216 41 :if-does-not-exist :ignore))
j@216 42
j@216 43 (defun %drop-datasets-join-table (database)
j@216 44 (clsql:drop-table "amuse_datasets_join"
j@216 45 :database database
j@216 46 :if-does-not-exist :ignore))