Skip to content

Commit

Permalink
Merge pull request sequelize#191 from Jtkantor198/setDateonlyForDateC…
Browse files Browse the repository at this point in the history
…olumns

Set type to 'DATEONLY' for date columns
  • Loading branch information
durango authored Oct 23, 2017
2 parents fd2add3 + 3f3f0cd commit e292402
Showing 1 changed file with 5 additions and 2 deletions.
7 changes: 5 additions & 2 deletions lib/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -310,6 +310,9 @@ AutoSequelize.prototype.run = function(callback) {
else if (_attr.match(/text|ntext$/)) {
val = 'DataTypes.TEXT';
}
else if (_attr==="date"){
val = 'DataTypes.DATEONLY';
}
else if (_attr.match(/^(date|timestamp)/)) {
val = 'DataTypes.DATE';
}
Expand Down Expand Up @@ -385,7 +388,7 @@ AutoSequelize.prototype.run = function(callback) {

// typescript end table in definitions file
if(self.options.typescript) typescriptFiles[0] += tsHelper.def.getTableDefinition(tsTableDef, tableName);

function addAdditionalOption(value, key) {
if (key === 'name') {
// name: true - preserve table name always
Expand All @@ -405,7 +408,7 @@ AutoSequelize.prototype.run = function(callback) {
_callback(null);
}, function(){
self.sequelize.close();

// typescript generate tables
if(self.options.typescript) typescriptFiles[1] = tsHelper.model.generateTableModels(tsTableNames, self.options.spaces, self.options.indentation);

Expand Down

0 comments on commit e292402

Please sign in to comment.