diff options
Diffstat (limited to 'tests/ds-artists.lisp')
-rw-r--r-- | tests/ds-artists.lisp | 31 |
1 files changed, 31 insertions, 0 deletions
diff --git a/tests/ds-artists.lisp b/tests/ds-artists.lisp new file mode 100644 index 0000000..f4d3271 --- /dev/null +++ b/tests/ds-artists.lisp @@ -0,0 +1,31 @@ +(in-package #:clsql-tests) + +(clsql-sys:file-enable-sql-reader-syntax) + +(defparameter artist1 nil) + +(def-view-class artist () + ((artist_id :accessor artist_id :initarg :id + :type integer :db-kind :key :db-constraints (:not-null :auto-increment) + :autoincrement-sequence 'artist_artist_id_seq) + (name :accessor name :initarg :name :type (varchar 20)) + (genre :accessor genre :initarg :genre :type (varchar 10) :db-constraints (:default "'Unknown'")))) + +(defun initialize-ds-artists () + (mapc #'clsql:create-view-from-class + '(artist)) + + (setq *test-start-utime* (get-universal-time)) + (let* ((*db-auto-sync* nil)) + (setf artist1 (make-instance 'artist + :name "Mogwai")))) + +(def-dataset *ds-artists* + (:setup initialize-ds-artists) + (:cleanup (lambda () + (mapc #'clsql-sys:drop-view-from-class + '(artist)) + (ignore-errors + (mapc #'clsql-sys:drop-sequence + (list "artist_artist_id_seq")))))) + |