Add createdAt to license keys

This commit is contained in:
NeilClack
2026-09-10 13:11:34 -05:00
parent 4a1777de87
commit f50eb34769
7 changed files with 52 additions and 11 deletions
@@ -0,0 +1,2 @@
-- AlterTable
ALTER TABLE "LicenseKey" ADD COLUMN "createdAt" TIMESTAMP(3) NOT NULL DEFAULT CURRENT_TIMESTAMP;
+1
View File
@@ -198,6 +198,7 @@ model LicenseKey {
id String @id @default(uuid())
key String @unique
active Boolean
createdAt DateTime @default(now())
userId String?
user User? @relation(fields: [userId], references: [id], onDelete: SetNull)
email String?
File diff suppressed because one or more lines are too long
@@ -1717,6 +1717,7 @@ export const LicenseKeyScalarFieldEnum = {
id: 'id',
key: 'key',
active: 'active',
createdAt: 'createdAt',
userId: 'userId',
email: 'email'
} as const
@@ -234,6 +234,7 @@ export const LicenseKeyScalarFieldEnum = {
id: 'id',
key: 'key',
active: 'active',
createdAt: 'createdAt',
userId: 'userId',
email: 'email'
} as const
+36 -1
View File
@@ -28,6 +28,7 @@ export type LicenseKeyMinAggregateOutputType = {
id: string | null
key: string | null
active: boolean | null
createdAt: Date | null
userId: string | null
email: string | null
}
@@ -36,6 +37,7 @@ export type LicenseKeyMaxAggregateOutputType = {
id: string | null
key: string | null
active: boolean | null
createdAt: Date | null
userId: string | null
email: string | null
}
@@ -44,6 +46,7 @@ export type LicenseKeyCountAggregateOutputType = {
id: number
key: number
active: number
createdAt: number
userId: number
email: number
_all: number
@@ -54,6 +57,7 @@ export type LicenseKeyMinAggregateInputType = {
id?: true
key?: true
active?: true
createdAt?: true
userId?: true
email?: true
}
@@ -62,6 +66,7 @@ export type LicenseKeyMaxAggregateInputType = {
id?: true
key?: true
active?: true
createdAt?: true
userId?: true
email?: true
}
@@ -70,6 +75,7 @@ export type LicenseKeyCountAggregateInputType = {
id?: true
key?: true
active?: true
createdAt?: true
userId?: true
email?: true
_all?: true
@@ -151,6 +157,7 @@ export type LicenseKeyGroupByOutputType = {
id: string
key: string
active: boolean
createdAt: Date
userId: string | null
email: string | null
_count: LicenseKeyCountAggregateOutputType | null
@@ -180,6 +187,7 @@ export type LicenseKeyWhereInput = {
id?: Prisma.StringFilter<"LicenseKey"> | string
key?: Prisma.StringFilter<"LicenseKey"> | string
active?: Prisma.BoolFilter<"LicenseKey"> | boolean
createdAt?: Prisma.DateTimeFilter<"LicenseKey"> | Date | string
userId?: Prisma.StringNullableFilter<"LicenseKey"> | string | null
email?: Prisma.StringNullableFilter<"LicenseKey"> | string | null
user?: Prisma.XOR<Prisma.UserNullableScalarRelationFilter, Prisma.UserWhereInput> | null
@@ -189,6 +197,7 @@ export type LicenseKeyOrderByWithRelationInput = {
id?: Prisma.SortOrder
key?: Prisma.SortOrder
active?: Prisma.SortOrder
createdAt?: Prisma.SortOrder
userId?: Prisma.SortOrderInput | Prisma.SortOrder
email?: Prisma.SortOrderInput | Prisma.SortOrder
user?: Prisma.UserOrderByWithRelationInput
@@ -201,6 +210,7 @@ export type LicenseKeyWhereUniqueInput = Prisma.AtLeast<{
OR?: Prisma.LicenseKeyWhereInput[]
NOT?: Prisma.LicenseKeyWhereInput | Prisma.LicenseKeyWhereInput[]
active?: Prisma.BoolFilter<"LicenseKey"> | boolean
createdAt?: Prisma.DateTimeFilter<"LicenseKey"> | Date | string
userId?: Prisma.StringNullableFilter<"LicenseKey"> | string | null
email?: Prisma.StringNullableFilter<"LicenseKey"> | string | null
user?: Prisma.XOR<Prisma.UserNullableScalarRelationFilter, Prisma.UserWhereInput> | null
@@ -210,6 +220,7 @@ export type LicenseKeyOrderByWithAggregationInput = {
id?: Prisma.SortOrder
key?: Prisma.SortOrder
active?: Prisma.SortOrder
createdAt?: Prisma.SortOrder
userId?: Prisma.SortOrderInput | Prisma.SortOrder
email?: Prisma.SortOrderInput | Prisma.SortOrder
_count?: Prisma.LicenseKeyCountOrderByAggregateInput
@@ -224,6 +235,7 @@ export type LicenseKeyScalarWhereWithAggregatesInput = {
id?: Prisma.StringWithAggregatesFilter<"LicenseKey"> | string
key?: Prisma.StringWithAggregatesFilter<"LicenseKey"> | string
active?: Prisma.BoolWithAggregatesFilter<"LicenseKey"> | boolean
createdAt?: Prisma.DateTimeWithAggregatesFilter<"LicenseKey"> | Date | string
userId?: Prisma.StringNullableWithAggregatesFilter<"LicenseKey"> | string | null
email?: Prisma.StringNullableWithAggregatesFilter<"LicenseKey"> | string | null
}
@@ -232,6 +244,7 @@ export type LicenseKeyCreateInput = {
id?: string
key: string
active: boolean
createdAt?: Date | string
email?: string | null
user?: Prisma.UserCreateNestedOneWithoutLicenseKeysInput
}
@@ -240,6 +253,7 @@ export type LicenseKeyUncheckedCreateInput = {
id?: string
key: string
active: boolean
createdAt?: Date | string
userId?: string | null
email?: string | null
}
@@ -248,6 +262,7 @@ export type LicenseKeyUpdateInput = {
id?: Prisma.StringFieldUpdateOperationsInput | string
key?: Prisma.StringFieldUpdateOperationsInput | string
active?: Prisma.BoolFieldUpdateOperationsInput | boolean
createdAt?: Prisma.DateTimeFieldUpdateOperationsInput | Date | string
email?: Prisma.NullableStringFieldUpdateOperationsInput | string | null
user?: Prisma.UserUpdateOneWithoutLicenseKeysNestedInput
}
@@ -256,6 +271,7 @@ export type LicenseKeyUncheckedUpdateInput = {
id?: Prisma.StringFieldUpdateOperationsInput | string
key?: Prisma.StringFieldUpdateOperationsInput | string
active?: Prisma.BoolFieldUpdateOperationsInput | boolean
createdAt?: Prisma.DateTimeFieldUpdateOperationsInput | Date | string
userId?: Prisma.NullableStringFieldUpdateOperationsInput | string | null
email?: Prisma.NullableStringFieldUpdateOperationsInput | string | null
}
@@ -264,6 +280,7 @@ export type LicenseKeyCreateManyInput = {
id?: string
key: string
active: boolean
createdAt?: Date | string
userId?: string | null
email?: string | null
}
@@ -272,6 +289,7 @@ export type LicenseKeyUpdateManyMutationInput = {
id?: Prisma.StringFieldUpdateOperationsInput | string
key?: Prisma.StringFieldUpdateOperationsInput | string
active?: Prisma.BoolFieldUpdateOperationsInput | boolean
createdAt?: Prisma.DateTimeFieldUpdateOperationsInput | Date | string
email?: Prisma.NullableStringFieldUpdateOperationsInput | string | null
}
@@ -279,6 +297,7 @@ export type LicenseKeyUncheckedUpdateManyInput = {
id?: Prisma.StringFieldUpdateOperationsInput | string
key?: Prisma.StringFieldUpdateOperationsInput | string
active?: Prisma.BoolFieldUpdateOperationsInput | boolean
createdAt?: Prisma.DateTimeFieldUpdateOperationsInput | Date | string
userId?: Prisma.NullableStringFieldUpdateOperationsInput | string | null
email?: Prisma.NullableStringFieldUpdateOperationsInput | string | null
}
@@ -297,6 +316,7 @@ export type LicenseKeyCountOrderByAggregateInput = {
id?: Prisma.SortOrder
key?: Prisma.SortOrder
active?: Prisma.SortOrder
createdAt?: Prisma.SortOrder
userId?: Prisma.SortOrder
email?: Prisma.SortOrder
}
@@ -305,6 +325,7 @@ export type LicenseKeyMaxOrderByAggregateInput = {
id?: Prisma.SortOrder
key?: Prisma.SortOrder
active?: Prisma.SortOrder
createdAt?: Prisma.SortOrder
userId?: Prisma.SortOrder
email?: Prisma.SortOrder
}
@@ -313,6 +334,7 @@ export type LicenseKeyMinOrderByAggregateInput = {
id?: Prisma.SortOrder
key?: Prisma.SortOrder
active?: Prisma.SortOrder
createdAt?: Prisma.SortOrder
userId?: Prisma.SortOrder
email?: Prisma.SortOrder
}
@@ -363,6 +385,7 @@ export type LicenseKeyCreateWithoutUserInput = {
id?: string
key: string
active: boolean
createdAt?: Date | string
email?: string | null
}
@@ -370,6 +393,7 @@ export type LicenseKeyUncheckedCreateWithoutUserInput = {
id?: string
key: string
active: boolean
createdAt?: Date | string
email?: string | null
}
@@ -406,6 +430,7 @@ export type LicenseKeyScalarWhereInput = {
id?: Prisma.StringFilter<"LicenseKey"> | string
key?: Prisma.StringFilter<"LicenseKey"> | string
active?: Prisma.BoolFilter<"LicenseKey"> | boolean
createdAt?: Prisma.DateTimeFilter<"LicenseKey"> | Date | string
userId?: Prisma.StringNullableFilter<"LicenseKey"> | string | null
email?: Prisma.StringNullableFilter<"LicenseKey"> | string | null
}
@@ -414,6 +439,7 @@ export type LicenseKeyCreateManyUserInput = {
id?: string
key: string
active: boolean
createdAt?: Date | string
email?: string | null
}
@@ -421,6 +447,7 @@ export type LicenseKeyUpdateWithoutUserInput = {
id?: Prisma.StringFieldUpdateOperationsInput | string
key?: Prisma.StringFieldUpdateOperationsInput | string
active?: Prisma.BoolFieldUpdateOperationsInput | boolean
createdAt?: Prisma.DateTimeFieldUpdateOperationsInput | Date | string
email?: Prisma.NullableStringFieldUpdateOperationsInput | string | null
}
@@ -428,6 +455,7 @@ export type LicenseKeyUncheckedUpdateWithoutUserInput = {
id?: Prisma.StringFieldUpdateOperationsInput | string
key?: Prisma.StringFieldUpdateOperationsInput | string
active?: Prisma.BoolFieldUpdateOperationsInput | boolean
createdAt?: Prisma.DateTimeFieldUpdateOperationsInput | Date | string
email?: Prisma.NullableStringFieldUpdateOperationsInput | string | null
}
@@ -435,6 +463,7 @@ export type LicenseKeyUncheckedUpdateManyWithoutUserInput = {
id?: Prisma.StringFieldUpdateOperationsInput | string
key?: Prisma.StringFieldUpdateOperationsInput | string
active?: Prisma.BoolFieldUpdateOperationsInput | boolean
createdAt?: Prisma.DateTimeFieldUpdateOperationsInput | Date | string
email?: Prisma.NullableStringFieldUpdateOperationsInput | string | null
}
@@ -444,6 +473,7 @@ export type LicenseKeySelect<ExtArgs extends runtime.Types.Extensions.InternalAr
id?: boolean
key?: boolean
active?: boolean
createdAt?: boolean
userId?: boolean
email?: boolean
user?: boolean | Prisma.LicenseKey$userArgs<ExtArgs>
@@ -453,6 +483,7 @@ export type LicenseKeySelectCreateManyAndReturn<ExtArgs extends runtime.Types.Ex
id?: boolean
key?: boolean
active?: boolean
createdAt?: boolean
userId?: boolean
email?: boolean
user?: boolean | Prisma.LicenseKey$userArgs<ExtArgs>
@@ -462,6 +493,7 @@ export type LicenseKeySelectUpdateManyAndReturn<ExtArgs extends runtime.Types.Ex
id?: boolean
key?: boolean
active?: boolean
createdAt?: boolean
userId?: boolean
email?: boolean
user?: boolean | Prisma.LicenseKey$userArgs<ExtArgs>
@@ -471,11 +503,12 @@ export type LicenseKeySelectScalar = {
id?: boolean
key?: boolean
active?: boolean
createdAt?: boolean
userId?: boolean
email?: boolean
}
export type LicenseKeyOmit<ExtArgs extends runtime.Types.Extensions.InternalArgs = runtime.Types.Extensions.DefaultArgs> = runtime.Types.Extensions.GetOmit<"id" | "key" | "active" | "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" | "userId" | "email", ExtArgs["result"]["licenseKey"]>
export type LicenseKeyInclude<ExtArgs extends runtime.Types.Extensions.InternalArgs = runtime.Types.Extensions.DefaultArgs> = {
user?: boolean | Prisma.LicenseKey$userArgs<ExtArgs>
}
@@ -495,6 +528,7 @@ export type $LicenseKeyPayload<ExtArgs extends runtime.Types.Extensions.Internal
id: string
key: string
active: boolean
createdAt: Date
userId: string | null
email: string | null
}, ExtArgs["result"]["licenseKey"]>
@@ -924,6 +958,7 @@ export interface LicenseKeyFieldRefs {
readonly id: Prisma.FieldRef<"LicenseKey", 'String'>
readonly key: Prisma.FieldRef<"LicenseKey", 'String'>
readonly active: Prisma.FieldRef<"LicenseKey", 'Boolean'>
readonly createdAt: Prisma.FieldRef<"LicenseKey", 'DateTime'>
readonly userId: Prisma.FieldRef<"LicenseKey", 'String'>
readonly email: Prisma.FieldRef<"LicenseKey", 'String'>
}
+1
View File
@@ -88,6 +88,7 @@ export function mockLicenseKey(overrides?: Record<string, unknown>) {
id: 'key-1',
key: 'AAAA-BBBB-CCCC-DDDD',
active: true,
createdAt: new Date('2026-01-01T00:00:00.000Z'),
level: 'standard',
userId: 'user-1',
...overrides