balderdashy / balderdashy/sails
Document that `type:'string'` attributes are automigrated as VARCHAR by default and not TEXT (and thus silent truncation if you use long strings and don't specify a columnType)
- Dominant language
- JavaScript
- Stars
- 22.8k
- Forks
- 1.9k
- PR merge metrics
- No merged PRs in 30d
Description
**Sails version**: 1.0.1
**Node version**: 8.11.1
**NPM version**: 4.0.5
**DB adapter name**: sails-mysql
**DB adapter version**: 1.0.0
**Operating system**: windows/ubuntu
I just realized that fields with type 'string' get persisted to database(MySql) silently without any error or warning if their length is over 255 chars.
Its a SERIOUS BUG IMO and must be either resolved quickly or should be explicitly mentioned in documentation of sailsjs or sails-mysql adapter.
I temporarily found a fix about it which is by using the `columnType` attribute.
Eg:
```
description: {
type: 'string',
required: true,
columnType: 'text'
}
```
Contributor guide
Research direction
No file or test is named; start by locating the Sails or sails-mysql documentation covering string attributes and MySQL column types. Verify the stated default and the `columnType: 'text'` example, then document the behavior and truncation risk; done means a newcomer can find and understand this guidance.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- javascript, mysql, node.js
- Domain
- databases, documentation
- Issue type
- Documentation
- Difficulty
- 2/5
- Estimated time
- 1-3 hours
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 38/100