added new fields to the playlist entry, migrations and started with the api controller to manage the list
This commit is contained in:
50
Tv7Playlist.Data/Migrations/20190124221302_AddedEnabledAvailableNameOverride.Designer.cs
generated
Normal file
50
Tv7Playlist.Data/Migrations/20190124221302_AddedEnabledAvailableNameOverride.Designer.cs
generated
Normal file
@@ -0,0 +1,50 @@
|
||||
// <auto-generated />
|
||||
using System;
|
||||
using Microsoft.EntityFrameworkCore;
|
||||
using Microsoft.EntityFrameworkCore.Infrastructure;
|
||||
using Microsoft.EntityFrameworkCore.Migrations;
|
||||
using Microsoft.EntityFrameworkCore.Storage.ValueConversion;
|
||||
using Tv7Playlist.Data;
|
||||
|
||||
namespace Tv7Playlist.Data.Migrations
|
||||
{
|
||||
[DbContext(typeof(PlaylistContext))]
|
||||
[Migration("20190124221302_AddedEnabledAvailableNameOverride")]
|
||||
partial class AddedEnabledAvailableNameOverride
|
||||
{
|
||||
protected override void BuildTargetModel(ModelBuilder modelBuilder)
|
||||
{
|
||||
#pragma warning disable 612, 618
|
||||
modelBuilder
|
||||
.HasAnnotation("ProductVersion", "2.2.0-rtm-35687");
|
||||
|
||||
modelBuilder.Entity("Tv7Playlist.Data.PlaylistEntry", b =>
|
||||
{
|
||||
b.Property<Guid>("Id")
|
||||
.ValueGeneratedOnAdd();
|
||||
|
||||
b.Property<bool>("IsAvailable");
|
||||
|
||||
b.Property<bool>("IsEnabled");
|
||||
|
||||
b.Property<string>("Name");
|
||||
|
||||
b.Property<string>("NameOverride");
|
||||
|
||||
b.Property<int>("TrackNumber");
|
||||
|
||||
b.Property<string>("Url");
|
||||
|
||||
b.HasKey("Id");
|
||||
|
||||
b.HasIndex("Name");
|
||||
|
||||
b.HasIndex("TrackNumber")
|
||||
.IsUnique();
|
||||
|
||||
b.ToTable("PlaylistEntries");
|
||||
});
|
||||
#pragma warning restore 612, 618
|
||||
}
|
||||
}
|
||||
}
|
@@ -0,0 +1,70 @@
|
||||
using Microsoft.EntityFrameworkCore.Migrations;
|
||||
|
||||
namespace Tv7Playlist.Data.Migrations
|
||||
{
|
||||
public partial class AddedEnabledAvailableNameOverride : Migration
|
||||
{
|
||||
protected override void Up(MigrationBuilder migrationBuilder)
|
||||
{
|
||||
migrationBuilder.DropUniqueConstraint(
|
||||
name: "AK_PlaylistEntries_TrackNumber",
|
||||
table: "PlaylistEntries");
|
||||
|
||||
migrationBuilder.AddColumn<bool>(
|
||||
name: "IsAvailable",
|
||||
table: "PlaylistEntries",
|
||||
nullable: false,
|
||||
defaultValue: false);
|
||||
|
||||
migrationBuilder.AddColumn<bool>(
|
||||
name: "IsEnabled",
|
||||
table: "PlaylistEntries",
|
||||
nullable: false,
|
||||
defaultValue: false);
|
||||
|
||||
migrationBuilder.AddColumn<string>(
|
||||
name: "NameOverride",
|
||||
table: "PlaylistEntries",
|
||||
nullable: true);
|
||||
|
||||
migrationBuilder.CreateIndex(
|
||||
name: "IX_PlaylistEntries_Name",
|
||||
table: "PlaylistEntries",
|
||||
column: "Name");
|
||||
|
||||
migrationBuilder.CreateIndex(
|
||||
name: "IX_PlaylistEntries_TrackNumber",
|
||||
table: "PlaylistEntries",
|
||||
column: "TrackNumber",
|
||||
unique: true);
|
||||
}
|
||||
|
||||
protected override void Down(MigrationBuilder migrationBuilder)
|
||||
{
|
||||
migrationBuilder.DropIndex(
|
||||
name: "IX_PlaylistEntries_Name",
|
||||
table: "PlaylistEntries");
|
||||
|
||||
migrationBuilder.DropIndex(
|
||||
name: "IX_PlaylistEntries_TrackNumber",
|
||||
table: "PlaylistEntries");
|
||||
|
||||
migrationBuilder.DropColumn(
|
||||
name: "IsAvailable",
|
||||
table: "PlaylistEntries");
|
||||
|
||||
migrationBuilder.DropColumn(
|
||||
name: "IsEnabled",
|
||||
table: "PlaylistEntries");
|
||||
|
||||
migrationBuilder.DropColumn(
|
||||
name: "NameOverride",
|
||||
table: "PlaylistEntries");
|
||||
|
||||
migrationBuilder.AddUniqueConstraint(
|
||||
name: "AK_PlaylistEntries_TrackNumber",
|
||||
table: "PlaylistEntries",
|
||||
column: "TrackNumber");
|
||||
}
|
||||
}
|
||||
}
|
@@ -21,15 +21,24 @@ namespace Tv7Playlist.Data.Migrations
|
||||
b.Property<Guid>("Id")
|
||||
.ValueGeneratedOnAdd();
|
||||
|
||||
b.Property<bool>("IsAvailable");
|
||||
|
||||
b.Property<bool>("IsEnabled");
|
||||
|
||||
b.Property<string>("Name");
|
||||
|
||||
b.Property<string>("NameOverride");
|
||||
|
||||
b.Property<int>("TrackNumber");
|
||||
|
||||
b.Property<string>("Url");
|
||||
|
||||
b.HasKey("Id");
|
||||
|
||||
b.HasAlternateKey("TrackNumber");
|
||||
b.HasIndex("Name");
|
||||
|
||||
b.HasIndex("TrackNumber")
|
||||
.IsUnique();
|
||||
|
||||
b.ToTable("PlaylistEntries");
|
||||
});
|
||||
|
@@ -17,7 +17,8 @@ namespace Tv7Playlist.Data
|
||||
|
||||
var entityTypeBuilder = modelBuilder.Entity<PlaylistEntry>();
|
||||
entityTypeBuilder.HasKey(e => e.Id);
|
||||
entityTypeBuilder.HasAlternateKey(e => e.TrackNumber);
|
||||
entityTypeBuilder.HasIndex(e => e.TrackNumber).IsUnique();
|
||||
entityTypeBuilder.HasIndex(e => e.Name);
|
||||
}
|
||||
}
|
||||
}
|
@@ -9,7 +9,13 @@ namespace Tv7Playlist.Data
|
||||
public int TrackNumber { get; set; }
|
||||
|
||||
public string Name { get; set; }
|
||||
|
||||
public string NameOverride { get; set; }
|
||||
|
||||
public string Url { get; set; }
|
||||
|
||||
public bool IsAvailable { get; set; }
|
||||
|
||||
public bool IsEnabled { get; set; }
|
||||
}
|
||||
}
|
Reference in New Issue
Block a user