using Microsoft.EntityFrameworkCore.Migrations;

#nullable disable

namespace Forwarder.Data.Migrations;

/// <inheritdoc />
public partial class Initial : Migration
{
	/// <inheritdoc />
	protected override void Up(MigrationBuilder migrationBuilder)
	{
		_ = migrationBuilder.CreateTable(
			name: "Maps",
			columns: table => new
			{
				Id = table.Column<Guid>(type: "uuid", nullable: false),
				Abonent = table.Column<string>(type: "text", nullable: false),
				AssetId = table.Column<Guid>(type: "uuid", nullable: true)
			},
			constraints: table =>
			{
				_ = table.PrimaryKey("PK_Maps", x => x.Id);
			});

		_ = migrationBuilder.CreateTable(
			name: "Messages",
			columns: table => new
			{
				Id = table.Column<Guid>(type: "uuid", nullable: false),
				Receiver = table.Column<int>(type: "integer", nullable: false),
				Line = table.Column<int>(type: "integer", nullable: false),
				Abonent = table.Column<string>(type: "character varying(32)", maxLength: 32, nullable: false),
				Type = table.Column<int>(type: "integer", nullable: false),
				Code = table.Column<int>(type: "integer", nullable: false),
				Sector = table.Column<int>(type: "integer", nullable: false),
				Zone = table.Column<int>(type: "integer", nullable: false),
				CreatedAt = table.Column<DateTime>(type: "timestamp with time zone", nullable: false)
			},
			constraints: table =>
			{
				_ = table.PrimaryKey("PK_Messages", x => x.Id);
			});

		_ = migrationBuilder.CreateIndex(
			name: "IX_Maps_Abonent",
			table: "Maps",
			column: "Abonent",
			unique: true);

		_ = migrationBuilder.CreateIndex(
			name: "IX_Messages_CreatedAt",
			table: "Messages",
			column: "CreatedAt");
	}

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

		_ = migrationBuilder.DropTable(
			name: "Messages");
	}
}
