using System;
using Microsoft.EntityFrameworkCore.Migrations;

#nullable disable

namespace DAL.Migrations
{
    public partial class InitialCreate : Migration
    {
        protected override void Up(MigrationBuilder migrationBuilder)
        {
            migrationBuilder.EnsureSchema(
                name: "webapi");

            migrationBuilder.CreateTable(
                name: "AdWebAppToWebAppRole",
                schema: "webapi",
                columns: table => new
                {
                    AdWebAppToWebAppRoleId = table.Column<int>(type: "int", nullable: false)
                        .Annotation("SqlServer:Identity", "1, 1"),
                    WebAppId = table.Column<int>(type: "int", nullable: false),
                    AdWebAppName = table.Column<string>(type: "nvarchar(max)", nullable: true),
                    AdWebAppRoleName = table.Column<string>(type: "nvarchar(max)", nullable: true)
                },
                constraints: table =>
                {
                    table.PrimaryKey("PK_AdWebAppToWebAppRole", x => x.AdWebAppToWebAppRoleId);
                });

            migrationBuilder.CreateTable(
                name: "CostCentre",
                schema: "webapi",
                columns: table => new
                {
                    CostCentreId = table.Column<int>(type: "int", nullable: false)
                        .Annotation("SqlServer:Identity", "1, 1"),
                    CostCentreName = table.Column<string>(type: "nvarchar(max)", nullable: true),
                    SortOrder = table.Column<int>(type: "int", nullable: false)
                },
                constraints: table =>
                {
                    table.PrimaryKey("PK_CostCentre", x => x.CostCentreId);
                });

            migrationBuilder.CreateTable(
                name: "Department",
                schema: "webapi",
                columns: table => new
                {
                    DepartmentId = table.Column<int>(type: "int", nullable: false)
                        .Annotation("SqlServer:Identity", "1, 1"),
                    DepartmentName = table.Column<string>(type: "nvarchar(max)", nullable: true),
                    CostCentreId = table.Column<int>(type: "int", nullable: false),
                    DepartmentTypeId = table.Column<int>(type: "int", nullable: false),
                    HeadofDepartmentId = table.Column<int>(type: "int", nullable: true),
                    ExecutiveDirectorId = table.Column<int>(type: "int", nullable: true),
                    ManagingDirectorId = table.Column<int>(type: "int", nullable: true),
                    DepartmentNameFolder = table.Column<string>(type: "nvarchar(max)", nullable: true),
                    AdGroupDepartmentName = table.Column<string>(type: "nvarchar(max)", nullable: true),
                    ClientId = table.Column<int>(type: "int", nullable: true),
                    IsVirtual = table.Column<bool>(type: "bit", nullable: false),
                    CostCentre = table.Column<string>(type: "nvarchar(max)", nullable: true),
                    HeadofDepartment = table.Column<string>(type: "nvarchar(max)", nullable: true),
                    ExecutiveDirector = table.Column<string>(type: "nvarchar(max)", nullable: true),
                    ManagingDirector = table.Column<string>(type: "nvarchar(max)", nullable: true)
                },
                constraints: table =>
                {
                    table.PrimaryKey("PK_Department", x => x.DepartmentId);
                });

            migrationBuilder.CreateTable(
                name: "DepartmentToWebAppToEmployeeForWindream",
                schema: "webapi",
                columns: table => new
                {
                    DepartmentToWebAppToEmployeeForWindreamId = table.Column<int>(type: "int", nullable: false)
                        .Annotation("SqlServer:Identity", "1, 1"),
                    EmployeeId = table.Column<int>(type: "int", nullable: false),
                    DepartmentId = table.Column<int>(type: "int", nullable: false),
                    DepartmentName = table.Column<string>(type: "nvarchar(max)", nullable: true),
                    ShortName = table.Column<string>(type: "nvarchar(max)", nullable: true),
                    LoginName = table.Column<string>(type: "nvarchar(max)", nullable: true),
                    IsMain = table.Column<int>(type: "int", nullable: false),
                    ClientId = table.Column<int>(type: "int", nullable: true)
                },
                constraints: table =>
                {
                    table.PrimaryKey("PK_DepartmentToWebAppToEmployeeForWindream", x => x.DepartmentToWebAppToEmployeeForWindreamId);
                });

            migrationBuilder.CreateTable(
                name: "DocumentArt",
                schema: "webapi",
                columns: table => new
                {
                    DocumentArtId = table.Column<int>(type: "int", nullable: false)
                        .Annotation("SqlServer:Identity", "1, 1"),
                    Name = table.Column<string>(type: "nvarchar(max)", nullable: true),
                    Shortname = table.Column<string>(type: "nvarchar(max)", nullable: true),
                    RootPath = table.Column<string>(type: "nvarchar(max)", nullable: true),
                    Folder = table.Column<string>(type: "nvarchar(max)", nullable: true),
                    Comment = table.Column<string>(type: "nvarchar(max)", nullable: true),
                    ClientId = table.Column<int>(type: "int", nullable: false),
                    DepartmentNamesList = table.Column<string>(type: "nvarchar(max)", nullable: true)
                },
                constraints: table =>
                {
                    table.PrimaryKey("PK_DocumentArt", x => x.DocumentArtId);
                });

            migrationBuilder.CreateTable(
                name: "DocumentArtToDepartment",
                schema: "webapi",
                columns: table => new
                {
                    DocumentArtToDepartmentId = table.Column<int>(type: "int", nullable: false)
                        .Annotation("SqlServer:Identity", "1, 1"),
                    DepartmentId = table.Column<int>(type: "int", nullable: false),
                    DocumentArtId = table.Column<int>(type: "int", nullable: false),
                    IsActive = table.Column<bool>(type: "bit", nullable: false),
                    UseGlobix = table.Column<bool>(type: "bit", nullable: true),
                    DocumentArtName = table.Column<string>(type: "nvarchar(max)", nullable: true),
                    DocumentArtShortname = table.Column<string>(type: "nvarchar(max)", nullable: true),
                    DocumentArtFolder = table.Column<string>(type: "nvarchar(max)", nullable: true)
                },
                constraints: table =>
                {
                    table.PrimaryKey("PK_DocumentArtToDepartment", x => x.DocumentArtToDepartmentId);
                });

            migrationBuilder.CreateTable(
                name: "Employee",
                schema: "webapi",
                columns: table => new
                {
                    EmployeeId = table.Column<int>(type: "int", nullable: false)
                        .Annotation("SqlServer:Identity", "1, 1"),
                    EmployeeNo = table.Column<string>(type: "nvarchar(max)", nullable: true),
                    Salutation = table.Column<string>(type: "nvarchar(max)", nullable: true),
                    FirstName = table.Column<string>(type: "nvarchar(max)", nullable: true),
                    LastName = table.Column<string>(type: "nvarchar(max)", nullable: true),
                    ShortName = table.Column<string>(type: "nvarchar(max)", nullable: true),
                    Title = table.Column<string>(type: "nvarchar(max)", nullable: true),
                    Position = table.Column<string>(type: "nvarchar(max)", nullable: true),
                    LoginName = table.Column<string>(type: "nvarchar(max)", nullable: true),
                    Email = table.Column<string>(type: "nvarchar(max)", nullable: true),
                    RangId = table.Column<int>(type: "int", nullable: true),
                    ClientId = table.Column<int>(type: "int", nullable: false),
                    IsActive = table.Column<bool>(type: "bit", nullable: true),
                    MandantCode = table.Column<string>(type: "nvarchar(max)", nullable: true),
                    MainDepartmentId = table.Column<int>(type: "int", nullable: true),
                    DepartmentNamesList = table.Column<string>(type: "nvarchar(max)", nullable: true),
                    DepartmentIdList = table.Column<string>(type: "nvarchar(max)", nullable: true),
                    WebappNamesList = table.Column<string>(type: "nvarchar(max)", nullable: true),
                    WebappIdList = table.Column<string>(type: "nvarchar(max)", nullable: true),
                    AttributeNamesList = table.Column<string>(type: "nvarchar(max)", nullable: true),
                    AttributeIdList = table.Column<string>(type: "nvarchar(max)", nullable: true),
                    MobilePhoneNo = table.Column<string>(type: "nvarchar(max)", nullable: true),
                    PhoneNo = table.Column<string>(type: "nvarchar(max)", nullable: true)
                },
                constraints: table =>
                {
                    table.PrimaryKey("PK_Employee", x => x.EmployeeId);
                });

            migrationBuilder.CreateTable(
                name: "EmployeeAttribute",
                schema: "webapi",
                columns: table => new
                {
                    EmployeeAttributeId = table.Column<int>(type: "int", nullable: false)
                        .Annotation("SqlServer:Identity", "1, 1"),
                    Name = table.Column<string>(type: "nvarchar(max)", nullable: true),
                    Shortname = table.Column<string>(type: "nvarchar(max)", nullable: true),
                    RoleList = table.Column<string>(type: "nvarchar(max)", nullable: true),
                    SeqNo = table.Column<int>(type: "int", nullable: true)
                },
                constraints: table =>
                {
                    table.PrimaryKey("PK_EmployeeAttribute", x => x.EmployeeAttributeId);
                });

            migrationBuilder.CreateTable(
                name: "EmployeeStatus",
                schema: "webapi",
                columns: table => new
                {
                    EmployeeStatusId = table.Column<int>(type: "int", nullable: false)
                        .Annotation("SqlServer:Identity", "1, 1"),
                    EmployeeStatusName = table.Column<string>(type: "nvarchar(max)", nullable: true)
                },
                constraints: table =>
                {
                    table.PrimaryKey("PK_EmployeeStatus", x => x.EmployeeStatusId);
                });

            migrationBuilder.CreateTable(
                name: "EmployeeToAttribute",
                schema: "webapi",
                columns: table => new
                {
                    EmployeeToAttributeId = table.Column<int>(type: "int", nullable: false)
                        .Annotation("SqlServer:Identity", "1, 1"),
                    EmployeeId = table.Column<int>(type: "int", nullable: false),
                    EmployeeAttributeId = table.Column<int>(type: "int", nullable: false)
                },
                constraints: table =>
                {
                    table.PrimaryKey("PK_EmployeeToAttribute", x => x.EmployeeToAttributeId);
                });

            migrationBuilder.CreateTable(
                name: "EmployeeToDepartment",
                schema: "webapi",
                columns: table => new
                {
                    EmployeeToDepartmentId = table.Column<int>(type: "int", nullable: false)
                        .Annotation("SqlServer:Identity", "1, 1"),
                    EmployeeId = table.Column<int>(type: "int", nullable: false),
                    DepartmentId = table.Column<int>(type: "int", nullable: false),
                    DepartmentName = table.Column<string>(type: "nvarchar(max)", nullable: true),
                    EmployeeBudget = table.Column<decimal>(type: "decimal(18,2)", nullable: false),
                    EmployeeStatusId = table.Column<int>(type: "int", nullable: true),
                    RangId = table.Column<int>(type: "int", nullable: true)
                },
                constraints: table =>
                {
                    table.PrimaryKey("PK_EmployeeToDepartment", x => x.EmployeeToDepartmentId);
                });

            migrationBuilder.CreateTable(
                name: "EmployeeToWebApp",
                schema: "webapi",
                columns: table => new
                {
                    EmployeeToWebAppId = table.Column<int>(type: "int", nullable: false)
                        .Annotation("SqlServer:Identity", "1, 1"),
                    EmployeeId = table.Column<int>(type: "int", nullable: false),
                    WebAppId = table.Column<int>(type: "int", nullable: false),
                    WebAppRoleId = table.Column<int>(type: "int", nullable: false),
                    DepartmentId = table.Column<int>(type: "int", nullable: true),
                    WebAppRoleName = table.Column<string>(type: "nvarchar(max)", nullable: true),
                    WebAppName = table.Column<string>(type: "nvarchar(max)", nullable: true),
                    DepartmentName = table.Column<string>(type: "nvarchar(max)", nullable: true),
                    ExtendedDepartmentNameList = table.Column<string>(type: "nvarchar(max)", nullable: true),
                    ExtendedDepartmentIdList = table.Column<string>(type: "nvarchar(max)", nullable: true),
                    AdditionalRoleNameList = table.Column<string>(type: "nvarchar(max)", nullable: true),
                    AdditionalRoleIdList = table.Column<string>(type: "nvarchar(max)", nullable: true)
                },
                constraints: table =>
                {
                    table.PrimaryKey("PK_EmployeeToWebApp", x => x.EmployeeToWebAppId);
                });

            migrationBuilder.CreateTable(
                name: "Project",
                schema: "webapi",
                columns: table => new
                {
                    ProjectId = table.Column<int>(type: "int", nullable: false)
                        .Annotation("SqlServer:Identity", "1, 1"),
                    ProjectName = table.Column<string>(type: "nvarchar(max)", nullable: true)
                },
                constraints: table =>
                {
                    table.PrimaryKey("PK_Project", x => x.ProjectId);
                });

            migrationBuilder.CreateTable(
                name: "Rang",
                schema: "webapi",
                columns: table => new
                {
                    RangId = table.Column<int>(type: "int", nullable: false)
                        .Annotation("SqlServer:Identity", "1, 1"),
                    RangName = table.Column<string>(type: "nvarchar(max)", nullable: true),
                    RangShortname = table.Column<string>(type: "nvarchar(max)", nullable: true),
                    RangOrder = table.Column<int>(type: "int", nullable: false)
                },
                constraints: table =>
                {
                    table.PrimaryKey("PK_Rang", x => x.RangId);
                });

            migrationBuilder.CreateTable(
                name: "Subsidiary",
                schema: "webapi",
                columns: table => new
                {
                    SubsidiaryId = table.Column<int>(type: "int", nullable: false)
                        .Annotation("SqlServer:Identity", "1, 1"),
                    ClientId = table.Column<int>(type: "int", nullable: true),
                    Name = table.Column<string>(type: "nvarchar(max)", nullable: true),
                    SubsidiaryCode = table.Column<string>(type: "nvarchar(max)", nullable: true),
                    Comment = table.Column<string>(type: "nvarchar(max)", nullable: true)
                },
                constraints: table =>
                {
                    table.PrimaryKey("PK_Subsidiary", x => x.SubsidiaryId);
                });

            migrationBuilder.CreateTable(
                name: "WebApp",
                schema: "webapi",
                columns: table => new
                {
                    WebAppId = table.Column<int>(type: "int", nullable: false)
                        .Annotation("SqlServer:Identity", "1, 1"),
                    WebAppName = table.Column<string>(type: "nvarchar(max)", nullable: true),
                    WebAppLinkLive = table.Column<string>(type: "nvarchar(max)", nullable: true),
                    WebAppLinkDev = table.Column<string>(type: "nvarchar(max)", nullable: true),
                    IsActive = table.Column<bool>(type: "bit", nullable: false),
                    AdWebAppName = table.Column<string>(type: "nvarchar(max)", nullable: true)
                },
                constraints: table =>
                {
                    table.PrimaryKey("PK_WebApp", x => x.WebAppId);
                });

            migrationBuilder.CreateTable(
                name: "WebAppAdditionalRole",
                schema: "webapi",
                columns: table => new
                {
                    WebAppAdditionalRoleId = table.Column<int>(type: "int", nullable: false)
                        .Annotation("SqlServer:Identity", "1, 1"),
                    WebAppId = table.Column<int>(type: "int", nullable: false),
                    WebAppAdditionalRoleName = table.Column<string>(type: "nvarchar(max)", nullable: true),
                    AdWebAppAdditionalRoleName = table.Column<string>(type: "nvarchar(max)", nullable: true)
                },
                constraints: table =>
                {
                    table.PrimaryKey("PK_WebAppAdditionalRole", x => x.WebAppAdditionalRoleId);
                });

            migrationBuilder.CreateTable(
                name: "WebAppEmployeeInfo",
                schema: "webapi",
                columns: table => new
                {
                    WebAppEmployeeInfoId = table.Column<int>(type: "int", nullable: false)
                        .Annotation("SqlServer:Identity", "1, 1"),
                    EmployeeNo = table.Column<string>(type: "nvarchar(max)", nullable: true),
                    Salutation = table.Column<string>(type: "nvarchar(max)", nullable: true),
                    FirstName = table.Column<string>(type: "nvarchar(max)", nullable: true),
                    LastName = table.Column<string>(type: "nvarchar(max)", nullable: true),
                    ShortName = table.Column<string>(type: "nvarchar(max)", nullable: true),
                    Title = table.Column<string>(type: "nvarchar(max)", nullable: true),
                    Position = table.Column<string>(type: "nvarchar(max)", nullable: true),
                    LoginName = table.Column<string>(type: "nvarchar(max)", nullable: true),
                    Email = table.Column<string>(type: "nvarchar(max)", nullable: true),
                    DepartmentId = table.Column<int>(type: "int", nullable: false),
                    ExtendedDepartmentIdList = table.Column<string>(type: "nvarchar(max)", nullable: true),
                    DepartmentName = table.Column<string>(type: "nvarchar(max)", nullable: true),
                    EmployeeId = table.Column<int>(type: "int", nullable: false),
                    CostCentreId = table.Column<int>(type: "int", nullable: false),
                    RangShortname = table.Column<string>(type: "nvarchar(max)", nullable: true),
                    RangName = table.Column<string>(type: "nvarchar(max)", nullable: true),
                    RangOrder = table.Column<int>(type: "int", nullable: false),
                    ClientId = table.Column<int>(type: "int", nullable: false),
                    WebAppId = table.Column<int>(type: "int", nullable: false)
                },
                constraints: table =>
                {
                    table.PrimaryKey("PK_WebAppEmployeeInfo", x => x.WebAppEmployeeInfoId);
                });

            migrationBuilder.CreateTable(
                name: "WebAppRole",
                schema: "webapi",
                columns: table => new
                {
                    WebAppRoleId = table.Column<int>(type: "int", nullable: false)
                        .Annotation("SqlServer:Identity", "1, 1"),
                    WebAppRoleName = table.Column<string>(type: "nvarchar(max)", nullable: true),
                    WebAppRoleHierarchy = table.Column<int>(type: "int", nullable: false)
                },
                constraints: table =>
                {
                    table.PrimaryKey("PK_WebAppRole", x => x.WebAppRoleId);
                });

            migrationBuilder.CreateTable(
                name: "WebAppToDepartment",
                schema: "webapi",
                columns: table => new
                {
                    WebAppToDepartmentId = table.Column<int>(type: "int", nullable: false)
                        .Annotation("SqlServer:Identity", "1, 1"),
                    EmployeeToWebAppId = table.Column<int>(type: "int", nullable: false),
                    DepartmentId = table.Column<int>(type: "int", nullable: false),
                    DepartmentName = table.Column<string>(type: "nvarchar(max)", nullable: true)
                },
                constraints: table =>
                {
                    table.PrimaryKey("PK_WebAppToDepartment", x => x.WebAppToDepartmentId);
                });

            migrationBuilder.CreateTable(
                name: "WebAppToWebAppAdditionalRole",
                schema: "webapi",
                columns: table => new
                {
                    WebAppToWebAppAdditionalRoleId = table.Column<int>(type: "int", nullable: false)
                        .Annotation("SqlServer:Identity", "1, 1"),
                    WebAppAdditionalRoleId = table.Column<int>(type: "int", nullable: false),
                    EmployeeToWebAppId = table.Column<int>(type: "int", nullable: false)
                },
                constraints: table =>
                {
                    table.PrimaryKey("PK_WebAppToWebAppAdditionalRole", x => x.WebAppToWebAppAdditionalRoleId);
                });

            migrationBuilder.CreateTable(
                name: "WebAppToWebAppRole",
                schema: "webapi",
                columns: table => new
                {
                    WebAppToWebAppRoleId = table.Column<int>(type: "int", nullable: false)
                        .Annotation("SqlServer:Identity", "1, 1"),
                    WebAppId = table.Column<int>(type: "int", nullable: false),
                    WebAppRoleId = table.Column<int>(type: "int", nullable: false),
                    WebAppRoleName = table.Column<string>(type: "nvarchar(max)", nullable: true),
                    WebAppRoleHierarchy = table.Column<int>(type: "int", nullable: false)
                },
                constraints: table =>
                {
                    table.PrimaryKey("PK_WebAppToWebAppRole", x => x.WebAppToWebAppRoleId);
                });

            migrationBuilder.CreateTable(
                name: "WebAppUser",
                schema: "webapi",
                columns: table => new
                {
                    WebAppUserId = table.Column<int>(type: "int", nullable: false)
                        .Annotation("SqlServer:Identity", "1, 1"),
                    Name = table.Column<string>(type: "nvarchar(max)", nullable: true),
                    ShortName = table.Column<string>(type: "nvarchar(max)", nullable: true),
                    LoginName = table.Column<string>(type: "nvarchar(max)", nullable: true),
                    Password = table.Column<string>(type: "nvarchar(max)", nullable: true),
                    RoleList = table.Column<string>(type: "nvarchar(max)", nullable: true),
                    WebAppRoleList = table.Column<string>(type: "nvarchar(max)", nullable: true),
                    JwtExpiredOn = table.Column<DateTime>(type: "datetime2", nullable: true),
                    LastLogin = table.Column<DateTime>(type: "datetime2", nullable: true),
                    ClientVersion = table.Column<string>(type: "nvarchar(max)", nullable: true),
                    Language = table.Column<string>(type: "nvarchar(max)", nullable: true),
                    Culture = table.Column<string>(type: "nvarchar(max)", nullable: true)
                },
                constraints: table =>
                {
                    table.PrimaryKey("PK_WebAppUser", x => x.WebAppUserId);
                });

            migrationBuilder.CreateTable(
                name: "WindreamColumnsToDepartment",
                schema: "webapi",
                columns: table => new
                {
                    WindreamColumnsToDepartmentId = table.Column<int>(type: "int", nullable: false)
                        .Annotation("SqlServer:Identity", "1, 1"),
                    AttributeDwAttrId = table.Column<int>(type: "int", nullable: false),
                    AttributeSzColumnName = table.Column<string>(type: "nvarchar(max)", nullable: true),
                    Comment = table.Column<string>(type: "nvarchar(max)", nullable: true),
                    AttributeDwAttrType = table.Column<int>(type: "int", nullable: false),
                    ComumnLength = table.Column<int>(type: "int", nullable: false),
                    ObjectTypeAttributeSzName = table.Column<string>(type: "nvarchar(max)", nullable: true),
                    ClientId = table.Column<int>(type: "int", nullable: false),
                    ObjectTypeszDocTypeName = table.Column<string>(type: "nvarchar(max)", nullable: true),
                    DepartmentId = table.Column<int>(type: "int", nullable: false),
                    Seq = table.Column<int>(type: "int", nullable: false),
                    WindreamSearchId = table.Column<int>(type: "int", nullable: false)
                },
                constraints: table =>
                {
                    table.PrimaryKey("PK_WindreamColumnsToDepartment", x => x.WindreamColumnsToDepartmentId);
                });

            migrationBuilder.CreateTable(
                name: "WindreamIndex",
                schema: "webapi",
                columns: table => new
                {
                    WindreamIndexId = table.Column<int>(type: "int", nullable: false)
                        .Annotation("SqlServer:Identity", "1, 1"),
                    AttributeDwAttrId = table.Column<int>(type: "int", nullable: false),
                    AttributeSzColumnName = table.Column<string>(type: "nvarchar(max)", nullable: true),
                    Comment = table.Column<string>(type: "nvarchar(max)", nullable: true),
                    ComumnLength = table.Column<int>(type: "int", nullable: true),
                    AttributeDwAttrType = table.Column<int>(type: "int", nullable: true),
                    ClientId = table.Column<int>(type: "int", nullable: false),
                    ObjectTypeAttributeSzName = table.Column<string>(type: "nvarchar(max)", nullable: true)
                },
                constraints: table =>
                {
                    table.PrimaryKey("PK_WindreamIndex", x => x.WindreamIndexId);
                });

            migrationBuilder.CreateTable(
                name: "WindreamIndexToWindreamSearchToDepartment",
                schema: "webapi",
                columns: table => new
                {
                    WindreamIndexToWindreamSearchToDepartmentId = table.Column<int>(type: "int", nullable: false)
                        .Annotation("SqlServer:Identity", "1, 1"),
                    WindreamSearchToDepartmentId = table.Column<int>(type: "int", nullable: false),
                    WindreamIndexId = table.Column<int>(type: "int", nullable: false),
                    Seq = table.Column<int>(type: "int", nullable: false),
                    AttributeSzColumnName = table.Column<string>(type: "nvarchar(max)", nullable: true),
                    ObjectTypeAttributeSzName = table.Column<string>(type: "nvarchar(max)", nullable: true)
                },
                constraints: table =>
                {
                    table.PrimaryKey("PK_WindreamIndexToWindreamSearchToDepartment", x => x.WindreamIndexToWindreamSearchToDepartmentId);
                });

            migrationBuilder.CreateTable(
                name: "WindreamInputFolder",
                schema: "webapi",
                columns: table => new
                {
                    WindreamInputFolderId = table.Column<int>(type: "int", nullable: false)
                        .Annotation("SqlServer:Identity", "1, 1"),
                    Name = table.Column<string>(type: "nvarchar(max)", nullable: true),
                    XMLPath = table.Column<string>(type: "nvarchar(max)", nullable: true),
                    Comment = table.Column<string>(type: "nvarchar(max)", nullable: true),
                    ClientId = table.Column<int>(type: "int", nullable: true)
                },
                constraints: table =>
                {
                    table.PrimaryKey("PK_WindreamInputFolder", x => x.WindreamInputFolderId);
                });

            migrationBuilder.CreateTable(
                name: "WindreamSearch",
                schema: "webapi",
                columns: table => new
                {
                    WindreamSearchId = table.Column<int>(type: "int", nullable: false)
                        .Annotation("SqlServer:Identity", "1, 1"),
                    Name = table.Column<string>(type: "nvarchar(max)", nullable: true),
                    XMLPath = table.Column<string>(type: "nvarchar(max)", nullable: true),
                    Comment = table.Column<string>(type: "nvarchar(max)", nullable: true),
                    ClientId = table.Column<int>(type: "int", nullable: false),
                    Color = table.Column<int>(type: "int", nullable: true),
                    SearchIndex = table.Column<int>(type: "int", nullable: true)
                },
                constraints: table =>
                {
                    table.PrimaryKey("PK_WindreamSearch", x => x.WindreamSearchId);
                });

            migrationBuilder.CreateTable(
                name: "WindreamSearchItem",
                schema: "webapi",
                columns: table => new
                {
                    WindreamSearchItemId = table.Column<int>(type: "int", nullable: false)
                        .Annotation("SqlServer:Identity", "1, 1"),
                    Name = table.Column<string>(type: "nvarchar(max)", nullable: true),
                    Comment = table.Column<string>(type: "nvarchar(max)", nullable: true),
                    ClientId = table.Column<int>(type: "int", nullable: false),
                    Caption = table.Column<string>(type: "nvarchar(max)", nullable: true),
                    PlaceHolder = table.Column<string>(type: "nvarchar(max)", nullable: true),
                    SearchTemplate = table.Column<string>(type: "nvarchar(max)", nullable: true),
                    ConnectedList = table.Column<string>(type: "nvarchar(max)", nullable: true),
                    AlternativeWindreamSearchItemIdList = table.Column<string>(type: "nvarchar(max)", nullable: true)
                },
                constraints: table =>
                {
                    table.PrimaryKey("PK_WindreamSearchItem", x => x.WindreamSearchItemId);
                });

            migrationBuilder.CreateTable(
                name: "WindreamSearchItemToWindreamSearchToDepartment",
                schema: "webapi",
                columns: table => new
                {
                    WindreamSearchItemToWindreamSearchToDepartmentId = table.Column<int>(type: "int", nullable: false)
                        .Annotation("SqlServer:Identity", "1, 1"),
                    WindreamSearchToDepartmentId = table.Column<int>(type: "int", nullable: false),
                    Seq = table.Column<int>(type: "int", nullable: false),
                    WindreamSearchItemId = table.Column<int>(type: "int", nullable: false),
                    DepartmentId = table.Column<int>(type: "int", nullable: false),
                    WindreamSearchItemName = table.Column<string>(type: "nvarchar(max)", nullable: true),
                    WindreamSearchItemCaption = table.Column<string>(type: "nvarchar(max)", nullable: true),
                    WindreamSearchItemPlaceHolder = table.Column<string>(type: "nvarchar(max)", nullable: true),
                    WindreamSearchItemSearchTemplate = table.Column<string>(type: "nvarchar(max)", nullable: true),
                    WindreamSearchItemTemplate = table.Column<string>(type: "nvarchar(max)", nullable: true),
                    WindreamSearchItemConnectedList = table.Column<string>(type: "nvarchar(max)", nullable: true),
                    WindreamSearchItemComment = table.Column<string>(type: "nvarchar(max)", nullable: true),
                    WindreamSearchIndexType = table.Column<int>(type: "int", nullable: true)
                },
                constraints: table =>
                {
                    table.PrimaryKey("PK_WindreamSearchItemToWindreamSearchToDepartment", x => x.WindreamSearchItemToWindreamSearchToDepartmentId);
                });

            migrationBuilder.CreateTable(
                name: "WindreamSearchToDepartment",
                schema: "webapi",
                columns: table => new
                {
                    WindreamSearchToDepartmentId = table.Column<int>(type: "int", nullable: false)
                        .Annotation("SqlServer:Identity", "1, 1"),
                    DepartmentId = table.Column<int>(type: "int", nullable: false),
                    WindreamSearchId = table.Column<int>(type: "int", nullable: false),
                    Seq = table.Column<int>(type: "int", nullable: false),
                    IsActive = table.Column<bool>(type: "bit", nullable: false),
                    DepartmentName = table.Column<string>(type: "nvarchar(max)", nullable: true),
                    WindreamSearchName = table.Column<string>(type: "nvarchar(max)", nullable: true),
                    WindreamSearchXMLPath = table.Column<string>(type: "nvarchar(max)", nullable: true),
                    WindreamSearchComment = table.Column<string>(type: "nvarchar(max)", nullable: true),
                    WindreamSearchColor = table.Column<int>(type: "int", nullable: true)
                },
                constraints: table =>
                {
                    table.PrimaryKey("PK_WindreamSearchToDepartment", x => x.WindreamSearchToDepartmentId);
                });
        }

        protected override void Down(MigrationBuilder migrationBuilder)
        {
            migrationBuilder.DropTable(
                name: "AdWebAppToWebAppRole",
                schema: "webapi");

            migrationBuilder.DropTable(
                name: "CostCentre",
                schema: "webapi");

            migrationBuilder.DropTable(
                name: "Department",
                schema: "webapi");

            migrationBuilder.DropTable(
                name: "DepartmentToWebAppToEmployeeForWindream",
                schema: "webapi");

            migrationBuilder.DropTable(
                name: "DocumentArt",
                schema: "webapi");

            migrationBuilder.DropTable(
                name: "DocumentArtToDepartment",
                schema: "webapi");

            migrationBuilder.DropTable(
                name: "Employee",
                schema: "webapi");

            migrationBuilder.DropTable(
                name: "EmployeeAttribute",
                schema: "webapi");

            migrationBuilder.DropTable(
                name: "EmployeeStatus",
                schema: "webapi");

            migrationBuilder.DropTable(
                name: "EmployeeToAttribute",
                schema: "webapi");

            migrationBuilder.DropTable(
                name: "EmployeeToDepartment",
                schema: "webapi");

            migrationBuilder.DropTable(
                name: "EmployeeToWebApp",
                schema: "webapi");

            migrationBuilder.DropTable(
                name: "Project",
                schema: "webapi");

            migrationBuilder.DropTable(
                name: "Rang",
                schema: "webapi");

            migrationBuilder.DropTable(
                name: "Subsidiary",
                schema: "webapi");

            migrationBuilder.DropTable(
                name: "WebApp",
                schema: "webapi");

            migrationBuilder.DropTable(
                name: "WebAppAdditionalRole",
                schema: "webapi");

            migrationBuilder.DropTable(
                name: "WebAppEmployeeInfo",
                schema: "webapi");

            migrationBuilder.DropTable(
                name: "WebAppRole",
                schema: "webapi");

            migrationBuilder.DropTable(
                name: "WebAppToDepartment",
                schema: "webapi");

            migrationBuilder.DropTable(
                name: "WebAppToWebAppAdditionalRole",
                schema: "webapi");

            migrationBuilder.DropTable(
                name: "WebAppToWebAppRole",
                schema: "webapi");

            migrationBuilder.DropTable(
                name: "WebAppUser",
                schema: "webapi");

            migrationBuilder.DropTable(
                name: "WindreamColumnsToDepartment",
                schema: "webapi");

            migrationBuilder.DropTable(
                name: "WindreamIndex",
                schema: "webapi");

            migrationBuilder.DropTable(
                name: "WindreamIndexToWindreamSearchToDepartment",
                schema: "webapi");

            migrationBuilder.DropTable(
                name: "WindreamInputFolder",
                schema: "webapi");

            migrationBuilder.DropTable(
                name: "WindreamSearch",
                schema: "webapi");

            migrationBuilder.DropTable(
                name: "WindreamSearchItem",
                schema: "webapi");

            migrationBuilder.DropTable(
                name: "WindreamSearchItemToWindreamSearchToDepartment",
                schema: "webapi");

            migrationBuilder.DropTable(
                name: "WindreamSearchToDepartment",
                schema: "webapi");
        }
    }
}
