Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 0 additions & 10 deletions apps/api/src/pkg/testutil/harness.ts
Original file line number Diff line number Diff line change
Expand Up @@ -254,19 +254,14 @@ export abstract class Harness {
id: newId("test"),
name: "unkey",
orgId: newId("test"),
__toBeDeleted: newId("test"),
plan: "enterprise",
tier: "Enterprise",
features: {},
betaFeatures: {},
stripeCustomerId: null,
stripeSubscriptionId: null,
trialEnds: null,
subscriptions: null,
planLockedUntil: null,
planChanged: null,
createdAtM: Date.now(),
planDowngradeRequest: null,
enabled: true,
deleteProtection: true,
updatedAtM: null,
Expand All @@ -276,19 +271,14 @@ export abstract class Harness {
id: newId("test"),
name: "user",
orgId: newId("test"),
__toBeDeleted: newId("test"),
plan: "pro",
tier: "Pro Max",
features: {},
betaFeatures: {},
stripeCustomerId: null,
stripeSubscriptionId: null,
trialEnds: null,
subscriptions: null,
planLockedUntil: null,
planChanged: null,
createdAtM: Date.now(),
planDowngradeRequest: null,
enabled: true,
deleteProtection: true,
updatedAtM: null,
Expand Down
5 changes: 0 additions & 5 deletions apps/dashboard/lib/trpc/routers/workspace/create.ts
Original file line number Diff line number Diff line change
Expand Up @@ -31,19 +31,14 @@ export const createWorkspace = t.procedure
const workspace: Workspace = {
id: newId("workspace"),
orgId: orgId,
__toBeDeleted: newId("fake"),
name: input.name,
plan: "free",
tier: "Free",
stripeCustomerId: null,
stripeSubscriptionId: null,
trialEnds: new Date(Date.now() + 1000 * 60 * 60 * 24 * 14), // 2 weeks
features: {},
betaFeatures: {},
planLockedUntil: null,
planChanged: null,
subscriptions: {},
planDowngradeRequest: null,
enabled: true,
deleteProtection: true,
createdAtM: Date.now(),
Expand Down
16 changes: 3 additions & 13 deletions internal/db/src/schema/workspaces.ts
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
import type { Subscriptions } from "@unkey/billing";
import { newId } from "@unkey/id";
import { relations } from "drizzle-orm";
import { boolean, datetime, json, mysqlEnum, mysqlTable, varchar } from "drizzle-orm/mysql-core";
import { boolean, json, mysqlEnum, mysqlTable, varchar } from "drizzle-orm/mysql-core";
import { apis } from "./apis";
import { identities } from "./identity";
import { keyAuth } from "./keyAuth";
Expand All @@ -15,7 +14,6 @@ import { vercelBindings, vercelIntegrations } from "./vercel_integration";

export const workspaces = mysqlTable("workspaces", {
id: varchar("id", { length: 256 }).primaryKey(),
__toBeDeleted: varchar("tenant_id", { length: 256 }).$defaultFn(() => newId("fake")),

orgId: varchar("org_id", { length: 256 }).notNull().unique(),
name: varchar("name", { length: 256 }).notNull(),
Expand All @@ -30,9 +28,6 @@ export const workspaces = mysqlTable("workspaces", {
stripeCustomerId: varchar("stripe_customer_id", { length: 256 }),
stripeSubscriptionId: varchar("stripe_subscription_id", { length: 256 }),

// null means there was no trial
trialEnds: datetime("trial_ends", { fsp: 3 }),

/**
* feature flags
*
Expand Down Expand Up @@ -82,15 +77,10 @@ export const workspaces = mysqlTable("workspaces", {
webhooks?: boolean;
}>()
.notNull(),
// prevent plan changes for a certain time, should be 1 day
// deprecated, use planChanged
planLockedUntil: datetime("plan_locked_until", { fsp: 3 }),

/**
* If a user requests to downgrade, we mark the workspace and downgrade it after the next
* billing happened.
* deprecated, most customers are on stripe subscriptions instead
*/
planDowngradeRequest: mysqlEnum("plan_downgrade_request", ["free"]),
planChanged: datetime("plan_changed", { fsp: 3 }),
subscriptions: json("subscriptions").$type<Subscriptions>(),
/**
* if the workspace is disabled, all API requests will be rejected
Expand Down
2 changes: 1 addition & 1 deletion tools/local/src/cmd/seed/apis.ts
Original file line number Diff line number Diff line change
Expand Up @@ -398,7 +398,7 @@ export async function seedApiAndKeys(workspaceId: string, count: number) {
);
}
} else {
console.log(
console.info(
"No keys available for verification events. Skipping verification event generation.",
);
}
Expand Down
4 changes: 2 additions & 2 deletions tools/local/src/cmd/seed/batch-operations.ts
Original file line number Diff line number Diff line change
Expand Up @@ -92,7 +92,7 @@ export async function insertVerificationEvents(

process.stdout.write("\n");

console.log(
console.info(
`\n✅ Successfully inserted ${count.toLocaleString()} verification events with ${
generateMatchingApiRequests ? "matching API requests" : "no matching API requests"
}.`,
Expand Down Expand Up @@ -175,7 +175,7 @@ export async function insertRatelimitEvents(
const totalTimeElapsed = Date.now() - progress.startTime;
const avgRecordsPerSecond = count / (totalTimeElapsed / 1000);

console.log(
console.info(
`✅ Successfully inserted ${count.toLocaleString()} ratelimit events with ${
generateMatchingApiRequests ? "matching API requests" : "no matching API requests"
} (avg: ${Math.round(avgRecordsPerSecond).toLocaleString()} records/sec)`,
Expand Down
2 changes: 1 addition & 1 deletion tools/local/src/cmd/seed/logs.ts
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,7 @@ async function insertApiRequestLogs(
const totalTimeElapsed = Date.now() - progress.startTime;
const avgRecordsPerSecond = count / (totalTimeElapsed / 1000);

console.log(
console.info(
`✅ Successfully inserted ${count.toLocaleString()} API request logs with realistic 30-day time distribution (avg: ${Math.round(
avgRecordsPerSecond,
).toLocaleString()} records/sec)`,
Expand Down
Loading