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

Already on GitHub? Sign in to your account

Support for sql options following column definitions in create_table #8353

Closed
wants to merge 1 commit into
from

Conversation

Projects
None yet
2 participants
Contributor

garysweaver commented Nov 28, 2012

This will allow definition with additional options inside the parenths per discussion and request on Rails core list, like:

create_table(:foos, table_options: "FOREIGN KEY(column2) REFERENCES table1(column1) DEFERRABLE, FOREIGN KEY(column3) REFERENCES table2(column2) DEFERRABLE")
Owner

rafaelfranca commented Nov 28, 2012

Could you explain what you want with this feature?

Also, could you add tests?

Contributor

garysweaver commented Nov 28, 2012

@rafaelfranca I looked for tests for options in create_table and couldn't find any. Could you point me to those? That way I could use those as a starting point for a table_options test. I updated the description to provide a bit more info. Thanks!

Owner

rafaelfranca commented Nov 28, 2012

Seems like these opitions should be added per column, not per table.

Reading the Rails-Core mailing list seems it is needed to add options to constraints, but since we don't support constraints we don't need this feature here.

Thank you for the pull request.

Contributor

garysweaver commented Nov 28, 2012

Agreed. Thanks for looking into it. Rails indirectly supports constraints via allowing custom SQL executes, structure.sql, and you can use the foreigner gem, so there are options.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment