-
-
Notifications
You must be signed in to change notification settings - Fork 76
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
.text
creates a VARCHAR(255) column
#290
Comments
@bottlehall you can use |
Let me know if that seems right and if you'd like to submit a PR. Otherwise I will, thanks! |
@tanner0101, thanks. I will do a PR in the next few days. |
Tried doing a PR but it has errors during testing. Haven't checked them all exhaustively but this is indicative: "MySQL error: Server error: BLOB, TEXT, GEOMETRY or JSON column 'name' can't have a default value" |
Error above arises because SQLBenchmarker+Planets.swift creates a test table with a 'name' field that is type |
Hmm... that's unfortunate. The easiest fix would be to check if Going forward, maybe some method for getting a "best fit" type for a Swift type (like .column("name", type: .best(for: String.self), .default("Unamed Planet")) |
I am trying to store text of approximately 600-1k characters. Using a field definition, such as:
Creates the usual
VARCHAR(255)
column in the MySQL data table. This results in the INSERT crashing because the data is too long.I have tried putting an explicit definition in the
Migration
to use a TEXT column type as follows:.field("role", .sql(.text))
However, in MySQLDialect.swift, at line 46, this defines a field specified as
.text
as still beingVARCHAR(255)
. So, I get the same result.If I manually change the column to TEXT using MySQL client between the migration to create the table and the one to insert the initial dataset, my application works as intended.
Shouldn't
.text
create aTEXT
column instead of the same as.string
?The text was updated successfully, but these errors were encountered: