ojamoto_models 1.0.16 → 1.0.17

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -0,0 +1,34 @@
1
+ ("use strict");
2
+
3
+ module.exports = {
4
+ async up(queryInterface, Sequelize) {
5
+ await queryInterface.addColumn("users", "google_id", {
6
+ type: Sequelize.STRING(255),
7
+ allowNull: true,
8
+ unique: true,
9
+ after: "totp_secret",
10
+ });
11
+
12
+ await queryInterface.addColumn("users", "auth_provider", {
13
+ type: Sequelize.ENUM("LOCAL", "GOOGLE"),
14
+ allowNull: false,
15
+ defaultValue: "LOCAL",
16
+ after: "google_id",
17
+ });
18
+
19
+ await queryInterface.changeColumn("users", "password_hash", {
20
+ type: Sequelize.STRING(255),
21
+ allowNull: true, // Google-only accounts never set one
22
+ after: "auth_provider",
23
+ });
24
+ },
25
+
26
+ async down(queryInterface) {
27
+ await queryInterface.removeColumn("users", "google_id");
28
+ await queryInterface.removeColumn("users", "auth_provider");
29
+ await queryInterface.changeColumn("users", "password_hash", {
30
+ type: Sequelize.STRING(255),
31
+ allowNull: false,
32
+ });
33
+ },
34
+ };
package/models/User.js CHANGED
@@ -166,7 +166,7 @@ module.exports = (sequelize) => {
166
166
  },
167
167
  password_hash: {
168
168
  type: DataTypes.STRING(255),
169
- allowNull: false,
169
+ allowNull: true, // Google-only accounts never set one
170
170
  },
171
171
  transaction_pin_hash: {
172
172
  type: DataTypes.STRING(255),
@@ -230,6 +230,16 @@ module.exports = (sequelize) => {
230
230
  type: DataTypes.STRING,
231
231
  allowNull: true,
232
232
  },
233
+ google_id: {
234
+ type: DataTypes.STRING(255),
235
+ allowNull: true,
236
+ unique: true,
237
+ },
238
+ auth_provider: {
239
+ type: DataTypes.ENUM("LOCAL", "GOOGLE"),
240
+ allowNull: false,
241
+ defaultValue: "LOCAL",
242
+ },
233
243
  },
234
244
  {
235
245
  sequelize,
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "ojamoto_models",
3
- "version": "1.0.16",
3
+ "version": "1.0.17",
4
4
  "main": "index.js",
5
5
  "scripts": {
6
6
  "migrate:up": "npx sequelize-cli db:migrate",