// api-keys.ts ....
import { organizationId } from "./organizations";
export const apiKeys = pgTable("api_keys", {
id,
name: text("name").notNull(),
preview: text("preview").notNull(),
hashedKey: text("hashed_key").notNull(),
organizationId,
...timestamps,
}, (table) => {
return {
hashedKeyIdx: uniqueIndex("hashed_key_idx").on(table.hashedKey),
};
});
// I export a column reference so I can have one place if i decide to change stuff
export const createdByApiKeyId = uuid("created_by_api_key_id")
.references(() => apiKeys.id);
// api-keys.ts ....
import { organizationId } from "./organizations";
export const apiKeys = pgTable("api_keys", {
id,
name: text("name").notNull(),
preview: text("preview").notNull(),
hashedKey: text("hashed_key").notNull(),
organizationId,
...timestamps,
}, (table) => {
return {
hashedKeyIdx: uniqueIndex("hashed_key_idx").on(table.hashedKey),
};
});
// I export a column reference so I can have one place if i decide to change stuff
export const createdByApiKeyId = uuid("created_by_api_key_id")
.references(() => apiKeys.id);