generator client {
  provider = "prisma-client-js"
}

datasource db {
  provider = "postgresql"
  url      = env("DATABASE_URL")
}

model cf_api_keys {
  id         Int       @id @default(autoincrement())
  key        String    @unique @db.VarChar(255)
  suffix     String    @db.VarChar(4)
  name       String    @db.VarChar(255)
  created_at DateTime  @default(now()) @db.Timestamptz(6)
  last_used  DateTime? @db.Timestamptz(6)
  user_id    String?
  tier       String?
}

model users {
  user_id              String  @id
  github_username      String  @unique
  email                String?
  name                 String?
  onboarding_completed Boolean @default(false)
}

model optimization_features {
  trace_id            String    @id @db.Char(36)
  original_code       String?
  optimizations_raw   Json?
  optimizations_post  Json?
  speedup_ratio       Json?
  original_runtime    Float?
  optimized_runtime   Json?
  is_correct          Json?
  generated_test      String[]
  instrumented_generated_test String[]
  test_framework      String?
  created_at          DateTime? @default(now()) @db.Timestamptz(6)
  aiservice_commit_id String?
  metadata            Json?
  explanations_post   Json?
  explanations_raw    Json?
  user_id             String?
  experiment_metadata Json?
  pull_request        Json?
}
