mirror of
				https://github.com/9technologygroup/patchmon.net.git
				synced 2025-11-03 21:43:33 +00:00 
			
		
		
		
	
		
			
				
	
	
		
			201 lines
		
	
	
		
			6.4 KiB
		
	
	
	
		
			Plaintext
		
	
	
	
	
	
			
		
		
	
	
			201 lines
		
	
	
		
			6.4 KiB
		
	
	
	
		
			Plaintext
		
	
	
	
	
	
generator client {
 | 
						|
  provider = "prisma-client-js"
 | 
						|
}
 | 
						|
 | 
						|
datasource db {
 | 
						|
  provider = "postgresql"
 | 
						|
  url      = env("DATABASE_URL")
 | 
						|
}
 | 
						|
 | 
						|
model agent_versions {
 | 
						|
  id                 String   @id
 | 
						|
  version            String   @unique
 | 
						|
  is_current         Boolean  @default(false)
 | 
						|
  release_notes      String?
 | 
						|
  download_url       String?
 | 
						|
  min_server_version String?
 | 
						|
  created_at         DateTime @default(now())
 | 
						|
  updated_at         DateTime
 | 
						|
  is_default         Boolean  @default(false)
 | 
						|
  script_content     String?
 | 
						|
}
 | 
						|
 | 
						|
model dashboard_preferences {
 | 
						|
  id         String   @id
 | 
						|
  user_id    String
 | 
						|
  card_id    String
 | 
						|
  enabled    Boolean  @default(true)
 | 
						|
  order      Int      @default(0)
 | 
						|
  created_at DateTime @default(now())
 | 
						|
  updated_at DateTime
 | 
						|
  users      users    @relation(fields: [user_id], references: [id], onDelete: Cascade)
 | 
						|
 | 
						|
  @@unique([user_id, card_id])
 | 
						|
}
 | 
						|
 | 
						|
model host_groups {
 | 
						|
  id          String   @id
 | 
						|
  name        String   @unique
 | 
						|
  description String?
 | 
						|
  color       String?  @default("#3B82F6")
 | 
						|
  created_at  DateTime @default(now())
 | 
						|
  updated_at  DateTime
 | 
						|
  hosts       hosts[]
 | 
						|
}
 | 
						|
 | 
						|
model host_packages {
 | 
						|
  id                 String   @id
 | 
						|
  host_id            String
 | 
						|
  package_id         String
 | 
						|
  current_version    String
 | 
						|
  available_version  String?
 | 
						|
  needs_update       Boolean  @default(false)
 | 
						|
  is_security_update Boolean  @default(false)
 | 
						|
  last_checked       DateTime @default(now())
 | 
						|
  hosts              hosts    @relation(fields: [host_id], references: [id], onDelete: Cascade)
 | 
						|
  packages           packages @relation(fields: [package_id], references: [id], onDelete: Cascade)
 | 
						|
 | 
						|
  @@unique([host_id, package_id])
 | 
						|
}
 | 
						|
 | 
						|
model host_repositories {
 | 
						|
  id            String       @id
 | 
						|
  host_id       String
 | 
						|
  repository_id String
 | 
						|
  is_enabled    Boolean      @default(true)
 | 
						|
  last_checked  DateTime     @default(now())
 | 
						|
  hosts         hosts        @relation(fields: [host_id], references: [id], onDelete: Cascade)
 | 
						|
  repositories  repositories @relation(fields: [repository_id], references: [id], onDelete: Cascade)
 | 
						|
 | 
						|
  @@unique([host_id, repository_id])
 | 
						|
}
 | 
						|
 | 
						|
model hosts {
 | 
						|
  id                 String              @id
 | 
						|
  friendly_name      String              @unique
 | 
						|
  ip                 String?
 | 
						|
  os_type            String
 | 
						|
  os_version         String
 | 
						|
  architecture       String?
 | 
						|
  last_update        DateTime            @default(now())
 | 
						|
  status             String              @default("active")
 | 
						|
  created_at         DateTime            @default(now())
 | 
						|
  updated_at         DateTime
 | 
						|
  api_id             String              @unique
 | 
						|
  api_key            String              @unique
 | 
						|
  host_group_id      String?
 | 
						|
  agent_version      String?
 | 
						|
  auto_update        Boolean             @default(true)
 | 
						|
  cpu_cores          Int?
 | 
						|
  cpu_model          String?
 | 
						|
  disk_details       Json?
 | 
						|
  dns_servers        Json?
 | 
						|
  gateway_ip         String?
 | 
						|
  hostname           String?
 | 
						|
  kernel_version     String?
 | 
						|
  load_average       Json?
 | 
						|
  network_interfaces Json?
 | 
						|
  ram_installed      Int?
 | 
						|
  selinux_status     String?
 | 
						|
  swap_size          Int?
 | 
						|
  system_uptime      String?
 | 
						|
  host_packages      host_packages[]
 | 
						|
  host_repositories  host_repositories[]
 | 
						|
  host_groups        host_groups?        @relation(fields: [host_group_id], references: [id])
 | 
						|
  update_history     update_history[]
 | 
						|
}
 | 
						|
 | 
						|
model packages {
 | 
						|
  id             String          @id
 | 
						|
  name           String          @unique
 | 
						|
  description    String?
 | 
						|
  category       String?
 | 
						|
  latest_version String?
 | 
						|
  created_at     DateTime        @default(now())
 | 
						|
  updated_at     DateTime
 | 
						|
  host_packages  host_packages[]
 | 
						|
}
 | 
						|
 | 
						|
model repositories {
 | 
						|
  id                String              @id
 | 
						|
  name              String
 | 
						|
  url               String
 | 
						|
  distribution      String
 | 
						|
  components        String
 | 
						|
  repo_type         String
 | 
						|
  is_active         Boolean             @default(true)
 | 
						|
  is_secure         Boolean             @default(true)
 | 
						|
  priority          Int?
 | 
						|
  description       String?
 | 
						|
  created_at        DateTime            @default(now())
 | 
						|
  updated_at        DateTime
 | 
						|
  host_repositories host_repositories[]
 | 
						|
 | 
						|
  @@unique([url, distribution, components])
 | 
						|
}
 | 
						|
 | 
						|
model role_permissions {
 | 
						|
  id                  String   @id
 | 
						|
  role                String   @unique
 | 
						|
  can_view_dashboard  Boolean  @default(true)
 | 
						|
  can_view_hosts      Boolean  @default(true)
 | 
						|
  can_manage_hosts    Boolean  @default(false)
 | 
						|
  can_view_packages   Boolean  @default(true)
 | 
						|
  can_manage_packages Boolean  @default(false)
 | 
						|
  can_view_users      Boolean  @default(false)
 | 
						|
  can_manage_users    Boolean  @default(false)
 | 
						|
  can_view_reports    Boolean  @default(true)
 | 
						|
  can_export_data     Boolean  @default(false)
 | 
						|
  can_manage_settings Boolean  @default(false)
 | 
						|
  created_at          DateTime @default(now())
 | 
						|
  updated_at          DateTime
 | 
						|
}
 | 
						|
 | 
						|
model settings {
 | 
						|
  id                String    @id
 | 
						|
  server_url        String    @default("http://localhost:3001")
 | 
						|
  server_protocol   String    @default("http")
 | 
						|
  server_host       String    @default("localhost")
 | 
						|
  server_port       Int       @default(3001)
 | 
						|
  created_at        DateTime  @default(now())
 | 
						|
  updated_at        DateTime
 | 
						|
  update_interval   Int       @default(60)
 | 
						|
  auto_update       Boolean   @default(false)
 | 
						|
  github_repo_url   String    @default("git@github.com:9technologygroup/patchmon.net.git")
 | 
						|
  ssh_key_path      String?
 | 
						|
  repository_type   String    @default("public")
 | 
						|
  last_update_check DateTime?
 | 
						|
  latest_version    String?
 | 
						|
  update_available  Boolean   @default(false)
 | 
						|
  signup_enabled    Boolean   @default(false)
 | 
						|
}
 | 
						|
 | 
						|
model update_history {
 | 
						|
  id             String   @id
 | 
						|
  host_id        String
 | 
						|
  packages_count Int
 | 
						|
  security_count Int
 | 
						|
  timestamp      DateTime @default(now())
 | 
						|
  status         String   @default("success")
 | 
						|
  error_message  String?
 | 
						|
  hosts          hosts    @relation(fields: [host_id], references: [id], onDelete: Cascade)
 | 
						|
}
 | 
						|
 | 
						|
model users {
 | 
						|
  id                    String                  @id
 | 
						|
  username              String                  @unique
 | 
						|
  email                 String                  @unique
 | 
						|
  password_hash         String
 | 
						|
  first_name            String?
 | 
						|
  last_name             String?
 | 
						|
  role                  String                  @default("admin")
 | 
						|
  is_active             Boolean                 @default(true)
 | 
						|
  last_login            DateTime?
 | 
						|
  created_at            DateTime                @default(now())
 | 
						|
  updated_at            DateTime
 | 
						|
  tfa_backup_codes      String?
 | 
						|
  tfa_enabled           Boolean                 @default(false)
 | 
						|
  tfa_secret            String?
 | 
						|
  dashboard_preferences dashboard_preferences[]
 | 
						|
}
 |