mirror of
https://github.com/nocobase/nocobase
synced 2024-11-15 07:15:36 +00:00
fix: migration error
This commit is contained in:
parent
f466e6ec95
commit
c44f459756
@ -12,15 +12,17 @@ export default class AddUsersPhoneMigration extends Migration {
|
||||
{
|
||||
type: 'string',
|
||||
name: 'phone',
|
||||
unique: true,
|
||||
},
|
||||
],
|
||||
});
|
||||
const tableNameWithSchema = collection.getTableNameWithSchema();
|
||||
const field = collection.getField('username');
|
||||
const field = collection.getField('phone');
|
||||
const exists = await field.existsInDb();
|
||||
if (!exists) {
|
||||
await this.db.sequelize.getQueryInterface().addColumn(tableNameWithSchema, field.columnName(), {
|
||||
type: DataTypes.STRING,
|
||||
});
|
||||
}
|
||||
await this.db.sequelize.getQueryInterface().addConstraint(tableNameWithSchema, {
|
||||
type: 'unique',
|
||||
fields: [field.columnName()],
|
||||
|
@ -12,15 +12,17 @@ export default class AddUserNameMigration extends Migration {
|
||||
{
|
||||
type: 'string',
|
||||
name: 'username',
|
||||
unique: true,
|
||||
},
|
||||
],
|
||||
});
|
||||
const tableNameWithSchema = collection.getTableNameWithSchema();
|
||||
const field = collection.getField('username');
|
||||
const exists = await field.existsInDb();
|
||||
if (!exists) {
|
||||
await this.db.sequelize.getQueryInterface().addColumn(tableNameWithSchema, field.columnName(), {
|
||||
type: DataTypes.STRING,
|
||||
});
|
||||
}
|
||||
await this.db.sequelize.getQueryInterface().addConstraint(tableNameWithSchema, {
|
||||
type: 'unique',
|
||||
fields: [field.columnName()],
|
||||
|
Loading…
Reference in New Issue
Block a user