- snapshot scenario and snippet content into version tables on every
content change; live tables keep holding the latest version
- record the scenario version on each run and copy its steps into the
run steps, so runs execute and show the version they were created with
- keep run step history when a step is deleted (FK set null)
- pin a snippet version with runSnippet('alias@N')
- add version picker to the run modal and version info across the UI
- add version list/get endpoints and MCP tools
- include version in exports and require it on import, restoring the
exact version by id + version
48 lines
942 B
TypeScript
48 lines
942 B
TypeScript
import {
|
|
Column,
|
|
CreateDateColumn,
|
|
Entity,
|
|
JoinColumn,
|
|
ManyToOne,
|
|
PrimaryGeneratedColumn,
|
|
Unique,
|
|
} from "typeorm";
|
|
import { SnippetEntity } from "./snippet.entity";
|
|
|
|
/**
|
|
* Immutable snapshot of a snippet at one version. The `snippets` table always
|
|
* holds the latest version. Step code pins a version with
|
|
* `runSnippet("alias@<version>")`.
|
|
*/
|
|
@Entity("snippet_versions")
|
|
@Unique(["snippetId", "version"])
|
|
export class SnippetVersionEntity {
|
|
@PrimaryGeneratedColumn("uuid")
|
|
id: string;
|
|
|
|
@Column("text")
|
|
snippetId: string;
|
|
|
|
@ManyToOne(() => SnippetEntity, { onDelete: "CASCADE" })
|
|
@JoinColumn({ name: "snippetId" })
|
|
snippet: SnippetEntity;
|
|
|
|
@Column({ type: "int" })
|
|
version: number;
|
|
|
|
@Column()
|
|
alias: string;
|
|
|
|
@Column({ default: "" })
|
|
title: string;
|
|
|
|
@Column("text", { nullable: true })
|
|
description: string | null;
|
|
|
|
@Column("text")
|
|
code: string;
|
|
|
|
@CreateDateColumn()
|
|
createdAt: Date;
|
|
}
|