using System;
using Microsoft.EntityFrameworkCore.Migrations;
#nullable disable
namespace gehGassi.Persistence.Migrations
{
///
public partial class AppUserSubscriptionsAdded : Migration
{
///
protected override void Up(MigrationBuilder migrationBuilder)
{
migrationBuilder.CreateTable(
name: "AppUserSubscriptions",
columns: table => new
{
Id = table.Column(type: "bigint", nullable: false)
.Annotation("SqlServer:Identity", "1, 1"),
AppUserId = table.Column(type: "nvarchar(128)", maxLength: 128, nullable: false),
SubscriptionId = table.Column(type: "nvarchar(128)", maxLength: 128, nullable: false),
ExpirationDate = table.Column(type: "datetimeoffset", nullable: true),
LastRenewalDate = table.Column(type: "datetimeoffset", nullable: true),
LastUpdate = table.Column(type: "datetimeoffset", nullable: true),
Manual = table.Column(type: "bit", nullable: false),
CreatedBy = table.Column(type: "nvarchar(256)", maxLength: 256, nullable: true),
Created = table.Column(type: "datetimeoffset", nullable: false)
},
constraints: table =>
{
table.PrimaryKey("PK_AppUserSubscriptions", x => x.Id);
table.ForeignKey(
name: "FK_AppUserSubscriptions_AppUsers_AppUserId",
column: x => x.AppUserId,
principalTable: "AppUsers",
principalColumn: "Id",
onDelete: ReferentialAction.Cascade);
table.ForeignKey(
name: "FK_AppUserSubscriptions_Subscriptions_SubscriptionId",
column: x => x.SubscriptionId,
principalTable: "Subscriptions",
principalColumn: "Id",
onDelete: ReferentialAction.Cascade);
});
migrationBuilder.CreateIndex(
name: "IX_AppUserSubscriptions_AppUserId",
table: "AppUserSubscriptions",
column: "AppUserId");
migrationBuilder.CreateIndex(
name: "IX_AppUserSubscriptions_SubscriptionId",
table: "AppUserSubscriptions",
column: "SubscriptionId");
}
///
protected override void Down(MigrationBuilder migrationBuilder)
{
migrationBuilder.DropTable(
name: "AppUserSubscriptions");
}
}
}