Compare commits
2 Commits
ac2b6aba6e
...
56273c2e3f
| Author | SHA1 | Date | |
|---|---|---|---|
| 56273c2e3f | |||
| 0b74cf2daa |
35
.gitea/workflows/02_release.yml
Normal file
35
.gitea/workflows/02_release.yml
Normal file
@@ -0,0 +1,35 @@
|
|||||||
|
# Credit: https://gitea.com/gitea/runner-images/src/branch/main/.gitea/workflows/release.yaml
|
||||||
|
name: Release new version
|
||||||
|
run-name: Release ${{ github.ref_name }}
|
||||||
|
|
||||||
|
on:
|
||||||
|
push:
|
||||||
|
tags:
|
||||||
|
- "*"
|
||||||
|
|
||||||
|
jobs:
|
||||||
|
release:
|
||||||
|
runs-on: ubuntu-latest
|
||||||
|
container: docker.io/thegeeklab/git-sv:2.0.9
|
||||||
|
steps:
|
||||||
|
- name: Install tools
|
||||||
|
run: |
|
||||||
|
apk add -q --update --no-cache nodejs
|
||||||
|
- name: Checkout repository
|
||||||
|
uses: actions/checkout@v6
|
||||||
|
with:
|
||||||
|
fetch-tags: true
|
||||||
|
fetch-depth: 0
|
||||||
|
|
||||||
|
- name: Create changelog
|
||||||
|
run: |
|
||||||
|
git sv current-version
|
||||||
|
git sv release-notes -t ${GITHUB_REF#refs/tags/} -o CHANGELOG.md
|
||||||
|
sed -i '1,2d' CHANGELOG.md # remove version
|
||||||
|
cat CHANGELOG.md
|
||||||
|
|
||||||
|
- name: Release
|
||||||
|
uses: https://github.com/akkuman/gitea-release-action@v1
|
||||||
|
with:
|
||||||
|
body_path: CHANGELOG.md
|
||||||
|
token: "${{ secrets.REPO_RW_TOKEN }}"
|
||||||
@@ -34,4 +34,4 @@ jobs:
|
|||||||
curl -s -X POST "https://gitea.7o7.cx/api/v1/repos/sherl/Shadow/issues" -H "Authorization: token ${{ secrets.ISSUE_RW_TOKEN }}" -H "Content-Type: application/json" -d "$JSON_DATA" > /dev/null
|
curl -s -X POST "https://gitea.7o7.cx/api/v1/repos/sherl/Shadow/issues" -H "Authorization: token ${{ secrets.ISSUE_RW_TOKEN }}" -H "Content-Type: application/json" -d "$JSON_DATA" > /dev/null
|
||||||
else
|
else
|
||||||
curl -s -X PATCH "https://gitea.7o7.cx/api/v1/repos/sherl/Shadow/issues/$ISSUE_NUMBER" -H "Authorization: token ${{ secrets.ISSUE_RW_TOKEN }}" -H "Content-Type: application/json" -d "$JSON_DATA" > /dev/null
|
curl -s -X PATCH "https://gitea.7o7.cx/api/v1/repos/sherl/Shadow/issues/$ISSUE_NUMBER" -H "Authorization: token ${{ secrets.ISSUE_RW_TOKEN }}" -H "Content-Type: application/json" -d "$JSON_DATA" > /dev/null
|
||||||
fi
|
fi
|
||||||
|
|||||||
@@ -6,6 +6,7 @@ public class Playlist
|
|||||||
required public string Uri { get; set; }
|
required public string Uri { get; set; }
|
||||||
required public string Description { get; set; }
|
required public string Description { get; set; }
|
||||||
required public int CreatorId { get; set; } // UserId?
|
required public int CreatorId { get; set; } // UserId?
|
||||||
|
required public bool Private { get; set; } = true;
|
||||||
|
|
||||||
required public User Creator { get; set; }
|
required public User Creator { get; set; }
|
||||||
public List<PlaylistUser> AuthorizedPlaylistUsers { get; set; } = [];
|
public List<PlaylistUser> AuthorizedPlaylistUsers { get; set; } = [];
|
||||||
|
|||||||
31
Migrations/00000000000000_StoredProcedure.Designer.cs
generated
Normal file
31
Migrations/00000000000000_StoredProcedure.Designer.cs
generated
Normal file
@@ -0,0 +1,31 @@
|
|||||||
|
// <auto-generated />
|
||||||
|
using System;
|
||||||
|
using Microsoft.EntityFrameworkCore;
|
||||||
|
using Microsoft.EntityFrameworkCore.Infrastructure;
|
||||||
|
using Microsoft.EntityFrameworkCore.Migrations;
|
||||||
|
using Microsoft.EntityFrameworkCore.Storage.ValueConversion;
|
||||||
|
using Npgsql.EntityFrameworkCore.PostgreSQL.Metadata;
|
||||||
|
using Shadow.Data;
|
||||||
|
|
||||||
|
#nullable disable
|
||||||
|
|
||||||
|
namespace Shadow.Migrations
|
||||||
|
{
|
||||||
|
[DbContext(typeof(ApplicationDbContext))]
|
||||||
|
[Migration("00000000000000_StoredProcedure")]
|
||||||
|
partial class _00000000000000_StoredProcedure
|
||||||
|
{
|
||||||
|
/// <inheritdoc />
|
||||||
|
protected override void BuildTargetModel(ModelBuilder modelBuilder)
|
||||||
|
{
|
||||||
|
#pragma warning disable 612, 618
|
||||||
|
modelBuilder
|
||||||
|
.HasAnnotation("ProductVersion", "10.0.1")
|
||||||
|
.HasAnnotation("Relational:MaxIdentifierLength", 63);
|
||||||
|
|
||||||
|
NpgsqlModelBuilderExtensions.UseIdentityByDefaultColumns(modelBuilder);
|
||||||
|
|
||||||
|
#pragma warning restore 612, 618
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
32
Migrations/00000000000000_StoredProcedure.cs
Normal file
32
Migrations/00000000000000_StoredProcedure.cs
Normal file
@@ -0,0 +1,32 @@
|
|||||||
|
using System;
|
||||||
|
using Microsoft.EntityFrameworkCore.Migrations;
|
||||||
|
|
||||||
|
namespace Shadow.Migrations;
|
||||||
|
public partial class _00000000000000_StoredProcedure : Migration
|
||||||
|
{
|
||||||
|
protected override void Up(MigrationBuilder migrationBuilder)
|
||||||
|
{
|
||||||
|
migrationBuilder.Sql("""
|
||||||
|
|
||||||
|
CREATE OR REPLACE PROCEDURE song_cleanup()
|
||||||
|
LANGUAGE plpgsql
|
||||||
|
AS $$
|
||||||
|
BEGIN
|
||||||
|
DELETE FROM "Songs"
|
||||||
|
WHERE "State" = 0;
|
||||||
|
|
||||||
|
COMMIT;
|
||||||
|
END;
|
||||||
|
$$;
|
||||||
|
|
||||||
|
""");
|
||||||
|
}
|
||||||
|
|
||||||
|
protected override void Down(MigrationBuilder migrationBuilder)
|
||||||
|
{
|
||||||
|
migrationBuilder.Sql("""
|
||||||
|
DROP PROCEDURE IF EXISTS song_cleanup();
|
||||||
|
""");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
635
Migrations/20251216025633_InitialMigration.Designer.cs
generated
635
Migrations/20251216025633_InitialMigration.Designer.cs
generated
@@ -1,635 +0,0 @@
|
|||||||
// <auto-generated />
|
|
||||||
using System;
|
|
||||||
using Microsoft.EntityFrameworkCore;
|
|
||||||
using Microsoft.EntityFrameworkCore.Infrastructure;
|
|
||||||
using Microsoft.EntityFrameworkCore.Migrations;
|
|
||||||
using Microsoft.EntityFrameworkCore.Storage.ValueConversion;
|
|
||||||
using Npgsql.EntityFrameworkCore.PostgreSQL.Metadata;
|
|
||||||
using Shadow.Data;
|
|
||||||
|
|
||||||
#nullable disable
|
|
||||||
|
|
||||||
namespace Shadow.Migrations
|
|
||||||
{
|
|
||||||
[DbContext(typeof(ApplicationDbContext))]
|
|
||||||
[Migration("20251216025633_InitialMigration")]
|
|
||||||
partial class InitialMigration
|
|
||||||
{
|
|
||||||
/// <inheritdoc />
|
|
||||||
protected override void BuildTargetModel(ModelBuilder modelBuilder)
|
|
||||||
{
|
|
||||||
#pragma warning disable 612, 618
|
|
||||||
modelBuilder
|
|
||||||
.HasAnnotation("ProductVersion", "10.0.1")
|
|
||||||
.HasAnnotation("Relational:MaxIdentifierLength", 63);
|
|
||||||
|
|
||||||
NpgsqlModelBuilderExtensions.UseIdentityByDefaultColumns(modelBuilder);
|
|
||||||
|
|
||||||
modelBuilder.Entity("Shadow.Entities.Album", b =>
|
|
||||||
{
|
|
||||||
b.Property<int>("Id")
|
|
||||||
.ValueGeneratedOnAdd()
|
|
||||||
.HasColumnType("integer");
|
|
||||||
|
|
||||||
NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property<int>("Id"));
|
|
||||||
|
|
||||||
b.Property<int?>("ArtistId")
|
|
||||||
.HasColumnType("integer");
|
|
||||||
|
|
||||||
b.Property<string>("Name")
|
|
||||||
.IsRequired()
|
|
||||||
.HasColumnType("text");
|
|
||||||
|
|
||||||
b.Property<int>("State")
|
|
||||||
.HasColumnType("integer");
|
|
||||||
|
|
||||||
b.Property<string>("Uri")
|
|
||||||
.IsRequired()
|
|
||||||
.HasColumnType("text");
|
|
||||||
|
|
||||||
b.HasKey("Id");
|
|
||||||
|
|
||||||
b.HasIndex("ArtistId");
|
|
||||||
|
|
||||||
b.HasIndex("Uri")
|
|
||||||
.IsUnique();
|
|
||||||
|
|
||||||
b.ToTable("Albums");
|
|
||||||
});
|
|
||||||
|
|
||||||
modelBuilder.Entity("Shadow.Entities.AlbumInteraction", b =>
|
|
||||||
{
|
|
||||||
b.Property<int>("AlbumId")
|
|
||||||
.HasColumnType("integer");
|
|
||||||
|
|
||||||
b.Property<int>("UserId")
|
|
||||||
.HasColumnType("integer");
|
|
||||||
|
|
||||||
b.Property<int>("Id")
|
|
||||||
.HasColumnType("integer");
|
|
||||||
|
|
||||||
b.Property<DateTime?>("PlayDate")
|
|
||||||
.HasColumnType("timestamp with time zone");
|
|
||||||
|
|
||||||
b.Property<bool>("Starred")
|
|
||||||
.HasColumnType("boolean");
|
|
||||||
|
|
||||||
b.HasKey("AlbumId", "UserId");
|
|
||||||
|
|
||||||
b.HasIndex("UserId");
|
|
||||||
|
|
||||||
b.ToTable("AlbumInteractions");
|
|
||||||
});
|
|
||||||
|
|
||||||
modelBuilder.Entity("Shadow.Entities.Artist", b =>
|
|
||||||
{
|
|
||||||
b.Property<int>("Id")
|
|
||||||
.ValueGeneratedOnAdd()
|
|
||||||
.HasColumnType("integer");
|
|
||||||
|
|
||||||
NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property<int>("Id"));
|
|
||||||
|
|
||||||
b.Property<string>("Name")
|
|
||||||
.IsRequired()
|
|
||||||
.HasColumnType("text");
|
|
||||||
|
|
||||||
b.Property<string>("NormalizedName")
|
|
||||||
.IsRequired()
|
|
||||||
.HasColumnType("text");
|
|
||||||
|
|
||||||
b.HasKey("Id");
|
|
||||||
|
|
||||||
b.HasIndex("NormalizedName")
|
|
||||||
.IsUnique();
|
|
||||||
|
|
||||||
b.ToTable("Artists");
|
|
||||||
});
|
|
||||||
|
|
||||||
modelBuilder.Entity("Shadow.Entities.Genre", b =>
|
|
||||||
{
|
|
||||||
b.Property<int>("Id")
|
|
||||||
.ValueGeneratedOnAdd()
|
|
||||||
.HasColumnType("integer");
|
|
||||||
|
|
||||||
NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property<int>("Id"));
|
|
||||||
|
|
||||||
b.Property<string>("Name")
|
|
||||||
.IsRequired()
|
|
||||||
.HasColumnType("text");
|
|
||||||
|
|
||||||
b.Property<string>("NormalizedName")
|
|
||||||
.IsRequired()
|
|
||||||
.HasColumnType("text");
|
|
||||||
|
|
||||||
b.HasKey("Id");
|
|
||||||
|
|
||||||
b.HasIndex("NormalizedName")
|
|
||||||
.IsUnique();
|
|
||||||
|
|
||||||
b.ToTable("Genres");
|
|
||||||
});
|
|
||||||
|
|
||||||
modelBuilder.Entity("Shadow.Entities.GenreSong", b =>
|
|
||||||
{
|
|
||||||
b.Property<int>("GenreId")
|
|
||||||
.HasColumnType("integer");
|
|
||||||
|
|
||||||
b.Property<int>("SongId")
|
|
||||||
.HasColumnType("integer");
|
|
||||||
|
|
||||||
b.HasKey("GenreId", "SongId");
|
|
||||||
|
|
||||||
b.HasIndex("SongId");
|
|
||||||
|
|
||||||
b.ToTable("GenreSongs");
|
|
||||||
});
|
|
||||||
|
|
||||||
modelBuilder.Entity("Shadow.Entities.Global", b =>
|
|
||||||
{
|
|
||||||
b.Property<int>("Id")
|
|
||||||
.ValueGeneratedOnAdd()
|
|
||||||
.HasColumnType("integer");
|
|
||||||
|
|
||||||
NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property<int>("Id"));
|
|
||||||
|
|
||||||
b.Property<string>("Key")
|
|
||||||
.IsRequired()
|
|
||||||
.HasColumnType("text");
|
|
||||||
|
|
||||||
b.Property<string>("Value")
|
|
||||||
.HasColumnType("text");
|
|
||||||
|
|
||||||
b.HasKey("Id");
|
|
||||||
|
|
||||||
b.HasIndex("Key")
|
|
||||||
.IsUnique();
|
|
||||||
|
|
||||||
b.ToTable("Globals");
|
|
||||||
});
|
|
||||||
|
|
||||||
modelBuilder.Entity("Shadow.Entities.Image", b =>
|
|
||||||
{
|
|
||||||
b.Property<int>("Id")
|
|
||||||
.ValueGeneratedOnAdd()
|
|
||||||
.HasColumnType("integer");
|
|
||||||
|
|
||||||
NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property<int>("Id"));
|
|
||||||
|
|
||||||
b.Property<string>("Filetype")
|
|
||||||
.IsRequired()
|
|
||||||
.HasColumnType("text");
|
|
||||||
|
|
||||||
b.Property<int?>("SongId")
|
|
||||||
.HasColumnType("integer");
|
|
||||||
|
|
||||||
b.Property<int>("State")
|
|
||||||
.HasColumnType("integer");
|
|
||||||
|
|
||||||
b.Property<string>("Uri")
|
|
||||||
.IsRequired()
|
|
||||||
.HasColumnType("text");
|
|
||||||
|
|
||||||
b.HasKey("Id");
|
|
||||||
|
|
||||||
b.HasIndex("SongId")
|
|
||||||
.IsUnique();
|
|
||||||
|
|
||||||
b.ToTable("Images");
|
|
||||||
});
|
|
||||||
|
|
||||||
modelBuilder.Entity("Shadow.Entities.Playlist", b =>
|
|
||||||
{
|
|
||||||
b.Property<int>("Id")
|
|
||||||
.ValueGeneratedOnAdd()
|
|
||||||
.HasColumnType("integer");
|
|
||||||
|
|
||||||
NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property<int>("Id"));
|
|
||||||
|
|
||||||
b.Property<int>("CreatorId")
|
|
||||||
.HasColumnType("integer");
|
|
||||||
|
|
||||||
b.Property<string>("Description")
|
|
||||||
.IsRequired()
|
|
||||||
.HasColumnType("text");
|
|
||||||
|
|
||||||
b.Property<string>("Name")
|
|
||||||
.IsRequired()
|
|
||||||
.HasColumnType("text");
|
|
||||||
|
|
||||||
b.Property<string>("Uri")
|
|
||||||
.IsRequired()
|
|
||||||
.HasColumnType("text");
|
|
||||||
|
|
||||||
b.HasKey("Id");
|
|
||||||
|
|
||||||
b.HasIndex("CreatorId");
|
|
||||||
|
|
||||||
b.HasIndex("Uri")
|
|
||||||
.IsUnique();
|
|
||||||
|
|
||||||
b.ToTable("Playlists");
|
|
||||||
});
|
|
||||||
|
|
||||||
modelBuilder.Entity("Shadow.Entities.PlaylistSong", b =>
|
|
||||||
{
|
|
||||||
b.Property<int>("PlaylistId")
|
|
||||||
.HasColumnType("integer");
|
|
||||||
|
|
||||||
b.Property<int>("SongId")
|
|
||||||
.HasColumnType("integer");
|
|
||||||
|
|
||||||
b.Property<int>("Index")
|
|
||||||
.HasColumnType("integer");
|
|
||||||
|
|
||||||
b.HasKey("PlaylistId", "SongId");
|
|
||||||
|
|
||||||
b.HasIndex("SongId");
|
|
||||||
|
|
||||||
b.ToTable("PlaylistSongs");
|
|
||||||
});
|
|
||||||
|
|
||||||
modelBuilder.Entity("Shadow.Entities.PlaylistUser", b =>
|
|
||||||
{
|
|
||||||
b.Property<int>("PlaylistId")
|
|
||||||
.HasColumnType("integer");
|
|
||||||
|
|
||||||
b.Property<int>("UserId")
|
|
||||||
.HasColumnType("integer");
|
|
||||||
|
|
||||||
b.HasKey("PlaylistId", "UserId");
|
|
||||||
|
|
||||||
b.HasIndex("UserId");
|
|
||||||
|
|
||||||
b.ToTable("PlaylistUsers");
|
|
||||||
});
|
|
||||||
|
|
||||||
modelBuilder.Entity("Shadow.Entities.Radio", b =>
|
|
||||||
{
|
|
||||||
b.Property<int>("Id")
|
|
||||||
.ValueGeneratedOnAdd()
|
|
||||||
.HasColumnType("integer");
|
|
||||||
|
|
||||||
NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property<int>("Id"));
|
|
||||||
|
|
||||||
b.Property<string>("Homepage")
|
|
||||||
.HasColumnType("text");
|
|
||||||
|
|
||||||
b.Property<string>("Name")
|
|
||||||
.IsRequired()
|
|
||||||
.HasColumnType("text");
|
|
||||||
|
|
||||||
b.Property<string>("NormalizedName")
|
|
||||||
.IsRequired()
|
|
||||||
.HasColumnType("text");
|
|
||||||
|
|
||||||
b.Property<string>("Url")
|
|
||||||
.IsRequired()
|
|
||||||
.HasColumnType("text");
|
|
||||||
|
|
||||||
b.Property<int>("UserId")
|
|
||||||
.HasColumnType("integer");
|
|
||||||
|
|
||||||
b.HasKey("Id");
|
|
||||||
|
|
||||||
b.HasIndex("NormalizedName")
|
|
||||||
.IsUnique();
|
|
||||||
|
|
||||||
b.HasIndex("UserId");
|
|
||||||
|
|
||||||
b.ToTable("Radios");
|
|
||||||
});
|
|
||||||
|
|
||||||
modelBuilder.Entity("Shadow.Entities.Song", b =>
|
|
||||||
{
|
|
||||||
b.Property<int>("Id")
|
|
||||||
.ValueGeneratedOnAdd()
|
|
||||||
.HasColumnType("integer");
|
|
||||||
|
|
||||||
NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property<int>("Id"));
|
|
||||||
|
|
||||||
b.Property<int>("AlbumId")
|
|
||||||
.HasColumnType("integer");
|
|
||||||
|
|
||||||
b.Property<int>("ArtistId")
|
|
||||||
.HasColumnType("integer");
|
|
||||||
|
|
||||||
b.Property<int?>("BitDepth")
|
|
||||||
.HasColumnType("integer");
|
|
||||||
|
|
||||||
b.Property<int>("Bitrate")
|
|
||||||
.HasColumnType("integer");
|
|
||||||
|
|
||||||
b.Property<int>("Channels")
|
|
||||||
.HasColumnType("integer");
|
|
||||||
|
|
||||||
b.Property<string>("Comment")
|
|
||||||
.HasColumnType("text");
|
|
||||||
|
|
||||||
b.Property<DateTime>("Date")
|
|
||||||
.HasColumnType("timestamp with time zone");
|
|
||||||
|
|
||||||
b.Property<int?>("DiscNumber")
|
|
||||||
.HasColumnType("integer");
|
|
||||||
|
|
||||||
b.Property<int>("Duration")
|
|
||||||
.HasColumnType("integer");
|
|
||||||
|
|
||||||
b.Property<string>("Filepath")
|
|
||||||
.IsRequired()
|
|
||||||
.HasColumnType("text");
|
|
||||||
|
|
||||||
b.Property<string>("Filetype")
|
|
||||||
.IsRequired()
|
|
||||||
.HasColumnType("text");
|
|
||||||
|
|
||||||
b.Property<int?>("ImageId")
|
|
||||||
.HasColumnType("integer");
|
|
||||||
|
|
||||||
b.Property<int>("Index")
|
|
||||||
.HasColumnType("integer");
|
|
||||||
|
|
||||||
b.Property<int>("SamplingRate")
|
|
||||||
.HasColumnType("integer");
|
|
||||||
|
|
||||||
b.Property<int>("Size")
|
|
||||||
.HasColumnType("integer");
|
|
||||||
|
|
||||||
b.Property<int>("State")
|
|
||||||
.HasColumnType("integer");
|
|
||||||
|
|
||||||
b.Property<string>("Title")
|
|
||||||
.IsRequired()
|
|
||||||
.HasColumnType("text");
|
|
||||||
|
|
||||||
b.Property<int?>("TrackNumber")
|
|
||||||
.HasColumnType("integer");
|
|
||||||
|
|
||||||
b.Property<string>("Uri")
|
|
||||||
.IsRequired()
|
|
||||||
.HasColumnType("text");
|
|
||||||
|
|
||||||
b.HasKey("Id");
|
|
||||||
|
|
||||||
b.HasIndex("AlbumId");
|
|
||||||
|
|
||||||
b.HasIndex("ArtistId");
|
|
||||||
|
|
||||||
b.HasIndex("Uri")
|
|
||||||
.IsUnique();
|
|
||||||
|
|
||||||
b.ToTable("Songs");
|
|
||||||
});
|
|
||||||
|
|
||||||
modelBuilder.Entity("Shadow.Entities.SongInteraction", b =>
|
|
||||||
{
|
|
||||||
b.Property<int>("SongId")
|
|
||||||
.HasColumnType("integer");
|
|
||||||
|
|
||||||
b.Property<int>("UserId")
|
|
||||||
.HasColumnType("integer");
|
|
||||||
|
|
||||||
b.Property<int>("Id")
|
|
||||||
.HasColumnType("integer");
|
|
||||||
|
|
||||||
b.Property<int>("PlayCount")
|
|
||||||
.HasColumnType("integer");
|
|
||||||
|
|
||||||
b.Property<int>("Rating")
|
|
||||||
.HasColumnType("integer");
|
|
||||||
|
|
||||||
b.Property<bool?>("Starred")
|
|
||||||
.HasColumnType("boolean");
|
|
||||||
|
|
||||||
b.HasKey("SongId", "UserId");
|
|
||||||
|
|
||||||
b.HasIndex("UserId");
|
|
||||||
|
|
||||||
b.ToTable("SongInteractions");
|
|
||||||
});
|
|
||||||
|
|
||||||
modelBuilder.Entity("Shadow.Entities.User", b =>
|
|
||||||
{
|
|
||||||
b.Property<int>("Id")
|
|
||||||
.ValueGeneratedOnAdd()
|
|
||||||
.HasColumnType("integer");
|
|
||||||
|
|
||||||
NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property<int>("Id"));
|
|
||||||
|
|
||||||
b.Property<string>("Name")
|
|
||||||
.IsRequired()
|
|
||||||
.HasColumnType("text");
|
|
||||||
|
|
||||||
b.Property<string>("NormalizedName")
|
|
||||||
.IsRequired()
|
|
||||||
.HasColumnType("text");
|
|
||||||
|
|
||||||
b.Property<string>("Password")
|
|
||||||
.IsRequired()
|
|
||||||
.HasColumnType("text");
|
|
||||||
|
|
||||||
b.Property<int>("Role")
|
|
||||||
.HasColumnType("integer");
|
|
||||||
|
|
||||||
b.HasKey("Id");
|
|
||||||
|
|
||||||
b.HasIndex("Name")
|
|
||||||
.IsUnique();
|
|
||||||
|
|
||||||
b.ToTable("Users");
|
|
||||||
});
|
|
||||||
|
|
||||||
modelBuilder.Entity("Shadow.Entities.Album", b =>
|
|
||||||
{
|
|
||||||
b.HasOne("Shadow.Entities.Artist", "Artist")
|
|
||||||
.WithMany("Albums")
|
|
||||||
.HasForeignKey("ArtistId");
|
|
||||||
|
|
||||||
b.Navigation("Artist");
|
|
||||||
});
|
|
||||||
|
|
||||||
modelBuilder.Entity("Shadow.Entities.AlbumInteraction", b =>
|
|
||||||
{
|
|
||||||
b.HasOne("Shadow.Entities.Album", "Album")
|
|
||||||
.WithMany()
|
|
||||||
.HasForeignKey("AlbumId")
|
|
||||||
.OnDelete(DeleteBehavior.Cascade)
|
|
||||||
.IsRequired();
|
|
||||||
|
|
||||||
b.HasOne("Shadow.Entities.User", "User")
|
|
||||||
.WithMany("AlbumInteractions")
|
|
||||||
.HasForeignKey("UserId")
|
|
||||||
.OnDelete(DeleteBehavior.Cascade)
|
|
||||||
.IsRequired();
|
|
||||||
|
|
||||||
b.Navigation("Album");
|
|
||||||
|
|
||||||
b.Navigation("User");
|
|
||||||
});
|
|
||||||
|
|
||||||
modelBuilder.Entity("Shadow.Entities.GenreSong", b =>
|
|
||||||
{
|
|
||||||
b.HasOne("Shadow.Entities.Genre", "Genre")
|
|
||||||
.WithMany("GenreSongPair")
|
|
||||||
.HasForeignKey("GenreId")
|
|
||||||
.OnDelete(DeleteBehavior.Cascade)
|
|
||||||
.IsRequired();
|
|
||||||
|
|
||||||
b.HasOne("Shadow.Entities.Song", "Song")
|
|
||||||
.WithMany("GenreSongPair")
|
|
||||||
.HasForeignKey("SongId")
|
|
||||||
.OnDelete(DeleteBehavior.Cascade)
|
|
||||||
.IsRequired();
|
|
||||||
|
|
||||||
b.Navigation("Genre");
|
|
||||||
|
|
||||||
b.Navigation("Song");
|
|
||||||
});
|
|
||||||
|
|
||||||
modelBuilder.Entity("Shadow.Entities.Image", b =>
|
|
||||||
{
|
|
||||||
b.HasOne("Shadow.Entities.Song", "Song")
|
|
||||||
.WithOne("Image")
|
|
||||||
.HasForeignKey("Shadow.Entities.Image", "SongId");
|
|
||||||
|
|
||||||
b.Navigation("Song");
|
|
||||||
});
|
|
||||||
|
|
||||||
modelBuilder.Entity("Shadow.Entities.Playlist", b =>
|
|
||||||
{
|
|
||||||
b.HasOne("Shadow.Entities.User", "Creator")
|
|
||||||
.WithMany("Playlists")
|
|
||||||
.HasForeignKey("CreatorId")
|
|
||||||
.OnDelete(DeleteBehavior.Cascade)
|
|
||||||
.IsRequired();
|
|
||||||
|
|
||||||
b.Navigation("Creator");
|
|
||||||
});
|
|
||||||
|
|
||||||
modelBuilder.Entity("Shadow.Entities.PlaylistSong", b =>
|
|
||||||
{
|
|
||||||
b.HasOne("Shadow.Entities.Playlist", "Playlist")
|
|
||||||
.WithMany()
|
|
||||||
.HasForeignKey("PlaylistId")
|
|
||||||
.OnDelete(DeleteBehavior.Cascade)
|
|
||||||
.IsRequired();
|
|
||||||
|
|
||||||
b.HasOne("Shadow.Entities.Song", "Song")
|
|
||||||
.WithMany()
|
|
||||||
.HasForeignKey("SongId")
|
|
||||||
.OnDelete(DeleteBehavior.Cascade)
|
|
||||||
.IsRequired();
|
|
||||||
|
|
||||||
b.Navigation("Playlist");
|
|
||||||
|
|
||||||
b.Navigation("Song");
|
|
||||||
});
|
|
||||||
|
|
||||||
modelBuilder.Entity("Shadow.Entities.PlaylistUser", b =>
|
|
||||||
{
|
|
||||||
b.HasOne("Shadow.Entities.Playlist", "Playlist")
|
|
||||||
.WithMany("AuthorizedPlaylistUsers")
|
|
||||||
.HasForeignKey("PlaylistId")
|
|
||||||
.OnDelete(DeleteBehavior.Cascade)
|
|
||||||
.IsRequired();
|
|
||||||
|
|
||||||
b.HasOne("Shadow.Entities.User", "User")
|
|
||||||
.WithMany()
|
|
||||||
.HasForeignKey("UserId")
|
|
||||||
.OnDelete(DeleteBehavior.Cascade)
|
|
||||||
.IsRequired();
|
|
||||||
|
|
||||||
b.Navigation("Playlist");
|
|
||||||
|
|
||||||
b.Navigation("User");
|
|
||||||
});
|
|
||||||
|
|
||||||
modelBuilder.Entity("Shadow.Entities.Radio", b =>
|
|
||||||
{
|
|
||||||
b.HasOne("Shadow.Entities.User", "User")
|
|
||||||
.WithMany()
|
|
||||||
.HasForeignKey("UserId")
|
|
||||||
.OnDelete(DeleteBehavior.Cascade)
|
|
||||||
.IsRequired();
|
|
||||||
|
|
||||||
b.Navigation("User");
|
|
||||||
});
|
|
||||||
|
|
||||||
modelBuilder.Entity("Shadow.Entities.Song", b =>
|
|
||||||
{
|
|
||||||
b.HasOne("Shadow.Entities.Album", "Album")
|
|
||||||
.WithMany("Songs")
|
|
||||||
.HasForeignKey("AlbumId")
|
|
||||||
.OnDelete(DeleteBehavior.Cascade)
|
|
||||||
.IsRequired();
|
|
||||||
|
|
||||||
b.HasOne("Shadow.Entities.Artist", "Artist")
|
|
||||||
.WithMany("Songs")
|
|
||||||
.HasForeignKey("ArtistId")
|
|
||||||
.OnDelete(DeleteBehavior.Cascade)
|
|
||||||
.IsRequired();
|
|
||||||
|
|
||||||
b.Navigation("Album");
|
|
||||||
|
|
||||||
b.Navigation("Artist");
|
|
||||||
});
|
|
||||||
|
|
||||||
modelBuilder.Entity("Shadow.Entities.SongInteraction", b =>
|
|
||||||
{
|
|
||||||
b.HasOne("Shadow.Entities.Song", "Song")
|
|
||||||
.WithMany()
|
|
||||||
.HasForeignKey("SongId")
|
|
||||||
.OnDelete(DeleteBehavior.Cascade)
|
|
||||||
.IsRequired();
|
|
||||||
|
|
||||||
b.HasOne("Shadow.Entities.User", "User")
|
|
||||||
.WithMany("SongInteractions")
|
|
||||||
.HasForeignKey("UserId")
|
|
||||||
.OnDelete(DeleteBehavior.Cascade)
|
|
||||||
.IsRequired();
|
|
||||||
|
|
||||||
b.Navigation("Song");
|
|
||||||
|
|
||||||
b.Navigation("User");
|
|
||||||
});
|
|
||||||
|
|
||||||
modelBuilder.Entity("Shadow.Entities.Album", b =>
|
|
||||||
{
|
|
||||||
b.Navigation("Songs");
|
|
||||||
});
|
|
||||||
|
|
||||||
modelBuilder.Entity("Shadow.Entities.Artist", b =>
|
|
||||||
{
|
|
||||||
b.Navigation("Albums");
|
|
||||||
|
|
||||||
b.Navigation("Songs");
|
|
||||||
});
|
|
||||||
|
|
||||||
modelBuilder.Entity("Shadow.Entities.Genre", b =>
|
|
||||||
{
|
|
||||||
b.Navigation("GenreSongPair");
|
|
||||||
});
|
|
||||||
|
|
||||||
modelBuilder.Entity("Shadow.Entities.Playlist", b =>
|
|
||||||
{
|
|
||||||
b.Navigation("AuthorizedPlaylistUsers");
|
|
||||||
});
|
|
||||||
|
|
||||||
modelBuilder.Entity("Shadow.Entities.Song", b =>
|
|
||||||
{
|
|
||||||
b.Navigation("GenreSongPair");
|
|
||||||
|
|
||||||
b.Navigation("Image");
|
|
||||||
});
|
|
||||||
|
|
||||||
modelBuilder.Entity("Shadow.Entities.User", b =>
|
|
||||||
{
|
|
||||||
b.Navigation("AlbumInteractions");
|
|
||||||
|
|
||||||
b.Navigation("Playlists");
|
|
||||||
|
|
||||||
b.Navigation("SongInteractions");
|
|
||||||
});
|
|
||||||
#pragma warning restore 612, 618
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
@@ -1,482 +0,0 @@
|
|||||||
using System;
|
|
||||||
using Microsoft.EntityFrameworkCore.Migrations;
|
|
||||||
using Npgsql.EntityFrameworkCore.PostgreSQL.Metadata;
|
|
||||||
|
|
||||||
#nullable disable
|
|
||||||
|
|
||||||
namespace Shadow.Migrations
|
|
||||||
{
|
|
||||||
/// <inheritdoc />
|
|
||||||
public partial class InitialMigration : Migration
|
|
||||||
{
|
|
||||||
/// <inheritdoc />
|
|
||||||
protected override void Up(MigrationBuilder migrationBuilder)
|
|
||||||
{
|
|
||||||
migrationBuilder.CreateTable(
|
|
||||||
name: "Artists",
|
|
||||||
columns: table => new
|
|
||||||
{
|
|
||||||
Id = table.Column<int>(type: "integer", nullable: false)
|
|
||||||
.Annotation("Npgsql:ValueGenerationStrategy", NpgsqlValueGenerationStrategy.IdentityByDefaultColumn),
|
|
||||||
Name = table.Column<string>(type: "text", nullable: false),
|
|
||||||
NormalizedName = table.Column<string>(type: "text", nullable: false)
|
|
||||||
},
|
|
||||||
constraints: table =>
|
|
||||||
{
|
|
||||||
table.PrimaryKey("PK_Artists", x => x.Id);
|
|
||||||
});
|
|
||||||
|
|
||||||
migrationBuilder.CreateTable(
|
|
||||||
name: "Genres",
|
|
||||||
columns: table => new
|
|
||||||
{
|
|
||||||
Id = table.Column<int>(type: "integer", nullable: false)
|
|
||||||
.Annotation("Npgsql:ValueGenerationStrategy", NpgsqlValueGenerationStrategy.IdentityByDefaultColumn),
|
|
||||||
Name = table.Column<string>(type: "text", nullable: false),
|
|
||||||
NormalizedName = table.Column<string>(type: "text", nullable: false)
|
|
||||||
},
|
|
||||||
constraints: table =>
|
|
||||||
{
|
|
||||||
table.PrimaryKey("PK_Genres", x => x.Id);
|
|
||||||
});
|
|
||||||
|
|
||||||
migrationBuilder.CreateTable(
|
|
||||||
name: "Globals",
|
|
||||||
columns: table => new
|
|
||||||
{
|
|
||||||
Id = table.Column<int>(type: "integer", nullable: false)
|
|
||||||
.Annotation("Npgsql:ValueGenerationStrategy", NpgsqlValueGenerationStrategy.IdentityByDefaultColumn),
|
|
||||||
Key = table.Column<string>(type: "text", nullable: false),
|
|
||||||
Value = table.Column<string>(type: "text", nullable: true)
|
|
||||||
},
|
|
||||||
constraints: table =>
|
|
||||||
{
|
|
||||||
table.PrimaryKey("PK_Globals", x => x.Id);
|
|
||||||
});
|
|
||||||
|
|
||||||
migrationBuilder.CreateTable(
|
|
||||||
name: "Users",
|
|
||||||
columns: table => new
|
|
||||||
{
|
|
||||||
Id = table.Column<int>(type: "integer", nullable: false)
|
|
||||||
.Annotation("Npgsql:ValueGenerationStrategy", NpgsqlValueGenerationStrategy.IdentityByDefaultColumn),
|
|
||||||
Name = table.Column<string>(type: "text", nullable: false),
|
|
||||||
NormalizedName = table.Column<string>(type: "text", nullable: false),
|
|
||||||
Password = table.Column<string>(type: "text", nullable: false),
|
|
||||||
Role = table.Column<int>(type: "integer", nullable: false)
|
|
||||||
},
|
|
||||||
constraints: table =>
|
|
||||||
{
|
|
||||||
table.PrimaryKey("PK_Users", x => x.Id);
|
|
||||||
});
|
|
||||||
|
|
||||||
migrationBuilder.CreateTable(
|
|
||||||
name: "Albums",
|
|
||||||
columns: table => new
|
|
||||||
{
|
|
||||||
Id = table.Column<int>(type: "integer", nullable: false)
|
|
||||||
.Annotation("Npgsql:ValueGenerationStrategy", NpgsqlValueGenerationStrategy.IdentityByDefaultColumn),
|
|
||||||
Name = table.Column<string>(type: "text", nullable: false),
|
|
||||||
Uri = table.Column<string>(type: "text", nullable: false),
|
|
||||||
State = table.Column<int>(type: "integer", nullable: false),
|
|
||||||
ArtistId = table.Column<int>(type: "integer", nullable: true)
|
|
||||||
},
|
|
||||||
constraints: table =>
|
|
||||||
{
|
|
||||||
table.PrimaryKey("PK_Albums", x => x.Id);
|
|
||||||
table.ForeignKey(
|
|
||||||
name: "FK_Albums_Artists_ArtistId",
|
|
||||||
column: x => x.ArtistId,
|
|
||||||
principalTable: "Artists",
|
|
||||||
principalColumn: "Id");
|
|
||||||
});
|
|
||||||
|
|
||||||
migrationBuilder.CreateTable(
|
|
||||||
name: "Playlists",
|
|
||||||
columns: table => new
|
|
||||||
{
|
|
||||||
Id = table.Column<int>(type: "integer", nullable: false)
|
|
||||||
.Annotation("Npgsql:ValueGenerationStrategy", NpgsqlValueGenerationStrategy.IdentityByDefaultColumn),
|
|
||||||
Name = table.Column<string>(type: "text", nullable: false),
|
|
||||||
Uri = table.Column<string>(type: "text", nullable: false),
|
|
||||||
Description = table.Column<string>(type: "text", nullable: false),
|
|
||||||
CreatorId = table.Column<int>(type: "integer", nullable: false)
|
|
||||||
},
|
|
||||||
constraints: table =>
|
|
||||||
{
|
|
||||||
table.PrimaryKey("PK_Playlists", x => x.Id);
|
|
||||||
table.ForeignKey(
|
|
||||||
name: "FK_Playlists_Users_CreatorId",
|
|
||||||
column: x => x.CreatorId,
|
|
||||||
principalTable: "Users",
|
|
||||||
principalColumn: "Id",
|
|
||||||
onDelete: ReferentialAction.Cascade);
|
|
||||||
});
|
|
||||||
|
|
||||||
migrationBuilder.CreateTable(
|
|
||||||
name: "Radios",
|
|
||||||
columns: table => new
|
|
||||||
{
|
|
||||||
Id = table.Column<int>(type: "integer", nullable: false)
|
|
||||||
.Annotation("Npgsql:ValueGenerationStrategy", NpgsqlValueGenerationStrategy.IdentityByDefaultColumn),
|
|
||||||
Name = table.Column<string>(type: "text", nullable: false),
|
|
||||||
NormalizedName = table.Column<string>(type: "text", nullable: false),
|
|
||||||
Homepage = table.Column<string>(type: "text", nullable: true),
|
|
||||||
Url = table.Column<string>(type: "text", nullable: false),
|
|
||||||
UserId = table.Column<int>(type: "integer", nullable: false)
|
|
||||||
},
|
|
||||||
constraints: table =>
|
|
||||||
{
|
|
||||||
table.PrimaryKey("PK_Radios", x => x.Id);
|
|
||||||
table.ForeignKey(
|
|
||||||
name: "FK_Radios_Users_UserId",
|
|
||||||
column: x => x.UserId,
|
|
||||||
principalTable: "Users",
|
|
||||||
principalColumn: "Id",
|
|
||||||
onDelete: ReferentialAction.Cascade);
|
|
||||||
});
|
|
||||||
|
|
||||||
migrationBuilder.CreateTable(
|
|
||||||
name: "AlbumInteractions",
|
|
||||||
columns: table => new
|
|
||||||
{
|
|
||||||
AlbumId = table.Column<int>(type: "integer", nullable: false),
|
|
||||||
UserId = table.Column<int>(type: "integer", nullable: false),
|
|
||||||
Id = table.Column<int>(type: "integer", nullable: false),
|
|
||||||
PlayDate = table.Column<DateTime>(type: "timestamp with time zone", nullable: true),
|
|
||||||
Starred = table.Column<bool>(type: "boolean", nullable: false)
|
|
||||||
},
|
|
||||||
constraints: table =>
|
|
||||||
{
|
|
||||||
table.PrimaryKey("PK_AlbumInteractions", x => new { x.AlbumId, x.UserId });
|
|
||||||
table.ForeignKey(
|
|
||||||
name: "FK_AlbumInteractions_Albums_AlbumId",
|
|
||||||
column: x => x.AlbumId,
|
|
||||||
principalTable: "Albums",
|
|
||||||
principalColumn: "Id",
|
|
||||||
onDelete: ReferentialAction.Cascade);
|
|
||||||
table.ForeignKey(
|
|
||||||
name: "FK_AlbumInteractions_Users_UserId",
|
|
||||||
column: x => x.UserId,
|
|
||||||
principalTable: "Users",
|
|
||||||
principalColumn: "Id",
|
|
||||||
onDelete: ReferentialAction.Cascade);
|
|
||||||
});
|
|
||||||
|
|
||||||
migrationBuilder.CreateTable(
|
|
||||||
name: "Songs",
|
|
||||||
columns: table => new
|
|
||||||
{
|
|
||||||
Id = table.Column<int>(type: "integer", nullable: false)
|
|
||||||
.Annotation("Npgsql:ValueGenerationStrategy", NpgsqlValueGenerationStrategy.IdentityByDefaultColumn),
|
|
||||||
Title = table.Column<string>(type: "text", nullable: false),
|
|
||||||
Uri = table.Column<string>(type: "text", nullable: false),
|
|
||||||
Filepath = table.Column<string>(type: "text", nullable: false),
|
|
||||||
State = table.Column<int>(type: "integer", nullable: false),
|
|
||||||
Filetype = table.Column<string>(type: "text", nullable: false),
|
|
||||||
Date = table.Column<DateTime>(type: "timestamp with time zone", nullable: false),
|
|
||||||
Duration = table.Column<int>(type: "integer", nullable: false),
|
|
||||||
Bitrate = table.Column<int>(type: "integer", nullable: false),
|
|
||||||
Size = table.Column<int>(type: "integer", nullable: false),
|
|
||||||
Comment = table.Column<string>(type: "text", nullable: true),
|
|
||||||
Channels = table.Column<int>(type: "integer", nullable: false),
|
|
||||||
SamplingRate = table.Column<int>(type: "integer", nullable: false),
|
|
||||||
BitDepth = table.Column<int>(type: "integer", nullable: true),
|
|
||||||
Index = table.Column<int>(type: "integer", nullable: false),
|
|
||||||
TrackNumber = table.Column<int>(type: "integer", nullable: true),
|
|
||||||
DiscNumber = table.Column<int>(type: "integer", nullable: true),
|
|
||||||
AlbumId = table.Column<int>(type: "integer", nullable: false),
|
|
||||||
ArtistId = table.Column<int>(type: "integer", nullable: false),
|
|
||||||
ImageId = table.Column<int>(type: "integer", nullable: true)
|
|
||||||
},
|
|
||||||
constraints: table =>
|
|
||||||
{
|
|
||||||
table.PrimaryKey("PK_Songs", x => x.Id);
|
|
||||||
table.ForeignKey(
|
|
||||||
name: "FK_Songs_Albums_AlbumId",
|
|
||||||
column: x => x.AlbumId,
|
|
||||||
principalTable: "Albums",
|
|
||||||
principalColumn: "Id",
|
|
||||||
onDelete: ReferentialAction.Cascade);
|
|
||||||
table.ForeignKey(
|
|
||||||
name: "FK_Songs_Artists_ArtistId",
|
|
||||||
column: x => x.ArtistId,
|
|
||||||
principalTable: "Artists",
|
|
||||||
principalColumn: "Id",
|
|
||||||
onDelete: ReferentialAction.Cascade);
|
|
||||||
});
|
|
||||||
|
|
||||||
migrationBuilder.CreateTable(
|
|
||||||
name: "PlaylistUsers",
|
|
||||||
columns: table => new
|
|
||||||
{
|
|
||||||
PlaylistId = table.Column<int>(type: "integer", nullable: false),
|
|
||||||
UserId = table.Column<int>(type: "integer", nullable: false)
|
|
||||||
},
|
|
||||||
constraints: table =>
|
|
||||||
{
|
|
||||||
table.PrimaryKey("PK_PlaylistUsers", x => new { x.PlaylistId, x.UserId });
|
|
||||||
table.ForeignKey(
|
|
||||||
name: "FK_PlaylistUsers_Playlists_PlaylistId",
|
|
||||||
column: x => x.PlaylistId,
|
|
||||||
principalTable: "Playlists",
|
|
||||||
principalColumn: "Id",
|
|
||||||
onDelete: ReferentialAction.Cascade);
|
|
||||||
table.ForeignKey(
|
|
||||||
name: "FK_PlaylistUsers_Users_UserId",
|
|
||||||
column: x => x.UserId,
|
|
||||||
principalTable: "Users",
|
|
||||||
principalColumn: "Id",
|
|
||||||
onDelete: ReferentialAction.Cascade);
|
|
||||||
});
|
|
||||||
|
|
||||||
migrationBuilder.CreateTable(
|
|
||||||
name: "GenreSongs",
|
|
||||||
columns: table => new
|
|
||||||
{
|
|
||||||
GenreId = table.Column<int>(type: "integer", nullable: false),
|
|
||||||
SongId = table.Column<int>(type: "integer", nullable: false)
|
|
||||||
},
|
|
||||||
constraints: table =>
|
|
||||||
{
|
|
||||||
table.PrimaryKey("PK_GenreSongs", x => new { x.GenreId, x.SongId });
|
|
||||||
table.ForeignKey(
|
|
||||||
name: "FK_GenreSongs_Genres_GenreId",
|
|
||||||
column: x => x.GenreId,
|
|
||||||
principalTable: "Genres",
|
|
||||||
principalColumn: "Id",
|
|
||||||
onDelete: ReferentialAction.Cascade);
|
|
||||||
table.ForeignKey(
|
|
||||||
name: "FK_GenreSongs_Songs_SongId",
|
|
||||||
column: x => x.SongId,
|
|
||||||
principalTable: "Songs",
|
|
||||||
principalColumn: "Id",
|
|
||||||
onDelete: ReferentialAction.Cascade);
|
|
||||||
});
|
|
||||||
|
|
||||||
migrationBuilder.CreateTable(
|
|
||||||
name: "Images",
|
|
||||||
columns: table => new
|
|
||||||
{
|
|
||||||
Id = table.Column<int>(type: "integer", nullable: false)
|
|
||||||
.Annotation("Npgsql:ValueGenerationStrategy", NpgsqlValueGenerationStrategy.IdentityByDefaultColumn),
|
|
||||||
Uri = table.Column<string>(type: "text", nullable: false),
|
|
||||||
Filetype = table.Column<string>(type: "text", nullable: false),
|
|
||||||
State = table.Column<int>(type: "integer", nullable: false),
|
|
||||||
SongId = table.Column<int>(type: "integer", nullable: true)
|
|
||||||
},
|
|
||||||
constraints: table =>
|
|
||||||
{
|
|
||||||
table.PrimaryKey("PK_Images", x => x.Id);
|
|
||||||
table.ForeignKey(
|
|
||||||
name: "FK_Images_Songs_SongId",
|
|
||||||
column: x => x.SongId,
|
|
||||||
principalTable: "Songs",
|
|
||||||
principalColumn: "Id");
|
|
||||||
});
|
|
||||||
|
|
||||||
migrationBuilder.CreateTable(
|
|
||||||
name: "PlaylistSongs",
|
|
||||||
columns: table => new
|
|
||||||
{
|
|
||||||
PlaylistId = table.Column<int>(type: "integer", nullable: false),
|
|
||||||
SongId = table.Column<int>(type: "integer", nullable: false),
|
|
||||||
Index = table.Column<int>(type: "integer", nullable: false)
|
|
||||||
},
|
|
||||||
constraints: table =>
|
|
||||||
{
|
|
||||||
table.PrimaryKey("PK_PlaylistSongs", x => new { x.PlaylistId, x.SongId });
|
|
||||||
table.ForeignKey(
|
|
||||||
name: "FK_PlaylistSongs_Playlists_PlaylistId",
|
|
||||||
column: x => x.PlaylistId,
|
|
||||||
principalTable: "Playlists",
|
|
||||||
principalColumn: "Id",
|
|
||||||
onDelete: ReferentialAction.Cascade);
|
|
||||||
table.ForeignKey(
|
|
||||||
name: "FK_PlaylistSongs_Songs_SongId",
|
|
||||||
column: x => x.SongId,
|
|
||||||
principalTable: "Songs",
|
|
||||||
principalColumn: "Id",
|
|
||||||
onDelete: ReferentialAction.Cascade);
|
|
||||||
});
|
|
||||||
|
|
||||||
migrationBuilder.CreateTable(
|
|
||||||
name: "SongInteractions",
|
|
||||||
columns: table => new
|
|
||||||
{
|
|
||||||
SongId = table.Column<int>(type: "integer", nullable: false),
|
|
||||||
UserId = table.Column<int>(type: "integer", nullable: false),
|
|
||||||
Id = table.Column<int>(type: "integer", nullable: false),
|
|
||||||
PlayCount = table.Column<int>(type: "integer", nullable: false),
|
|
||||||
Starred = table.Column<bool>(type: "boolean", nullable: true),
|
|
||||||
Rating = table.Column<int>(type: "integer", nullable: false)
|
|
||||||
},
|
|
||||||
constraints: table =>
|
|
||||||
{
|
|
||||||
table.PrimaryKey("PK_SongInteractions", x => new { x.SongId, x.UserId });
|
|
||||||
table.ForeignKey(
|
|
||||||
name: "FK_SongInteractions_Songs_SongId",
|
|
||||||
column: x => x.SongId,
|
|
||||||
principalTable: "Songs",
|
|
||||||
principalColumn: "Id",
|
|
||||||
onDelete: ReferentialAction.Cascade);
|
|
||||||
table.ForeignKey(
|
|
||||||
name: "FK_SongInteractions_Users_UserId",
|
|
||||||
column: x => x.UserId,
|
|
||||||
principalTable: "Users",
|
|
||||||
principalColumn: "Id",
|
|
||||||
onDelete: ReferentialAction.Cascade);
|
|
||||||
});
|
|
||||||
|
|
||||||
migrationBuilder.CreateIndex(
|
|
||||||
name: "IX_AlbumInteractions_UserId",
|
|
||||||
table: "AlbumInteractions",
|
|
||||||
column: "UserId");
|
|
||||||
|
|
||||||
migrationBuilder.CreateIndex(
|
|
||||||
name: "IX_Albums_ArtistId",
|
|
||||||
table: "Albums",
|
|
||||||
column: "ArtistId");
|
|
||||||
|
|
||||||
migrationBuilder.CreateIndex(
|
|
||||||
name: "IX_Albums_Uri",
|
|
||||||
table: "Albums",
|
|
||||||
column: "Uri",
|
|
||||||
unique: true);
|
|
||||||
|
|
||||||
migrationBuilder.CreateIndex(
|
|
||||||
name: "IX_Artists_NormalizedName",
|
|
||||||
table: "Artists",
|
|
||||||
column: "NormalizedName",
|
|
||||||
unique: true);
|
|
||||||
|
|
||||||
migrationBuilder.CreateIndex(
|
|
||||||
name: "IX_Genres_NormalizedName",
|
|
||||||
table: "Genres",
|
|
||||||
column: "NormalizedName",
|
|
||||||
unique: true);
|
|
||||||
|
|
||||||
migrationBuilder.CreateIndex(
|
|
||||||
name: "IX_GenreSongs_SongId",
|
|
||||||
table: "GenreSongs",
|
|
||||||
column: "SongId");
|
|
||||||
|
|
||||||
migrationBuilder.CreateIndex(
|
|
||||||
name: "IX_Globals_Key",
|
|
||||||
table: "Globals",
|
|
||||||
column: "Key",
|
|
||||||
unique: true);
|
|
||||||
|
|
||||||
migrationBuilder.CreateIndex(
|
|
||||||
name: "IX_Images_SongId",
|
|
||||||
table: "Images",
|
|
||||||
column: "SongId",
|
|
||||||
unique: true);
|
|
||||||
|
|
||||||
migrationBuilder.CreateIndex(
|
|
||||||
name: "IX_Playlists_CreatorId",
|
|
||||||
table: "Playlists",
|
|
||||||
column: "CreatorId");
|
|
||||||
|
|
||||||
migrationBuilder.CreateIndex(
|
|
||||||
name: "IX_Playlists_Uri",
|
|
||||||
table: "Playlists",
|
|
||||||
column: "Uri",
|
|
||||||
unique: true);
|
|
||||||
|
|
||||||
migrationBuilder.CreateIndex(
|
|
||||||
name: "IX_PlaylistSongs_SongId",
|
|
||||||
table: "PlaylistSongs",
|
|
||||||
column: "SongId");
|
|
||||||
|
|
||||||
migrationBuilder.CreateIndex(
|
|
||||||
name: "IX_PlaylistUsers_UserId",
|
|
||||||
table: "PlaylistUsers",
|
|
||||||
column: "UserId");
|
|
||||||
|
|
||||||
migrationBuilder.CreateIndex(
|
|
||||||
name: "IX_Radios_NormalizedName",
|
|
||||||
table: "Radios",
|
|
||||||
column: "NormalizedName",
|
|
||||||
unique: true);
|
|
||||||
|
|
||||||
migrationBuilder.CreateIndex(
|
|
||||||
name: "IX_Radios_UserId",
|
|
||||||
table: "Radios",
|
|
||||||
column: "UserId");
|
|
||||||
|
|
||||||
migrationBuilder.CreateIndex(
|
|
||||||
name: "IX_SongInteractions_UserId",
|
|
||||||
table: "SongInteractions",
|
|
||||||
column: "UserId");
|
|
||||||
|
|
||||||
migrationBuilder.CreateIndex(
|
|
||||||
name: "IX_Songs_AlbumId",
|
|
||||||
table: "Songs",
|
|
||||||
column: "AlbumId");
|
|
||||||
|
|
||||||
migrationBuilder.CreateIndex(
|
|
||||||
name: "IX_Songs_ArtistId",
|
|
||||||
table: "Songs",
|
|
||||||
column: "ArtistId");
|
|
||||||
|
|
||||||
migrationBuilder.CreateIndex(
|
|
||||||
name: "IX_Songs_Uri",
|
|
||||||
table: "Songs",
|
|
||||||
column: "Uri",
|
|
||||||
unique: true);
|
|
||||||
|
|
||||||
migrationBuilder.CreateIndex(
|
|
||||||
name: "IX_Users_Name",
|
|
||||||
table: "Users",
|
|
||||||
column: "Name",
|
|
||||||
unique: true);
|
|
||||||
}
|
|
||||||
|
|
||||||
/// <inheritdoc />
|
|
||||||
protected override void Down(MigrationBuilder migrationBuilder)
|
|
||||||
{
|
|
||||||
migrationBuilder.DropTable(
|
|
||||||
name: "AlbumInteractions");
|
|
||||||
|
|
||||||
migrationBuilder.DropTable(
|
|
||||||
name: "GenreSongs");
|
|
||||||
|
|
||||||
migrationBuilder.DropTable(
|
|
||||||
name: "Globals");
|
|
||||||
|
|
||||||
migrationBuilder.DropTable(
|
|
||||||
name: "Images");
|
|
||||||
|
|
||||||
migrationBuilder.DropTable(
|
|
||||||
name: "PlaylistSongs");
|
|
||||||
|
|
||||||
migrationBuilder.DropTable(
|
|
||||||
name: "PlaylistUsers");
|
|
||||||
|
|
||||||
migrationBuilder.DropTable(
|
|
||||||
name: "Radios");
|
|
||||||
|
|
||||||
migrationBuilder.DropTable(
|
|
||||||
name: "SongInteractions");
|
|
||||||
|
|
||||||
migrationBuilder.DropTable(
|
|
||||||
name: "Genres");
|
|
||||||
|
|
||||||
migrationBuilder.DropTable(
|
|
||||||
name: "Playlists");
|
|
||||||
|
|
||||||
migrationBuilder.DropTable(
|
|
||||||
name: "Songs");
|
|
||||||
|
|
||||||
migrationBuilder.DropTable(
|
|
||||||
name: "Users");
|
|
||||||
|
|
||||||
migrationBuilder.DropTable(
|
|
||||||
name: "Albums");
|
|
||||||
|
|
||||||
migrationBuilder.DropTable(
|
|
||||||
name: "Artists");
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
639
Migrations/20260125172515_InitialMigration.Designer.cs
generated
Normal file
639
Migrations/20260125172515_InitialMigration.Designer.cs
generated
Normal file
@@ -0,0 +1,639 @@
|
|||||||
|
// <auto-generated />
|
||||||
|
using System;
|
||||||
|
using Microsoft.EntityFrameworkCore;
|
||||||
|
using Microsoft.EntityFrameworkCore.Infrastructure;
|
||||||
|
using Microsoft.EntityFrameworkCore.Migrations;
|
||||||
|
using Microsoft.EntityFrameworkCore.Storage.ValueConversion;
|
||||||
|
using Npgsql.EntityFrameworkCore.PostgreSQL.Metadata;
|
||||||
|
using Shadow.Data;
|
||||||
|
|
||||||
|
#nullable disable
|
||||||
|
|
||||||
|
namespace Shadow.Migrations
|
||||||
|
{
|
||||||
|
[DbContext(typeof(ApplicationDbContext))]
|
||||||
|
[Migration("20260125172515_InitialMigration")]
|
||||||
|
partial class InitialMigration
|
||||||
|
{
|
||||||
|
/// <inheritdoc />
|
||||||
|
protected override void BuildTargetModel(ModelBuilder modelBuilder)
|
||||||
|
{
|
||||||
|
#pragma warning disable 612, 618
|
||||||
|
modelBuilder
|
||||||
|
.HasAnnotation("ProductVersion", "10.0.1")
|
||||||
|
.HasAnnotation("Relational:MaxIdentifierLength", 63);
|
||||||
|
|
||||||
|
NpgsqlModelBuilderExtensions.UseIdentityByDefaultColumns(modelBuilder);
|
||||||
|
|
||||||
|
modelBuilder.Entity("Shadow.Entities.Album", b =>
|
||||||
|
{
|
||||||
|
b.Property<int>("Id")
|
||||||
|
.ValueGeneratedOnAdd()
|
||||||
|
.HasColumnType("integer");
|
||||||
|
|
||||||
|
NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property<int>("Id"));
|
||||||
|
|
||||||
|
b.Property<int?>("ArtistId")
|
||||||
|
.HasColumnType("integer");
|
||||||
|
|
||||||
|
b.Property<string>("Name")
|
||||||
|
.IsRequired()
|
||||||
|
.HasColumnType("text");
|
||||||
|
|
||||||
|
b.Property<int>("State")
|
||||||
|
.HasColumnType("integer");
|
||||||
|
|
||||||
|
b.Property<string>("Uri")
|
||||||
|
.IsRequired()
|
||||||
|
.HasColumnType("text");
|
||||||
|
|
||||||
|
b.HasKey("Id");
|
||||||
|
|
||||||
|
b.HasIndex("ArtistId");
|
||||||
|
|
||||||
|
b.HasIndex("Uri")
|
||||||
|
.IsUnique();
|
||||||
|
|
||||||
|
b.ToTable("Albums");
|
||||||
|
});
|
||||||
|
|
||||||
|
modelBuilder.Entity("Shadow.Entities.AlbumInteraction", b =>
|
||||||
|
{
|
||||||
|
b.Property<int>("AlbumId")
|
||||||
|
.HasColumnType("integer");
|
||||||
|
|
||||||
|
b.Property<int>("UserId")
|
||||||
|
.HasColumnType("integer");
|
||||||
|
|
||||||
|
b.Property<int>("Id")
|
||||||
|
.HasColumnType("integer");
|
||||||
|
|
||||||
|
b.Property<DateTime?>("PlayDate")
|
||||||
|
.HasColumnType("timestamp with time zone");
|
||||||
|
|
||||||
|
b.Property<bool>("Starred")
|
||||||
|
.HasColumnType("boolean");
|
||||||
|
|
||||||
|
b.HasKey("AlbumId", "UserId");
|
||||||
|
|
||||||
|
b.HasIndex("UserId");
|
||||||
|
|
||||||
|
b.ToTable("AlbumInteractions");
|
||||||
|
});
|
||||||
|
|
||||||
|
modelBuilder.Entity("Shadow.Entities.Artist", b =>
|
||||||
|
{
|
||||||
|
b.Property<int>("Id")
|
||||||
|
.ValueGeneratedOnAdd()
|
||||||
|
.HasColumnType("integer");
|
||||||
|
|
||||||
|
NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property<int>("Id"));
|
||||||
|
|
||||||
|
b.Property<string>("Name")
|
||||||
|
.IsRequired()
|
||||||
|
.HasColumnType("text");
|
||||||
|
|
||||||
|
b.Property<string>("NormalizedName")
|
||||||
|
.IsRequired()
|
||||||
|
.HasColumnType("text");
|
||||||
|
|
||||||
|
b.HasKey("Id");
|
||||||
|
|
||||||
|
b.HasIndex("NormalizedName")
|
||||||
|
.IsUnique();
|
||||||
|
|
||||||
|
b.ToTable("Artists");
|
||||||
|
});
|
||||||
|
|
||||||
|
modelBuilder.Entity("Shadow.Entities.Genre", b =>
|
||||||
|
{
|
||||||
|
b.Property<int>("Id")
|
||||||
|
.ValueGeneratedOnAdd()
|
||||||
|
.HasColumnType("integer");
|
||||||
|
|
||||||
|
NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property<int>("Id"));
|
||||||
|
|
||||||
|
b.Property<string>("Name")
|
||||||
|
.IsRequired()
|
||||||
|
.HasColumnType("text");
|
||||||
|
|
||||||
|
b.Property<string>("NormalizedName")
|
||||||
|
.IsRequired()
|
||||||
|
.HasColumnType("text");
|
||||||
|
|
||||||
|
b.HasKey("Id");
|
||||||
|
|
||||||
|
b.HasIndex("NormalizedName")
|
||||||
|
.IsUnique();
|
||||||
|
|
||||||
|
b.ToTable("Genres");
|
||||||
|
});
|
||||||
|
|
||||||
|
modelBuilder.Entity("Shadow.Entities.GenreSong", b =>
|
||||||
|
{
|
||||||
|
b.Property<int>("GenreId")
|
||||||
|
.HasColumnType("integer");
|
||||||
|
|
||||||
|
b.Property<int>("SongId")
|
||||||
|
.HasColumnType("integer");
|
||||||
|
|
||||||
|
b.HasKey("GenreId", "SongId");
|
||||||
|
|
||||||
|
b.HasIndex("SongId");
|
||||||
|
|
||||||
|
b.ToTable("GenreSongs");
|
||||||
|
});
|
||||||
|
|
||||||
|
modelBuilder.Entity("Shadow.Entities.Global", b =>
|
||||||
|
{
|
||||||
|
b.Property<int>("Id")
|
||||||
|
.ValueGeneratedOnAdd()
|
||||||
|
.HasColumnType("integer");
|
||||||
|
|
||||||
|
NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property<int>("Id"));
|
||||||
|
|
||||||
|
b.Property<string>("Key")
|
||||||
|
.IsRequired()
|
||||||
|
.HasColumnType("text");
|
||||||
|
|
||||||
|
b.Property<string>("Value")
|
||||||
|
.HasColumnType("text");
|
||||||
|
|
||||||
|
b.HasKey("Id");
|
||||||
|
|
||||||
|
b.HasIndex("Key")
|
||||||
|
.IsUnique();
|
||||||
|
|
||||||
|
b.ToTable("Globals");
|
||||||
|
});
|
||||||
|
|
||||||
|
modelBuilder.Entity("Shadow.Entities.Image", b =>
|
||||||
|
{
|
||||||
|
b.Property<int>("Id")
|
||||||
|
.ValueGeneratedOnAdd()
|
||||||
|
.HasColumnType("integer");
|
||||||
|
|
||||||
|
NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property<int>("Id"));
|
||||||
|
|
||||||
|
b.Property<string>("Filetype")
|
||||||
|
.IsRequired()
|
||||||
|
.HasColumnType("text");
|
||||||
|
|
||||||
|
b.Property<int?>("SongId")
|
||||||
|
.HasColumnType("integer");
|
||||||
|
|
||||||
|
b.Property<int>("State")
|
||||||
|
.HasColumnType("integer");
|
||||||
|
|
||||||
|
b.Property<string>("Uri")
|
||||||
|
.IsRequired()
|
||||||
|
.HasColumnType("text");
|
||||||
|
|
||||||
|
b.HasKey("Id");
|
||||||
|
|
||||||
|
b.HasIndex("SongId")
|
||||||
|
.IsUnique();
|
||||||
|
|
||||||
|
b.ToTable("Images");
|
||||||
|
});
|
||||||
|
|
||||||
|
modelBuilder.Entity("Shadow.Entities.Playlist", b =>
|
||||||
|
{
|
||||||
|
b.Property<int>("Id")
|
||||||
|
.ValueGeneratedOnAdd()
|
||||||
|
.HasColumnType("integer");
|
||||||
|
|
||||||
|
NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property<int>("Id"));
|
||||||
|
|
||||||
|
b.Property<int>("CreatorId")
|
||||||
|
.HasColumnType("integer");
|
||||||
|
|
||||||
|
b.Property<string>("Description")
|
||||||
|
.IsRequired()
|
||||||
|
.HasColumnType("text");
|
||||||
|
|
||||||
|
b.Property<string>("Name")
|
||||||
|
.IsRequired()
|
||||||
|
.HasColumnType("text");
|
||||||
|
|
||||||
|
b.Property<bool>("Private")
|
||||||
|
.HasColumnType("boolean");
|
||||||
|
|
||||||
|
b.Property<string>("Uri")
|
||||||
|
.IsRequired()
|
||||||
|
.HasColumnType("text");
|
||||||
|
|
||||||
|
b.HasKey("Id");
|
||||||
|
|
||||||
|
b.HasIndex("CreatorId");
|
||||||
|
|
||||||
|
b.HasIndex("Uri")
|
||||||
|
.IsUnique();
|
||||||
|
|
||||||
|
b.ToTable("Playlists");
|
||||||
|
});
|
||||||
|
|
||||||
|
modelBuilder.Entity("Shadow.Entities.PlaylistSong", b =>
|
||||||
|
{
|
||||||
|
b.Property<int>("PlaylistId")
|
||||||
|
.HasColumnType("integer");
|
||||||
|
|
||||||
|
b.Property<int>("SongId")
|
||||||
|
.HasColumnType("integer");
|
||||||
|
|
||||||
|
b.Property<int>("Index")
|
||||||
|
.HasColumnType("integer");
|
||||||
|
|
||||||
|
b.HasKey("PlaylistId", "SongId");
|
||||||
|
|
||||||
|
b.HasIndex("SongId");
|
||||||
|
|
||||||
|
b.ToTable("PlaylistSongs");
|
||||||
|
});
|
||||||
|
|
||||||
|
modelBuilder.Entity("Shadow.Entities.PlaylistUser", b =>
|
||||||
|
{
|
||||||
|
b.Property<int>("PlaylistId")
|
||||||
|
.HasColumnType("integer");
|
||||||
|
|
||||||
|
b.Property<int>("UserId")
|
||||||
|
.HasColumnType("integer");
|
||||||
|
|
||||||
|
b.HasKey("PlaylistId", "UserId");
|
||||||
|
|
||||||
|
b.HasIndex("UserId");
|
||||||
|
|
||||||
|
b.ToTable("PlaylistUsers");
|
||||||
|
});
|
||||||
|
|
||||||
|
modelBuilder.Entity("Shadow.Entities.Radio", b =>
|
||||||
|
{
|
||||||
|
b.Property<int>("Id")
|
||||||
|
.ValueGeneratedOnAdd()
|
||||||
|
.HasColumnType("integer");
|
||||||
|
|
||||||
|
NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property<int>("Id"));
|
||||||
|
|
||||||
|
b.Property<string>("Homepage")
|
||||||
|
.HasColumnType("text");
|
||||||
|
|
||||||
|
b.Property<string>("Name")
|
||||||
|
.IsRequired()
|
||||||
|
.HasColumnType("text");
|
||||||
|
|
||||||
|
b.Property<string>("NormalizedName")
|
||||||
|
.IsRequired()
|
||||||
|
.HasColumnType("text");
|
||||||
|
|
||||||
|
b.Property<string>("Url")
|
||||||
|
.IsRequired()
|
||||||
|
.HasColumnType("text");
|
||||||
|
|
||||||
|
b.Property<int>("UserId")
|
||||||
|
.HasColumnType("integer");
|
||||||
|
|
||||||
|
b.HasKey("Id");
|
||||||
|
|
||||||
|
b.HasIndex("NormalizedName")
|
||||||
|
.IsUnique();
|
||||||
|
|
||||||
|
b.HasIndex("UserId");
|
||||||
|
|
||||||
|
b.ToTable("Radios");
|
||||||
|
});
|
||||||
|
|
||||||
|
modelBuilder.Entity("Shadow.Entities.Song", b =>
|
||||||
|
{
|
||||||
|
b.Property<int>("Id")
|
||||||
|
.ValueGeneratedOnAdd()
|
||||||
|
.HasColumnType("integer");
|
||||||
|
|
||||||
|
NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property<int>("Id"));
|
||||||
|
|
||||||
|
b.Property<int>("AlbumId")
|
||||||
|
.HasColumnType("integer");
|
||||||
|
|
||||||
|
b.Property<int>("ArtistId")
|
||||||
|
.HasColumnType("integer");
|
||||||
|
|
||||||
|
b.Property<int?>("BitDepth")
|
||||||
|
.HasColumnType("integer");
|
||||||
|
|
||||||
|
b.Property<int>("Bitrate")
|
||||||
|
.HasColumnType("integer");
|
||||||
|
|
||||||
|
b.Property<int>("Channels")
|
||||||
|
.HasColumnType("integer");
|
||||||
|
|
||||||
|
b.Property<string>("Comment")
|
||||||
|
.HasColumnType("text");
|
||||||
|
|
||||||
|
b.Property<DateTime>("Date")
|
||||||
|
.HasColumnType("timestamp with time zone");
|
||||||
|
|
||||||
|
b.Property<int?>("DiscNumber")
|
||||||
|
.HasColumnType("integer");
|
||||||
|
|
||||||
|
b.Property<int>("Duration")
|
||||||
|
.HasColumnType("integer");
|
||||||
|
|
||||||
|
b.Property<string>("Filepath")
|
||||||
|
.IsRequired()
|
||||||
|
.HasColumnType("text");
|
||||||
|
|
||||||
|
b.Property<string>("Filetype")
|
||||||
|
.IsRequired()
|
||||||
|
.HasColumnType("text");
|
||||||
|
|
||||||
|
b.Property<int?>("ImageId")
|
||||||
|
.HasColumnType("integer");
|
||||||
|
|
||||||
|
b.Property<int>("Index")
|
||||||
|
.HasColumnType("integer");
|
||||||
|
|
||||||
|
b.Property<int>("SamplingRate")
|
||||||
|
.HasColumnType("integer");
|
||||||
|
|
||||||
|
b.Property<int>("Size")
|
||||||
|
.HasColumnType("integer");
|
||||||
|
|
||||||
|
b.Property<int>("State")
|
||||||
|
.HasColumnType("integer");
|
||||||
|
|
||||||
|
b.Property<string>("Title")
|
||||||
|
.IsRequired()
|
||||||
|
.HasColumnType("text");
|
||||||
|
|
||||||
|
b.Property<int?>("TrackNumber")
|
||||||
|
.HasColumnType("integer");
|
||||||
|
|
||||||
|
b.Property<string>("Uri")
|
||||||
|
.IsRequired()
|
||||||
|
.HasColumnType("text");
|
||||||
|
|
||||||
|
b.HasKey("Id");
|
||||||
|
|
||||||
|
b.HasIndex("AlbumId");
|
||||||
|
|
||||||
|
b.HasIndex("ArtistId");
|
||||||
|
|
||||||
|
b.HasIndex("Uri")
|
||||||
|
.IsUnique();
|
||||||
|
|
||||||
|
b.ToTable("Songs");
|
||||||
|
});
|
||||||
|
|
||||||
|
modelBuilder.Entity("Shadow.Entities.SongInteraction", b =>
|
||||||
|
{
|
||||||
|
b.Property<int>("SongId")
|
||||||
|
.HasColumnType("integer");
|
||||||
|
|
||||||
|
b.Property<int>("UserId")
|
||||||
|
.HasColumnType("integer");
|
||||||
|
|
||||||
|
b.Property<int>("Id")
|
||||||
|
.HasColumnType("integer");
|
||||||
|
|
||||||
|
b.Property<int>("PlayCount")
|
||||||
|
.HasColumnType("integer");
|
||||||
|
|
||||||
|
b.Property<int>("Rating")
|
||||||
|
.HasColumnType("integer");
|
||||||
|
|
||||||
|
b.Property<bool?>("Starred")
|
||||||
|
.HasColumnType("boolean");
|
||||||
|
|
||||||
|
b.HasKey("SongId", "UserId");
|
||||||
|
|
||||||
|
b.HasIndex("UserId");
|
||||||
|
|
||||||
|
b.ToTable("SongInteractions");
|
||||||
|
});
|
||||||
|
|
||||||
|
modelBuilder.Entity("Shadow.Entities.User", b =>
|
||||||
|
{
|
||||||
|
b.Property<int>("Id")
|
||||||
|
.ValueGeneratedOnAdd()
|
||||||
|
.HasColumnType("integer");
|
||||||
|
|
||||||
|
NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property<int>("Id"));
|
||||||
|
|
||||||
|
b.Property<string>("Name")
|
||||||
|
.IsRequired()
|
||||||
|
.HasColumnType("text");
|
||||||
|
|
||||||
|
b.Property<string>("NormalizedName")
|
||||||
|
.IsRequired()
|
||||||
|
.HasColumnType("text");
|
||||||
|
|
||||||
|
b.Property<string>("Password")
|
||||||
|
.IsRequired()
|
||||||
|
.HasColumnType("text");
|
||||||
|
|
||||||
|
b.Property<int>("Role")
|
||||||
|
.HasColumnType("integer");
|
||||||
|
|
||||||
|
b.HasKey("Id");
|
||||||
|
|
||||||
|
b.HasIndex("Name")
|
||||||
|
.IsUnique();
|
||||||
|
|
||||||
|
b.ToTable("Users");
|
||||||
|
});
|
||||||
|
|
||||||
|
modelBuilder.Entity("Shadow.Entities.Album", b =>
|
||||||
|
{
|
||||||
|
b.HasOne("Shadow.Entities.Artist", "Artist")
|
||||||
|
.WithMany("Albums")
|
||||||
|
.HasForeignKey("ArtistId");
|
||||||
|
|
||||||
|
b.Navigation("Artist");
|
||||||
|
});
|
||||||
|
|
||||||
|
modelBuilder.Entity("Shadow.Entities.AlbumInteraction", b =>
|
||||||
|
{
|
||||||
|
b.HasOne("Shadow.Entities.Album", "Album")
|
||||||
|
.WithMany()
|
||||||
|
.HasForeignKey("AlbumId")
|
||||||
|
.OnDelete(DeleteBehavior.Cascade)
|
||||||
|
.IsRequired();
|
||||||
|
|
||||||
|
b.HasOne("Shadow.Entities.User", "User")
|
||||||
|
.WithMany("AlbumInteractions")
|
||||||
|
.HasForeignKey("UserId")
|
||||||
|
.OnDelete(DeleteBehavior.Cascade)
|
||||||
|
.IsRequired();
|
||||||
|
|
||||||
|
b.Navigation("Album");
|
||||||
|
|
||||||
|
b.Navigation("User");
|
||||||
|
});
|
||||||
|
|
||||||
|
modelBuilder.Entity("Shadow.Entities.GenreSong", b =>
|
||||||
|
{
|
||||||
|
b.HasOne("Shadow.Entities.Genre", "Genre")
|
||||||
|
.WithMany("GenreSongPair")
|
||||||
|
.HasForeignKey("GenreId")
|
||||||
|
.OnDelete(DeleteBehavior.Cascade)
|
||||||
|
.IsRequired();
|
||||||
|
|
||||||
|
b.HasOne("Shadow.Entities.Song", "Song")
|
||||||
|
.WithMany("GenreSongPair")
|
||||||
|
.HasForeignKey("SongId")
|
||||||
|
.OnDelete(DeleteBehavior.Cascade)
|
||||||
|
.IsRequired();
|
||||||
|
|
||||||
|
b.Navigation("Genre");
|
||||||
|
|
||||||
|
b.Navigation("Song");
|
||||||
|
});
|
||||||
|
|
||||||
|
modelBuilder.Entity("Shadow.Entities.Image", b =>
|
||||||
|
{
|
||||||
|
b.HasOne("Shadow.Entities.Song", "Song")
|
||||||
|
.WithOne("Image")
|
||||||
|
.HasForeignKey("Shadow.Entities.Image", "SongId");
|
||||||
|
|
||||||
|
b.Navigation("Song");
|
||||||
|
});
|
||||||
|
|
||||||
|
modelBuilder.Entity("Shadow.Entities.Playlist", b =>
|
||||||
|
{
|
||||||
|
b.HasOne("Shadow.Entities.User", "Creator")
|
||||||
|
.WithMany("Playlists")
|
||||||
|
.HasForeignKey("CreatorId")
|
||||||
|
.OnDelete(DeleteBehavior.Cascade)
|
||||||
|
.IsRequired();
|
||||||
|
|
||||||
|
b.Navigation("Creator");
|
||||||
|
});
|
||||||
|
|
||||||
|
modelBuilder.Entity("Shadow.Entities.PlaylistSong", b =>
|
||||||
|
{
|
||||||
|
b.HasOne("Shadow.Entities.Playlist", "Playlist")
|
||||||
|
.WithMany()
|
||||||
|
.HasForeignKey("PlaylistId")
|
||||||
|
.OnDelete(DeleteBehavior.Cascade)
|
||||||
|
.IsRequired();
|
||||||
|
|
||||||
|
b.HasOne("Shadow.Entities.Song", "Song")
|
||||||
|
.WithMany()
|
||||||
|
.HasForeignKey("SongId")
|
||||||
|
.OnDelete(DeleteBehavior.Cascade)
|
||||||
|
.IsRequired();
|
||||||
|
|
||||||
|
b.Navigation("Playlist");
|
||||||
|
|
||||||
|
b.Navigation("Song");
|
||||||
|
});
|
||||||
|
|
||||||
|
modelBuilder.Entity("Shadow.Entities.PlaylistUser", b =>
|
||||||
|
{
|
||||||
|
b.HasOne("Shadow.Entities.Playlist", "Playlist")
|
||||||
|
.WithMany("AuthorizedPlaylistUsers")
|
||||||
|
.HasForeignKey("PlaylistId")
|
||||||
|
.OnDelete(DeleteBehavior.Cascade)
|
||||||
|
.IsRequired();
|
||||||
|
|
||||||
|
b.HasOne("Shadow.Entities.User", "User")
|
||||||
|
.WithMany()
|
||||||
|
.HasForeignKey("UserId")
|
||||||
|
.OnDelete(DeleteBehavior.Cascade)
|
||||||
|
.IsRequired();
|
||||||
|
|
||||||
|
b.Navigation("Playlist");
|
||||||
|
|
||||||
|
b.Navigation("User");
|
||||||
|
});
|
||||||
|
|
||||||
|
modelBuilder.Entity("Shadow.Entities.Radio", b =>
|
||||||
|
{
|
||||||
|
b.HasOne("Shadow.Entities.User", "User")
|
||||||
|
.WithMany()
|
||||||
|
.HasForeignKey("UserId")
|
||||||
|
.OnDelete(DeleteBehavior.Cascade)
|
||||||
|
.IsRequired();
|
||||||
|
|
||||||
|
b.Navigation("User");
|
||||||
|
});
|
||||||
|
|
||||||
|
modelBuilder.Entity("Shadow.Entities.Song", b =>
|
||||||
|
{
|
||||||
|
b.HasOne("Shadow.Entities.Album", "Album")
|
||||||
|
.WithMany("Songs")
|
||||||
|
.HasForeignKey("AlbumId")
|
||||||
|
.OnDelete(DeleteBehavior.Cascade)
|
||||||
|
.IsRequired();
|
||||||
|
|
||||||
|
b.HasOne("Shadow.Entities.Artist", "Artist")
|
||||||
|
.WithMany("Songs")
|
||||||
|
.HasForeignKey("ArtistId")
|
||||||
|
.OnDelete(DeleteBehavior.Cascade)
|
||||||
|
.IsRequired();
|
||||||
|
|
||||||
|
b.Navigation("Album");
|
||||||
|
|
||||||
|
b.Navigation("Artist");
|
||||||
|
});
|
||||||
|
|
||||||
|
modelBuilder.Entity("Shadow.Entities.SongInteraction", b =>
|
||||||
|
{
|
||||||
|
b.HasOne("Shadow.Entities.Song", "Song")
|
||||||
|
.WithMany()
|
||||||
|
.HasForeignKey("SongId")
|
||||||
|
.OnDelete(DeleteBehavior.Cascade)
|
||||||
|
.IsRequired();
|
||||||
|
|
||||||
|
b.HasOne("Shadow.Entities.User", "User")
|
||||||
|
.WithMany("SongInteractions")
|
||||||
|
.HasForeignKey("UserId")
|
||||||
|
.OnDelete(DeleteBehavior.Cascade)
|
||||||
|
.IsRequired();
|
||||||
|
|
||||||
|
b.Navigation("Song");
|
||||||
|
|
||||||
|
b.Navigation("User");
|
||||||
|
});
|
||||||
|
|
||||||
|
modelBuilder.Entity("Shadow.Entities.Album", b =>
|
||||||
|
{
|
||||||
|
b.Navigation("Songs");
|
||||||
|
});
|
||||||
|
|
||||||
|
modelBuilder.Entity("Shadow.Entities.Artist", b =>
|
||||||
|
{
|
||||||
|
b.Navigation("Albums");
|
||||||
|
|
||||||
|
b.Navigation("Songs");
|
||||||
|
});
|
||||||
|
|
||||||
|
modelBuilder.Entity("Shadow.Entities.Genre", b =>
|
||||||
|
{
|
||||||
|
b.Navigation("GenreSongPair");
|
||||||
|
});
|
||||||
|
|
||||||
|
modelBuilder.Entity("Shadow.Entities.Playlist", b =>
|
||||||
|
{
|
||||||
|
b.Navigation("AuthorizedPlaylistUsers");
|
||||||
|
});
|
||||||
|
|
||||||
|
modelBuilder.Entity("Shadow.Entities.Song", b =>
|
||||||
|
{
|
||||||
|
b.Navigation("GenreSongPair");
|
||||||
|
|
||||||
|
b.Navigation("Image");
|
||||||
|
});
|
||||||
|
|
||||||
|
modelBuilder.Entity("Shadow.Entities.User", b =>
|
||||||
|
{
|
||||||
|
b.Navigation("AlbumInteractions");
|
||||||
|
|
||||||
|
b.Navigation("Playlists");
|
||||||
|
|
||||||
|
b.Navigation("SongInteractions");
|
||||||
|
});
|
||||||
|
|
||||||
|
#pragma warning restore 612, 618
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
483
Migrations/20260125172515_InitialMigration.cs
Normal file
483
Migrations/20260125172515_InitialMigration.cs
Normal file
@@ -0,0 +1,483 @@
|
|||||||
|
using System;
|
||||||
|
using Microsoft.EntityFrameworkCore.Migrations;
|
||||||
|
using Npgsql.EntityFrameworkCore.PostgreSQL.Metadata;
|
||||||
|
|
||||||
|
#nullable disable
|
||||||
|
|
||||||
|
namespace Shadow.Migrations
|
||||||
|
{
|
||||||
|
/// <inheritdoc />
|
||||||
|
public partial class InitialMigration : Migration
|
||||||
|
{
|
||||||
|
/// <inheritdoc />
|
||||||
|
protected override void Up(MigrationBuilder migrationBuilder)
|
||||||
|
{
|
||||||
|
migrationBuilder.CreateTable(
|
||||||
|
name: "Artists",
|
||||||
|
columns: table => new
|
||||||
|
{
|
||||||
|
Id = table.Column<int>(type: "integer", nullable: false)
|
||||||
|
.Annotation("Npgsql:ValueGenerationStrategy", NpgsqlValueGenerationStrategy.IdentityByDefaultColumn),
|
||||||
|
Name = table.Column<string>(type: "text", nullable: false),
|
||||||
|
NormalizedName = table.Column<string>(type: "text", nullable: false)
|
||||||
|
},
|
||||||
|
constraints: table =>
|
||||||
|
{
|
||||||
|
table.PrimaryKey("PK_Artists", x => x.Id);
|
||||||
|
});
|
||||||
|
|
||||||
|
migrationBuilder.CreateTable(
|
||||||
|
name: "Genres",
|
||||||
|
columns: table => new
|
||||||
|
{
|
||||||
|
Id = table.Column<int>(type: "integer", nullable: false)
|
||||||
|
.Annotation("Npgsql:ValueGenerationStrategy", NpgsqlValueGenerationStrategy.IdentityByDefaultColumn),
|
||||||
|
Name = table.Column<string>(type: "text", nullable: false),
|
||||||
|
NormalizedName = table.Column<string>(type: "text", nullable: false)
|
||||||
|
},
|
||||||
|
constraints: table =>
|
||||||
|
{
|
||||||
|
table.PrimaryKey("PK_Genres", x => x.Id);
|
||||||
|
});
|
||||||
|
|
||||||
|
migrationBuilder.CreateTable(
|
||||||
|
name: "Globals",
|
||||||
|
columns: table => new
|
||||||
|
{
|
||||||
|
Id = table.Column<int>(type: "integer", nullable: false)
|
||||||
|
.Annotation("Npgsql:ValueGenerationStrategy", NpgsqlValueGenerationStrategy.IdentityByDefaultColumn),
|
||||||
|
Key = table.Column<string>(type: "text", nullable: false),
|
||||||
|
Value = table.Column<string>(type: "text", nullable: true)
|
||||||
|
},
|
||||||
|
constraints: table =>
|
||||||
|
{
|
||||||
|
table.PrimaryKey("PK_Globals", x => x.Id);
|
||||||
|
});
|
||||||
|
|
||||||
|
migrationBuilder.CreateTable(
|
||||||
|
name: "Users",
|
||||||
|
columns: table => new
|
||||||
|
{
|
||||||
|
Id = table.Column<int>(type: "integer", nullable: false)
|
||||||
|
.Annotation("Npgsql:ValueGenerationStrategy", NpgsqlValueGenerationStrategy.IdentityByDefaultColumn),
|
||||||
|
Name = table.Column<string>(type: "text", nullable: false),
|
||||||
|
NormalizedName = table.Column<string>(type: "text", nullable: false),
|
||||||
|
Password = table.Column<string>(type: "text", nullable: false),
|
||||||
|
Role = table.Column<int>(type: "integer", nullable: false)
|
||||||
|
},
|
||||||
|
constraints: table =>
|
||||||
|
{
|
||||||
|
table.PrimaryKey("PK_Users", x => x.Id);
|
||||||
|
});
|
||||||
|
|
||||||
|
migrationBuilder.CreateTable(
|
||||||
|
name: "Albums",
|
||||||
|
columns: table => new
|
||||||
|
{
|
||||||
|
Id = table.Column<int>(type: "integer", nullable: false)
|
||||||
|
.Annotation("Npgsql:ValueGenerationStrategy", NpgsqlValueGenerationStrategy.IdentityByDefaultColumn),
|
||||||
|
Name = table.Column<string>(type: "text", nullable: false),
|
||||||
|
Uri = table.Column<string>(type: "text", nullable: false),
|
||||||
|
State = table.Column<int>(type: "integer", nullable: false),
|
||||||
|
ArtistId = table.Column<int>(type: "integer", nullable: true)
|
||||||
|
},
|
||||||
|
constraints: table =>
|
||||||
|
{
|
||||||
|
table.PrimaryKey("PK_Albums", x => x.Id);
|
||||||
|
table.ForeignKey(
|
||||||
|
name: "FK_Albums_Artists_ArtistId",
|
||||||
|
column: x => x.ArtistId,
|
||||||
|
principalTable: "Artists",
|
||||||
|
principalColumn: "Id");
|
||||||
|
});
|
||||||
|
|
||||||
|
migrationBuilder.CreateTable(
|
||||||
|
name: "Playlists",
|
||||||
|
columns: table => new
|
||||||
|
{
|
||||||
|
Id = table.Column<int>(type: "integer", nullable: false)
|
||||||
|
.Annotation("Npgsql:ValueGenerationStrategy", NpgsqlValueGenerationStrategy.IdentityByDefaultColumn),
|
||||||
|
Name = table.Column<string>(type: "text", nullable: false),
|
||||||
|
Uri = table.Column<string>(type: "text", nullable: false),
|
||||||
|
Description = table.Column<string>(type: "text", nullable: false),
|
||||||
|
CreatorId = table.Column<int>(type: "integer", nullable: false),
|
||||||
|
Private = table.Column<bool>(type: "boolean", nullable: false)
|
||||||
|
},
|
||||||
|
constraints: table =>
|
||||||
|
{
|
||||||
|
table.PrimaryKey("PK_Playlists", x => x.Id);
|
||||||
|
table.ForeignKey(
|
||||||
|
name: "FK_Playlists_Users_CreatorId",
|
||||||
|
column: x => x.CreatorId,
|
||||||
|
principalTable: "Users",
|
||||||
|
principalColumn: "Id",
|
||||||
|
onDelete: ReferentialAction.Cascade);
|
||||||
|
});
|
||||||
|
|
||||||
|
migrationBuilder.CreateTable(
|
||||||
|
name: "Radios",
|
||||||
|
columns: table => new
|
||||||
|
{
|
||||||
|
Id = table.Column<int>(type: "integer", nullable: false)
|
||||||
|
.Annotation("Npgsql:ValueGenerationStrategy", NpgsqlValueGenerationStrategy.IdentityByDefaultColumn),
|
||||||
|
Name = table.Column<string>(type: "text", nullable: false),
|
||||||
|
NormalizedName = table.Column<string>(type: "text", nullable: false),
|
||||||
|
Homepage = table.Column<string>(type: "text", nullable: true),
|
||||||
|
Url = table.Column<string>(type: "text", nullable: false),
|
||||||
|
UserId = table.Column<int>(type: "integer", nullable: false)
|
||||||
|
},
|
||||||
|
constraints: table =>
|
||||||
|
{
|
||||||
|
table.PrimaryKey("PK_Radios", x => x.Id);
|
||||||
|
table.ForeignKey(
|
||||||
|
name: "FK_Radios_Users_UserId",
|
||||||
|
column: x => x.UserId,
|
||||||
|
principalTable: "Users",
|
||||||
|
principalColumn: "Id",
|
||||||
|
onDelete: ReferentialAction.Cascade);
|
||||||
|
});
|
||||||
|
|
||||||
|
migrationBuilder.CreateTable(
|
||||||
|
name: "AlbumInteractions",
|
||||||
|
columns: table => new
|
||||||
|
{
|
||||||
|
AlbumId = table.Column<int>(type: "integer", nullable: false),
|
||||||
|
UserId = table.Column<int>(type: "integer", nullable: false),
|
||||||
|
Id = table.Column<int>(type: "integer", nullable: false),
|
||||||
|
PlayDate = table.Column<DateTime>(type: "timestamp with time zone", nullable: true),
|
||||||
|
Starred = table.Column<bool>(type: "boolean", nullable: false)
|
||||||
|
},
|
||||||
|
constraints: table =>
|
||||||
|
{
|
||||||
|
table.PrimaryKey("PK_AlbumInteractions", x => new { x.AlbumId, x.UserId });
|
||||||
|
table.ForeignKey(
|
||||||
|
name: "FK_AlbumInteractions_Albums_AlbumId",
|
||||||
|
column: x => x.AlbumId,
|
||||||
|
principalTable: "Albums",
|
||||||
|
principalColumn: "Id",
|
||||||
|
onDelete: ReferentialAction.Cascade);
|
||||||
|
table.ForeignKey(
|
||||||
|
name: "FK_AlbumInteractions_Users_UserId",
|
||||||
|
column: x => x.UserId,
|
||||||
|
principalTable: "Users",
|
||||||
|
principalColumn: "Id",
|
||||||
|
onDelete: ReferentialAction.Cascade);
|
||||||
|
});
|
||||||
|
|
||||||
|
migrationBuilder.CreateTable(
|
||||||
|
name: "Songs",
|
||||||
|
columns: table => new
|
||||||
|
{
|
||||||
|
Id = table.Column<int>(type: "integer", nullable: false)
|
||||||
|
.Annotation("Npgsql:ValueGenerationStrategy", NpgsqlValueGenerationStrategy.IdentityByDefaultColumn),
|
||||||
|
Title = table.Column<string>(type: "text", nullable: false),
|
||||||
|
Uri = table.Column<string>(type: "text", nullable: false),
|
||||||
|
Filepath = table.Column<string>(type: "text", nullable: false),
|
||||||
|
State = table.Column<int>(type: "integer", nullable: false),
|
||||||
|
Filetype = table.Column<string>(type: "text", nullable: false),
|
||||||
|
Date = table.Column<DateTime>(type: "timestamp with time zone", nullable: false),
|
||||||
|
Duration = table.Column<int>(type: "integer", nullable: false),
|
||||||
|
Bitrate = table.Column<int>(type: "integer", nullable: false),
|
||||||
|
Size = table.Column<int>(type: "integer", nullable: false),
|
||||||
|
Comment = table.Column<string>(type: "text", nullable: true),
|
||||||
|
Channels = table.Column<int>(type: "integer", nullable: false),
|
||||||
|
SamplingRate = table.Column<int>(type: "integer", nullable: false),
|
||||||
|
BitDepth = table.Column<int>(type: "integer", nullable: true),
|
||||||
|
Index = table.Column<int>(type: "integer", nullable: false),
|
||||||
|
TrackNumber = table.Column<int>(type: "integer", nullable: true),
|
||||||
|
DiscNumber = table.Column<int>(type: "integer", nullable: true),
|
||||||
|
AlbumId = table.Column<int>(type: "integer", nullable: false),
|
||||||
|
ArtistId = table.Column<int>(type: "integer", nullable: false),
|
||||||
|
ImageId = table.Column<int>(type: "integer", nullable: true)
|
||||||
|
},
|
||||||
|
constraints: table =>
|
||||||
|
{
|
||||||
|
table.PrimaryKey("PK_Songs", x => x.Id);
|
||||||
|
table.ForeignKey(
|
||||||
|
name: "FK_Songs_Albums_AlbumId",
|
||||||
|
column: x => x.AlbumId,
|
||||||
|
principalTable: "Albums",
|
||||||
|
principalColumn: "Id",
|
||||||
|
onDelete: ReferentialAction.Cascade);
|
||||||
|
table.ForeignKey(
|
||||||
|
name: "FK_Songs_Artists_ArtistId",
|
||||||
|
column: x => x.ArtistId,
|
||||||
|
principalTable: "Artists",
|
||||||
|
principalColumn: "Id",
|
||||||
|
onDelete: ReferentialAction.Cascade);
|
||||||
|
});
|
||||||
|
|
||||||
|
migrationBuilder.CreateTable(
|
||||||
|
name: "PlaylistUsers",
|
||||||
|
columns: table => new
|
||||||
|
{
|
||||||
|
PlaylistId = table.Column<int>(type: "integer", nullable: false),
|
||||||
|
UserId = table.Column<int>(type: "integer", nullable: false)
|
||||||
|
},
|
||||||
|
constraints: table =>
|
||||||
|
{
|
||||||
|
table.PrimaryKey("PK_PlaylistUsers", x => new { x.PlaylistId, x.UserId });
|
||||||
|
table.ForeignKey(
|
||||||
|
name: "FK_PlaylistUsers_Playlists_PlaylistId",
|
||||||
|
column: x => x.PlaylistId,
|
||||||
|
principalTable: "Playlists",
|
||||||
|
principalColumn: "Id",
|
||||||
|
onDelete: ReferentialAction.Cascade);
|
||||||
|
table.ForeignKey(
|
||||||
|
name: "FK_PlaylistUsers_Users_UserId",
|
||||||
|
column: x => x.UserId,
|
||||||
|
principalTable: "Users",
|
||||||
|
principalColumn: "Id",
|
||||||
|
onDelete: ReferentialAction.Cascade);
|
||||||
|
});
|
||||||
|
|
||||||
|
migrationBuilder.CreateTable(
|
||||||
|
name: "GenreSongs",
|
||||||
|
columns: table => new
|
||||||
|
{
|
||||||
|
GenreId = table.Column<int>(type: "integer", nullable: false),
|
||||||
|
SongId = table.Column<int>(type: "integer", nullable: false)
|
||||||
|
},
|
||||||
|
constraints: table =>
|
||||||
|
{
|
||||||
|
table.PrimaryKey("PK_GenreSongs", x => new { x.GenreId, x.SongId });
|
||||||
|
table.ForeignKey(
|
||||||
|
name: "FK_GenreSongs_Genres_GenreId",
|
||||||
|
column: x => x.GenreId,
|
||||||
|
principalTable: "Genres",
|
||||||
|
principalColumn: "Id",
|
||||||
|
onDelete: ReferentialAction.Cascade);
|
||||||
|
table.ForeignKey(
|
||||||
|
name: "FK_GenreSongs_Songs_SongId",
|
||||||
|
column: x => x.SongId,
|
||||||
|
principalTable: "Songs",
|
||||||
|
principalColumn: "Id",
|
||||||
|
onDelete: ReferentialAction.Cascade);
|
||||||
|
});
|
||||||
|
|
||||||
|
migrationBuilder.CreateTable(
|
||||||
|
name: "Images",
|
||||||
|
columns: table => new
|
||||||
|
{
|
||||||
|
Id = table.Column<int>(type: "integer", nullable: false)
|
||||||
|
.Annotation("Npgsql:ValueGenerationStrategy", NpgsqlValueGenerationStrategy.IdentityByDefaultColumn),
|
||||||
|
Uri = table.Column<string>(type: "text", nullable: false),
|
||||||
|
Filetype = table.Column<string>(type: "text", nullable: false),
|
||||||
|
State = table.Column<int>(type: "integer", nullable: false),
|
||||||
|
SongId = table.Column<int>(type: "integer", nullable: true)
|
||||||
|
},
|
||||||
|
constraints: table =>
|
||||||
|
{
|
||||||
|
table.PrimaryKey("PK_Images", x => x.Id);
|
||||||
|
table.ForeignKey(
|
||||||
|
name: "FK_Images_Songs_SongId",
|
||||||
|
column: x => x.SongId,
|
||||||
|
principalTable: "Songs",
|
||||||
|
principalColumn: "Id");
|
||||||
|
});
|
||||||
|
|
||||||
|
migrationBuilder.CreateTable(
|
||||||
|
name: "PlaylistSongs",
|
||||||
|
columns: table => new
|
||||||
|
{
|
||||||
|
PlaylistId = table.Column<int>(type: "integer", nullable: false),
|
||||||
|
SongId = table.Column<int>(type: "integer", nullable: false),
|
||||||
|
Index = table.Column<int>(type: "integer", nullable: false)
|
||||||
|
},
|
||||||
|
constraints: table =>
|
||||||
|
{
|
||||||
|
table.PrimaryKey("PK_PlaylistSongs", x => new { x.PlaylistId, x.SongId });
|
||||||
|
table.ForeignKey(
|
||||||
|
name: "FK_PlaylistSongs_Playlists_PlaylistId",
|
||||||
|
column: x => x.PlaylistId,
|
||||||
|
principalTable: "Playlists",
|
||||||
|
principalColumn: "Id",
|
||||||
|
onDelete: ReferentialAction.Cascade);
|
||||||
|
table.ForeignKey(
|
||||||
|
name: "FK_PlaylistSongs_Songs_SongId",
|
||||||
|
column: x => x.SongId,
|
||||||
|
principalTable: "Songs",
|
||||||
|
principalColumn: "Id",
|
||||||
|
onDelete: ReferentialAction.Cascade);
|
||||||
|
});
|
||||||
|
|
||||||
|
migrationBuilder.CreateTable(
|
||||||
|
name: "SongInteractions",
|
||||||
|
columns: table => new
|
||||||
|
{
|
||||||
|
SongId = table.Column<int>(type: "integer", nullable: false),
|
||||||
|
UserId = table.Column<int>(type: "integer", nullable: false),
|
||||||
|
Id = table.Column<int>(type: "integer", nullable: false),
|
||||||
|
PlayCount = table.Column<int>(type: "integer", nullable: false),
|
||||||
|
Starred = table.Column<bool>(type: "boolean", nullable: true),
|
||||||
|
Rating = table.Column<int>(type: "integer", nullable: false)
|
||||||
|
},
|
||||||
|
constraints: table =>
|
||||||
|
{
|
||||||
|
table.PrimaryKey("PK_SongInteractions", x => new { x.SongId, x.UserId });
|
||||||
|
table.ForeignKey(
|
||||||
|
name: "FK_SongInteractions_Songs_SongId",
|
||||||
|
column: x => x.SongId,
|
||||||
|
principalTable: "Songs",
|
||||||
|
principalColumn: "Id",
|
||||||
|
onDelete: ReferentialAction.Cascade);
|
||||||
|
table.ForeignKey(
|
||||||
|
name: "FK_SongInteractions_Users_UserId",
|
||||||
|
column: x => x.UserId,
|
||||||
|
principalTable: "Users",
|
||||||
|
principalColumn: "Id",
|
||||||
|
onDelete: ReferentialAction.Cascade);
|
||||||
|
});
|
||||||
|
|
||||||
|
migrationBuilder.CreateIndex(
|
||||||
|
name: "IX_AlbumInteractions_UserId",
|
||||||
|
table: "AlbumInteractions",
|
||||||
|
column: "UserId");
|
||||||
|
|
||||||
|
migrationBuilder.CreateIndex(
|
||||||
|
name: "IX_Albums_ArtistId",
|
||||||
|
table: "Albums",
|
||||||
|
column: "ArtistId");
|
||||||
|
|
||||||
|
migrationBuilder.CreateIndex(
|
||||||
|
name: "IX_Albums_Uri",
|
||||||
|
table: "Albums",
|
||||||
|
column: "Uri",
|
||||||
|
unique: true);
|
||||||
|
|
||||||
|
migrationBuilder.CreateIndex(
|
||||||
|
name: "IX_Artists_NormalizedName",
|
||||||
|
table: "Artists",
|
||||||
|
column: "NormalizedName",
|
||||||
|
unique: true);
|
||||||
|
|
||||||
|
migrationBuilder.CreateIndex(
|
||||||
|
name: "IX_Genres_NormalizedName",
|
||||||
|
table: "Genres",
|
||||||
|
column: "NormalizedName",
|
||||||
|
unique: true);
|
||||||
|
|
||||||
|
migrationBuilder.CreateIndex(
|
||||||
|
name: "IX_GenreSongs_SongId",
|
||||||
|
table: "GenreSongs",
|
||||||
|
column: "SongId");
|
||||||
|
|
||||||
|
migrationBuilder.CreateIndex(
|
||||||
|
name: "IX_Globals_Key",
|
||||||
|
table: "Globals",
|
||||||
|
column: "Key",
|
||||||
|
unique: true);
|
||||||
|
|
||||||
|
migrationBuilder.CreateIndex(
|
||||||
|
name: "IX_Images_SongId",
|
||||||
|
table: "Images",
|
||||||
|
column: "SongId",
|
||||||
|
unique: true);
|
||||||
|
|
||||||
|
migrationBuilder.CreateIndex(
|
||||||
|
name: "IX_Playlists_CreatorId",
|
||||||
|
table: "Playlists",
|
||||||
|
column: "CreatorId");
|
||||||
|
|
||||||
|
migrationBuilder.CreateIndex(
|
||||||
|
name: "IX_Playlists_Uri",
|
||||||
|
table: "Playlists",
|
||||||
|
column: "Uri",
|
||||||
|
unique: true);
|
||||||
|
|
||||||
|
migrationBuilder.CreateIndex(
|
||||||
|
name: "IX_PlaylistSongs_SongId",
|
||||||
|
table: "PlaylistSongs",
|
||||||
|
column: "SongId");
|
||||||
|
|
||||||
|
migrationBuilder.CreateIndex(
|
||||||
|
name: "IX_PlaylistUsers_UserId",
|
||||||
|
table: "PlaylistUsers",
|
||||||
|
column: "UserId");
|
||||||
|
|
||||||
|
migrationBuilder.CreateIndex(
|
||||||
|
name: "IX_Radios_NormalizedName",
|
||||||
|
table: "Radios",
|
||||||
|
column: "NormalizedName",
|
||||||
|
unique: true);
|
||||||
|
|
||||||
|
migrationBuilder.CreateIndex(
|
||||||
|
name: "IX_Radios_UserId",
|
||||||
|
table: "Radios",
|
||||||
|
column: "UserId");
|
||||||
|
|
||||||
|
migrationBuilder.CreateIndex(
|
||||||
|
name: "IX_SongInteractions_UserId",
|
||||||
|
table: "SongInteractions",
|
||||||
|
column: "UserId");
|
||||||
|
|
||||||
|
migrationBuilder.CreateIndex(
|
||||||
|
name: "IX_Songs_AlbumId",
|
||||||
|
table: "Songs",
|
||||||
|
column: "AlbumId");
|
||||||
|
|
||||||
|
migrationBuilder.CreateIndex(
|
||||||
|
name: "IX_Songs_ArtistId",
|
||||||
|
table: "Songs",
|
||||||
|
column: "ArtistId");
|
||||||
|
|
||||||
|
migrationBuilder.CreateIndex(
|
||||||
|
name: "IX_Songs_Uri",
|
||||||
|
table: "Songs",
|
||||||
|
column: "Uri",
|
||||||
|
unique: true);
|
||||||
|
|
||||||
|
migrationBuilder.CreateIndex(
|
||||||
|
name: "IX_Users_Name",
|
||||||
|
table: "Users",
|
||||||
|
column: "Name",
|
||||||
|
unique: true);
|
||||||
|
}
|
||||||
|
|
||||||
|
/// <inheritdoc />
|
||||||
|
protected override void Down(MigrationBuilder migrationBuilder)
|
||||||
|
{
|
||||||
|
migrationBuilder.DropTable(
|
||||||
|
name: "AlbumInteractions");
|
||||||
|
|
||||||
|
migrationBuilder.DropTable(
|
||||||
|
name: "GenreSongs");
|
||||||
|
|
||||||
|
migrationBuilder.DropTable(
|
||||||
|
name: "Globals");
|
||||||
|
|
||||||
|
migrationBuilder.DropTable(
|
||||||
|
name: "Images");
|
||||||
|
|
||||||
|
migrationBuilder.DropTable(
|
||||||
|
name: "PlaylistSongs");
|
||||||
|
|
||||||
|
migrationBuilder.DropTable(
|
||||||
|
name: "PlaylistUsers");
|
||||||
|
|
||||||
|
migrationBuilder.DropTable(
|
||||||
|
name: "Radios");
|
||||||
|
|
||||||
|
migrationBuilder.DropTable(
|
||||||
|
name: "SongInteractions");
|
||||||
|
|
||||||
|
migrationBuilder.DropTable(
|
||||||
|
name: "Genres");
|
||||||
|
|
||||||
|
migrationBuilder.DropTable(
|
||||||
|
name: "Playlists");
|
||||||
|
|
||||||
|
migrationBuilder.DropTable(
|
||||||
|
name: "Songs");
|
||||||
|
|
||||||
|
migrationBuilder.DropTable(
|
||||||
|
name: "Users");
|
||||||
|
|
||||||
|
migrationBuilder.DropTable(
|
||||||
|
name: "Albums");
|
||||||
|
|
||||||
|
migrationBuilder.DropTable(
|
||||||
|
name: "Artists");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -1,4 +1,4 @@
|
|||||||
// <auto-generated />
|
// <auto-generated />
|
||||||
using System;
|
using System;
|
||||||
using Microsoft.EntityFrameworkCore;
|
using Microsoft.EntityFrameworkCore;
|
||||||
using Microsoft.EntityFrameworkCore.Infrastructure;
|
using Microsoft.EntityFrameworkCore.Infrastructure;
|
||||||
@@ -213,6 +213,9 @@ namespace Shadow.Migrations
|
|||||||
.IsRequired()
|
.IsRequired()
|
||||||
.HasColumnType("text");
|
.HasColumnType("text");
|
||||||
|
|
||||||
|
b.Property<bool>("Private")
|
||||||
|
.HasColumnType("boolean");
|
||||||
|
|
||||||
b.Property<string>("Uri")
|
b.Property<string>("Uri")
|
||||||
.IsRequired()
|
.IsRequired()
|
||||||
.HasColumnType("text");
|
.HasColumnType("text");
|
||||||
|
|||||||
@@ -67,7 +67,7 @@ public class Seeder
|
|||||||
}
|
}
|
||||||
else
|
else
|
||||||
Console.WriteLine("Upgrade detected. Make sure you're using the most recent migrations.\n" +
|
Console.WriteLine("Upgrade detected. Make sure you're using the most recent migrations.\n" +
|
||||||
"If not, apply them with `dotnet ef database update`.\n");
|
"If not, apply them automatically or with `dotnet ef database update`.\n");
|
||||||
|
|
||||||
lastVersion.Value = ThisAssembly.Git.Commit;
|
lastVersion.Value = ThisAssembly.Git.Commit;
|
||||||
lastVersionDate.Value = ThisAssembly.Git.CommitDate;
|
lastVersionDate.Value = ThisAssembly.Git.CommitDate;
|
||||||
|
|||||||
Reference in New Issue
Block a user