91 lines
3.7 KiB
C#
91 lines
3.7 KiB
C#
using System;
|
|
using Microsoft.EntityFrameworkCore.Migrations;
|
|
|
|
#nullable disable
|
|
|
|
namespace line_gestao_api.Migrations
|
|
{
|
|
/// <inheritdoc />
|
|
public partial class AddNotifications : Migration
|
|
{
|
|
/// <inheritdoc />
|
|
protected override void Up(MigrationBuilder migrationBuilder)
|
|
{
|
|
migrationBuilder.CreateTable(
|
|
name: "Notifications",
|
|
columns: table => new
|
|
{
|
|
Id = table.Column<Guid>(type: "uuid", nullable: false),
|
|
Tipo = table.Column<string>(type: "text", nullable: false),
|
|
Titulo = table.Column<string>(type: "text", nullable: false),
|
|
Mensagem = table.Column<string>(type: "text", nullable: false),
|
|
Data = table.Column<DateTime>(type: "timestamp with time zone", nullable: false),
|
|
ReferenciaData = table.Column<DateTime>(type: "timestamp with time zone", nullable: true),
|
|
DiasParaVencer = table.Column<int>(type: "integer", nullable: true),
|
|
Lida = table.Column<bool>(type: "boolean", nullable: false),
|
|
LidaEm = table.Column<DateTime>(type: "timestamp with time zone", nullable: true),
|
|
DedupKey = table.Column<string>(type: "text", nullable: false),
|
|
UserId = table.Column<Guid>(type: "uuid", nullable: true),
|
|
VigenciaLineId = table.Column<Guid>(type: "uuid", nullable: true),
|
|
Usuario = table.Column<string>(type: "text", nullable: true),
|
|
Cliente = table.Column<string>(type: "text", nullable: true),
|
|
Linha = table.Column<string>(type: "text", nullable: true)
|
|
},
|
|
constraints: table =>
|
|
{
|
|
table.PrimaryKey("PK_Notifications", x => x.Id);
|
|
table.ForeignKey(
|
|
name: "FK_Notifications_Users_UserId",
|
|
column: x => x.UserId,
|
|
principalTable: "Users",
|
|
principalColumn: "Id",
|
|
onDelete: ReferentialAction.Restrict);
|
|
table.ForeignKey(
|
|
name: "FK_Notifications_VigenciaLines_VigenciaLineId",
|
|
column: x => x.VigenciaLineId,
|
|
principalTable: "VigenciaLines",
|
|
principalColumn: "Id",
|
|
onDelete: ReferentialAction.Restrict);
|
|
});
|
|
|
|
migrationBuilder.CreateIndex(
|
|
name: "IX_Notifications_Cliente",
|
|
table: "Notifications",
|
|
column: "Cliente");
|
|
|
|
migrationBuilder.CreateIndex(
|
|
name: "IX_Notifications_Data",
|
|
table: "Notifications",
|
|
column: "Data");
|
|
|
|
migrationBuilder.CreateIndex(
|
|
name: "IX_Notifications_DedupKey",
|
|
table: "Notifications",
|
|
column: "DedupKey",
|
|
unique: true);
|
|
|
|
migrationBuilder.CreateIndex(
|
|
name: "IX_Notifications_Lida",
|
|
table: "Notifications",
|
|
column: "Lida");
|
|
|
|
migrationBuilder.CreateIndex(
|
|
name: "IX_Notifications_UserId",
|
|
table: "Notifications",
|
|
column: "UserId");
|
|
|
|
migrationBuilder.CreateIndex(
|
|
name: "IX_Notifications_VigenciaLineId",
|
|
table: "Notifications",
|
|
column: "VigenciaLineId");
|
|
}
|
|
|
|
/// <inheritdoc />
|
|
protected override void Down(MigrationBuilder migrationBuilder)
|
|
{
|
|
migrationBuilder.DropTable(
|
|
name: "Notifications");
|
|
}
|
|
}
|
|
}
|