|
| 1 | +// Prisma schema for @ossinsight/api-server |
| 2 | +// This file mirrors packages/db/prisma/schema.prisma to allow `prisma generate` |
| 3 | +// to run independently within this package. The generated client is used by |
| 4 | +// the @ossinsight/prisma Fastify plugin (src/plugins/prisma.ts). |
| 5 | + |
| 6 | +generator client { |
| 7 | + provider = "prisma-client-js" |
| 8 | +} |
| 9 | + |
| 10 | +datasource db { |
| 11 | + provider = "mysql" |
| 12 | + url = env("DATABASE_URL") |
| 13 | +} |
| 14 | + |
| 15 | +model GithubEvent { |
| 16 | + id Int @id @default(autoincrement()) |
| 17 | + type String? |
| 18 | + createdAt DateTime? @map("created_at") |
| 19 | + repoId BigInt? @map("repo_id") |
| 20 | + repoName String? @map("repo_name") |
| 21 | + actorId BigInt? @map("actor_id") |
| 22 | + actorLogin String? @map("actor_login") |
| 23 | + actorLocation String? @map("actor_location") |
| 24 | + language String? |
| 25 | + additions BigInt? |
| 26 | + deletions BigInt? |
| 27 | + action String? |
| 28 | + number Int? |
| 29 | + commitId String? @map("commit_id") |
| 30 | + commentId BigInt? @map("comment_id") |
| 31 | + orgLogin String? @map("org_login") |
| 32 | + orgId BigInt? @map("org_id") |
| 33 | + state String? |
| 34 | + closedAt DateTime? @map("closed_at") |
| 35 | + comments Int? |
| 36 | + prMergedAt DateTime? @map("pr_merged_at") |
| 37 | + prMerged Boolean? @map("pr_merged") |
| 38 | + prChangedFiles Int? @map("pr_changed_files") |
| 39 | + prReviewComments Int? @map("pr_review_comments") |
| 40 | + prOrIssueId BigInt? @map("pr_or_issue_id") |
| 41 | + eventDay DateTime? @map("event_day") @db.Date |
| 42 | + eventMonth DateTime? @map("event_month") @db.Date |
| 43 | + authorAssociation String? @map("author_association") |
| 44 | + eventYear Int? @map("event_year") |
| 45 | + pushSize Int? @map("push_size") |
| 46 | + pushDistinctSize Int? @map("push_distinct_size") |
| 47 | +
|
| 48 | + @@map("github_events") |
| 49 | +} |
| 50 | + |
| 51 | +model GitHubRepo { |
| 52 | + repoId Int @id @map("repo_id") |
| 53 | + repoName String @map("repo_name") |
| 54 | + ownerId Int @map("owner_id") |
| 55 | + ownerLogin String @map("owner_login") |
| 56 | + ownerIsOrg Boolean @map("owner_is_org") |
| 57 | + description String? |
| 58 | + primaryLanguage String? @map("primary_language") |
| 59 | + languages GitHubRepoLanguage[] |
| 60 | + topics GitHubRepoTopic[] |
| 61 | + license String? |
| 62 | + size Int? |
| 63 | + stars Int? |
| 64 | + forks Int? |
| 65 | + parentRepoId Int? @map("parent_repo_id") |
| 66 | + isFork Boolean? @map("is_fork") |
| 67 | + isArchived Boolean? @map("is_archived") |
| 68 | + isDeleted Boolean? @map("is_deleted") |
| 69 | + latestReleasedAt DateTime? @db.Timestamp() @map("latest_released_at") |
| 70 | + pushedAt DateTime? @db.Timestamp() @map("pushed_at") |
| 71 | + createdAt DateTime @db.Timestamp() @map("created_at") |
| 72 | + updatedAt DateTime @db.Timestamp() @map("updated_at") |
| 73 | + lastEventAt DateTime? @db.Timestamp() @map("last_event_at") |
| 74 | + refreshedAt DateTime? @db.Timestamp() @map("refreshed_at") |
| 75 | +
|
| 76 | + @@map("github_repos") |
| 77 | +} |
| 78 | + |
| 79 | +model GitHubRepoTopic { |
| 80 | + repoId Int @map("repo_id") |
| 81 | + topic String |
| 82 | + repo GitHubRepo @relation(fields: [repoId], references: [repoId]) |
| 83 | +
|
| 84 | + @@id([repoId, topic]) |
| 85 | + @@map("github_repo_topics") |
| 86 | +} |
| 87 | + |
| 88 | +model GitHubRepoLanguage { |
| 89 | + repoId Int @map("repo_id") |
| 90 | + language String |
| 91 | + size Int? |
| 92 | + repo GitHubRepo @relation(fields: [repoId], references: [repoId]) |
| 93 | +
|
| 94 | + @@id([repoId, language]) |
| 95 | + @@map("github_repo_languages") |
| 96 | +} |
| 97 | + |
| 98 | +model GitHubUser { |
| 99 | + id Int @id |
| 100 | + login String |
| 101 | + type String? |
| 102 | + isBot Boolean? @map("is_bot") |
| 103 | + name String? |
| 104 | + email String? |
| 105 | + organization String? |
| 106 | + organizationFormatted String? @map("organization_formatted") |
| 107 | + address String? |
| 108 | + countryCode String? @map("country_code") |
| 109 | + regionCode String? @map("region_code") |
| 110 | + state String? |
| 111 | + city String? |
| 112 | + longitude Decimal? |
| 113 | + latitude Decimal? |
| 114 | + publicRepos Int? @map("public_repos") |
| 115 | + followers Int? |
| 116 | + followings Int? |
| 117 | + createdAt DateTime @map("created_at") |
| 118 | + updatedAt DateTime @map("updated_at") |
| 119 | + isDeleted Boolean? @map("is_deleted") |
| 120 | + refreshedAt DateTime? @map("refreshed_at") |
| 121 | +
|
| 122 | + @@map("github_users") |
| 123 | +} |
| 124 | + |
| 125 | +model Collection { |
| 126 | + id Int @id @default(autoincrement()) |
| 127 | + name String |
| 128 | + createdAt DateTime? @map("created_at") |
| 129 | + updatedAt DateTime? @map("updated_at") |
| 130 | + deletedAt DateTime? @map("deleted_at") |
| 131 | + items CollectionItem[] |
| 132 | +
|
| 133 | + @@map("collections") |
| 134 | +} |
| 135 | + |
| 136 | +model CollectionItem { |
| 137 | + id Int @id @default(autoincrement()) |
| 138 | + collectionId Int @map("collection_id") |
| 139 | + repoId Int @map("repo_id") |
| 140 | + repoName String? @map("repo_name") |
| 141 | + createdAt DateTime? @map("created_at") |
| 142 | + updatedAt DateTime? @map("updated_at") |
| 143 | + deletedAt DateTime? @map("deleted_at") |
| 144 | + collection Collection @relation(fields: [collectionId], references: [id]) |
| 145 | +
|
| 146 | + @@map("collection_items") |
| 147 | +} |
| 148 | + |
| 149 | +model LocationCacheItem { |
| 150 | + address String @id |
| 151 | + valid Boolean |
| 152 | + formattedAddress String @map("formatted_address") |
| 153 | + countryCode String @default("UND") @map("country_code") |
| 154 | + regionCode String @default("UND") @map("region_code") |
| 155 | + state String? |
| 156 | + city String? |
| 157 | + longitude Decimal? |
| 158 | + latitude Decimal? |
| 159 | + provider String @default("UNKNOWN") |
| 160 | + createdAt DateTime @default(now()) @map("created_at") |
| 161 | + updatedAt DateTime @default(now()) @updatedAt @map("updated_at") |
| 162 | +
|
| 163 | + @@map("location_cache") |
| 164 | +} |
0 commit comments