I am using heroku, and in doing so, am experiencing my first foray into postgresql. Maybe I just never came across it in development, but I am unable to save entries into my database that are longer than 255 characters. Is there a way around this? Currently the I am just using strings to store message data.
Secondly, if there is indeed a way to store more than 255 characters, is there a good way to convert my message strings into this form, using migrations? My app is currently live and in use.
Thanks!
PostgreSQL normally stores its table data in chunks of 8KB. The number of these blocks is limited to a 32-bit signed integer (just over two billion), giving a maximum table size of 16TB.
What is PostgreSQL Varchar datatype? In PostgreSQL, the Varchar data type is used to keep the character of infinite length. And it can hold a string with a maximum length of 65,535 bytes.
Heroku Postgres is an easy, low-cost way to get started with a relational database on the Heroku platform. This open-source database is also the most effective service for developers looking to build engaging apps.
Heroku Postgres is a managed SQL database service provided directly by Heroku. You can access a Heroku Postgres database from any language with a PostgreSQL driver, including all languages officially supported by Heroku.
use text
instead of string
on your migration type.
To change a migration
script/generate migration change_string_to_text
change_column :model, :attribute, :text
rake db:migrate
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With