Bugfix: unique constraints for single slots.
Sat Sep 15 17:59:30 PDT 2007 Ryszard Szopa <ryszard.szopa@gmail.com>
* Bugfix: unique constraints for single slots.
diff -rN -u old-submarine/db.lisp new-submarine/db.lisp
--- old-submarine/db.lisp 2014-07-27 23:16:39.000000000 -0700
+++ new-submarine/db.lisp 2014-07-27 23:16:39.000000000 -0700
@@ -104,7 +104,7 @@
(otherwise (on-delete slot)))))
(defmethod add-constraint ((slot db-class-slot-definition) (constraint (eql :unique)))
- (format nil "UNIQUE ~A"
+ (format nil "UNIQUE \(~A\)"
(sql-ize (slot-definition-name slot))))
(defmethod add-constraint ((list list) (constraint (eql :unique)))
diff -rN -u old-submarine/submarine-tests.lisp new-submarine/submarine-tests.lisp
--- old-submarine/submarine-tests.lisp 2014-07-27 23:16:39.000000000 -0700
+++ new-submarine/submarine-tests.lisp 2014-07-27 23:16:39.000000000 -0700
@@ -300,11 +300,16 @@
((foo :type integer :accessor foo :initarg :foo)
(bar :type integer :accessor bar :initarg :bar ))
(:unique (foo bar))))
-
+ (finishes (defdao-example seis ()
+ ((foo :type integer :accessor foo :initarg :foo :unique t))))
+
(make-and-save 'cinco :foo 1 :bar 1)
(finishes (make-and-save 'cinco :foo 1 :bar 2))
(finishes (make-and-save 'cinco :foo 2 :bar 1))
- (signals cl-postgres:database-error (make-and-save 'cinco :foo 1 :bar 1)))
+ (signals cl-postgres:database-error (make-and-save 'cinco :foo 1 :bar 1))
+
+ (make-and-save 'seis :foo 1)
+ (signals cl-postgres:database-error (make-and-save 'seis :foo 1)))
;;; Copyright (C) 2007
;;; Ryszard Szopa <ryszard.szopa@gmail.com> &