annotate base/datasets/datasets-db/datasets-db-setup.lisp @ 259:c4e9a7bb9897

change move-to-first-bar to return a constituent, not a list of events
author Jamie Forth <j.forth@gold.ac.uk>
date Sat, 19 Mar 2011 18:50:24 +0000
parents 6a3adca16910
children
rev   line source
j@250 1 (cl:in-package #:amuse-database-admin)
j@250 2
j@251 3 (defun create-datasets-table (&optional (database
j@251 4 amuse-database-admin:*amuse-database*))
j@250 5 (%create-datasets-table database)
j@250 6 (%create-datasets-join-table database))
j@250 7
j@251 8 (defun drop-datasets-table (&optional (database
j@251 9 amuse-database-admin:*amuse-database*))
j@250 10 (%drop-datasets-table database)
j@250 11 (%drop-datasets-join-table database))
j@250 12
j@251 13
j@251 14 ;;;=====================================================================
j@250 15 ;;; Helper functions
j@251 16 ;;;=====================================================================
j@250 17
j@250 18 (defun %create-datasets-table (database)
j@250 19 #.(clsql:locally-enable-sql-reader-syntax)
j@250 20 (clsql:create-table "amuse_datasets"
j@250 21 '(([|dataset-id|] clsql:smallint :unsigned
j@250 22 :not-null :auto-increment :primary-key)
j@250 23 ([|description|] (clsql:varchar 255)
j@250 24 :not-null))
j@250 25 :database database
j@250 26 :transactions t)
j@250 27 #.(clsql:locally-disable-sql-reader-syntax))
j@250 28
j@250 29 (defun %create-datasets-join-table (database)
j@250 30 #.(clsql:locally-enable-sql-reader-syntax)
j@250 31 (clsql:create-table "amuse_datasets_join"
j@250 32 '(([|dataset-id|] clsql:smallint :unsigned
j@250 33 :not-null)
j@250 34 ([|implementation-id|] clsql:smallint
j@250 35 :unsigned :not-null)
j@250 36 ([|composition-id|] clsql:smallint :not-null))
j@250 37 :constraints '("KEY (dataset_id)")
j@250 38 :database database
j@250 39 :transactions t)
j@250 40 #.(clsql:locally-disable-sql-reader-syntax))
j@250 41
j@250 42 (defun %drop-datasets-table (database)
j@250 43 (clsql:drop-table "amuse_datasets"
j@250 44 :database database
j@250 45 :if-does-not-exist :ignore))
j@250 46
j@250 47 (defun %drop-datasets-join-table (database)
j@250 48 (clsql:drop-table "amuse_datasets_join"
j@250 49 :database database
j@250 50 :if-does-not-exist :ignore))