47 lines
1.6 KiB
C#
47 lines
1.6 KiB
C#
using Microsoft.EntityFrameworkCore.Migrations;
|
|
|
|
#nullable disable
|
|
|
|
namespace Moonlight.App.Database.Migrations
|
|
{
|
|
/// <inheritdoc />
|
|
public partial class AddedTransactions : Migration
|
|
{
|
|
/// <inheritdoc />
|
|
protected override void Up(MigrationBuilder migrationBuilder)
|
|
{
|
|
migrationBuilder.CreateTable(
|
|
name: "Transaction",
|
|
columns: table => new
|
|
{
|
|
Id = table.Column<int>(type: "INTEGER", nullable: false)
|
|
.Annotation("Sqlite:Autoincrement", true),
|
|
Price = table.Column<double>(type: "REAL", nullable: false),
|
|
Text = table.Column<string>(type: "TEXT", nullable: false),
|
|
UserId = table.Column<int>(type: "INTEGER", nullable: true)
|
|
},
|
|
constraints: table =>
|
|
{
|
|
table.PrimaryKey("PK_Transaction", x => x.Id);
|
|
table.ForeignKey(
|
|
name: "FK_Transaction_Users_UserId",
|
|
column: x => x.UserId,
|
|
principalTable: "Users",
|
|
principalColumn: "Id");
|
|
});
|
|
|
|
migrationBuilder.CreateIndex(
|
|
name: "IX_Transaction_UserId",
|
|
table: "Transaction",
|
|
column: "UserId");
|
|
}
|
|
|
|
/// <inheritdoc />
|
|
protected override void Down(MigrationBuilder migrationBuilder)
|
|
{
|
|
migrationBuilder.DropTable(
|
|
name: "Transaction");
|
|
}
|
|
}
|
|
}
|