86 lines
2.8 KiB
Common Lisp
86 lines
2.8 KiB
Common Lisp
(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")
|
|
|
|
(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 ()
|
|
; ((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))
|
|
|
|
|