Skip to content

Commit 6f79234

Browse files
committed
Extract columnDataType to base connector
1 parent af4961a commit 6f79234

File tree

1 file changed

+3
-23
lines changed

1 file changed

+3
-23
lines changed

lib/migration.js

Lines changed: 3 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -378,29 +378,9 @@ function mixinMigration(PostgreSQL) {
378378
return colDefault ? (' DEFAULT ' + colDefault) : '';
379379
};
380380

381-
/*!
382-
* Find the column type for a given model property
383-
*
384-
* @param {String} model The model name
385-
* @param {String} property The property name
386-
* @returns {String} The column type
387-
*/
388-
PostgreSQL.prototype.columnDataType = function(model, property) {
389-
var columnMetadata = this.columnMetadata(model, property);
390-
var colType = columnMetadata && columnMetadata.dataType;
391-
if (colType) {
392-
colType = colType.toUpperCase();
393-
}
394-
var prop = this.getModelDefinition(model).properties[property];
395-
if (!prop) {
396-
return null;
397-
}
398-
var colLength = columnMetadata && columnMetadata.dataLength || prop.length;
399-
if (colType) {
400-
return colType + (colLength ? '(' + colLength + ')' : '');
401-
}
402-
403-
switch (prop.type.name) {
381+
PostgreSQL.prototype.buildColumnType = function buildColumnType(propertyDefinition) {
382+
var p = propertyDefinition;
383+
switch (p.type.name) {
404384
default:
405385
case 'String':
406386
case 'JSON':

0 commit comments

Comments
 (0)