This repository has been archived on 2024-07-04. You can view files and clone it, but cannot push or open issues or pull requests.
worblehat-old/lisp/db.lisp

86 lines
2.8 KiB
Common Lisp
Raw Normal View History

2009-07-03 18:09:14 +02:00
(pushnew #P"/home/pvv/d/tirilane/clbuild/systems/" asdf:*central-registry*)
(asdf:oos 'asdf:load-op :postmodern)
(use-package :postmodern)
(connect-toplevel "worblehat" "horace" "" "localhost")
2009-07-04 15:22:14 +02:00
(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))))
2009-07-03 18:09:14 +02:00
;(defclass book ()
; ((isbn :col-type string
; :initarg :isbn
; :accessor book-isbn)
; (title :col-type string
; :initarg :title
; :accessor book-title)
; (year :col-type integer
; :initarg :year
; :accessor book-year)
; (publisher :col-type(or db-null string)
; :initarg :publisher
; :accessor book-publisher)
; (udc :col-type string
; :initarg udc
; :accessor book-udc)
; (edition :col-type integer
; :initarg :edition
; :accessor book-edition)
; (picture :col-type (or db-null string)
; :initarg :picture
; :accessor book-picture)
; (description :col-type (or db-null text)
; :initarg :description
; :accessor book-descripton)
; (language :col-type string
; :initarg :language
; :accessor book-language))
; (:metaclass dao-class)
; (:keys name))
;
;(defclass review ()
; ((review :col-type text
; :initarg :review
; :accessor review-review)
; (grade :col-type integer
; :initarg :grade
; :accessor review-grade)
; (author :col-type text
; :initarg :author
; :accessor review-author))
; (:metaclass dao-class)
; (:keys name))