forked from ddrilling/AsbCloudServer
60 lines
2.8 KiB
C#
60 lines
2.8 KiB
C#
|
using System;
|
|||
|
using Microsoft.EntityFrameworkCore.Migrations;
|
|||
|
using Npgsql.EntityFrameworkCore.PostgreSQL.Metadata;
|
|||
|
|
|||
|
namespace AsbCloudDb.Migrations
|
|||
|
{
|
|||
|
public partial class Add_File_Marks : Migration
|
|||
|
{
|
|||
|
protected override void Up(MigrationBuilder migrationBuilder)
|
|||
|
{
|
|||
|
migrationBuilder.CreateTable(
|
|||
|
name: "t_file_mark",
|
|||
|
columns: table => new
|
|||
|
{
|
|||
|
id = table.Column<int>(type: "integer", nullable: false)
|
|||
|
.Annotation("Npgsql:ValueGenerationStrategy", NpgsqlValueGenerationStrategy.IdentityByDefaultColumn),
|
|||
|
id_mark = table.Column<int>(type: "integer", nullable: false, comment: "0 - Согласован, \n1 - Отредактирован"),
|
|||
|
date_created = table.Column<DateTime>(type: "timestamp without time zone", nullable: false, comment: "Дата совершенного действия"),
|
|||
|
id_file = table.Column<int>(type: "integer", nullable: false, comment: "id файла"),
|
|||
|
id_user = table.Column<int>(type: "integer", nullable: false, comment: "id пользователя"),
|
|||
|
comment = table.Column<string>(type: "character varying(255)", maxLength: 255, nullable: true, comment: "Комментарий"),
|
|||
|
is_deleted = table.Column<bool>(type: "boolean", nullable: false, comment: "Помечен ли файл как удаленный")
|
|||
|
},
|
|||
|
constraints: table =>
|
|||
|
{
|
|||
|
table.PrimaryKey("PK_t_file_mark", x => x.id);
|
|||
|
table.ForeignKey(
|
|||
|
name: "t_file_mark_t_file_info_fk",
|
|||
|
column: x => x.id_file,
|
|||
|
principalTable: "t_file_info",
|
|||
|
principalColumn: "id",
|
|||
|
onDelete: ReferentialAction.Cascade);
|
|||
|
table.ForeignKey(
|
|||
|
name: "t_user_t_file_mark_fk",
|
|||
|
column: x => x.id_user,
|
|||
|
principalTable: "t_user",
|
|||
|
principalColumn: "id",
|
|||
|
onDelete: ReferentialAction.Cascade);
|
|||
|
},
|
|||
|
comment: "Действия с файлами.");
|
|||
|
|
|||
|
migrationBuilder.CreateIndex(
|
|||
|
name: "IX_t_file_mark_id_file",
|
|||
|
table: "t_file_mark",
|
|||
|
column: "id_file");
|
|||
|
|
|||
|
migrationBuilder.CreateIndex(
|
|||
|
name: "IX_t_file_mark_id_user",
|
|||
|
table: "t_file_mark",
|
|||
|
column: "id_user");
|
|||
|
}
|
|||
|
|
|||
|
protected override void Down(MigrationBuilder migrationBuilder)
|
|||
|
{
|
|||
|
migrationBuilder.DropTable(
|
|||
|
name: "t_file_mark");
|
|||
|
}
|
|||
|
}
|
|||
|
}
|