mirror of
https://github.com/awatertrevi/infisical.git
synced 2026-10-10 02:28:39 +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) {
|
if (!isTablePresent) {
|
||||||
await knex.schema.createTable(TableName.Users, (t) => {
|
await knex.schema.createTable(TableName.Users, (t) => {
|
||||||
t.uuid("id", { primaryKey: true }).defaultTo(knex.fn.uuid());
|
t.uuid("id", { primaryKey: true }).defaultTo(knex.fn.uuid());
|
||||||
t.string("email").notNullable();
|
t.string("email").unique().notNullable();
|
||||||
t.specificType("authMethods", "text[]");
|
t.specificType("authMethods", "text[]");
|
||||||
t.boolean("superAdmin").defaultTo(false);
|
t.boolean("superAdmin").defaultTo(false);
|
||||||
t.string("firstName");
|
t.string("firstName");
|
||||||
|
|||||||
@@ -311,8 +311,12 @@ const main = async () => {
|
|||||||
postgresTableName: TableName.Users,
|
postgresTableName: TableName.Users,
|
||||||
returnKeys: ["id", "email"],
|
returnKeys: ["id", "email"],
|
||||||
preProcessing: async (doc) => {
|
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);
|
await userKv.put(doc.id.toString(), id);
|
||||||
|
|
||||||
return {
|
return {
|
||||||
|
|||||||
Reference in New Issue
Block a user