Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Added :rename-to and :rename-column-to for :alter-table #131

Closed
wants to merge 3 commits into from

Conversation

knobo
Copy link

@knobo knobo commented Mar 5, 2018

No description provided.

@knobo
Copy link
Author

knobo commented Mar 5, 2018

(sql (:alter-table "mytable" :rename-to "newtable"))
"ALTER TABLE mytable RENAME TO newtable"

(sql (:alter-table :my-table :rename-to :new-table))
"ALTER TABLE my_table RENAME TO new_table"

@sabracrolleton sabracrolleton self-assigned this Mar 8, 2018
@sabracrolleton
Copy link
Collaborator

I would request that your patch handle renaming a column as well as renaming the table itself.

@knobo
Copy link
Author

knobo commented Mar 9, 2018

Would you also accept something like alter-sequence function:

https://gist.github.com/knobo/6beb0ab71b8bbe182afc5ffee5b7e69f#file-s-sql-lisp

(with-schema ("testing_rename" :drop-after t)
      (query (:create-table  :testing ((:main :type int :primary-key t))))
      (query (:alter-table :testing :rename-column-to :main :id))
      (query (:alter-table :testing :rename-to :success))
      (table-description :success))
@knobo
Copy link
Author

knobo commented Mar 9, 2018

Do you have any suggestion on :rename-to, maybe it should be :rename-table-to?

@knobo knobo changed the title Added :rename-to for :alter-table Added :rename-to nad :rename-column-to for :alter-table Mar 9, 2018
@knobo
Copy link
Author

knobo commented Mar 9, 2018

To test it:

(with-schema ("testing_rename" :drop-after t)
      (query (:create-table  :testing ((:main :type int :primary-key t))))
      (query (:alter-table :testing :rename-column-to :main :id))
      (query (:alter-table :testing :rename-to :success))
      (table-description :success))

@knobo
Copy link
Author

knobo commented Mar 9, 2018

Maybe it should be :rename and :rename-column, and skip the "-to" part?

@sabracrolleton
Copy link
Collaborator

I am comfortable with :rename and :rename-column

@knobo knobo changed the title Added :rename-to nad :rename-column-to for :alter-table Added :rename-to and :rename-column-to for :alter-table Mar 10, 2018
@sabracrolleton
Copy link
Collaborator

Your requested additions have been included in the most recent update.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants