Commit 1214099b authored by ryszard.szopa's avatar ryszard.szopa
Browse files

empty CONNECTION-SPEC in a db-class definition means that the table is not created.

parent cad2517e
......@@ -10,7 +10,14 @@
(defclass db-class (standard-class)
((indices :initarg :indices :initform () :reader db-class-indices)
(connection-spec :initarg :connection-spec :reader db-class-connection-spec)))
(connection-spec :initarg :connection-spec :reader db-class-connection-spec))
(:documentation "Metaclass for PostgreSQL aware classes. It takes
two additional arguments in DEFTABLE: :INDICES (which slots are used
as indices) and :CONNECTION-SPEC, which specifies how the class should
connect to the database (its format is the same as in
SUBMARINE assumes it is a class created just for the sake of
inheritance and does not create any tables for it."))
(defmethod validate-superclass ((class db-class)
(superclass standard-class))
......@@ -62,5 +69,5 @@ ignored in all database related operations.")))
(finalize-inheritance class)
;; DAO is just a class to inherit from, and a table for it shouldn't
;; be created
(unless (eq (class-name class) 'dao)
(when (db-class-connection-spec class)
(create-table class)))
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