From 08819c6738a4f82ccf07ae5ed60835b087f7bb34 Mon Sep 17 00:00:00 2001 From: HombreLaser Date: Sun, 6 Nov 2022 02:10:44 -0600 Subject: Añadidos grupos y usuarios MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- Migrations/20221106041635_AddGroup.cs | 64 +++++++++++++++++++++++++++++++++++ 1 file changed, 64 insertions(+) create mode 100644 Migrations/20221106041635_AddGroup.cs (limited to 'Migrations/20221106041635_AddGroup.cs') diff --git a/Migrations/20221106041635_AddGroup.cs b/Migrations/20221106041635_AddGroup.cs new file mode 100644 index 0000000..23f5fc9 --- /dev/null +++ b/Migrations/20221106041635_AddGroup.cs @@ -0,0 +1,64 @@ +using Microsoft.EntityFrameworkCore.Migrations; +using Npgsql.EntityFrameworkCore.PostgreSQL.Metadata; + +#nullable disable + +namespace LibraryAPI.Migrations +{ + public partial class AddGroup : Migration + { + protected override void Up(MigrationBuilder migrationBuilder) + { + migrationBuilder.CreateTable( + name: "Groups", + columns: table => new + { + Id = table.Column(type: "bigint", nullable: false) + .Annotation("Npgsql:ValueGenerationStrategy", NpgsqlValueGenerationStrategy.IdentityByDefaultColumn), + Name = table.Column(type: "text", nullable: false) + }, + constraints: table => + { + table.PrimaryKey("PK_Groups", x => x.Id); + }); + + migrationBuilder.CreateTable( + name: "GroupUserAccount", + columns: table => new + { + GroupsId = table.Column(type: "bigint", nullable: false), + UsersId = table.Column(type: "bigint", nullable: false) + }, + constraints: table => + { + table.PrimaryKey("PK_GroupUserAccount", x => new { x.GroupsId, x.UsersId }); + table.ForeignKey( + name: "FK_GroupUserAccount_Groups_GroupsId", + column: x => x.GroupsId, + principalTable: "Groups", + principalColumn: "Id", + onDelete: ReferentialAction.Cascade); + table.ForeignKey( + name: "FK_GroupUserAccount_Users_UsersId", + column: x => x.UsersId, + principalTable: "Users", + principalColumn: "Id", + onDelete: ReferentialAction.Cascade); + }); + + migrationBuilder.CreateIndex( + name: "IX_GroupUserAccount_UsersId", + table: "GroupUserAccount", + column: "UsersId"); + } + + protected override void Down(MigrationBuilder migrationBuilder) + { + migrationBuilder.DropTable( + name: "GroupUserAccount"); + + migrationBuilder.DropTable( + name: "Groups"); + } + } +} -- cgit v1.2.3