Merge pull request #435 from andrewhayward/birthdays

Storing learner birthday
This commit is contained in:
Chris McAvoy 2013-06-06 09:55:09 -07:00
Родитель 52fd6504d7 30c2d6c12d
Коммит 17968469f9
3 изменённых файлов: 21 добавлений и 1 удалений

Просмотреть файл

@ -160,7 +160,12 @@ function processInitialLearnerSignup (req, res, next) {
// race conditions on usernames - even if the username does not exist now, it may
// well have been created by the time sign-up is complete.
// This will fail if the username is already being used
learners.create({username: normalizedUsername, password: '', underage: underage})
learners.create({
username: normalizedUsername,
password: '',
underage: underage,
birthday: birthday
})
.error(function(err) {
// Did try a `findOrCreate`, but couldn't get `isNewRecord` to work
if (err.code === 'ER_DUP_ENTRY')

Просмотреть файл

@ -0,0 +1,11 @@
module.exports = {
up: function(migration, DataTypes) {
migration.addColumn('Learners', 'birthday', {
type: db.type.DATE,
allowNull: false
});
},
down: function(migration) {
migration.removeColumn('Applications', 'birthday');
}
}

Просмотреть файл

@ -20,6 +20,10 @@ module.exports = {
allowNull: false,
defaultValue: true
},
birthday: {
type: db.type.DATE,
allowNull: false
},
firstName: {
type: db.type.STRING,
allowNull: true