2024-11-01 07:40:53 +00:00
|
|
|
|
using System;
|
|
|
|
|
using Microsoft.EntityFrameworkCore.Migrations;
|
|
|
|
|
using Npgsql.EntityFrameworkCore.PostgreSQL.Metadata;
|
|
|
|
|
|
|
|
|
|
#nullable disable
|
|
|
|
|
|
|
|
|
|
namespace Demo.Migrations
|
|
|
|
|
{
|
|
|
|
|
/// <inheritdoc />
|
2024-11-05 18:36:49 +00:00
|
|
|
|
public partial class createbase : Migration
|
2024-11-01 07:40:53 +00:00
|
|
|
|
{
|
|
|
|
|
/// <inheritdoc />
|
|
|
|
|
protected override void Up(MigrationBuilder migrationBuilder)
|
|
|
|
|
{
|
|
|
|
|
migrationBuilder.CreateTable(
|
|
|
|
|
name: "Groups",
|
|
|
|
|
columns: table => new
|
|
|
|
|
{
|
|
|
|
|
Id = 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_Groups", x => x.Id);
|
|
|
|
|
});
|
|
|
|
|
|
|
|
|
|
migrationBuilder.CreateTable(
|
|
|
|
|
name: "Users",
|
|
|
|
|
columns: table => new
|
|
|
|
|
{
|
|
|
|
|
Guid = table.Column<Guid>(type: "uuid", nullable: false),
|
|
|
|
|
FIO = table.Column<string>(type: "text", nullable: false),
|
|
|
|
|
GroupID = table.Column<int>(type: "integer", nullable: false)
|
|
|
|
|
},
|
|
|
|
|
constraints: table =>
|
|
|
|
|
{
|
|
|
|
|
table.PrimaryKey("PK_Users", x => x.Guid);
|
|
|
|
|
table.ForeignKey(
|
|
|
|
|
name: "FK_Users_Groups_GroupID",
|
|
|
|
|
column: x => x.GroupID,
|
|
|
|
|
principalTable: "Groups",
|
|
|
|
|
principalColumn: "Id",
|
|
|
|
|
onDelete: ReferentialAction.Cascade);
|
|
|
|
|
});
|
|
|
|
|
|
|
|
|
|
migrationBuilder.CreateTable(
|
|
|
|
|
name: "PresenceDaos",
|
|
|
|
|
columns: table => new
|
|
|
|
|
{
|
2024-11-05 18:36:49 +00:00
|
|
|
|
Id = table.Column<int>(type: "integer", nullable: false).Annotation("Npgsql:ValueGenerationStrategy", NpgsqlValueGenerationStrategy.IdentityByDefaultColumn),
|
2024-11-01 07:40:53 +00:00
|
|
|
|
UserGuid = table.Column<Guid>(type: "uuid", nullable: false),
|
|
|
|
|
IsAttedance = table.Column<bool>(type: "boolean", nullable: false),
|
|
|
|
|
Date = table.Column<DateOnly>(type: "date", nullable: false),
|
2024-11-05 18:36:49 +00:00
|
|
|
|
LessonNumber = table.Column<int>(type: "integer", nullable: false),
|
|
|
|
|
GroupId = table.Column<int>(type: "integer", nullable: false)
|
2024-11-01 07:40:53 +00:00
|
|
|
|
},
|
|
|
|
|
constraints: table =>
|
|
|
|
|
{
|
2024-11-05 18:36:49 +00:00
|
|
|
|
table.PrimaryKey("PK_PresenceDaos", x => x.Id );
|
2024-11-01 07:40:53 +00:00
|
|
|
|
});
|
|
|
|
|
|
|
|
|
|
migrationBuilder.CreateIndex(
|
|
|
|
|
name: "IX_Users_GroupID",
|
|
|
|
|
table: "Users",
|
|
|
|
|
column: "GroupID");
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/// <inheritdoc />
|
|
|
|
|
protected override void Down(MigrationBuilder migrationBuilder)
|
|
|
|
|
{
|
|
|
|
|
migrationBuilder.DropTable(
|
|
|
|
|
name: "PresenceDaos");
|
|
|
|
|
|
|
|
|
|
migrationBuilder.DropTable(
|
|
|
|
|
name: "Users");
|
|
|
|
|
|
|
|
|
|
migrationBuilder.DropTable(
|
|
|
|
|
name: "Groups");
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|