53 lines
901 B
C#
53 lines
901 B
C#
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" = 1;
|
|
|
|
COMMIT;
|
|
END;
|
|
$$;
|
|
|
|
""");
|
|
|
|
migrationBuilder.Sql("""
|
|
|
|
CREATE OR REPLACE PROCEDURE force_rescan()
|
|
LANGUAGE plpgsql
|
|
AS $$
|
|
BEGIN
|
|
UPDATE "Globals"
|
|
SET "Value" = '0'
|
|
WHERE "Key" = 'libraryState';
|
|
|
|
COMMIT;
|
|
END;
|
|
$$;
|
|
|
|
""");
|
|
}
|
|
|
|
protected override void Down(MigrationBuilder migrationBuilder)
|
|
{
|
|
migrationBuilder.Sql("""
|
|
DROP PROCEDURE IF EXISTS song_cleanup();
|
|
""");
|
|
|
|
migrationBuilder.Sql("""
|
|
DROP PROCEDURE IF EXISTS force_rescan();
|
|
""");
|
|
}
|
|
}
|
|
|