Allow specifying which MySQL Engine to Use, and store it in schema.rb#8242
Allow specifying which MySQL Engine to Use, and store it in schema.rb#8242kenmazaika wants to merge 1 commit intorails:masterfrom
Conversation
|
Looks like this should support all table options rather than |
|
My goal was to be able to use MyISAM specific features. Since there are things like FULLTEXT indexes that are only supported in MyISAM, which are not usable because schema.rb would create the tables in InnoDB, and wouldn't let sql syntax like run through tests. I don't think other table specific variables are as important to store in the schema. If there are other options we should add to pg and sqlite adapters, perhaps we should add them as needed? |
|
Should be added as needed, yes, but when making API choices we'd be well-off to anticipate how/whether other dbs use table options. |
|
I would say it should pull in a subset of values that Happy to make changes to my code if you have suggestions. |
… it be maintained through schema.rb
|
I just made a new project that shows the problem that this is solving. https://github.com/kenmazaika/mysql-engine-example/commit/f8c5cf2d4507a76f73b4eb9ce2d387b3f28c5b65 Notice that using the API now, you can create a database table, of the type of "MyISAM", but this change will not be persisted in the schema. This causes the database that is created in the tests (by However there are specific features of MyISAM that InnoDB does not support (http://dev.mysql.com/doc/refman/5.5/en/fulltext-search.html), and this causes all of those features not be able to be used in a rails application that is unit tested. Since Rails is adding logic to default the engine to InnoDB, I think persisting the Engine makes sense in this case. In MySQL the other fields we could track are:
The table option field is explicit for MySQL in the docs. I believe in Postgres the options can be used to configure these options: In the future the options may want to include some of this data as well. I can't find any documentation that leads me to believe SQLite can support options, so I think it does not. |
|
Looks like the pull request was accepted on this, can this be closed? |
|
I don't think this feature was merged. It doesn't look like schema.rb will be generated including the engine type in it if the type isn't InnoDB. The other pull request I opened was a different (but related) feature. Will you reopen this pull request? |
|
👍 |
|
Any status on this ? |
|
It doesn't merge cleanly. |
|
merged in #12172 unless @kenmazaika wants to do it himself. |
|
Closing in favor of #12172. @Intrepidd it would be awesome if you give @kenmazaika credits in your commit too. |
Support specifying the MySQL Engine when creating a table, and having it be maintained through
schema.rb.Also make
create_table's options parameter to allow strings or symbols for the keys, because the new hash syntax seems to be what the migrations and schema.rb are supposed to be by convention.This is half of #8239 that I submitted earlier today.