Closed TomShen1234 closed 4 years ago
My guess is this is related to TEXT
, I'd recommend trying VARCHAR
as a workaround. I'll make sure this gets fixed before final release, thanks.
@tanner0101 Thanks for the response, the same error happens to VARCHAR
type as well. Which makes me think that this is an error in creating the SQL command rather than a database issue?
@TomShen1234 looks like this was an issue with length encoding not being implemented yet. I've put up a fix here: https://github.com/vapor/mysql-nio/pull/24
Found another bug related to MySQL
Posting this directly here because it's related to MySQL (where my previous unrelated issue has been migrated to).
MySQL supports the
TEXT
data type for storing extra long strings. I can access it in Fluent by using.custom("text")
during migration. Fluent is able to read from and write to it fine, with a caveat: the content cannot be over 252 characters long.This does not happen with FluentSQLiteDriver, it can save string of any length to the column with
text
datatype. (I did not test with Postgre because I don't have it installed on my system)Steps to reproduce
Create a new project from template (
vapor new --branch=4
), then add a new content field, when migrating, let it have the text data type:Expected behavior
The server should be able to read and write strings of any length.
Actual behavior
If the string is over 252 characters long, FluentMySQLDriver will output an error:
If the string is over 255 characters long, the server will just crash with the following error:
Environment