Portal: add nullable System Name to LicenseKey with per-account unique index
Adds systemName (as typed, trimmed) and systemNameLower (case-folded) to LicenseKey plus a unique index on (userId, systemNameLower) so names are case-insensitively unique per account when non-null. Additive and reversible; migration tested up/down. Regenerates the Prisma client.
This commit is contained in:
File diff suppressed because one or more lines are too long
@@ -2020,7 +2020,9 @@ export const LicenseKeyScalarFieldEnum = {
|
||||
createdAt: 'createdAt',
|
||||
lastValidatedAt: 'lastValidatedAt',
|
||||
userId: 'userId',
|
||||
email: 'email'
|
||||
email: 'email',
|
||||
systemName: 'systemName',
|
||||
systemNameLower: 'systemNameLower'
|
||||
} as const
|
||||
|
||||
export type LicenseKeyScalarFieldEnum = (typeof LicenseKeyScalarFieldEnum)[keyof typeof LicenseKeyScalarFieldEnum]
|
||||
|
||||
@@ -241,7 +241,9 @@ export const LicenseKeyScalarFieldEnum = {
|
||||
createdAt: 'createdAt',
|
||||
lastValidatedAt: 'lastValidatedAt',
|
||||
userId: 'userId',
|
||||
email: 'email'
|
||||
email: 'email',
|
||||
systemName: 'systemName',
|
||||
systemNameLower: 'systemNameLower'
|
||||
} as const
|
||||
|
||||
export type LicenseKeyScalarFieldEnum = (typeof LicenseKeyScalarFieldEnum)[keyof typeof LicenseKeyScalarFieldEnum]
|
||||
|
||||
@@ -32,6 +32,8 @@ export type LicenseKeyMinAggregateOutputType = {
|
||||
lastValidatedAt: Date | null
|
||||
userId: string | null
|
||||
email: string | null
|
||||
systemName: string | null
|
||||
systemNameLower: string | null
|
||||
}
|
||||
|
||||
export type LicenseKeyMaxAggregateOutputType = {
|
||||
@@ -42,6 +44,8 @@ export type LicenseKeyMaxAggregateOutputType = {
|
||||
lastValidatedAt: Date | null
|
||||
userId: string | null
|
||||
email: string | null
|
||||
systemName: string | null
|
||||
systemNameLower: string | null
|
||||
}
|
||||
|
||||
export type LicenseKeyCountAggregateOutputType = {
|
||||
@@ -52,6 +56,8 @@ export type LicenseKeyCountAggregateOutputType = {
|
||||
lastValidatedAt: number
|
||||
userId: number
|
||||
email: number
|
||||
systemName: number
|
||||
systemNameLower: number
|
||||
_all: number
|
||||
}
|
||||
|
||||
@@ -64,6 +70,8 @@ export type LicenseKeyMinAggregateInputType = {
|
||||
lastValidatedAt?: true
|
||||
userId?: true
|
||||
email?: true
|
||||
systemName?: true
|
||||
systemNameLower?: true
|
||||
}
|
||||
|
||||
export type LicenseKeyMaxAggregateInputType = {
|
||||
@@ -74,6 +82,8 @@ export type LicenseKeyMaxAggregateInputType = {
|
||||
lastValidatedAt?: true
|
||||
userId?: true
|
||||
email?: true
|
||||
systemName?: true
|
||||
systemNameLower?: true
|
||||
}
|
||||
|
||||
export type LicenseKeyCountAggregateInputType = {
|
||||
@@ -84,6 +94,8 @@ export type LicenseKeyCountAggregateInputType = {
|
||||
lastValidatedAt?: true
|
||||
userId?: true
|
||||
email?: true
|
||||
systemName?: true
|
||||
systemNameLower?: true
|
||||
_all?: true
|
||||
}
|
||||
|
||||
@@ -167,6 +179,8 @@ export type LicenseKeyGroupByOutputType = {
|
||||
lastValidatedAt: Date | null
|
||||
userId: string | null
|
||||
email: string | null
|
||||
systemName: string | null
|
||||
systemNameLower: string | null
|
||||
_count: LicenseKeyCountAggregateOutputType | null
|
||||
_min: LicenseKeyMinAggregateOutputType | null
|
||||
_max: LicenseKeyMaxAggregateOutputType | null
|
||||
@@ -198,6 +212,8 @@ export type LicenseKeyWhereInput = {
|
||||
lastValidatedAt?: Prisma.DateTimeNullableFilter<"LicenseKey"> | Date | string | null
|
||||
userId?: Prisma.StringNullableFilter<"LicenseKey"> | string | null
|
||||
email?: Prisma.StringNullableFilter<"LicenseKey"> | string | null
|
||||
systemName?: Prisma.StringNullableFilter<"LicenseKey"> | string | null
|
||||
systemNameLower?: Prisma.StringNullableFilter<"LicenseKey"> | string | null
|
||||
user?: Prisma.XOR<Prisma.UserNullableScalarRelationFilter, Prisma.UserWhereInput> | null
|
||||
}
|
||||
|
||||
@@ -209,12 +225,15 @@ export type LicenseKeyOrderByWithRelationInput = {
|
||||
lastValidatedAt?: Prisma.SortOrderInput | Prisma.SortOrder
|
||||
userId?: Prisma.SortOrderInput | Prisma.SortOrder
|
||||
email?: Prisma.SortOrderInput | Prisma.SortOrder
|
||||
systemName?: Prisma.SortOrderInput | Prisma.SortOrder
|
||||
systemNameLower?: Prisma.SortOrderInput | Prisma.SortOrder
|
||||
user?: Prisma.UserOrderByWithRelationInput
|
||||
}
|
||||
|
||||
export type LicenseKeyWhereUniqueInput = Prisma.AtLeast<{
|
||||
id?: string
|
||||
key?: string
|
||||
userId_systemNameLower?: Prisma.LicenseKeyUserIdSystemNameLowerCompoundUniqueInput
|
||||
AND?: Prisma.LicenseKeyWhereInput | Prisma.LicenseKeyWhereInput[]
|
||||
OR?: Prisma.LicenseKeyWhereInput[]
|
||||
NOT?: Prisma.LicenseKeyWhereInput | Prisma.LicenseKeyWhereInput[]
|
||||
@@ -223,8 +242,10 @@ export type LicenseKeyWhereUniqueInput = Prisma.AtLeast<{
|
||||
lastValidatedAt?: Prisma.DateTimeNullableFilter<"LicenseKey"> | Date | string | null
|
||||
userId?: Prisma.StringNullableFilter<"LicenseKey"> | string | null
|
||||
email?: Prisma.StringNullableFilter<"LicenseKey"> | string | null
|
||||
systemName?: Prisma.StringNullableFilter<"LicenseKey"> | string | null
|
||||
systemNameLower?: Prisma.StringNullableFilter<"LicenseKey"> | string | null
|
||||
user?: Prisma.XOR<Prisma.UserNullableScalarRelationFilter, Prisma.UserWhereInput> | null
|
||||
}, "id" | "key">
|
||||
}, "id" | "key" | "userId_systemNameLower">
|
||||
|
||||
export type LicenseKeyOrderByWithAggregationInput = {
|
||||
id?: Prisma.SortOrder
|
||||
@@ -234,6 +255,8 @@ export type LicenseKeyOrderByWithAggregationInput = {
|
||||
lastValidatedAt?: Prisma.SortOrderInput | Prisma.SortOrder
|
||||
userId?: Prisma.SortOrderInput | Prisma.SortOrder
|
||||
email?: Prisma.SortOrderInput | Prisma.SortOrder
|
||||
systemName?: Prisma.SortOrderInput | Prisma.SortOrder
|
||||
systemNameLower?: Prisma.SortOrderInput | Prisma.SortOrder
|
||||
_count?: Prisma.LicenseKeyCountOrderByAggregateInput
|
||||
_max?: Prisma.LicenseKeyMaxOrderByAggregateInput
|
||||
_min?: Prisma.LicenseKeyMinOrderByAggregateInput
|
||||
@@ -250,6 +273,8 @@ export type LicenseKeyScalarWhereWithAggregatesInput = {
|
||||
lastValidatedAt?: Prisma.DateTimeNullableWithAggregatesFilter<"LicenseKey"> | Date | string | null
|
||||
userId?: Prisma.StringNullableWithAggregatesFilter<"LicenseKey"> | string | null
|
||||
email?: Prisma.StringNullableWithAggregatesFilter<"LicenseKey"> | string | null
|
||||
systemName?: Prisma.StringNullableWithAggregatesFilter<"LicenseKey"> | string | null
|
||||
systemNameLower?: Prisma.StringNullableWithAggregatesFilter<"LicenseKey"> | string | null
|
||||
}
|
||||
|
||||
export type LicenseKeyCreateInput = {
|
||||
@@ -259,6 +284,8 @@ export type LicenseKeyCreateInput = {
|
||||
createdAt?: Date | string
|
||||
lastValidatedAt?: Date | string | null
|
||||
email?: string | null
|
||||
systemName?: string | null
|
||||
systemNameLower?: string | null
|
||||
user?: Prisma.UserCreateNestedOneWithoutLicenseKeysInput
|
||||
}
|
||||
|
||||
@@ -270,6 +297,8 @@ export type LicenseKeyUncheckedCreateInput = {
|
||||
lastValidatedAt?: Date | string | null
|
||||
userId?: string | null
|
||||
email?: string | null
|
||||
systemName?: string | null
|
||||
systemNameLower?: string | null
|
||||
}
|
||||
|
||||
export type LicenseKeyUpdateInput = {
|
||||
@@ -279,6 +308,8 @@ export type LicenseKeyUpdateInput = {
|
||||
createdAt?: Prisma.DateTimeFieldUpdateOperationsInput | Date | string
|
||||
lastValidatedAt?: Prisma.NullableDateTimeFieldUpdateOperationsInput | Date | string | null
|
||||
email?: Prisma.NullableStringFieldUpdateOperationsInput | string | null
|
||||
systemName?: Prisma.NullableStringFieldUpdateOperationsInput | string | null
|
||||
systemNameLower?: Prisma.NullableStringFieldUpdateOperationsInput | string | null
|
||||
user?: Prisma.UserUpdateOneWithoutLicenseKeysNestedInput
|
||||
}
|
||||
|
||||
@@ -290,6 +321,8 @@ export type LicenseKeyUncheckedUpdateInput = {
|
||||
lastValidatedAt?: Prisma.NullableDateTimeFieldUpdateOperationsInput | Date | string | null
|
||||
userId?: Prisma.NullableStringFieldUpdateOperationsInput | string | null
|
||||
email?: Prisma.NullableStringFieldUpdateOperationsInput | string | null
|
||||
systemName?: Prisma.NullableStringFieldUpdateOperationsInput | string | null
|
||||
systemNameLower?: Prisma.NullableStringFieldUpdateOperationsInput | string | null
|
||||
}
|
||||
|
||||
export type LicenseKeyCreateManyInput = {
|
||||
@@ -300,6 +333,8 @@ export type LicenseKeyCreateManyInput = {
|
||||
lastValidatedAt?: Date | string | null
|
||||
userId?: string | null
|
||||
email?: string | null
|
||||
systemName?: string | null
|
||||
systemNameLower?: string | null
|
||||
}
|
||||
|
||||
export type LicenseKeyUpdateManyMutationInput = {
|
||||
@@ -309,6 +344,8 @@ export type LicenseKeyUpdateManyMutationInput = {
|
||||
createdAt?: Prisma.DateTimeFieldUpdateOperationsInput | Date | string
|
||||
lastValidatedAt?: Prisma.NullableDateTimeFieldUpdateOperationsInput | Date | string | null
|
||||
email?: Prisma.NullableStringFieldUpdateOperationsInput | string | null
|
||||
systemName?: Prisma.NullableStringFieldUpdateOperationsInput | string | null
|
||||
systemNameLower?: Prisma.NullableStringFieldUpdateOperationsInput | string | null
|
||||
}
|
||||
|
||||
export type LicenseKeyUncheckedUpdateManyInput = {
|
||||
@@ -319,6 +356,8 @@ export type LicenseKeyUncheckedUpdateManyInput = {
|
||||
lastValidatedAt?: Prisma.NullableDateTimeFieldUpdateOperationsInput | Date | string | null
|
||||
userId?: Prisma.NullableStringFieldUpdateOperationsInput | string | null
|
||||
email?: Prisma.NullableStringFieldUpdateOperationsInput | string | null
|
||||
systemName?: Prisma.NullableStringFieldUpdateOperationsInput | string | null
|
||||
systemNameLower?: Prisma.NullableStringFieldUpdateOperationsInput | string | null
|
||||
}
|
||||
|
||||
export type LicenseKeyListRelationFilter = {
|
||||
@@ -331,6 +370,11 @@ export type LicenseKeyOrderByRelationAggregateInput = {
|
||||
_count?: Prisma.SortOrder
|
||||
}
|
||||
|
||||
export type LicenseKeyUserIdSystemNameLowerCompoundUniqueInput = {
|
||||
userId: string
|
||||
systemNameLower: string
|
||||
}
|
||||
|
||||
export type LicenseKeyCountOrderByAggregateInput = {
|
||||
id?: Prisma.SortOrder
|
||||
key?: Prisma.SortOrder
|
||||
@@ -339,6 +383,8 @@ export type LicenseKeyCountOrderByAggregateInput = {
|
||||
lastValidatedAt?: Prisma.SortOrder
|
||||
userId?: Prisma.SortOrder
|
||||
email?: Prisma.SortOrder
|
||||
systemName?: Prisma.SortOrder
|
||||
systemNameLower?: Prisma.SortOrder
|
||||
}
|
||||
|
||||
export type LicenseKeyMaxOrderByAggregateInput = {
|
||||
@@ -349,6 +395,8 @@ export type LicenseKeyMaxOrderByAggregateInput = {
|
||||
lastValidatedAt?: Prisma.SortOrder
|
||||
userId?: Prisma.SortOrder
|
||||
email?: Prisma.SortOrder
|
||||
systemName?: Prisma.SortOrder
|
||||
systemNameLower?: Prisma.SortOrder
|
||||
}
|
||||
|
||||
export type LicenseKeyMinOrderByAggregateInput = {
|
||||
@@ -359,6 +407,8 @@ export type LicenseKeyMinOrderByAggregateInput = {
|
||||
lastValidatedAt?: Prisma.SortOrder
|
||||
userId?: Prisma.SortOrder
|
||||
email?: Prisma.SortOrder
|
||||
systemName?: Prisma.SortOrder
|
||||
systemNameLower?: Prisma.SortOrder
|
||||
}
|
||||
|
||||
export type LicenseKeyCreateNestedManyWithoutUserInput = {
|
||||
@@ -410,6 +460,8 @@ export type LicenseKeyCreateWithoutUserInput = {
|
||||
createdAt?: Date | string
|
||||
lastValidatedAt?: Date | string | null
|
||||
email?: string | null
|
||||
systemName?: string | null
|
||||
systemNameLower?: string | null
|
||||
}
|
||||
|
||||
export type LicenseKeyUncheckedCreateWithoutUserInput = {
|
||||
@@ -419,6 +471,8 @@ export type LicenseKeyUncheckedCreateWithoutUserInput = {
|
||||
createdAt?: Date | string
|
||||
lastValidatedAt?: Date | string | null
|
||||
email?: string | null
|
||||
systemName?: string | null
|
||||
systemNameLower?: string | null
|
||||
}
|
||||
|
||||
export type LicenseKeyCreateOrConnectWithoutUserInput = {
|
||||
@@ -458,6 +512,8 @@ export type LicenseKeyScalarWhereInput = {
|
||||
lastValidatedAt?: Prisma.DateTimeNullableFilter<"LicenseKey"> | Date | string | null
|
||||
userId?: Prisma.StringNullableFilter<"LicenseKey"> | string | null
|
||||
email?: Prisma.StringNullableFilter<"LicenseKey"> | string | null
|
||||
systemName?: Prisma.StringNullableFilter<"LicenseKey"> | string | null
|
||||
systemNameLower?: Prisma.StringNullableFilter<"LicenseKey"> | string | null
|
||||
}
|
||||
|
||||
export type LicenseKeyCreateManyUserInput = {
|
||||
@@ -467,6 +523,8 @@ export type LicenseKeyCreateManyUserInput = {
|
||||
createdAt?: Date | string
|
||||
lastValidatedAt?: Date | string | null
|
||||
email?: string | null
|
||||
systemName?: string | null
|
||||
systemNameLower?: string | null
|
||||
}
|
||||
|
||||
export type LicenseKeyUpdateWithoutUserInput = {
|
||||
@@ -476,6 +534,8 @@ export type LicenseKeyUpdateWithoutUserInput = {
|
||||
createdAt?: Prisma.DateTimeFieldUpdateOperationsInput | Date | string
|
||||
lastValidatedAt?: Prisma.NullableDateTimeFieldUpdateOperationsInput | Date | string | null
|
||||
email?: Prisma.NullableStringFieldUpdateOperationsInput | string | null
|
||||
systemName?: Prisma.NullableStringFieldUpdateOperationsInput | string | null
|
||||
systemNameLower?: Prisma.NullableStringFieldUpdateOperationsInput | string | null
|
||||
}
|
||||
|
||||
export type LicenseKeyUncheckedUpdateWithoutUserInput = {
|
||||
@@ -485,6 +545,8 @@ export type LicenseKeyUncheckedUpdateWithoutUserInput = {
|
||||
createdAt?: Prisma.DateTimeFieldUpdateOperationsInput | Date | string
|
||||
lastValidatedAt?: Prisma.NullableDateTimeFieldUpdateOperationsInput | Date | string | null
|
||||
email?: Prisma.NullableStringFieldUpdateOperationsInput | string | null
|
||||
systemName?: Prisma.NullableStringFieldUpdateOperationsInput | string | null
|
||||
systemNameLower?: Prisma.NullableStringFieldUpdateOperationsInput | string | null
|
||||
}
|
||||
|
||||
export type LicenseKeyUncheckedUpdateManyWithoutUserInput = {
|
||||
@@ -494,6 +556,8 @@ export type LicenseKeyUncheckedUpdateManyWithoutUserInput = {
|
||||
createdAt?: Prisma.DateTimeFieldUpdateOperationsInput | Date | string
|
||||
lastValidatedAt?: Prisma.NullableDateTimeFieldUpdateOperationsInput | Date | string | null
|
||||
email?: Prisma.NullableStringFieldUpdateOperationsInput | string | null
|
||||
systemName?: Prisma.NullableStringFieldUpdateOperationsInput | string | null
|
||||
systemNameLower?: Prisma.NullableStringFieldUpdateOperationsInput | string | null
|
||||
}
|
||||
|
||||
|
||||
@@ -506,6 +570,8 @@ export type LicenseKeySelect<ExtArgs extends runtime.Types.Extensions.InternalAr
|
||||
lastValidatedAt?: boolean
|
||||
userId?: boolean
|
||||
email?: boolean
|
||||
systemName?: boolean
|
||||
systemNameLower?: boolean
|
||||
user?: boolean | Prisma.LicenseKey$userArgs<ExtArgs>
|
||||
}, ExtArgs["result"]["licenseKey"]>
|
||||
|
||||
@@ -517,6 +583,8 @@ export type LicenseKeySelectCreateManyAndReturn<ExtArgs extends runtime.Types.Ex
|
||||
lastValidatedAt?: boolean
|
||||
userId?: boolean
|
||||
email?: boolean
|
||||
systemName?: boolean
|
||||
systemNameLower?: boolean
|
||||
user?: boolean | Prisma.LicenseKey$userArgs<ExtArgs>
|
||||
}, ExtArgs["result"]["licenseKey"]>
|
||||
|
||||
@@ -528,6 +596,8 @@ export type LicenseKeySelectUpdateManyAndReturn<ExtArgs extends runtime.Types.Ex
|
||||
lastValidatedAt?: boolean
|
||||
userId?: boolean
|
||||
email?: boolean
|
||||
systemName?: boolean
|
||||
systemNameLower?: boolean
|
||||
user?: boolean | Prisma.LicenseKey$userArgs<ExtArgs>
|
||||
}, ExtArgs["result"]["licenseKey"]>
|
||||
|
||||
@@ -539,9 +609,11 @@ export type LicenseKeySelectScalar = {
|
||||
lastValidatedAt?: boolean
|
||||
userId?: boolean
|
||||
email?: boolean
|
||||
systemName?: boolean
|
||||
systemNameLower?: boolean
|
||||
}
|
||||
|
||||
export type LicenseKeyOmit<ExtArgs extends runtime.Types.Extensions.InternalArgs = runtime.Types.Extensions.DefaultArgs> = runtime.Types.Extensions.GetOmit<"id" | "key" | "active" | "createdAt" | "lastValidatedAt" | "userId" | "email", ExtArgs["result"]["licenseKey"]>
|
||||
export type LicenseKeyOmit<ExtArgs extends runtime.Types.Extensions.InternalArgs = runtime.Types.Extensions.DefaultArgs> = runtime.Types.Extensions.GetOmit<"id" | "key" | "active" | "createdAt" | "lastValidatedAt" | "userId" | "email" | "systemName" | "systemNameLower", ExtArgs["result"]["licenseKey"]>
|
||||
export type LicenseKeyInclude<ExtArgs extends runtime.Types.Extensions.InternalArgs = runtime.Types.Extensions.DefaultArgs> = {
|
||||
user?: boolean | Prisma.LicenseKey$userArgs<ExtArgs>
|
||||
}
|
||||
@@ -565,6 +637,8 @@ export type $LicenseKeyPayload<ExtArgs extends runtime.Types.Extensions.Internal
|
||||
lastValidatedAt: Date | null
|
||||
userId: string | null
|
||||
email: string | null
|
||||
systemName: string | null
|
||||
systemNameLower: string | null
|
||||
}, ExtArgs["result"]["licenseKey"]>
|
||||
composites: {}
|
||||
}
|
||||
@@ -996,6 +1070,8 @@ export interface LicenseKeyFieldRefs {
|
||||
readonly lastValidatedAt: Prisma.FieldRef<"LicenseKey", 'DateTime'>
|
||||
readonly userId: Prisma.FieldRef<"LicenseKey", 'String'>
|
||||
readonly email: Prisma.FieldRef<"LicenseKey", 'String'>
|
||||
readonly systemName: Prisma.FieldRef<"LicenseKey", 'String'>
|
||||
readonly systemNameLower: Prisma.FieldRef<"LicenseKey", 'String'>
|
||||
}
|
||||
|
||||
|
||||
|
||||
Reference in New Issue
Block a user