X-Git-Url: http://git.kpe.io/?p=clsql.git;a=blobdiff_plain;f=tests%2Fds-artists.lisp;fp=tests%2Fds-artists.lisp;h=8fe86d2ec2cc4ddcbd6f5752f43284e07c3d52f4;hp=0000000000000000000000000000000000000000;hb=a4bb1686f874b4ce4e6cac8adf75c0ecc114d683;hpb=ee203eb66c696ddbbf13595002a4ccc651c1ada7 diff --git a/tests/ds-artists.lisp b/tests/ds-artists.lisp new file mode 100644 index 0000000..8fe86d2 --- /dev/null +++ b/tests/ds-artists.lisp @@ -0,0 +1,36 @@ +(in-package #:clsql-tests) + +#.(clsql:locally-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)))) + +(defun initialize-ds-artists () + ; (start-sql-recording :type :both) + ; (let ((*backend-warning-behavior* + ; (if (member *test-database-type* '(:postgresql :postgresql-socket)) + ; :ignore + ; :warn))) + (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")))))) + +#.(clsql:restore-sql-reader-syntax-state)