-
-
Notifications
You must be signed in to change notification settings - Fork 528
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat: modernize assets & skeleton files (#909)
- Loading branch information
1 parent
7419ddb
commit 8e04ce2
Showing
36 changed files
with
310 additions
and
387 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,16 @@ | ||
# Number of days of inactivity before an issue becomes stale | ||
daysUntilStale: 60 | ||
# Number of days of inactivity before a stale issue is closed | ||
daysUntilClose: 7 | ||
# Issues with these labels will never be considered stale | ||
exemptLabels: | ||
- bug | ||
- feature | ||
- semver:major | ||
# Comment to post when marking an issue as stale. Set to `false` to disable | ||
markComment: > | ||
This issue has been automatically marked as stale because it has not had | ||
recent activity. It will be closed if no further activity occurs. Thank you | ||
for your contributions. | ||
# Comment to post when closing a stale issue. Set to `false` to disable | ||
closeComment: false |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,35 +1,34 @@ | ||
'use strict'; | ||
|
||
module.exports = { | ||
up: (queryInterface, Sequelize) => { | ||
return queryInterface | ||
.createTable('<%= tableName %>', { | ||
id: { | ||
allowNull: false, | ||
autoIncrement: true, | ||
primaryKey: true, | ||
type: Sequelize.INTEGER | ||
}, | ||
|
||
<% attributes.forEach(function(attribute) { %> | ||
<%= attribute.fieldName %>: { | ||
type: Sequelize.<%= attribute.dataFunction ? `${attribute.dataFunction.toUpperCase()}(Sequelize.${attribute.dataType.toUpperCase()})` : attribute.dataValues ? `${attribute.dataType.toUpperCase()}(${attribute.dataValues})` : attribute.dataType.toUpperCase() %> | ||
}, | ||
<% }) %> | ||
up: async (queryInterface, Sequelize) => { | ||
await queryInterface.createTable('<%= tableName %>', { | ||
id: { | ||
allowNull: false, | ||
autoIncrement: true, | ||
primaryKey: true, | ||
type: Sequelize.INTEGER | ||
}, | ||
|
||
<%= createdAt %>: { | ||
allowNull: false, | ||
type: Sequelize.DATE | ||
<% attributes.forEach(function(attribute) { %> | ||
<%= attribute.fieldName %>: { | ||
type: Sequelize.<%= attribute.dataFunction ? `${attribute.dataFunction.toUpperCase()}(Sequelize.${attribute.dataType.toUpperCase()})` : attribute.dataValues ? `${attribute.dataType.toUpperCase()}(${attribute.dataValues})` : attribute.dataType.toUpperCase() %> | ||
}, | ||
<% }) %> | ||
|
||
<%= createdAt %>: { | ||
allowNull: false, | ||
type: Sequelize.DATE | ||
}, | ||
|
||
<%= updatedAt %>: { | ||
allowNull: false, | ||
type: Sequelize.DATE | ||
} | ||
}); | ||
<%= updatedAt %>: { | ||
allowNull: false, | ||
type: Sequelize.DATE | ||
} | ||
}); | ||
}, | ||
|
||
down: (queryInterface, Sequelize) => { | ||
return queryInterface.dropTable('<%= tableName %>'); | ||
down: async (queryInterface, Sequelize) => { | ||
await queryInterface.dropTable('<%= tableName %>'); | ||
} | ||
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,23 +1,21 @@ | ||
'use strict'; | ||
|
||
module.exports = { | ||
up: (queryInterface, Sequelize) => { | ||
/* | ||
Add altering commands here. | ||
Return a promise to correctly handle asynchronicity. | ||
Example: | ||
return queryInterface.createTable('users', { id: Sequelize.INTEGER }); | ||
*/ | ||
up: async (queryInterface, Sequelize) => { | ||
/** | ||
* Add altering commands here. | ||
* | ||
* Example: | ||
* await queryInterface.createTable('users', { id: Sequelize.INTEGER }); | ||
*/ | ||
}, | ||
|
||
down: (queryInterface, Sequelize) => { | ||
/* | ||
Add reverting commands here. | ||
Return a promise to correctly handle asynchronicity. | ||
Example: | ||
return queryInterface.dropTable('users'); | ||
*/ | ||
down: async (queryInterface, Sequelize) => { | ||
/** | ||
* Add reverting commands here. | ||
* | ||
* Example: | ||
* await queryInterface.dropTable('users'); | ||
*/ | ||
} | ||
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,18 +1,29 @@ | ||
'use strict'; | ||
|
||
const { Model } = require('sequelize'); | ||
|
||
module.exports = (sequelize, DataTypes) => { | ||
const <%= name %> = sequelize.define('<%= name %>', { | ||
class <%= name %> extends Model { | ||
/** | ||
* Helper method for defining associations. | ||
* This method is not part of Sequelize lifecycle. | ||
* The `models/index` file will call this method automatically. | ||
*/ | ||
static associate (models) { | ||
// define association here | ||
} | ||
}; | ||
|
||
<%= name %>.init({ | ||
<% attributes.forEach(function(attribute, index) { %> | ||
<%= attribute.fieldName %>: DataTypes.<%= attribute.dataFunction ? `${attribute.dataFunction.toUpperCase()}(DataTypes.${attribute.dataType.toUpperCase()})` : attribute.dataValues ? `${attribute.dataType.toUpperCase()}(${attribute.dataValues})` : attribute.dataType.toUpperCase() %> | ||
<%= (Object.keys(attributes).length - 1) > index ? ',' : '' %> | ||
<% }) %> | ||
}, { | ||
sequelize, | ||
modelName: '<%= name %>', | ||
<%= underscored ? 'underscored: true,' : '' %> | ||
}); | ||
|
||
<%= name %>.associate = function(models) { | ||
// associations can be defined here | ||
}; | ||
|
||
return <%= name %>; | ||
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,26 +1,24 @@ | ||
'use strict'; | ||
|
||
module.exports = { | ||
up: (queryInterface, Sequelize) => { | ||
/* | ||
Add altering commands here. | ||
Return a promise to correctly handle asynchronicity. | ||
Example: | ||
return queryInterface.bulkInsert('People', [{ | ||
name: 'John Doe', | ||
isBetaMember: false | ||
}], {}); | ||
up: async (queryInterface, Sequelize) => { | ||
/** | ||
* Add seed commands here. | ||
* | ||
* Example: | ||
* await queryInterface.bulkInsert('People', [{ | ||
* name: 'John Doe', | ||
* isBetaMember: false | ||
* }], {}); | ||
*/ | ||
}, | ||
|
||
down: (queryInterface, Sequelize) => { | ||
/* | ||
Add reverting commands here. | ||
Return a promise to correctly handle asynchronicity. | ||
Example: | ||
return queryInterface.bulkDelete('People', null, {}); | ||
*/ | ||
down: async (queryInterface, Sequelize) => { | ||
/** | ||
* Add commands to revert seed here. | ||
* | ||
* Example: | ||
* await queryInterface.bulkDelete('People', null, {}); | ||
*/ | ||
} | ||
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
29 changes: 13 additions & 16 deletions
29
test/support/assets/migrations/20111117063700-createPerson.js
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,21 +1,18 @@ | ||
'use strict'; | ||
|
||
var nodeify = require('nodeify'); | ||
"use strict"; | ||
|
||
module.exports = { | ||
up: function (migration, DataTypes, done) { | ||
nodeify(migration | ||
.createTable('Person', { | ||
name: DataTypes.STRING, | ||
isBetaMember: { | ||
type: DataTypes.BOOLEAN, | ||
defaultValue: false, | ||
allowNull: false | ||
} | ||
}), done); | ||
up: function (migration, DataTypes) { | ||
return migration.createTable("Person", { | ||
name: DataTypes.STRING, | ||
isBetaMember: { | ||
type: DataTypes.BOOLEAN, | ||
defaultValue: false, | ||
allowNull: false, | ||
}, | ||
}); | ||
}, | ||
|
||
down: function (migration, DataTypes, done) { | ||
nodeify(migration.dropTable('Person'), done); | ||
} | ||
down: function (migration, DataTypes) { | ||
return migration.dropTable("Person"); | ||
}, | ||
}; |
Oops, something went wrong.