| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297 |
- using System;
- using Microsoft.EntityFrameworkCore.Migrations;
- #nullable disable
- namespace Business.Migrations
- {
- public partial class AddIndex : Migration
- {
- protected override void Up(MigrationBuilder migrationBuilder)
- {
- migrationBuilder.DropTable(
- name: "ic_item_inventory");
- migrationBuilder.DropIndex(
- name: "IX_srm_supplier_supplier_no_tenant_id_factory_id",
- table: "srm_supplier");
- migrationBuilder.DropIndex(
- name: "IX_srm_po_main_po_billno_tenant_id_factory_id",
- table: "srm_po_main");
- migrationBuilder.DropIndex(
- name: "IX_ic_bom_bom_number_item_number_version_tenant_id_factory_id",
- table: "ic_bom");
- migrationBuilder.DropIndex(
- name: "IX_crm_seorder_bill_no_tenant_id_factory_id",
- table: "crm_seorder");
- migrationBuilder.DropIndex(
- name: "IX_crm_customer_customer_no_tenant_id_factory_id",
- table: "crm_customer");
- migrationBuilder.DropColumn(
- name: "factory_fode",
- table: "ic_item_stock");
- migrationBuilder.AddColumn<string>(
- name: "number",
- table: "srm_purchase",
- type: "nvarchar(20)",
- maxLength: 20,
- nullable: true,
- comment: "物料编码");
- migrationBuilder.AddColumn<string>(
- name: "fversion",
- table: "ic_substitute_group_detail",
- type: "nvarchar(80)",
- maxLength: 80,
- nullable: true,
- comment: "版本号");
- migrationBuilder.AddColumn<string>(
- name: "fversion",
- table: "ic_item_stock",
- type: "nvarchar(80)",
- maxLength: 80,
- nullable: true,
- comment: "版本号");
- migrationBuilder.AddColumn<string>(
- name: "icitem_number",
- table: "ic_item_stock",
- type: "nvarchar(80)",
- maxLength: 80,
- nullable: true,
- comment: "物料编码");
- migrationBuilder.CreateIndex(
- name: "IX_srm_supplier_supplier_no_tenant_id_factory_id",
- table: "srm_supplier",
- columns: new[] { "supplier_no", "tenant_id", "factory_id" },
- unique: true,
- filter: "[supplier_no] IS NOT NULL AND [factory_id] IS NOT NULL");
- migrationBuilder.CreateIndex(
- name: "IX_srm_purchase_supplier_number_number_tenant_id_factory_id",
- table: "srm_purchase",
- columns: new[] { "supplier_number", "number", "tenant_id", "factory_id" },
- unique: true,
- filter: "[supplier_number] IS NOT NULL AND [number] IS NOT NULL AND [factory_id] IS NOT NULL");
- migrationBuilder.CreateIndex(
- name: "IX_srm_pr_main_pr_billno_tenant_id_factory_id",
- table: "srm_pr_main",
- columns: new[] { "pr_billno", "tenant_id", "factory_id" },
- unique: true,
- filter: "[pr_billno] IS NOT NULL AND [factory_id] IS NOT NULL");
- migrationBuilder.CreateIndex(
- name: "IX_srm_po_main_po_billno_tenant_id_factory_id",
- table: "srm_po_main",
- columns: new[] { "po_billno", "tenant_id", "factory_id" },
- unique: true,
- filter: "[po_billno] IS NOT NULL AND [factory_id] IS NOT NULL");
- migrationBuilder.CreateIndex(
- name: "IX_srm_po_list_po_billno_polist_row_tenant_id_factory_id",
- table: "srm_po_list",
- columns: new[] { "po_billno", "polist_row", "tenant_id", "factory_id" },
- unique: true,
- filter: "[po_billno] IS NOT NULL AND [polist_row] IS NOT NULL AND [factory_id] IS NOT NULL");
- migrationBuilder.CreateIndex(
- name: "IX_ic_item_stock_icitem_number_fversion_tenant_id_factory_id",
- table: "ic_item_stock",
- columns: new[] { "icitem_number", "fversion", "tenant_id", "factory_id" },
- unique: true,
- filter: "[icitem_number] IS NOT NULL AND [fversion] IS NOT NULL AND [factory_id] IS NOT NULL");
- migrationBuilder.CreateIndex(
- name: "IX_ic_item_number_fversion_tenant_id_factory_id",
- table: "ic_item",
- columns: new[] { "number", "fversion", "tenant_id", "factory_id" },
- unique: true,
- filter: "[number] IS NOT NULL AND [fversion] IS NOT NULL AND [factory_id] IS NOT NULL");
- migrationBuilder.CreateIndex(
- name: "IX_ic_bom_child_bom_number_item_number_version_tenant_id_factory_id",
- table: "ic_bom_child",
- columns: new[] { "bom_number", "item_number", "version", "tenant_id", "factory_id" },
- unique: true,
- filter: "[bom_number] IS NOT NULL AND [item_number] IS NOT NULL AND [version] IS NOT NULL AND [factory_id] IS NOT NULL");
- migrationBuilder.CreateIndex(
- name: "IX_ic_bom_bom_number_item_number_version_tenant_id_factory_id",
- table: "ic_bom",
- columns: new[] { "bom_number", "item_number", "version", "tenant_id", "factory_id" },
- unique: true,
- filter: "[bom_number] IS NOT NULL AND [item_number] IS NOT NULL AND [version] IS NOT NULL AND [factory_id] IS NOT NULL");
- migrationBuilder.CreateIndex(
- name: "IX_crm_seorderentry_bill_no_entry_seq_tenant_id_factory_id",
- table: "crm_seorderentry",
- columns: new[] { "bill_no", "entry_seq", "tenant_id", "factory_id" },
- unique: true,
- filter: "[bill_no] IS NOT NULL AND [entry_seq] IS NOT NULL AND [factory_id] IS NOT NULL");
- migrationBuilder.CreateIndex(
- name: "IX_crm_seorder_bill_no_tenant_id_factory_id",
- table: "crm_seorder",
- columns: new[] { "bill_no", "tenant_id", "factory_id" },
- unique: true,
- filter: "[bill_no] IS NOT NULL AND [factory_id] IS NOT NULL");
- migrationBuilder.CreateIndex(
- name: "IX_crm_customer_customer_no_tenant_id_factory_id",
- table: "crm_customer",
- columns: new[] { "customer_no", "tenant_id", "factory_id" },
- unique: true,
- filter: "[customer_no] IS NOT NULL AND [factory_id] IS NOT NULL");
- }
- protected override void Down(MigrationBuilder migrationBuilder)
- {
- migrationBuilder.DropIndex(
- name: "IX_srm_supplier_supplier_no_tenant_id_factory_id",
- table: "srm_supplier");
- migrationBuilder.DropIndex(
- name: "IX_srm_purchase_sourcelist_number_icitem_number_tenant_id_factory_id",
- table: "srm_purchase");
- migrationBuilder.DropIndex(
- name: "IX_srm_pr_main_pr_billno_tenant_id_factory_id",
- table: "srm_pr_main");
- migrationBuilder.DropIndex(
- name: "IX_srm_po_main_po_billno_tenant_id_factory_id",
- table: "srm_po_main");
- migrationBuilder.DropIndex(
- name: "IX_srm_po_list_po_billno_polist_row_tenant_id_factory_id",
- table: "srm_po_list");
- migrationBuilder.DropIndex(
- name: "IX_ic_item_stock_icitem_number_fversion_tenant_id_factory_id",
- table: "ic_item_stock");
- migrationBuilder.DropIndex(
- name: "IX_ic_item_number_fversion_tenant_id_factory_id",
- table: "ic_item");
- migrationBuilder.DropIndex(
- name: "IX_ic_bom_child_bom_number_item_number_version_tenant_id_factory_id",
- table: "ic_bom_child");
- migrationBuilder.DropIndex(
- name: "IX_ic_bom_bom_number_item_number_version_tenant_id_factory_id",
- table: "ic_bom");
- migrationBuilder.DropIndex(
- name: "IX_crm_seorderentry_bill_no_entry_seq_tenant_id_factory_id",
- table: "crm_seorderentry");
- migrationBuilder.DropIndex(
- name: "IX_crm_seorder_bill_no_tenant_id_factory_id",
- table: "crm_seorder");
- migrationBuilder.DropIndex(
- name: "IX_crm_customer_customer_no_tenant_id_factory_id",
- table: "crm_customer");
- migrationBuilder.DropColumn(
- name: "icitem_number",
- table: "srm_purchase");
- migrationBuilder.DropColumn(
- name: "fversion",
- table: "ic_substitute_group_detail");
- migrationBuilder.DropColumn(
- name: "fversion",
- table: "ic_item_stock");
- migrationBuilder.DropColumn(
- name: "icitem_number",
- table: "ic_item_stock");
- migrationBuilder.AddColumn<string>(
- name: "factory_fode",
- table: "ic_item_stock",
- type: "nvarchar(80)",
- maxLength: 80,
- nullable: true,
- comment: "工厂编码");
- migrationBuilder.CreateTable(
- name: "ic_item_inventory",
- columns: table => new
- {
- Id = table.Column<long>(type: "bigint", nullable: false),
- IsDeleted = table.Column<bool>(type: "bit", nullable: false, defaultValue: false, comment: "删除标识"),
- bal = table.Column<decimal>(type: "decimal(23,10)", precision: 23, scale: 10, nullable: true, comment: "金额"),
- batch_no = table.Column<string>(type: "nvarchar(80)", maxLength: 80, nullable: true, comment: "批次号"),
- create_by = table.Column<long>(type: "bigint", nullable: true, comment: "创建人id"),
- create_by_name = table.Column<string>(type: "nvarchar(50)", maxLength: 50, nullable: true, comment: "创建人名称"),
- create_time = table.Column<DateTime>(type: "datetime2", nullable: true, comment: "创建时间"),
- factory_id = table.Column<long>(type: "bigint", nullable: true, comment: "工厂ID"),
- icitem_stock_id = table.Column<long>(type: "bigint", nullable: false, comment: "物料库存主键"),
- kf_date = table.Column<DateTime>(type: "datetime2", nullable: true, comment: "保质期时间"),
- kf_period = table.Column<decimal>(type: "decimal(23,10)", precision: 23, scale: 10, nullable: true, comment: "保质期时长"),
- org_id = table.Column<long>(type: "bigint", nullable: true, comment: "组织ID"),
- qty = table.Column<decimal>(type: "decimal(23,10)", precision: 23, scale: 10, nullable: true, comment: "数量"),
- qty_lock = table.Column<decimal>(type: "decimal(23,10)", precision: 23, scale: 10, nullable: true, comment: "锁定库存"),
- rq = table.Column<DateTime>(type: "datetime2", nullable: true, comment: "日期"),
- sec_qty = table.Column<decimal>(type: "decimal(23,10)", precision: 23, scale: 10, nullable: true, comment: "安全库存"),
- stock_id = table.Column<long>(type: "bigint", nullable: false, comment: "仓库id"),
- stock_name = table.Column<string>(type: "nvarchar(80)", maxLength: 80, nullable: true, comment: "仓库名称"),
- stock_place_code = table.Column<string>(type: "nvarchar(80)", maxLength: 80, nullable: true, comment: "库位编码"),
- stock_place_id = table.Column<long>(type: "bigint", nullable: false, comment: "库位id"),
- tenant_id = table.Column<long>(type: "bigint", nullable: false, comment: "企业ID"),
- unit = table.Column<string>(type: "nvarchar(80)", maxLength: 80, nullable: true, comment: "单位"),
- update_by = table.Column<long>(type: "bigint", nullable: true, comment: "修改人"),
- update_by_name = table.Column<string>(type: "nvarchar(50)", maxLength: 50, nullable: true, comment: "修改人名称"),
- update_time = table.Column<DateTime>(type: "datetime2", nullable: true, comment: "修改时间")
- },
- constraints: table =>
- {
- table.PrimaryKey("PK_ic_item_inventory", x => x.Id);
- },
- comment: "物料库存明细表");
- migrationBuilder.CreateIndex(
- name: "IX_srm_supplier_supplier_no_tenant_id_factory_id",
- table: "srm_supplier",
- columns: new[] { "supplier_no", "tenant_id", "factory_id" });
- migrationBuilder.CreateIndex(
- name: "IX_srm_po_main_po_billno_tenant_id_factory_id",
- table: "srm_po_main",
- columns: new[] { "po_billno", "tenant_id", "factory_id" });
- migrationBuilder.CreateIndex(
- name: "IX_ic_bom_bom_number_item_number_version_tenant_id_factory_id",
- table: "ic_bom",
- columns: new[] { "bom_number", "item_number", "version", "tenant_id", "factory_id" });
- migrationBuilder.CreateIndex(
- name: "IX_crm_seorder_bill_no_tenant_id_factory_id",
- table: "crm_seorder",
- columns: new[] { "bill_no", "tenant_id", "factory_id" });
- migrationBuilder.CreateIndex(
- name: "IX_crm_customer_customer_no_tenant_id_factory_id",
- table: "crm_customer",
- columns: new[] { "customer_no", "tenant_id", "factory_id" });
- migrationBuilder.CreateIndex(
- name: "IX_ic_item_inventory_stock_id_stock_place_id_tenant_id_factory_id",
- table: "ic_item_inventory",
- columns: new[] { "stock_id", "stock_place_id", "tenant_id", "factory_id" });
- }
- }
- }
|