-
Notifications
You must be signed in to change notification settings - Fork 895
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
Big objects #248
Comments
@brodock - Thanks for the report. It seems like the Do you have any idea what happens if you add the |
Experiment
ResultsMySQLCREATE TABLE `bananas` (
`id` ..,
`object` text COLLATE utf8_unicode_ci,
..
) ..;
CREATE TABLE `kiwis` (
`id` ..,
`object` longtext COLLATE utf8_unicode_ci,
..
) ..; PostgresCREATE TABLE bananas (
id ..,
object text
);
CREATE TABLE kiwis (
id ..,
object text
); SQLiteCREATE TABLE "bananas" (
"id" ..,
"object" text
);
CREATE TABLE "kiwis" (
"id" ..,
"object" text(1073741823)
); Conclusions
Remaining Questions
|
I'll take a look the PaperTrail migrations and see if we can add a |
[Fixes #248] - MySQL uses limit to choose between `text`, `mediumtext`, and `longtext`. - Postgres ignores any limit up to 1GB - 1 byte. Greater limits cause an error. - SQLite uses the limit literally
Closing, conversation can continue at #551 |
For posterity, MySQL's behavior re: truncation is documented as follows:
|
I know this is late but thanks for the detailed research and reporting @jaredbeck, I did read this at the time FWIW |
currently migration is like the following:
This approach is good enough for objects that serialized is smaller then 64kb (on mysql), as this is the maximum size "TEXT" can hold, according to http://www.electrictoolbox.com/maximum-length-mysql-text-field-types/
I've searched on how to force ActiveRecord migration to create "MEDIUMTEXT" or "LONGTEXT". It seems that all you have to do is define a limit that is bigger enough.
See http://stackoverflow.com/questions/4443477/rails-3-migration-with-longtext for more information.
I don't know what is the best default versions should have. It seems like a good idea to have a bigger size as default to prevent headaches from people who figure out late that they lost data because it wasn't saved (as the object was bigger then expected). Also worth noting that it increases only 2 bytes per entry according to: http://dev.mysql.com/doc/refman/5.0/en/storage-requirements.html#id733892
This might be the reason #245 happened.
The text was updated successfully, but these errors were encountered: