From a771b49ca720d3474f7fd2eb42a7c5e761563a62 Mon Sep 17 00:00:00 2001 From: tirilane Date: Sat, 4 Jul 2009 13:22:14 +0000 Subject: [PATCH] metodisering --- db.lisp | 66 ++++++++++++++++++++++++++++----------------------------- 1 file changed, 32 insertions(+), 34 deletions(-) diff --git a/db.lisp b/db.lisp index 7ede259..9d57fc8 100644 --- a/db.lisp +++ b/db.lisp @@ -4,40 +4,38 @@ (connect-toplevel "worblehat" "horace" "" "localhost") -(:create-table book - ((isbn :type string :primary-key t) - (title :type string) - (year :type integer) - (publisher :type string) - (udc :type string) - (edition :type integer) - (picture :type string) - (description :type (or db-null text)) - (language :type string) - (review :type integer :unique t) - (author :type integer :unique t)) - (:foreign-key (review) (review id)) - (:foreign-key (author) (author id))) - -(:create-table review - ((id :type integer :primary-key t :references (book :cascade :cascade)) - (review :type text) - (grade :type integer) - (author :type string))) - -(:create-table author - ((id :type integer :primary-key t :references (book :cascade :cascade)) - (surname :type string) - (lastname :type string))) - -(:create-table copy - ((id :type integer :primary-key t) - (shelf :type string) - (rented :type boolean) - (owner :type string) - (condition :type string) - (book :type string)) - (:foreign-key (book) (book isbn))) +(defun create-tables () + (:create-table book + ((isbn :type string :primary-key t) + (title :type string) + (year :type integer) + (publisher :type string) + (udc :type string) + (edition :type integer) + (picture :type string) + (description :type (or db-null text)) + (language :type string) + (review :type integer :unique t) + (author :type integer :unique t)) + (:foreign-key (review) (review id)) + (:foreign-key (author) (author id))) + (:create-table review + ((id :type integer :primary-key t :references (book :cascade :cascade)) + (review :type text) + (grade :type integer) + (author :type string))) + (:create-table author + ((id :type integer :primary-key t :references (book :cascade :cascade)) + (surname :type string) + (lastname :type string))) + (:create-table copy + ((id :type integer :primary-key t) + (shelf :type string) + (rented :type boolean) + (owner :type string) + (condition :type string) + (book :type string)) + (:foreign-key (book) (book isbn)))) ;(defclass book ()