using Microsoft.EntityFrameworkCore.Migrations;
#nullable disable
namespace MiGu.DB.Migrations.Sqlite
{
///
/// Sqlite 初始 Schema(平台库全量表)。旧 EnsureCreated 库启动时会先基线本迁移名,再应用后续增量。
///
public partial class InitialPlatform : Migration
{
///
protected override void Up(MigrationBuilder migrationBuilder)
{
migrationBuilder.CreateTable(
name: "simple_fields",
columns: table => new
{
id = table.Column(type: "TEXT", maxLength: 36, nullable: false),
car_type = table.Column(type: "TEXT", maxLength: 64, nullable: false),
field_type = table.Column(type: "TEXT", maxLength: 64, nullable: false),
key = table.Column(type: "TEXT", maxLength: 128, nullable: false),
value = table.Column(type: "TEXT", nullable: false),
data_type = table.Column(type: "TEXT", maxLength: 128, nullable: false),
chinese = table.Column(type: "TEXT", maxLength: 256, nullable: true),
english = table.Column(type: "TEXT", maxLength: 256, nullable: true),
other = table.Column(type: "TEXT", maxLength: 512, nullable: false),
is_default = table.Column(type: "INTEGER", nullable: false),
create_time = table.Column(type: "TEXT", maxLength: 19, nullable: false),
update_time = table.Column(type: "TEXT", maxLength: 19, nullable: false)
},
constraints: table =>
{
table.PrimaryKey("PK_simple_fields", x => x.id);
});
migrationBuilder.CreateTable(
name: "user_dashboard_shortcuts",
columns: table => new
{
user_id = table.Column(type: "TEXT", maxLength: 64, nullable: false),
scope = table.Column(type: "TEXT", maxLength: 32, nullable: false),
keys_json = table.Column(type: "text", nullable: false),
updated_at = table.Column(type: "TEXT", maxLength: 40, nullable: false)
},
constraints: table =>
{
table.PrimaryKey("PK_user_dashboard_shortcuts", x => new { x.user_id, x.scope });
});
migrationBuilder.CreateTable(
name: "wms_areas",
columns: table => new
{
Id = table.Column(type: "TEXT", maxLength: 36, nullable: false),
WarehouseId = table.Column(type: "TEXT", maxLength: 36, nullable: false),
Code = table.Column(type: "TEXT", maxLength: 64, nullable: false),
Name = table.Column(type: "TEXT", maxLength: 128, nullable: false),
Type = table.Column(type: "TEXT", maxLength: 64, nullable: false),
LayoutMode = table.Column(type: "TEXT", maxLength: 32, nullable: false),
State = table.Column(type: "TEXT", maxLength: 32, nullable: false),
Enabled = table.Column(type: "INTEGER", nullable: false),
SortOrder = table.Column(type: "INTEGER", nullable: false),
CreatedAt = table.Column(type: "TEXT", maxLength: 40, nullable: false),
UpdatedAt = table.Column(type: "TEXT", maxLength: 40, nullable: false),
CreatedBy = table.Column(type: "TEXT", maxLength: 128, nullable: false),
UpdatedBy = table.Column(type: "TEXT", maxLength: 128, nullable: false),
IsDeleted = table.Column(type: "INTEGER", nullable: false),
DeletedAt = table.Column(type: "TEXT", maxLength: 40, nullable: true),
DeletedBy = table.Column(type: "TEXT", maxLength: 128, nullable: false),
Version = table.Column(type: "INTEGER", nullable: false),
IsLock = table.Column(type: "INTEGER", nullable: false),
Remark = table.Column(type: "TEXT", maxLength: 1000, nullable: false),
Extend = table.Column(type: "text", nullable: false)
},
constraints: table =>
{
table.PrimaryKey("PK_wms_areas", x => x.Id);
});
migrationBuilder.CreateTable(
name: "wms_container_location_history",
columns: table => new
{
Id = table.Column(type: "TEXT", maxLength: 36, nullable: false),
FromLocationType = table.Column(type: "TEXT", maxLength: 32, nullable: false),
FromLocationId = table.Column(type: "TEXT", maxLength: 64, nullable: false),
ToLocationType = table.Column(type: "TEXT", maxLength: 32, nullable: false),
ToLocationId = table.Column(type: "TEXT", maxLength: 64, nullable: false),
RelationId = table.Column(type: "TEXT", maxLength: 36, nullable: true),
EventType = table.Column(type: "TEXT", maxLength: 64, nullable: false),
BeforeJson = table.Column(type: "text", nullable: false),
AfterJson = table.Column(type: "text", nullable: false),
ContainerId = table.Column(type: "TEXT", maxLength: 36, nullable: true),
Operator = table.Column(type: "TEXT", maxLength: 128, nullable: false),
OperatedAt = table.Column(type: "TEXT", maxLength: 40, nullable: false),
Source = table.Column(type: "TEXT", maxLength: 32, nullable: false),
Reason = table.Column(type: "TEXT", maxLength: 500, nullable: false),
Remark = table.Column(type: "TEXT", maxLength: 1000, nullable: false),
Extend = table.Column(type: "text", nullable: false)
},
constraints: table =>
{
table.PrimaryKey("PK_wms_container_location_history", x => x.Id);
});
migrationBuilder.CreateTable(
name: "wms_container_locations",
columns: table => new
{
Id = table.Column(type: "TEXT", maxLength: 36, nullable: false),
ContainerId = table.Column(type: "TEXT", maxLength: 36, nullable: false),
LocationType = table.Column(type: "TEXT", maxLength: 32, nullable: false),
LocationId = table.Column(type: "TEXT", maxLength: 64, nullable: false),
StorageId = table.Column(type: "TEXT", maxLength: 36, nullable: true),
LocationCode = table.Column(type: "TEXT", maxLength: 64, nullable: false),
LocationName = table.Column(type: "TEXT", maxLength: 128, nullable: false),
Status = table.Column(type: "TEXT", maxLength: 32, nullable: false),
EnteredAt = table.Column(type: "TEXT", maxLength: 40, nullable: false),
CreatedAt = table.Column(type: "TEXT", maxLength: 40, nullable: false),
UpdatedAt = table.Column(type: "TEXT", maxLength: 40, nullable: false),
CreatedBy = table.Column(type: "TEXT", maxLength: 128, nullable: false),
UpdatedBy = table.Column(type: "TEXT", maxLength: 128, nullable: false),
IsDeleted = table.Column(type: "INTEGER", nullable: false),
DeletedAt = table.Column(type: "TEXT", maxLength: 40, nullable: true),
DeletedBy = table.Column(type: "TEXT", maxLength: 128, nullable: false),
Version = table.Column(type: "INTEGER", nullable: false),
IsLock = table.Column(type: "INTEGER", nullable: false),
Remark = table.Column(type: "TEXT", maxLength: 1000, nullable: false),
Extend = table.Column(type: "text", nullable: false)
},
constraints: table =>
{
table.PrimaryKey("PK_wms_container_locations", x => x.Id);
});
migrationBuilder.CreateTable(
name: "wms_container_material_history",
columns: table => new
{
Id = table.Column(type: "TEXT", maxLength: 36, nullable: false),
MaterialId = table.Column(type: "TEXT", maxLength: 36, nullable: true),
QuantityDelta = table.Column(type: "TEXT", precision: 18, scale: 4, nullable: false),
RelationId = table.Column(type: "TEXT", maxLength: 36, nullable: true),
EventType = table.Column(type: "TEXT", maxLength: 64, nullable: false),
BeforeJson = table.Column(type: "text", nullable: false),
AfterJson = table.Column(type: "text", nullable: false),
ContainerId = table.Column(type: "TEXT", maxLength: 36, nullable: true),
Operator = table.Column(type: "TEXT", maxLength: 128, nullable: false),
OperatedAt = table.Column(type: "TEXT", maxLength: 40, nullable: false),
Source = table.Column(type: "TEXT", maxLength: 32, nullable: false),
Reason = table.Column(type: "TEXT", maxLength: 500, nullable: false),
Remark = table.Column(type: "TEXT", maxLength: 1000, nullable: false),
Extend = table.Column(type: "text", nullable: false)
},
constraints: table =>
{
table.PrimaryKey("PK_wms_container_material_history", x => x.Id);
});
migrationBuilder.CreateTable(
name: "wms_container_materials",
columns: table => new
{
Id = table.Column(type: "TEXT", maxLength: 36, nullable: false),
ContainerId = table.Column(type: "TEXT", maxLength: 36, nullable: false),
MaterialId = table.Column(type: "TEXT", maxLength: 36, nullable: false),
Quantity = table.Column(type: "TEXT", precision: 18, scale: 4, nullable: false),
BatchNo = table.Column(type: "TEXT", maxLength: 64, nullable: false),
SerialNo = table.Column(type: "TEXT", maxLength: 64, nullable: false),
Status = table.Column(type: "TEXT", maxLength: 32, nullable: false),
BoundAt = table.Column(type: "TEXT", maxLength: 40, nullable: false),
LoadedAt = table.Column(type: "TEXT", maxLength: 40, nullable: false),
UnloadedAt = table.Column(type: "TEXT", maxLength: 40, nullable: true),
CreatedAt = table.Column(type: "TEXT", maxLength: 40, nullable: false),
UpdatedAt = table.Column(type: "TEXT", maxLength: 40, nullable: false),
CreatedBy = table.Column(type: "TEXT", maxLength: 128, nullable: false),
UpdatedBy = table.Column(type: "TEXT", maxLength: 128, nullable: false),
IsDeleted = table.Column(type: "INTEGER", nullable: false),
DeletedAt = table.Column(type: "TEXT", maxLength: 40, nullable: true),
DeletedBy = table.Column(type: "TEXT", maxLength: 128, nullable: false),
Version = table.Column(type: "INTEGER", nullable: false),
IsLock = table.Column(type: "INTEGER", nullable: false),
Remark = table.Column(type: "TEXT", maxLength: 1000, nullable: false),
Extend = table.Column(type: "text", nullable: false)
},
constraints: table =>
{
table.PrimaryKey("PK_wms_container_materials", x => x.Id);
});
migrationBuilder.CreateTable(
name: "wms_containers",
columns: table => new
{
Id = table.Column(type: "TEXT", maxLength: 36, nullable: false),
AreaId = table.Column(type: "TEXT", maxLength: 36, nullable: true),
Code = table.Column(type: "TEXT", maxLength: 64, nullable: false),
Name = table.Column(type: "TEXT", maxLength: 128, nullable: false),
ContainerType = table.Column(type: "TEXT", maxLength: 64, nullable: false),
Status = table.Column(type: "TEXT", maxLength: 32, nullable: false),
Barcode = table.Column(type: "TEXT", maxLength: 128, nullable: false),
Length = table.Column(type: "REAL", nullable: false),
Width = table.Column(type: "REAL", nullable: false),
Height = table.Column(type: "REAL", nullable: false),
Enabled = table.Column(type: "INTEGER", nullable: false),
CreatedAt = table.Column(type: "TEXT", maxLength: 40, nullable: false),
UpdatedAt = table.Column(type: "TEXT", maxLength: 40, nullable: false),
CreatedBy = table.Column(type: "TEXT", maxLength: 128, nullable: false),
UpdatedBy = table.Column(type: "TEXT", maxLength: 128, nullable: false),
IsDeleted = table.Column(type: "INTEGER", nullable: false),
DeletedAt = table.Column(type: "TEXT", maxLength: 40, nullable: true),
DeletedBy = table.Column(type: "TEXT", maxLength: 128, nullable: false),
Version = table.Column(type: "INTEGER", nullable: false),
IsLock = table.Column(type: "INTEGER", nullable: false),
Remark = table.Column(type: "TEXT", maxLength: 1000, nullable: false),
Extend = table.Column(type: "text", nullable: false)
},
constraints: table =>
{
table.PrimaryKey("PK_wms_containers", x => x.Id);
});
migrationBuilder.CreateTable(
name: "wms_material_types",
columns: table => new
{
Id = table.Column(type: "TEXT", maxLength: 36, nullable: false),
Code = table.Column(type: "TEXT", maxLength: 64, nullable: false),
Name = table.Column(type: "TEXT", maxLength: 128, nullable: false),
Spec = table.Column(type: "TEXT", maxLength: 128, nullable: false),
Unit = table.Column(type: "TEXT", maxLength: 32, nullable: false),
Category = table.Column(type: "TEXT", maxLength: 64, nullable: false),
BarcodePrefix = table.Column(type: "TEXT", maxLength: 64, nullable: false),
Enabled = table.Column(type: "INTEGER", nullable: false),
CreatedAt = table.Column(type: "TEXT", maxLength: 40, nullable: false),
UpdatedAt = table.Column(type: "TEXT", maxLength: 40, nullable: false),
CreatedBy = table.Column(type: "TEXT", maxLength: 128, nullable: false),
UpdatedBy = table.Column(type: "TEXT", maxLength: 128, nullable: false),
IsDeleted = table.Column(type: "INTEGER", nullable: false),
DeletedAt = table.Column(type: "TEXT", maxLength: 40, nullable: true),
DeletedBy = table.Column(type: "TEXT", maxLength: 128, nullable: false),
Version = table.Column(type: "INTEGER", nullable: false),
IsLock = table.Column(type: "INTEGER", nullable: false),
Remark = table.Column(type: "TEXT", maxLength: 1000, nullable: false),
Extend = table.Column(type: "text", nullable: false)
},
constraints: table =>
{
table.PrimaryKey("PK_wms_material_types", x => x.Id);
});
migrationBuilder.CreateTable(
name: "wms_materials",
columns: table => new
{
Id = table.Column(type: "TEXT", maxLength: 36, nullable: false),
Code = table.Column(type: "TEXT", maxLength: 64, nullable: false),
Name = table.Column(type: "TEXT", maxLength: 128, nullable: false),
TypeCode = table.Column(type: "TEXT", maxLength: 64, nullable: false),
Barcode = table.Column(type: "TEXT", maxLength: 128, nullable: false),
Spec = table.Column(type: "TEXT", maxLength: 128, nullable: false),
Unit = table.Column(type: "TEXT", maxLength: 32, nullable: false),
Category = table.Column(type: "TEXT", maxLength: 64, nullable: false),
LifecycleStatus = table.Column(type: "TEXT", maxLength: 32, nullable: false),
UnboundAt = table.Column(type: "TEXT", maxLength: 40, nullable: true),
Enabled = table.Column(type: "INTEGER", nullable: false),
CreatedAt = table.Column(type: "TEXT", maxLength: 40, nullable: false),
UpdatedAt = table.Column(type: "TEXT", maxLength: 40, nullable: false),
CreatedBy = table.Column(type: "TEXT", maxLength: 128, nullable: false),
UpdatedBy = table.Column(type: "TEXT", maxLength: 128, nullable: false),
IsDeleted = table.Column(type: "INTEGER", nullable: false),
DeletedAt = table.Column(type: "TEXT", maxLength: 40, nullable: true),
DeletedBy = table.Column(type: "TEXT", maxLength: 128, nullable: false),
Version = table.Column(type: "INTEGER", nullable: false),
IsLock = table.Column(type: "INTEGER", nullable: false),
Remark = table.Column(type: "TEXT", maxLength: 1000, nullable: false),
Extend = table.Column(type: "text", nullable: false)
},
constraints: table =>
{
table.PrimaryKey("PK_wms_materials", x => x.Id);
});
migrationBuilder.CreateTable(
name: "wms_stock_events",
columns: table => new
{
Id = table.Column(type: "TEXT", maxLength: 36, nullable: false),
EventType = table.Column(type: "TEXT", maxLength: 32, nullable: false),
MaterialId = table.Column(type: "TEXT", maxLength: 36, nullable: true),
MaterialCode = table.Column(type: "TEXT", maxLength: 64, nullable: false),
MaterialName = table.Column(type: "TEXT", maxLength: 128, nullable: false),
MaterialBarcode = table.Column(type: "TEXT", maxLength: 128, nullable: false),
MaterialTypeCode = table.Column(type: "TEXT", maxLength: 64, nullable: false),
ContainerId = table.Column(type: "TEXT", maxLength: 36, nullable: true),
ContainerCode = table.Column(type: "TEXT", maxLength: 64, nullable: false),
ContainerName = table.Column(type: "TEXT", maxLength: 128, nullable: false),
StorageId = table.Column(type: "TEXT", maxLength: 36, nullable: true),
StorageCode = table.Column(type: "TEXT", maxLength: 64, nullable: false),
StorageName = table.Column(type: "TEXT", maxLength: 128, nullable: false),
AreaCode = table.Column(type: "TEXT", maxLength: 64, nullable: false),
FromStorageId = table.Column(type: "TEXT", maxLength: 36, nullable: true),
FromStorageCode = table.Column(type: "TEXT", maxLength: 64, nullable: false),
FromStorageName = table.Column(type: "TEXT", maxLength: 128, nullable: false),
ToStorageId = table.Column(type: "TEXT", maxLength: 36, nullable: true),
ToStorageCode = table.Column(type: "TEXT", maxLength: 64, nullable: false),
ToStorageName = table.Column(type: "TEXT", maxLength: 128, nullable: false),
RefType = table.Column(type: "TEXT", maxLength: 64, nullable: false),
RefId = table.Column(type: "TEXT", maxLength: 36, nullable: true),
RefCode = table.Column(type: "TEXT", maxLength: 64, nullable: false),
Operator = table.Column(type: "TEXT", maxLength: 128, nullable: false),
OperatedAt = table.Column(type: "TEXT", maxLength: 40, nullable: false),
Reason = table.Column(type: "TEXT", maxLength: 500, nullable: false)
},
constraints: table =>
{
table.PrimaryKey("PK_wms_stock_events", x => x.Id);
});
migrationBuilder.CreateTable(
name: "wms_storages",
columns: table => new
{
Id = table.Column(type: "TEXT", maxLength: 36, nullable: false),
AreaId = table.Column(type: "TEXT", maxLength: 36, nullable: false),
Code = table.Column(type: "TEXT", maxLength: 64, nullable: false),
Name = table.Column(type: "TEXT", maxLength: 128, nullable: false),
StorageType = table.Column(type: "TEXT", maxLength: 64, nullable: false),
LocationKind = table.Column(type: "TEXT", maxLength: 32, nullable: false),
ColumnNo = table.Column(type: "INTEGER", nullable: false),
LevelNo = table.Column(type: "INTEGER", nullable: false),
DepthNo = table.Column(type: "INTEGER", nullable: false),
SiteId = table.Column(type: "TEXT", maxLength: 64, nullable: false),
SiteCode = table.Column(type: "TEXT", maxLength: 64, nullable: false),
Barcode = table.Column(type: "TEXT", maxLength: 128, nullable: false),
Capacity = table.Column(type: "INTEGER", nullable: false),
Status = table.Column(type: "TEXT", maxLength: 32, nullable: false),
Usage = table.Column(type: "TEXT", maxLength: 64, nullable: false),
Priority = table.Column(type: "INTEGER", nullable: false),
ZoneCode = table.Column(type: "TEXT", maxLength: 64, nullable: false),
AllowInbound = table.Column(type: "INTEGER", nullable: false),
AllowOutbound = table.Column(type: "INTEGER", nullable: false),
Enabled = table.Column(type: "INTEGER", nullable: false),
CreatedAt = table.Column(type: "TEXT", maxLength: 40, nullable: false),
UpdatedAt = table.Column(type: "TEXT", maxLength: 40, nullable: false),
CreatedBy = table.Column(type: "TEXT", maxLength: 128, nullable: false),
UpdatedBy = table.Column(type: "TEXT", maxLength: 128, nullable: false),
IsDeleted = table.Column(type: "INTEGER", nullable: false),
DeletedAt = table.Column(type: "TEXT", maxLength: 40, nullable: true),
DeletedBy = table.Column(type: "TEXT", maxLength: 128, nullable: false),
Version = table.Column(type: "INTEGER", nullable: false),
IsLock = table.Column(type: "INTEGER", nullable: false),
Remark = table.Column(type: "TEXT", maxLength: 1000, nullable: false),
Extend = table.Column(type: "text", nullable: false)
},
constraints: table =>
{
table.PrimaryKey("PK_wms_storages", x => x.Id);
});
migrationBuilder.CreateTable(
name: "wms_transport_reservations",
columns: table => new
{
Id = table.Column(type: "TEXT", maxLength: 36, nullable: false),
TaskId = table.Column(type: "TEXT", maxLength: 36, nullable: false),
ContainerId = table.Column(type: "TEXT", maxLength: 36, nullable: false),
SourceStorageId = table.Column(type: "TEXT", maxLength: 36, nullable: false),
TargetStorageId = table.Column(type: "TEXT", maxLength: 36, nullable: false),
Status = table.Column(type: "TEXT", maxLength: 32, nullable: false),
ExpiresAt = table.Column(type: "TEXT", maxLength: 40, nullable: true),
CreatedAt = table.Column(type: "TEXT", maxLength: 40, nullable: false),
UpdatedAt = table.Column(type: "TEXT", maxLength: 40, nullable: false),
CreatedBy = table.Column(type: "TEXT", maxLength: 128, nullable: false),
UpdatedBy = table.Column(type: "TEXT", maxLength: 128, nullable: false),
IsDeleted = table.Column(type: "INTEGER", nullable: false),
DeletedAt = table.Column(type: "TEXT", maxLength: 40, nullable: true),
DeletedBy = table.Column(type: "TEXT", maxLength: 128, nullable: false),
Version = table.Column(type: "INTEGER", nullable: false),
IsLock = table.Column(type: "INTEGER", nullable: false),
Remark = table.Column(type: "TEXT", maxLength: 1000, nullable: false),
Extend = table.Column(type: "text", nullable: false)
},
constraints: table =>
{
table.PrimaryKey("PK_wms_transport_reservations", x => x.Id);
});
migrationBuilder.CreateTable(
name: "wms_transport_rules",
columns: table => new
{
Id = table.Column(type: "TEXT", maxLength: 36, nullable: false),
Code = table.Column(type: "TEXT", maxLength: 64, nullable: false),
Name = table.Column(type: "TEXT", maxLength: 128, nullable: false),
TriggerType = table.Column(type: "TEXT", maxLength: 32, nullable: false),
Enabled = table.Column(type: "INTEGER", nullable: false),
Priority = table.Column(type: "INTEGER", nullable: false),
SourceSelectorJson = table.Column(type: "text", nullable: false),
TargetSelectorJson = table.Column(type: "text", nullable: false),
TaskOptionsJson = table.Column(type: "text", nullable: false),
CreatedAt = table.Column