You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
158 lines
5.3 KiB
158 lines
5.3 KiB
using System;
|
|
using Microsoft.EntityFrameworkCore.Migrations;
|
|
|
|
#nullable disable
|
|
|
|
namespace Shentun.Peis.Migrations
|
|
{
|
|
public partial class init20240420003 : Migration
|
|
{
|
|
protected override void Up(MigrationBuilder migrationBuilder)
|
|
{
|
|
migrationBuilder.DropForeignKey(
|
|
name: "fk_lis_request_sample_group",
|
|
table: "lis_request");
|
|
|
|
migrationBuilder.DropForeignKey(
|
|
name: "fk_sample_",
|
|
table: "sample_group");
|
|
|
|
migrationBuilder.DropIndex(
|
|
name: "IX_lis_request_sample_group_id",
|
|
table: "lis_request");
|
|
|
|
migrationBuilder.DropColumn(
|
|
name: "sample_group_id",
|
|
table: "lis_request");
|
|
|
|
migrationBuilder.DropColumn(
|
|
name: "sampler",
|
|
table: "lis_request");
|
|
|
|
migrationBuilder.AddColumn<Guid>(
|
|
name: "sample_container_id",
|
|
table: "lis_request",
|
|
type: "uuid",
|
|
nullable: false,
|
|
defaultValue: new Guid("00000000-0000-0000-0000-000000000000"),
|
|
comment: "标本容器编号");
|
|
|
|
migrationBuilder.AddColumn<Guid>(
|
|
name: "sample_type_id",
|
|
table: "lis_request",
|
|
type: "uuid",
|
|
nullable: false,
|
|
defaultValue: new Guid("00000000-0000-0000-0000-000000000000"),
|
|
comment: "标本类型");
|
|
|
|
migrationBuilder.AddColumn<Guid>(
|
|
name: "sampler_id",
|
|
table: "lis_request",
|
|
type: "uuid",
|
|
nullable: true,
|
|
comment: "采样人ID");
|
|
|
|
migrationBuilder.CreateIndex(
|
|
name: "IX_lis_request_sample_container_id",
|
|
table: "lis_request",
|
|
column: "sample_container_id");
|
|
|
|
migrationBuilder.CreateIndex(
|
|
name: "IX_lis_request_sample_type_id",
|
|
table: "lis_request",
|
|
column: "sample_type_id");
|
|
|
|
migrationBuilder.AddForeignKey(
|
|
name: "fk_lis_request_sample_container",
|
|
table: "lis_request",
|
|
column: "sample_container_id",
|
|
principalTable: "sample_container",
|
|
principalColumn: "id");
|
|
|
|
migrationBuilder.AddForeignKey(
|
|
name: "fk_lis_request_sample_type",
|
|
table: "lis_request",
|
|
column: "sample_type_id",
|
|
principalTable: "sample_type",
|
|
principalColumn: "id");
|
|
|
|
migrationBuilder.AddForeignKey(
|
|
name: "fk_sample_group_sample_container",
|
|
table: "sample_group",
|
|
column: "sample_container_id",
|
|
principalTable: "sample_container",
|
|
principalColumn: "id");
|
|
}
|
|
|
|
protected override void Down(MigrationBuilder migrationBuilder)
|
|
{
|
|
migrationBuilder.DropForeignKey(
|
|
name: "fk_lis_request_sample_container",
|
|
table: "lis_request");
|
|
|
|
migrationBuilder.DropForeignKey(
|
|
name: "fk_lis_request_sample_type",
|
|
table: "lis_request");
|
|
|
|
migrationBuilder.DropForeignKey(
|
|
name: "fk_sample_group_sample_container",
|
|
table: "sample_group");
|
|
|
|
migrationBuilder.DropIndex(
|
|
name: "IX_lis_request_sample_container_id",
|
|
table: "lis_request");
|
|
|
|
migrationBuilder.DropIndex(
|
|
name: "IX_lis_request_sample_type_id",
|
|
table: "lis_request");
|
|
|
|
migrationBuilder.DropColumn(
|
|
name: "sample_container_id",
|
|
table: "lis_request");
|
|
|
|
migrationBuilder.DropColumn(
|
|
name: "sample_type_id",
|
|
table: "lis_request");
|
|
|
|
migrationBuilder.DropColumn(
|
|
name: "sampler_id",
|
|
table: "lis_request");
|
|
|
|
migrationBuilder.AddColumn<Guid>(
|
|
name: "sample_group_id",
|
|
table: "lis_request",
|
|
type: "uuid",
|
|
fixedLength: true,
|
|
nullable: false,
|
|
defaultValue: new Guid("00000000-0000-0000-0000-000000000000"),
|
|
comment: "条码分组ID");
|
|
|
|
migrationBuilder.AddColumn<string>(
|
|
name: "sampler",
|
|
table: "lis_request",
|
|
type: "character varying(16)",
|
|
maxLength: 16,
|
|
nullable: true,
|
|
comment: "采样人姓名");
|
|
|
|
migrationBuilder.CreateIndex(
|
|
name: "IX_lis_request_sample_group_id",
|
|
table: "lis_request",
|
|
column: "sample_group_id");
|
|
|
|
migrationBuilder.AddForeignKey(
|
|
name: "fk_lis_request_sample_group",
|
|
table: "lis_request",
|
|
column: "sample_group_id",
|
|
principalTable: "sample_group",
|
|
principalColumn: "id");
|
|
|
|
migrationBuilder.AddForeignKey(
|
|
name: "fk_sample_",
|
|
table: "sample_group",
|
|
column: "sample_container_id",
|
|
principalTable: "sample_container",
|
|
principalColumn: "id");
|
|
}
|
|
}
|
|
}
|