65 lines
2.8 KiB
C#
65 lines
2.8 KiB
C#
using System;
|
|
using Microsoft.EntityFrameworkCore.Migrations;
|
|
|
|
#nullable disable
|
|
|
|
namespace gehGassi.Persistence.Migrations
|
|
{
|
|
/// <inheritdoc />
|
|
public partial class AppUserSubscriptionsAdded : Migration
|
|
{
|
|
/// <inheritdoc />
|
|
protected override void Up(MigrationBuilder migrationBuilder)
|
|
{
|
|
migrationBuilder.CreateTable(
|
|
name: "AppUserSubscriptions",
|
|
columns: table => new
|
|
{
|
|
Id = table.Column<long>(type: "bigint", nullable: false)
|
|
.Annotation("SqlServer:Identity", "1, 1"),
|
|
AppUserId = table.Column<string>(type: "nvarchar(128)", maxLength: 128, nullable: false),
|
|
SubscriptionId = table.Column<string>(type: "nvarchar(128)", maxLength: 128, nullable: false),
|
|
ExpirationDate = table.Column<DateTimeOffset>(type: "datetimeoffset", nullable: true),
|
|
LastRenewalDate = table.Column<DateTimeOffset>(type: "datetimeoffset", nullable: true),
|
|
LastUpdate = table.Column<DateTimeOffset>(type: "datetimeoffset", nullable: true),
|
|
Manual = table.Column<bool>(type: "bit", nullable: false),
|
|
CreatedBy = table.Column<string>(type: "nvarchar(256)", maxLength: 256, nullable: true),
|
|
Created = table.Column<DateTimeOffset>(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");
|
|
}
|
|
|
|
/// <inheritdoc />
|
|
protected override void Down(MigrationBuilder migrationBuilder)
|
|
{
|
|
migrationBuilder.DropTable(
|
|
name: "AppUserSubscriptions");
|
|
}
|
|
}
|
|
}
|