using Microsoft.EntityFrameworkCore.Migrations;
using Npgsql.EntityFrameworkCore.PostgreSQL.Metadata;

#nullable disable

namespace kehati.Migrations
{
    /// <inheritdoc />
    public partial class InitialCreate : Migration
    {
        /// <inheritdoc />
        protected override void Up(MigrationBuilder migrationBuilder)
        {
            migrationBuilder.CreateTable(
                name: "ms_famili",
                columns: table => new
                {
                    MsFamiliId = table.Column<int>(type: "integer", nullable: false)
                        .Annotation("Npgsql:ValueGenerationStrategy", NpgsqlValueGenerationStrategy.IdentityByDefaultColumn),
                    Name = table.Column<string>(type: "text", nullable: false)
                },
                constraints: table =>
                {
                    table.PrimaryKey("PK_ms_famili", x => x.MsFamiliId);
                });

            migrationBuilder.CreateTable(
                name: "ms_group",
                columns: table => new
                {
                    MsGroupId = table.Column<int>(type: "integer", nullable: false)
                        .Annotation("Npgsql:ValueGenerationStrategy", NpgsqlValueGenerationStrategy.IdentityByDefaultColumn),
                    Name = table.Column<string>(type: "text", nullable: false),
                    Alias = table.Column<string>(type: "text", nullable: false),
                    Status = table.Column<string>(type: "text", nullable: false),
                    CreatedBy = table.Column<int>(type: "integer", nullable: false),
                    UpdatedBy = table.Column<int>(type: "integer", nullable: false)
                },
                constraints: table =>
                {
                    table.PrimaryKey("PK_ms_group", x => x.MsGroupId);
                });

            migrationBuilder.CreateTable(
                name: "ms_habitus",
                columns: table => new
                {
                    MsHabitusId = table.Column<int>(type: "integer", nullable: false)
                        .Annotation("Npgsql:ValueGenerationStrategy", NpgsqlValueGenerationStrategy.IdentityByDefaultColumn),
                    Name = table.Column<string>(type: "text", nullable: false)
                },
                constraints: table =>
                {
                    table.PrimaryKey("PK_ms_habitus", x => x.MsHabitusId);
                });

            migrationBuilder.CreateTable(
                name: "ms_lokasi",
                columns: table => new
                {
                    MsLokasiId = table.Column<int>(type: "integer", nullable: false)
                        .Annotation("Npgsql:ValueGenerationStrategy", NpgsqlValueGenerationStrategy.IdentityByDefaultColumn),
                    name = table.Column<string>(type: "text", nullable: false),
                    kode = table.Column<int>(type: "integer", nullable: true),
                    status = table.Column<string>(type: "text", nullable: true),
                    image = table.Column<string>(type: "text", nullable: true),
                    slug = table.Column<string>(type: "text", nullable: true),
                    region = table.Column<string>(type: "text", nullable: true),
                    area = table.Column<string>(type: "text", nullable: true)
                },
                constraints: table =>
                {
                    table.PrimaryKey("PK_ms_lokasi", x => x.MsLokasiId);
                });

            migrationBuilder.CreateTable(
                name: "ms_lokasi_tumbuhan",
                columns: table => new
                {
                    MsLokasiTumbuhanId = table.Column<int>(type: "integer", nullable: false)
                        .Annotation("Npgsql:ValueGenerationStrategy", NpgsqlValueGenerationStrategy.IdentityByDefaultColumn),
                    ms_tumbuhan_id = table.Column<int>(type: "integer", nullable: false),
                    ms_lokasi_id = table.Column<int>(type: "integer", nullable: false)
                },
                constraints: table =>
                {
                    table.PrimaryKey("PK_ms_lokasi_tumbuhan", x => x.MsLokasiTumbuhanId);
                });

            migrationBuilder.CreateTable(
                name: "ms_menu",
                columns: table => new
                {
                    MsMenuId = table.Column<int>(type: "integer", nullable: false)
                        .Annotation("Npgsql:ValueGenerationStrategy", NpgsqlValueGenerationStrategy.IdentityByDefaultColumn),
                    parent_id = table.Column<int>(type: "integer", nullable: false),
                    Title = table.Column<string>(type: "text", nullable: false),
                    Module = table.Column<string>(type: "text", nullable: false),
                    Url = table.Column<string>(type: "text", nullable: false),
                    menu_type = table.Column<string>(type: "text", nullable: false),
                    menu_icon = table.Column<string>(type: "text", nullable: false),
                    Ordering = table.Column<string>(type: "text", nullable: false),
                    Status = table.Column<string>(type: "text", nullable: false)
                },
                constraints: table =>
                {
                    table.PrimaryKey("PK_ms_menu", x => x.MsMenuId);
                });

            migrationBuilder.CreateTable(
                name: "ms_tumbuhan",
                columns: table => new
                {
                    MsTumbuhanId = 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),
                    name = table.Column<string>(type: "text", nullable: true),
                    name_ilmiah = table.Column<string>(type: "text", nullable: true),
                    tanaman_khas_jakarta = table.Column<bool>(type: "boolean", nullable: false),
                    status_perlindungan = table.Column<string>(type: "text", nullable: true),
                    iucn = table.Column<string>(type: "text", nullable: true),
                    cites = table.Column<string>(type: "text", nullable: true),
                    slug = table.Column<string>(type: "text", nullable: true),
                    image = table.Column<string>(type: "text", nullable: true)
                },
                constraints: table =>
                {
                    table.PrimaryKey("PK_ms_tumbuhan", x => x.MsTumbuhanId);
                });

            migrationBuilder.CreateTable(
                name: "users",
                columns: table => new
                {
                    Id = table.Column<int>(type: "integer", nullable: false)
                        .Annotation("Npgsql:ValueGenerationStrategy", NpgsqlValueGenerationStrategy.IdentityByDefaultColumn),
                    ms_group_id = table.Column<int>(type: "integer", nullable: false),
                    Name = table.Column<string>(type: "text", nullable: false),
                    Username = table.Column<string>(type: "text", nullable: false),
                    Email = table.Column<string>(type: "text", nullable: false),
                    Password = table.Column<string>(type: "text", nullable: false)
                },
                constraints: table =>
                {
                    table.PrimaryKey("PK_users", x => x.Id);
                });
        }

        /// <inheritdoc />
        protected override void Down(MigrationBuilder migrationBuilder)
        {
            migrationBuilder.DropTable(
                name: "ms_famili");

            migrationBuilder.DropTable(
                name: "ms_group");

            migrationBuilder.DropTable(
                name: "ms_habitus");

            migrationBuilder.DropTable(
                name: "ms_lokasi");

            migrationBuilder.DropTable(
                name: "ms_lokasi_tumbuhan");

            migrationBuilder.DropTable(
                name: "ms_menu");

            migrationBuilder.DropTable(
                name: "ms_tumbuhan");

            migrationBuilder.DropTable(
                name: "users");
        }
    }
}
