fukamachi / integral

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

Allow to rename tables #23

Open fukamachi opened 9 years ago

fukamachi commented 9 years ago

Currently, the following code will raise an error.

(defclass tweet ()
  ((user :type text))
  (:metaclass <dao-table-class>))
(execute-sql (table-definition 'tweet))

(defclass tweet ()
  ((user :type text))
  (:metaclass <dao-table-class>)
  (:table-name "tweets"))  ;; <= adding this line
(migrate-table 'tweet)  ;=> ERROR

Renaming a table name can be done by RENAME TABLE in MySQL, and ALTER TABLE name RENAME TO new_name in SQLite/PostgreSQL.