Stream custom live channels using your own media
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 

126 lines
4.8 KiB

using System;
using Microsoft.EntityFrameworkCore.Migrations;
#nullable disable
namespace ErsatzTV.Infrastructure.Sqlite.Migrations
{
/// <inheritdoc />
public partial class Add_Template : Migration
{
/// <inheritdoc />
protected override void Up(MigrationBuilder migrationBuilder)
{
migrationBuilder.CreateTable(
name: "TemplateGroup",
columns: table => new
{
Id = table.Column<int>(type: "INTEGER", nullable: false)
.Annotation("Sqlite:Autoincrement", true),
Name = table.Column<string>(type: "TEXT", nullable: true)
},
constraints: table =>
{
table.PrimaryKey("PK_TemplateGroup", x => x.Id);
});
migrationBuilder.CreateTable(
name: "Template",
columns: table => new
{
Id = table.Column<int>(type: "INTEGER", nullable: false)
.Annotation("Sqlite:Autoincrement", true),
TemplateGroupId = table.Column<int>(type: "INTEGER", nullable: false),
Name = table.Column<string>(type: "TEXT", nullable: true),
PlayoutId = table.Column<int>(type: "INTEGER", nullable: true)
},
constraints: table =>
{
table.PrimaryKey("PK_Template", x => x.Id);
table.ForeignKey(
name: "FK_Template_Playout_PlayoutId",
column: x => x.PlayoutId,
principalTable: "Playout",
principalColumn: "Id");
table.ForeignKey(
name: "FK_Template_TemplateGroup_TemplateGroupId",
column: x => x.TemplateGroupId,
principalTable: "TemplateGroup",
principalColumn: "Id",
onDelete: ReferentialAction.Cascade);
});
migrationBuilder.CreateTable(
name: "TemplateItem",
columns: table => new
{
Id = table.Column<int>(type: "INTEGER", nullable: false)
.Annotation("Sqlite:Autoincrement", true),
TemplateId = table.Column<int>(type: "INTEGER", nullable: false),
BlockId = table.Column<int>(type: "INTEGER", nullable: false),
StartTime = table.Column<TimeSpan>(type: "TEXT", nullable: false)
},
constraints: table =>
{
table.PrimaryKey("PK_TemplateItem", x => x.Id);
table.ForeignKey(
name: "FK_TemplateItem_Block_BlockId",
column: x => x.BlockId,
principalTable: "Block",
principalColumn: "Id",
onDelete: ReferentialAction.Cascade);
table.ForeignKey(
name: "FK_TemplateItem_Template_TemplateId",
column: x => x.TemplateId,
principalTable: "Template",
principalColumn: "Id",
onDelete: ReferentialAction.Cascade);
});
migrationBuilder.CreateIndex(
name: "IX_Template_Name",
table: "Template",
column: "Name",
unique: true);
migrationBuilder.CreateIndex(
name: "IX_Template_PlayoutId",
table: "Template",
column: "PlayoutId");
migrationBuilder.CreateIndex(
name: "IX_Template_TemplateGroupId",
table: "Template",
column: "TemplateGroupId");
migrationBuilder.CreateIndex(
name: "IX_TemplateGroup_Name",
table: "TemplateGroup",
column: "Name",
unique: true);
migrationBuilder.CreateIndex(
name: "IX_TemplateItem_BlockId",
table: "TemplateItem",
column: "BlockId");
migrationBuilder.CreateIndex(
name: "IX_TemplateItem_TemplateId",
table: "TemplateItem",
column: "TemplateId");
}
/// <inheritdoc />
protected override void Down(MigrationBuilder migrationBuilder)
{
migrationBuilder.DropTable(
name: "TemplateItem");
migrationBuilder.DropTable(
name: "Template");
migrationBuilder.DropTable(
name: "TemplateGroup");
}
}
}