- &key (transactions t))
- (let ((schemadef '()))
- (dolist (slotdef (ordered-class-slots self))
- (let ((res (database-generate-column-definition (class-name self)
- slotdef database)))
- (when res
- (push res schemadef))))
- (unless schemadef
- (error "Class ~s has no :base slots" self))
- (create-table (sql-expression :table (view-table self)) (nreverse schemadef)
- :database database
- :transactions transactions
- :constraints (database-pkey-constraint self database))
- (push self (database-view-classes database)))
+ &key (transactions t))
+ (let ((schemadef '())
+ (ordered-slots (slots-for-possibly-normalized-class self)))
+ (dolist (slotdef ordered-slots)
+ (let ((res (database-generate-column-definition self slotdef database)))
+ (when res
+ (push res schemadef))))
+ (if (not schemadef)
+ (unless (normalizedp self)
+ (error "Class ~s has no :base slots" self))
+ (progn
+ (database-add-autoincrement-sequence self database)
+ (create-table (sql-expression :table (database-identifier self database))
+ (nreverse schemadef)
+ :database database
+ :transactions transactions
+ :constraints (database-pkey-constraint self database))
+ (push self (database-view-classes database)))))