mirror of
https://github.com/Infisical/infisical.git
synced 2025-03-25 14:05:03 +00:00
ignore dup user and make email unique
This commit is contained in:
committed by
Akhil Mohan
parent
af77ad8b2f
commit
1cefb036e0
@ -13,7 +13,7 @@ export async function up(knex: Knex): Promise<void> {
|
||||
if (!isTablePresent) {
|
||||
await knex.schema.createTable(TableName.Users, (t) => {
|
||||
t.uuid("id", { primaryKey: true }).defaultTo(knex.fn.uuid());
|
||||
t.string("email").notNullable();
|
||||
t.string("email").unique().notNullable();
|
||||
t.specificType("authMethods", "text[]");
|
||||
t.boolean("superAdmin").defaultTo(false);
|
||||
t.string("firstName");
|
||||
|
@ -311,8 +311,12 @@ const main = async () => {
|
||||
postgresTableName: TableName.Users,
|
||||
returnKeys: ["id", "email"],
|
||||
preProcessing: async (doc) => {
|
||||
const id = uuidV4();
|
||||
if (["64058e0ea5c55c6a8203fed7", "64155f5d75c91bf4e176eb85", "6434ff80b82e04f17008aa13"].includes(doc._id.toString())) {
|
||||
console.log("Skipping duplicate user")
|
||||
return
|
||||
}
|
||||
|
||||
const id = uuidV4();
|
||||
await userKv.put(doc.id.toString(), id);
|
||||
|
||||
return {
|
||||
|
Reference in New Issue
Block a user