74 lines
3.0 KiB
C#
74 lines
3.0 KiB
C#
using System;
|
|
using Microsoft.EntityFrameworkCore.Migrations;
|
|
|
|
#nullable disable
|
|
|
|
namespace MyOffice.Migrations.Postgres.Migrations
|
|
{
|
|
/// <inheritdoc />
|
|
public partial class MotionAccountFix2 : Migration
|
|
{
|
|
/// <inheritdoc />
|
|
protected override void Up(MigrationBuilder migrationBuilder)
|
|
{
|
|
migrationBuilder.CreateTable(
|
|
name: "AccountMotions",
|
|
columns: table => new
|
|
{
|
|
Id = table.Column<Guid>(type: "uuid", nullable: false),
|
|
CreatedOn = table.Column<DateTime>(type: "timestamp with time zone", nullable: false),
|
|
DateTime = table.Column<DateTime>(type: "timestamp with time zone", nullable: false),
|
|
MotionId = table.Column<int>(type: "integer", nullable: false),
|
|
AccountId = table.Column<Guid>(type: "uuid", nullable: false),
|
|
Description = table.Column<string>(type: "text", nullable: true),
|
|
AmountPlus = table.Column<decimal>(type: "numeric", nullable: false),
|
|
AmountMinus = table.Column<decimal>(type: "numeric", nullable: false),
|
|
UserId = table.Column<Guid>(type: "uuid", nullable: true)
|
|
},
|
|
constraints: table =>
|
|
{
|
|
table.PrimaryKey("PK_AccountMotions", x => x.Id);
|
|
table.ForeignKey(
|
|
name: "FK_AccountMotions_Accounts_AccountId",
|
|
column: x => x.AccountId,
|
|
principalTable: "Accounts",
|
|
principalColumn: "Id",
|
|
onDelete: ReferentialAction.Cascade);
|
|
table.ForeignKey(
|
|
name: "FK_AccountMotions_Motions_MotionId",
|
|
column: x => x.MotionId,
|
|
principalTable: "Motions",
|
|
principalColumn: "Id",
|
|
onDelete: ReferentialAction.Cascade);
|
|
table.ForeignKey(
|
|
name: "FK_AccountMotions_Users_UserId",
|
|
column: x => x.UserId,
|
|
principalTable: "Users",
|
|
principalColumn: "Id");
|
|
});
|
|
|
|
migrationBuilder.CreateIndex(
|
|
name: "IX_AccountMotions_AccountId",
|
|
table: "AccountMotions",
|
|
column: "AccountId");
|
|
|
|
migrationBuilder.CreateIndex(
|
|
name: "IX_AccountMotions_MotionId",
|
|
table: "AccountMotions",
|
|
column: "MotionId");
|
|
|
|
migrationBuilder.CreateIndex(
|
|
name: "IX_AccountMotions_UserId",
|
|
table: "AccountMotions",
|
|
column: "UserId");
|
|
}
|
|
|
|
/// <inheritdoc />
|
|
protected override void Down(MigrationBuilder migrationBuilder)
|
|
{
|
|
migrationBuilder.DropTable(
|
|
name: "AccountMotions");
|
|
}
|
|
}
|
|
}
|