using System; using Microsoft.EntityFrameworkCore.Migrations; #nullable disable namespace marlin.web.Migrations { /// public partial class AddWorkflowSnapshot : Migration { /// protected override void Up(MigrationBuilder migrationBuilder) { migrationBuilder.AddColumn( name: "workflow_scanned", table: "source_commits", type: "boolean", nullable: false, defaultValue: false); migrationBuilder.CreateTable( name: "workflow_snapshots", columns: table => new { id = table.Column(type: "uuid", nullable: false), commit_id = table.Column(type: "uuid", nullable: false), scanned_at = table.Column(type: "timestamp with time zone", nullable: false), workflow = table.Column(type: "text", nullable: false) }, constraints: table => { table.PrimaryKey("pk_workflow_snapshots", x => x.id); table.ForeignKey( name: "fk_workflow_snapshots_source_commits_commit_id", column: x => x.commit_id, principalTable: "source_commits", principalColumn: "id", onDelete: ReferentialAction.Cascade); }); migrationBuilder.CreateIndex( name: "ix_workflow_snapshots_commit_id", table: "workflow_snapshots", column: "commit_id", unique: true); } /// protected override void Down(MigrationBuilder migrationBuilder) { migrationBuilder.DropTable( name: "workflow_snapshots"); migrationBuilder.DropColumn( name: "workflow_scanned", table: "source_commits"); } } }