schema/projects.ts

stripemeter · packages/database/src/schema/projects.ts · typescript · MIT
database

Drizzle ORM schema for a projects table, defining columns, indexes, and TypeScript types for select/insert.

// Source: https://github.com/louispy/stripemeter | License: MIT | Copyright 2025 StripeMeter Contributors
// Provided via justclaw.it.com; keep this notice with the code.
/**
 * Projects table schema
 */

import { pgTable, uuid, text, timestamp, uniqueIndex } from 'drizzle-orm/pg-core';

export const projects = pgTable('projects', {
  id: uuid('id').primaryKey().defaultRandom(),
  organisationId: uuid('organisation_id').notNull(),
  name: text('name').notNull(),
  slug: text('slug').notNull(),
  createdAt: timestamp('created_at', { withTimezone: true }).notNull().defaultNow(),
  updatedAt: timestamp('updated_at', { withTimezone: true }).notNull().defaultNow(),
}, (table) => {
  return {
    slugIdx: uniqueIndex('uq_projects_org_slug').on(table.organisationId, table.slug),
  };
});

export

... (truncated -- full source via MCP)

See the full source, get the GitHub permalink, and search for more like it.

Get a free API key