import { Entity, PrimaryGeneratedColumn, Column, ManyToOne, JoinColumn, Unique, Check } from 'typeorm'; import { License } from './license.entity'; @Entity('plugin_registry') @Unique(['license_id', 'plugin_name']) @Check(`"source" IN ('umod', 'corrosion_module', 'manual')`) export class PluginRegistry { @PrimaryGeneratedColumn('uuid') id: string; @Column({ type: 'uuid' }) license_id: string; @Column({ type: 'varchar', length: 255 }) plugin_name: string; @Column({ type: 'varchar', length: 50, nullable: true }) plugin_version: string | null; @Column({ type: 'varchar', length: 20, default: 'manual' }) source: string; @Column({ type: 'varchar', length: 255, nullable: true }) umod_slug: string | null; @Column({ type: 'boolean', default: false }) is_installed: boolean; @Column({ type: 'boolean', default: false }) is_loaded: boolean; @Column({ type: 'jsonb', nullable: true }) config_json: Record | null; @Column({ type: 'text', nullable: true }) data_path: string | null; @Column({ type: 'boolean', default: false }) wipe_on_map: boolean; @Column({ type: 'boolean', default: false }) wipe_on_bp: boolean; @Column({ type: 'boolean', default: false }) wipe_on_full: boolean; @Column({ type: 'boolean', default: false }) never_wipe: boolean; @Column({ type: 'timestamptz', default: () => 'NOW()' }) installed_at: Date; @Column({ type: 'timestamptz', default: () => 'NOW()' }) updated_at: Date; @ManyToOne(() => License, { onDelete: 'CASCADE' }) @JoinColumn({ name: 'license_id' }) license: License; }