Files
zap-stream-api/NostrStreamer/Migrations/20230831134200_AddCredits.cs
2023-08-31 14:20:01 +01:00

23 lines
803 B
C#

using Microsoft.EntityFrameworkCore.Infrastructure;
using Microsoft.EntityFrameworkCore.Migrations;
using NostrStreamer.Database;
namespace NostrStreamer.Migrations;
[DbContext(typeof(StreamerContext))]
[Migration("20230831134200_AddCredits")]
public class AddCredits : Migration {
protected override void Up(MigrationBuilder migrationBuilder)
{
migrationBuilder.Sql("create extension if not exists pgcrypto");
migrationBuilder.Sql(@"insert into ""Payments""
select ""PubKey"", null, true, encode(digest(concat(""PubKey"", now()::text), 'sha256'), 'hex'), 1000 * 1000, now(), null, 2 from ""Users""");
}
protected override void Down(MigrationBuilder migrationBuilder)
{
migrationBuilder.Sql("delete from \"Payments\" where \"Type\" = 2");
}
}