54 lines
2.4 KiB
C#
54 lines
2.4 KiB
C#
using Microsoft.EntityFrameworkCore.Migrations;
|
|
using Npgsql.EntityFrameworkCore.PostgreSQL.Metadata;
|
|
|
|
#nullable disable
|
|
|
|
namespace kehati.Migrations
|
|
{
|
|
/// <inheritdoc />
|
|
public partial class AddFaunaTable : Migration
|
|
{
|
|
/// <inheritdoc />
|
|
protected override void Up(MigrationBuilder migrationBuilder)
|
|
{
|
|
migrationBuilder.CreateTable(
|
|
name: "ms_fauna",
|
|
columns: table => new
|
|
{
|
|
MsFaunaId = table.Column<int>(type: "integer", nullable: false)
|
|
.Annotation("Npgsql:ValueGenerationStrategy", NpgsqlValueGenerationStrategy.IdentityByDefaultColumn),
|
|
ms_famili_id = table.Column<int>(type: "integer", nullable: false),
|
|
ms_habitus_id = table.Column<int>(type: "integer", nullable: false),
|
|
slug = table.Column<string>(type: "character varying(200)", maxLength: 200, nullable: false),
|
|
name = table.Column<string>(type: "character varying(200)", maxLength: 200, nullable: false),
|
|
nama_ilmiah = table.Column<string>(type: "text", nullable: false),
|
|
status = table.Column<string>(type: "text", nullable: true),
|
|
image = table.Column<string>(type: "text", nullable: true),
|
|
created_at = table.Column<DateTime>(type: "timestamp with time zone", nullable: false),
|
|
updated_at = table.Column<DateTime>(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");
|
|
});
|
|
}
|
|
|
|
/// <inheritdoc />
|
|
protected override void Down(MigrationBuilder migrationBuilder)
|
|
{
|
|
migrationBuilder.DropTable(
|
|
name: "ms_fauna");
|
|
}
|
|
}
|
|
}
|