Commit 4e0e0722 authored by Ryszard Szopa's avatar Ryszard Szopa
Browse files

Bugfix: unique constraints for single slots.

parent 16f91c22
......@@ -104,7 +104,7 @@ be reverted.)"
(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)))
......@@ -300,11 +300,16 @@ metaclass set to HTML and the right connection-spec."
((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 <> &
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment