fukamachi / integral

[OBSOLETE] Use Mito instead.
https://github.com/fukamachi/mito
BSD 3-Clause "New" or "Revised" License
54 stars 3 forks source link

redefinition with removing :keys doesn't drop index #38

Open rudolph-miller opened 9 years ago

rudolph-miller commented 9 years ago

At first, I created table and migrate it.

(defclass tweet ()
  ((id :type bigint
        :auto-increment t
        :primary-key t
        :reader tweet-id)
   (user :type (varchar 255)
            :accessor tweet-user))
  (:metaclass <dao-table-class>)
  (:table-name "tweets")
  (:keys user))

(execute-sql (table-definition 'tweet)

then, I redefined this table to

(defclass tweet ()
  ((id :type bigint
        :auto-increment t
        :primary-key t
        :reader tweet-id)
   (user :type (varchar 255)
            :accessor tweet-user))
  (:metaclass <dao-table-class>)
  (:table-name "tweets"))

and

(make-migration-sql (find-class 'tweet))
;; => NIL

.

I can remove index with giving nothing to :keys

(defclass tweet ()
  ((id :type bigint
        :auto-increment t
        :primary-key t
        :reader tweet-id)
   (user :type (varchar 255)
            :accessor tweet-user))
  (:metaclass <dao-table-class>)
  (:table-name "tweets")
  (:keys))

(make-migration-sql (find-class 'tweet))
;; => ("DROP INDEX user ON tweets")

Is this as you expected?