mirror of
https://github.com/zoriya/Kyoo.git
synced 2025-05-24 02:02:36 -04:00
Fix database migration issue
This commit is contained in:
parent
f9df0b8a12
commit
b753fdd2b0
@ -15,6 +15,7 @@ namespace Kyoo.Postgresql.Migrations
|
||||
[Migration("20230621074246_RemoveTrigers")]
|
||||
partial class RemoveTrigers
|
||||
{
|
||||
/// <inheritdoc/>
|
||||
protected override void BuildTargetModel(ModelBuilder modelBuilder)
|
||||
{
|
||||
#pragma warning disable 612, 618
|
||||
|
@ -1,19 +1,33 @@
|
||||
// Kyoo - A portable and vast media library solution.
|
||||
// Copyright (c) Kyoo.
|
||||
//
|
||||
// See AUTHORS.md and LICENSE file in the project root for full license information.
|
||||
//
|
||||
// Kyoo is free software: you can redistribute it and/or modify
|
||||
// it under the terms of the GNU General Public License as published by
|
||||
// the Free Software Foundation, either version 3 of the License, or
|
||||
// any later version.
|
||||
//
|
||||
// Kyoo is distributed in the hope that it will be useful,
|
||||
// but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
// GNU General Public License for more details.
|
||||
//
|
||||
// You should have received a copy of the GNU General Public License
|
||||
// along with Kyoo. If not, see <https://www.gnu.org/licenses/>.
|
||||
|
||||
using Microsoft.EntityFrameworkCore.Migrations;
|
||||
|
||||
namespace Kyoo.Postgresql.Migrations
|
||||
{
|
||||
/// <summary>
|
||||
/// Remove triggers
|
||||
/// </summary>
|
||||
public partial class RemoveTrigers : Migration
|
||||
{
|
||||
/// <inheritdoc/>
|
||||
protected override void Up(MigrationBuilder migrationBuilder)
|
||||
{
|
||||
migrationBuilder.AlterDatabase()
|
||||
.Annotation("Npgsql:Enum:item_type", "show,movie,collection")
|
||||
.Annotation("Npgsql:Enum:status", "unknown,finished,airing,planned")
|
||||
.Annotation("Npgsql:Enum:stream_type", "unknown,video,audio,subtitle")
|
||||
.OldAnnotation("Npgsql:Enum:item_type", "show,movie,collection")
|
||||
.OldAnnotation("Npgsql:Enum:status", "unknown,finished,airing,planned")
|
||||
.OldAnnotation("Npgsql:Enum:stream_type", "unknown,video,audio,subtitle,attachment");
|
||||
|
||||
// language=PostgreSQL
|
||||
migrationBuilder.Sql("DROP TRIGGER show_slug_trigger ON shows;");
|
||||
// language=PostgreSQL
|
||||
@ -36,15 +50,9 @@ namespace Kyoo.Postgresql.Migrations
|
||||
migrationBuilder.Sql(@"DROP FUNCTION episode_update_tracks_slug;");
|
||||
}
|
||||
|
||||
/// <inheritdoc/>
|
||||
protected override void Down(MigrationBuilder migrationBuilder)
|
||||
{
|
||||
migrationBuilder.AlterDatabase()
|
||||
.Annotation("Npgsql:Enum:item_type", "show,movie,collection")
|
||||
.Annotation("Npgsql:Enum:status", "unknown,finished,airing,planned")
|
||||
.Annotation("Npgsql:Enum:stream_type", "unknown,video,audio,subtitle,attachment")
|
||||
.OldAnnotation("Npgsql:Enum:item_type", "show,movie,collection")
|
||||
.OldAnnotation("Npgsql:Enum:status", "unknown,finished,airing,planned")
|
||||
.OldAnnotation("Npgsql:Enum:stream_type", "unknown,video,audio,subtitle");
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -45,11 +45,11 @@ namespace Kyoo.Tests.Database
|
||||
PeopleRepository people = new(_NewContext(), provider,
|
||||
new Lazy<IShowRepository>(() => LibraryManager.ShowRepository));
|
||||
ShowRepository show = new(_NewContext(), studio, people, genre, provider);
|
||||
SeasonRepository season = new(_NewContext(), provider);
|
||||
SeasonRepository season = new(_NewContext(), show, provider);
|
||||
LibraryItemRepository libraryItem = new(_NewContext(),
|
||||
new Lazy<ILibraryRepository>(() => LibraryManager.LibraryRepository));
|
||||
TrackRepository track = new(_NewContext());
|
||||
EpisodeRepository episode = new(_NewContext(), provider, track);
|
||||
EpisodeRepository episode = new(_NewContext(), show, provider, track);
|
||||
UserRepository user = new(_NewContext());
|
||||
|
||||
LibraryManager = new LibraryManager(new IBaseRepository[] {
|
||||
|
@ -80,7 +80,7 @@ services:
|
||||
- "8901:8901"
|
||||
|
||||
postgres:
|
||||
image: "postgres"
|
||||
image: postgres:15
|
||||
restart: on-failure
|
||||
env_file:
|
||||
- ./.env
|
||||
|
@ -58,7 +58,7 @@ services:
|
||||
- "8901:8901"
|
||||
|
||||
postgres:
|
||||
image: postgres
|
||||
image: postgres:15
|
||||
restart: on-failure
|
||||
env_file:
|
||||
- ./.env
|
||||
|
@ -58,7 +58,7 @@ services:
|
||||
- "8901:8901"
|
||||
|
||||
postgres:
|
||||
image: postgres
|
||||
image: postgres:15
|
||||
restart: on-failure
|
||||
env_file:
|
||||
- ./.env
|
||||
|
Loading…
x
Reference in New Issue
Block a user