зеркало из https://github.com/mozilla/CSOL-site.git
Merge pull request #435 from andrewhayward/birthdays
Storing learner birthday
This commit is contained in:
Коммит
17968469f9
|
@ -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
|
||||
|
|
Загрузка…
Ссылка в новой задаче