using Microsoft.EntityFrameworkCore.Migrations;
using Npgsql.EntityFrameworkCore.PostgreSQL.Metadata;
#nullable disable
namespace kehati.Migrations
{
///
public partial class AddFaunaTable : Migration
{
///
protected override void Up(MigrationBuilder migrationBuilder)
{
migrationBuilder.CreateTable(
name: "ms_fauna",
columns: table => new
{
MsFaunaId = table.Column(type: "integer", nullable: false)
.Annotation("Npgsql:ValueGenerationStrategy", NpgsqlValueGenerationStrategy.IdentityByDefaultColumn),
ms_famili_id = table.Column(type: "integer", nullable: false),
ms_habitus_id = table.Column(type: "integer", nullable: false),
slug = table.Column(type: "character varying(200)", maxLength: 200, nullable: false),
name = table.Column(type: "character varying(200)", maxLength: 200, nullable: false),
nama_ilmiah = table.Column(type: "text", nullable: false),
status = table.Column(type: "text", nullable: true),
image = table.Column(type: "text", nullable: true),
created_at = table.Column(type: "timestamp with time zone", nullable: false),
updated_at = table.Column(type: "timestamp with time zone", nullable: true),
},
constraints: table =>
{
table.PrimaryKey("PK_MsFaunaId", x => x.MsFaunaId);
table.ForeignKey(
name: "FK_FamiliId",
column: x => x.ms_famili_id,
principalTable: "ms_famili",
principalColumn: "MsFamiliId");
table.ForeignKey(
name: "FK_HabitusId",
column: x => x.ms_habitus_id,
principalTable: "ms_habitus",
principalColumn: "MsHabitusId");
});
}
///
protected override void Down(MigrationBuilder migrationBuilder)
{
migrationBuilder.DropTable(
name: "ms_fauna");
}
}
}