fukamachi / mito

An ORM for Common Lisp with migrations, relationships and PostgreSQL support
292 stars 31 forks source link

Generating unnecessary ALTER migrations for :primary-key class option on PostgreSQL #66

Open fukamachi opened 4 years ago

fukamachi commented 4 years ago

Reported by @masatoi in person.

Need to reproduce with a minimum example. It could also happen with other RDBMS, but there's no information.

(defclass abc ()
  ((token :col-type (:varchar 32)
          :initarg :token
          :initform ""
          :accessor abc-token))
  (:primary-key token)
  (:metaclass mito:dao-table-class))

Workaround

Use a slot option instead of a class option.

(defclass abc ()
  ((token :col-type (:varchar 32)
          :primary-key t
          :initarg :token
          :initform ""
          :accessor abc-token))
  (:metaclass mito:dao-table-class))

Environment