using System;
using Microsoft.EntityFrameworkCore.Migrations;
#nullable disable
namespace marlin.web.Migrations
{
///
public partial class AddLogEvent : Migration
{
///
protected override void Up(MigrationBuilder migrationBuilder)
{
migrationBuilder.AlterColumn(
name: "main_branch",
table: "sources",
type: "text",
nullable: true,
oldClrType: typeof(string),
oldType: "text");
migrationBuilder.CreateTable(
name: "logs",
columns: table => new
{
id = table.Column(type: "uuid", nullable: false),
job_id = table.Column(type: "uuid", nullable: false),
at = table.Column(type: "timestamp with time zone", nullable: false),
message = table.Column(type: "text", nullable: false),
error = table.Column(type: "boolean", nullable: false),
step_id = table.Column(type: "text", nullable: false)
},
constraints: table =>
{
table.PrimaryKey("pk_logs", x => x.id);
table.ForeignKey(
name: "fk_logs_jobs_job_id",
column: x => x.job_id,
principalTable: "jobs",
principalColumn: "id",
onDelete: ReferentialAction.Cascade);
});
migrationBuilder.CreateIndex(
name: "ix_logs_job_id",
table: "logs",
column: "job_id");
}
///
protected override void Down(MigrationBuilder migrationBuilder)
{
migrationBuilder.DropTable(
name: "logs");
migrationBuilder.AlterColumn(
name: "main_branch",
table: "sources",
type: "text",
nullable: false,
defaultValue: "",
oldClrType: typeof(string),
oldType: "text",
oldNullable: true);
}
}
}