Conversation
When I was trying to use the ORM to create tables in postgreSQL with some column as 'varying character' datatype, I found that all string data types are converted into TEXT, even if I have given the size as specified in the documentation, the schema was not creating properly. So I made some changes in the case handling portion in utils.js file and it started working. If the size handling changes got added, it will be a great help for everyone. I even checked with the mysql library , there this particular issue is not present. Thanks.
|
Tests? |
|
I didn't written a unit-test-case particular to this issue, but once after the file change the issue got resolved. And that check was done manually. |
|
@mukesh-mohan So this is about adding a concept of In other words, I think this use case can be solved today by doing: // Animal.js
{
attributes: {
status: {
description: ‘A broad classification of this animal\’s status.’,
type: ‘string’,
columnType: ‘CHARACTER VARYING(239)’,
isIn: [‘healthy’, ‘deceased’, ‘ill’, ‘wounded’, ‘gestating’, ‘missing’],
required: true
},
}
}(columnType is a standard autoMigrations directive that is passed directly to the adapter.) |
mikermcneil
left a comment
There was a problem hiding this comment.
See #275 (comment) — I think we can get away without merging this, and still take care of this use case
When I was trying to use the ORM to create tables in postgreSQL with some column as 'varying character' datatype, I found that all string data types are converted into TEXT, even if I have given the size as specified in the documentation, the schema was not creating properly. So I made some changes in the case handling portion in utils.js file and it started working. If the size handling changes got added, it will be a great help for everyone. I even checked with the mysql library , there this particular issue is not present. Thanks.