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: "dbo");

            migrationBuilder.CreateTable(
                name: "TBSTF_AD_WEB_APP_TO_WEB_APP_ROLE",
                schema: "dbo",
                columns: table => new
                {
                    AD_WEB_APP_TO_WEB_APP_ROLE_ID = table.Column<int>(type: "int", nullable: false)
                        .Annotation("SqlServer:Identity", "1, 1"),
                    WEB_APP_ID = table.Column<int>(type: "int", nullable: false),
                    AD_WEB_APP_NAME = table.Column<string>(type: "nvarchar(max)", nullable: true),
                    AD_WEB_APP_ROLE_NAME = table.Column<string>(type: "nvarchar(max)", nullable: true)
                },
                constraints: table =>
                {
                    table.PrimaryKey("PK_TBSTF_AD_WEB_APP_TO_WEB_APP_ROLE", x => x.AD_WEB_APP_TO_WEB_APP_ROLE_ID);
                });

            migrationBuilder.CreateTable(
                name: "TBSTF_COST_CENTRE",
                schema: "dbo",
                columns: table => new
                {
                    COST_CENTRE_ID = table.Column<int>(type: "int", nullable: false)
                        .Annotation("SqlServer:Identity", "1, 1"),
                    COST_CENTRE_NAME = table.Column<string>(type: "nvarchar(max)", nullable: true),
                    SORT_ORDER = table.Column<int>(type: "int", nullable: false)
                },
                constraints: table =>
                {
                    table.PrimaryKey("PK_TBSTF_COST_CENTRE", x => x.COST_CENTRE_ID);
                });

            migrationBuilder.CreateTable(
                name: "TBSTF_DEPARTMENT",
                schema: "dbo",
                columns: table => new
                {
                    DEPARTMENT_ID = table.Column<int>(type: "int", nullable: false)
                        .Annotation("SqlServer:Identity", "1, 1"),
                    DEPARTMENT_NAME = table.Column<string>(type: "nvarchar(max)", nullable: true),
                    COST_CENTRE_ID = table.Column<int>(type: "int", nullable: false),
                    DEPARTMENT_TYPE_ID = table.Column<int>(type: "int", nullable: false),
                    HEADOF_DEPARTMENT_ID = table.Column<int>(type: "int", nullable: true),
                    EXECUTIVE_DIRECTOR_ID = table.Column<int>(type: "int", nullable: true),
                    MANAGING_DIRECTOR_ID = table.Column<int>(type: "int", nullable: true),
                    DEPARTMENT_NAME_FOLDER = table.Column<string>(type: "nvarchar(max)", nullable: true),
                    AD_GROUP_DEPARTMENT_NAME = table.Column<string>(type: "nvarchar(max)", nullable: true),
                    CLIENT_ID = table.Column<int>(type: "int", nullable: true),
                    IS_VIRTUAL = table.Column<bool>(type: "bit", nullable: false),
                    COST_CENTRE = table.Column<string>(type: "nvarchar(max)", nullable: true),
                    HEADOF_DEPARTMENT = table.Column<string>(type: "nvarchar(max)", nullable: true),
                    EXECUTIVE_DIRECTOR = table.Column<string>(type: "nvarchar(max)", nullable: true),
                    MANAGING_DIRECTOR = table.Column<string>(type: "nvarchar(max)", nullable: true)
                },
                constraints: table =>
                {
                    table.PrimaryKey("PK_TBSTF_DEPARTMENT", x => x.DEPARTMENT_ID);
                });

            migrationBuilder.CreateTable(
                name: "TBSTF_DEPARTMENT_TO_WEB_APP_TO_EMPLOYEE_FOR_WINDREAM",
                schema: "dbo",
                columns: table => new
                {
                    DEPARTMENT_TO_WEB_APP_TO_EMPLOYEE_FOR_WINDREAM_ID = table.Column<int>(type: "int", nullable: false)
                        .Annotation("SqlServer:Identity", "1, 1"),
                    EMPLOYEE_ID = table.Column<int>(type: "int", nullable: false),
                    DEPARTMENT_ID = table.Column<int>(type: "int", nullable: false),
                    DEPARTMENT_NAME = table.Column<string>(type: "nvarchar(max)", nullable: true),
                    SHORT_NAME = table.Column<string>(type: "nvarchar(max)", nullable: true),
                    LOGIN_NAME = table.Column<string>(type: "nvarchar(max)", nullable: true),
                    IS_MAIN = table.Column<int>(type: "int", nullable: false),
                    CLIENT_ID = table.Column<int>(type: "int", nullable: true)
                },
                constraints: table =>
                {
                    table.PrimaryKey("PK_TBSTF_DEPARTMENT_TO_WEB_APP_TO_EMPLOYEE_FOR_WINDREAM", x => x.DEPARTMENT_TO_WEB_APP_TO_EMPLOYEE_FOR_WINDREAM_ID);
                });

            migrationBuilder.CreateTable(
                name: "TBSTF_DOCUMENT_ART",
                schema: "dbo",
                columns: table => new
                {
                    DOCUMENT_ART_ID = 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),
                    ROOT_PATH = 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),
                    CLIENT_ID = table.Column<int>(type: "int", nullable: false),
                    DEPARTMENT_NAMES_LIST = table.Column<string>(type: "nvarchar(max)", nullable: true)
                },
                constraints: table =>
                {
                    table.PrimaryKey("PK_TBSTF_DOCUMENT_ART", x => x.DOCUMENT_ART_ID);
                });

            migrationBuilder.CreateTable(
                name: "TBSTF_DOCUMENT_ART_TO_DEPARTMENT",
                schema: "dbo",
                columns: table => new
                {
                    DOCUMENT_ART_TO_DEPARTMENT_ID = table.Column<int>(type: "int", nullable: false)
                        .Annotation("SqlServer:Identity", "1, 1"),
                    DEPARTMENT_ID = table.Column<int>(type: "int", nullable: false),
                    DOCUMENT_ART_ID = table.Column<int>(type: "int", nullable: false),
                    IS_ACTIVE = table.Column<bool>(type: "bit", nullable: false),
                    USE_GLOBIX = table.Column<bool>(type: "bit", nullable: true),
                    DOCUMENT_ART_NAME = table.Column<string>(type: "nvarchar(max)", nullable: true),
                    DOCUMENT_ART_SHORTNAME = table.Column<string>(type: "nvarchar(max)", nullable: true),
                    DOCUMENT_ART_FOLDER = table.Column<string>(type: "nvarchar(max)", nullable: true)
                },
                constraints: table =>
                {
                    table.PrimaryKey("PK_TBSTF_DOCUMENT_ART_TO_DEPARTMENT", x => x.DOCUMENT_ART_TO_DEPARTMENT_ID);
                });

            migrationBuilder.CreateTable(
                name: "TBSTF_EMPLOYEE",
                schema: "dbo",
                columns: table => new
                {
                    EMPLOYEE_ID = table.Column<int>(type: "int", nullable: false)
                        .Annotation("SqlServer:Identity", "1, 1"),
                    EMPLOYEE_NO = table.Column<string>(type: "nvarchar(max)", nullable: true),
                    SALUTATION = table.Column<string>(type: "nvarchar(max)", nullable: true),
                    FIRST_NAME = table.Column<string>(type: "nvarchar(max)", nullable: true),
                    LAST_NAME = table.Column<string>(type: "nvarchar(max)", nullable: true),
                    SHORT_NAME = 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),
                    LOGIN_NAME = table.Column<string>(type: "nvarchar(max)", nullable: true),
                    EMAIL = table.Column<string>(type: "nvarchar(max)", nullable: true),
                    RANG_ID = table.Column<int>(type: "int", nullable: true),
                    CLIENT_ID = table.Column<int>(type: "int", nullable: false),
                    IS_ACTIVE = table.Column<bool>(type: "bit", nullable: true),
                    MANDANT_CODE = table.Column<string>(type: "nvarchar(max)", nullable: true),
                    MAIN_DEPARTMENT_ID = table.Column<int>(type: "int", nullable: true),
                    DEPARTMENT_NAMES_LIST = table.Column<string>(type: "nvarchar(max)", nullable: true),
                    DEPARTMENT_ID_LIST = table.Column<string>(type: "nvarchar(max)", nullable: true),
                    WEBAPP_NAMES_LIST = table.Column<string>(type: "nvarchar(max)", nullable: true),
                    WEBAPP_ID_LIST = table.Column<string>(type: "nvarchar(max)", nullable: true),
                    ATTRIBUTE_NAMES_LIST = table.Column<string>(type: "nvarchar(max)", nullable: true),
                    ATTRIBUTE_ID_LIST = table.Column<string>(type: "nvarchar(max)", nullable: true),
                    MOBILE_PHONE_NO = table.Column<string>(type: "nvarchar(max)", nullable: true),
                    PHONE_NO = table.Column<string>(type: "nvarchar(max)", nullable: true)
                },
                constraints: table =>
                {
                    table.PrimaryKey("PK_TBSTF_EMPLOYEE", x => x.EMPLOYEE_ID);
                });

            migrationBuilder.CreateTable(
                name: "TBSTF_EMPLOYEE_ATTRIBUTE",
                schema: "dbo",
                columns: table => new
                {
                    EMPLOYEE_ATTRIBUTE_ID = 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),
                    ROLE_LIST = table.Column<string>(type: "nvarchar(max)", nullable: true),
                    SEQ_NO = table.Column<int>(type: "int", nullable: true)
                },
                constraints: table =>
                {
                    table.PrimaryKey("PK_TBSTF_EMPLOYEE_ATTRIBUTE", x => x.EMPLOYEE_ATTRIBUTE_ID);
                });

            migrationBuilder.CreateTable(
                name: "TBSTF_EMPLOYEE_STATUS",
                schema: "dbo",
                columns: table => new
                {
                    EMPLOYEE_STATUS_ID = table.Column<int>(type: "int", nullable: false)
                        .Annotation("SqlServer:Identity", "1, 1"),
                    EMPLOYEE_STATUS_NAME = table.Column<string>(type: "nvarchar(max)", nullable: true)
                },
                constraints: table =>
                {
                    table.PrimaryKey("PK_TBSTF_EMPLOYEE_STATUS", x => x.EMPLOYEE_STATUS_ID);
                });

            migrationBuilder.CreateTable(
                name: "TBSTF_EMPLOYEE_TO_ATTRIBUTE",
                schema: "dbo",
                columns: table => new
                {
                    EMPLOYEE_TO_ATTRIBUTE_ID = table.Column<int>(type: "int", nullable: false)
                        .Annotation("SqlServer:Identity", "1, 1"),
                    EMPLOYEE_ID = table.Column<int>(type: "int", nullable: false),
                    EMPLOYEE_ATTRIBUTE_ID = table.Column<int>(type: "int", nullable: false)
                },
                constraints: table =>
                {
                    table.PrimaryKey("PK_TBSTF_EMPLOYEE_TO_ATTRIBUTE", x => x.EMPLOYEE_TO_ATTRIBUTE_ID);
                });

            migrationBuilder.CreateTable(
                name: "TBSTF_EMPLOYEE_TO_DEPARTMENT",
                schema: "dbo",
                columns: table => new
                {
                    EMPLOYEE_TO_DEPARTMENT_ID = table.Column<int>(type: "int", nullable: false)
                        .Annotation("SqlServer:Identity", "1, 1"),
                    EMPLOYEE_ID = table.Column<int>(type: "int", nullable: false),
                    DEPARTMENT_ID = table.Column<int>(type: "int", nullable: false),
                    DEPARTMENT_NAME = table.Column<string>(type: "nvarchar(max)", nullable: true),
                    EMPLOYEE_BUDGET = table.Column<decimal>(type: "decimal(18,2)", nullable: false),
                    EMPLOYEE_STATUS_ID = table.Column<int>(type: "int", nullable: true),
                    RANG_ID = table.Column<int>(type: "int", nullable: true)
                },
                constraints: table =>
                {
                    table.PrimaryKey("PK_TBSTF_EMPLOYEE_TO_DEPARTMENT", x => x.EMPLOYEE_TO_DEPARTMENT_ID);
                });

            migrationBuilder.CreateTable(
                name: "TBSTF_EMPLOYEE_TO_WEB_APP",
                schema: "dbo",
                columns: table => new
                {
                    EMPLOYEE_TO_WEB_APP_ID = table.Column<int>(type: "int", nullable: false)
                        .Annotation("SqlServer:Identity", "1, 1"),
                    EMPLOYEE_ID = table.Column<int>(type: "int", nullable: false),
                    WEB_APP_ID = table.Column<int>(type: "int", nullable: false),
                    WEB_APP_ROLE_ID = table.Column<int>(type: "int", nullable: false),
                    DEPARTMENT_ID = table.Column<int>(type: "int", nullable: true),
                    WEB_APP_ROLE_NAME = table.Column<string>(type: "nvarchar(max)", nullable: true),
                    WEB_APP_NAME = table.Column<string>(type: "nvarchar(max)", nullable: true),
                    DEPARTMENT_NAME = table.Column<string>(type: "nvarchar(max)", nullable: true),
                    EXTENDED_DEPARTMENT_NAME_LIST = table.Column<string>(type: "nvarchar(max)", nullable: true),
                    EXTENDED_DEPARTMENT_ID_LIST = table.Column<string>(type: "nvarchar(max)", nullable: true),
                    ADDITIONAL_ROLE_NAME_LIST = table.Column<string>(type: "nvarchar(max)", nullable: true),
                    ADDITIONAL_ROLE_ID_LIST = table.Column<string>(type: "nvarchar(max)", nullable: true)
                },
                constraints: table =>
                {
                    table.PrimaryKey("PK_TBSTF_EMPLOYEE_TO_WEB_APP", x => x.EMPLOYEE_TO_WEB_APP_ID);
                });

            migrationBuilder.CreateTable(
                name: "TBSTF_PROJECT",
                schema: "dbo",
                columns: table => new
                {
                    PROJECT_ID = table.Column<int>(type: "int", nullable: false)
                        .Annotation("SqlServer:Identity", "1, 1"),
                    PROJECT_NAME = table.Column<string>(type: "nvarchar(max)", nullable: true)
                },
                constraints: table =>
                {
                    table.PrimaryKey("PK_TBSTF_PROJECT", x => x.PROJECT_ID);
                });

            migrationBuilder.CreateTable(
                name: "TBSTF_RANG",
                schema: "dbo",
                columns: table => new
                {
                    RANG_ID = table.Column<int>(type: "int", nullable: false)
                        .Annotation("SqlServer:Identity", "1, 1"),
                    RANG_NAME = table.Column<string>(type: "nvarchar(max)", nullable: true),
                    RANG_SHORTNAME = table.Column<string>(type: "nvarchar(max)", nullable: true),
                    RANG_ORDER = table.Column<int>(type: "int", nullable: false)
                },
                constraints: table =>
                {
                    table.PrimaryKey("PK_TBSTF_RANG", x => x.RANG_ID);
                });

            migrationBuilder.CreateTable(
                name: "TBSTF_SUBSIDIARY",
                schema: "dbo",
                columns: table => new
                {
                    SUBSIDIARY_ID = table.Column<int>(type: "int", nullable: false)
                        .Annotation("SqlServer:Identity", "1, 1"),
                    CLIENT_ID = table.Column<int>(type: "int", nullable: true),
                    NAME = table.Column<string>(type: "nvarchar(max)", nullable: true),
                    SUBSIDIARY_CODE = table.Column<string>(type: "nvarchar(max)", nullable: true),
                    COMMENT = table.Column<string>(type: "nvarchar(max)", nullable: true)
                },
                constraints: table =>
                {
                    table.PrimaryKey("PK_TBSTF_SUBSIDIARY", x => x.SUBSIDIARY_ID);
                });

            migrationBuilder.CreateTable(
                name: "TBSTF_WEB_APP",
                schema: "dbo",
                columns: table => new
                {
                    WEB_APP_ID = table.Column<int>(type: "int", nullable: false)
                        .Annotation("SqlServer:Identity", "1, 1"),
                    WEB_APP_NAME = table.Column<string>(type: "nvarchar(max)", nullable: true),
                    WEB_APP_LINK_LIVE = table.Column<string>(type: "nvarchar(max)", nullable: true),
                    WEB_APP_LINK_DEV = table.Column<string>(type: "nvarchar(max)", nullable: true),
                    IS_ACTIVE = table.Column<bool>(type: "bit", nullable: false),
                    AD_WEB_APP_NAME = table.Column<string>(type: "nvarchar(max)", nullable: true)
                },
                constraints: table =>
                {
                    table.PrimaryKey("PK_TBSTF_WEB_APP", x => x.WEB_APP_ID);
                });

            migrationBuilder.CreateTable(
                name: "TBSTF_WEB_APP_ADDITIONAL_ROLE",
                schema: "dbo",
                columns: table => new
                {
                    WEB_APP_ADDITIONAL_ROLE_ID = table.Column<int>(type: "int", nullable: false)
                        .Annotation("SqlServer:Identity", "1, 1"),
                    WEB_APP_ID = table.Column<int>(type: "int", nullable: false),
                    WEB_APP_ADDITIONAL_ROLE_NAME = table.Column<string>(type: "nvarchar(max)", nullable: true),
                    AD_WEB_APP_ADDITIONAL_ROLE_NAME = table.Column<string>(type: "nvarchar(max)", nullable: true)
                },
                constraints: table =>
                {
                    table.PrimaryKey("PK_TBSTF_WEB_APP_ADDITIONAL_ROLE", x => x.WEB_APP_ADDITIONAL_ROLE_ID);
                });

            migrationBuilder.CreateTable(
                name: "TBSTF_WEB_APP_EMPLOYEE_INFO",
                schema: "dbo",
                columns: table => new
                {
                    WEB_APP_EMPLOYEE_INFO_ID = table.Column<int>(type: "int", nullable: false)
                        .Annotation("SqlServer:Identity", "1, 1"),
                    EMPLOYEE_NO = table.Column<string>(type: "nvarchar(max)", nullable: true),
                    SALUTATION = table.Column<string>(type: "nvarchar(max)", nullable: true),
                    FIRST_NAME = table.Column<string>(type: "nvarchar(max)", nullable: true),
                    LAST_NAME = table.Column<string>(type: "nvarchar(max)", nullable: true),
                    SHORT_NAME = 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),
                    LOGIN_NAME = table.Column<string>(type: "nvarchar(max)", nullable: true),
                    EMAIL = table.Column<string>(type: "nvarchar(max)", nullable: true),
                    DEPARTMENT_ID = table.Column<int>(type: "int", nullable: false),
                    EXTENDED_DEPARTMENT_ID_LIST = table.Column<string>(type: "nvarchar(max)", nullable: true),
                    DEPARTMENT_NAME = table.Column<string>(type: "nvarchar(max)", nullable: true),
                    EMPLOYEE_ID = table.Column<int>(type: "int", nullable: false),
                    COST_CENTRE_ID = table.Column<int>(type: "int", nullable: false),
                    RANG_SHORTNAME = table.Column<string>(type: "nvarchar(max)", nullable: true),
                    RANG_NAME = table.Column<string>(type: "nvarchar(max)", nullable: true),
                    RANG_ORDER = table.Column<int>(type: "int", nullable: false),
                    CLIENT_ID = table.Column<int>(type: "int", nullable: false),
                    WEB_APP_ID = table.Column<int>(type: "int", nullable: false)
                },
                constraints: table =>
                {
                    table.PrimaryKey("PK_TBSTF_WEB_APP_EMPLOYEE_INFO", x => x.WEB_APP_EMPLOYEE_INFO_ID);
                });

            migrationBuilder.CreateTable(
                name: "TBSTF_WEB_APP_ROLE",
                schema: "dbo",
                columns: table => new
                {
                    WEB_APP_ROLE_ID = table.Column<int>(type: "int", nullable: false)
                        .Annotation("SqlServer:Identity", "1, 1"),
                    WEB_APP_ROLE_NAME = table.Column<string>(type: "nvarchar(max)", nullable: true),
                    WEB_APP_ROLE_HIERARCHY = table.Column<int>(type: "int", nullable: false)
                },
                constraints: table =>
                {
                    table.PrimaryKey("PK_TBSTF_WEB_APP_ROLE", x => x.WEB_APP_ROLE_ID);
                });

            migrationBuilder.CreateTable(
                name: "TBSTF_WEB_APP_TO_DEPARTMENT",
                schema: "dbo",
                columns: table => new
                {
                    WEB_APP_TO_DEPARTMENT_ID = table.Column<int>(type: "int", nullable: false)
                        .Annotation("SqlServer:Identity", "1, 1"),
                    EMPLOYEE_TO_WEB_APP_ID = table.Column<int>(type: "int", nullable: false),
                    DEPARTMENT_ID = table.Column<int>(type: "int", nullable: false),
                    DEPARTMENT_NAME = table.Column<string>(type: "nvarchar(max)", nullable: true)
                },
                constraints: table =>
                {
                    table.PrimaryKey("PK_TBSTF_WEB_APP_TO_DEPARTMENT", x => x.WEB_APP_TO_DEPARTMENT_ID);
                });

            migrationBuilder.CreateTable(
                name: "TBSTF_WEB_APP_TO_WEB_APP_ADDITIONAL_ROLE",
                schema: "dbo",
                columns: table => new
                {
                    WEB_APP_TO_WEB_APP_ADDITIONAL_ROLE_ID = table.Column<int>(type: "int", nullable: false)
                        .Annotation("SqlServer:Identity", "1, 1"),
                    WEB_APP_ADDITIONAL_ROLE_ID = table.Column<int>(type: "int", nullable: false),
                    EMPLOYEE_TO_WEB_APP_ID = table.Column<int>(type: "int", nullable: false)
                },
                constraints: table =>
                {
                    table.PrimaryKey("PK_TBSTF_WEB_APP_TO_WEB_APP_ADDITIONAL_ROLE", x => x.WEB_APP_TO_WEB_APP_ADDITIONAL_ROLE_ID);
                });

            migrationBuilder.CreateTable(
                name: "TBSTF_WEB_APP_TO_WEB_APP_ROLE",
                schema: "dbo",
                columns: table => new
                {
                    WEB_APP_TO_WEB_APP_ROLE_ID = table.Column<int>(type: "int", nullable: false)
                        .Annotation("SqlServer:Identity", "1, 1"),
                    WEB_APP_ID = table.Column<int>(type: "int", nullable: false),
                    WEB_APP_ROLE_ID = table.Column<int>(type: "int", nullable: false),
                    WEB_APP_ROLE_NAME = table.Column<string>(type: "nvarchar(max)", nullable: true),
                    WEB_APP_ROLE_HIERARCHY = table.Column<int>(type: "int", nullable: false)
                },
                constraints: table =>
                {
                    table.PrimaryKey("PK_TBSTF_WEB_APP_TO_WEB_APP_ROLE", x => x.WEB_APP_TO_WEB_APP_ROLE_ID);
                });

            migrationBuilder.CreateTable(
                name: "TBSTF_WEB_APP_USER",
                schema: "dbo",
                columns: table => new
                {
                    WEB_APP_USER_ID = table.Column<int>(type: "int", nullable: false)
                        .Annotation("SqlServer:Identity", "1, 1"),
                    NAME = table.Column<string>(type: "nvarchar(max)", nullable: true),
                    SHORT_NAME = table.Column<string>(type: "nvarchar(max)", nullable: true),
                    LOGIN_NAME = table.Column<string>(type: "nvarchar(max)", nullable: true),
                    PASSWORD = table.Column<string>(type: "nvarchar(max)", nullable: true),
                    ROLE_LIST = table.Column<string>(type: "nvarchar(max)", nullable: true),
                    WEB_APP_ROLE_LIST = table.Column<string>(type: "nvarchar(max)", nullable: true),
                    JWT_EXPIRED_ON = table.Column<DateTime>(type: "datetime2", nullable: true),
                    LAST_LOGIN = table.Column<DateTime>(type: "datetime2", nullable: true),
                    CLIENT_VERSION = 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_TBSTF_WEB_APP_USER", x => x.WEB_APP_USER_ID);
                });

            migrationBuilder.CreateTable(
                name: "TBSTF_WINDREAM_COLUMNS_TO_DEPARTMENT",
                schema: "dbo",
                columns: table => new
                {
                    WINDREAM_COLUMNS_TO_DEPARTMENT_ID = table.Column<int>(type: "int", nullable: false)
                        .Annotation("SqlServer:Identity", "1, 1"),
                    ATTRIBUTE_DW_ATTR_ID = table.Column<int>(type: "int", nullable: false),
                    ATTRIBUTE_SZ_COLUMN_NAME = table.Column<string>(type: "nvarchar(max)", nullable: true),
                    COMMENT = table.Column<string>(type: "nvarchar(max)", nullable: true),
                    ATTRIBUTE_DW_ATTR_TYPE = table.Column<int>(type: "int", nullable: false),
                    COMUMN_LENGTH = table.Column<int>(type: "int", nullable: false),
                    OBJECT_TYPE_ATTRIBUTE_SZ_NAME = table.Column<string>(type: "nvarchar(max)", nullable: true),
                    CLIENT_ID = table.Column<int>(type: "int", nullable: false),
                    OBJECT_TYPESZ_DOC_TYPE_NAME = table.Column<string>(type: "nvarchar(max)", nullable: true),
                    DEPARTMENT_ID = table.Column<int>(type: "int", nullable: false),
                    SEQ = table.Column<int>(type: "int", nullable: false),
                    WINDREAM_SEARCH_ID = table.Column<int>(type: "int", nullable: false)
                },
                constraints: table =>
                {
                    table.PrimaryKey("PK_TBSTF_WINDREAM_COLUMNS_TO_DEPARTMENT", x => x.WINDREAM_COLUMNS_TO_DEPARTMENT_ID);
                });

            migrationBuilder.CreateTable(
                name: "TBSTF_WINDREAM_INDEX",
                schema: "dbo",
                columns: table => new
                {
                    WINDREAM_INDEX_ID = table.Column<int>(type: "int", nullable: false)
                        .Annotation("SqlServer:Identity", "1, 1"),
                    ATTRIBUTE_DW_ATTR_ID = table.Column<int>(type: "int", nullable: false),
                    ATTRIBUTE_SZ_COLUMN_NAME = table.Column<string>(type: "nvarchar(max)", nullable: true),
                    COMMENT = table.Column<string>(type: "nvarchar(max)", nullable: true),
                    COMUMN_LENGTH = table.Column<int>(type: "int", nullable: true),
                    ATTRIBUTE_DW_ATTR_TYPE = table.Column<int>(type: "int", nullable: true),
                    CLIENT_ID = table.Column<int>(type: "int", nullable: false),
                    OBJECT_TYPE_ATTRIBUTE_SZ_NAME = table.Column<string>(type: "nvarchar(max)", nullable: true)
                },
                constraints: table =>
                {
                    table.PrimaryKey("PK_TBSTF_WINDREAM_INDEX", x => x.WINDREAM_INDEX_ID);
                });

            migrationBuilder.CreateTable(
                name: "TBSTF_WINDREAM_INDEX_TO_WINDREAM_SEARCH_TO_DEPARTMENT",
                schema: "dbo",
                columns: table => new
                {
                    WINDREAM_INDEX_TO_WINDREAM_SEARCH_TO_DEPARTMENT_ID = table.Column<int>(type: "int", nullable: false)
                        .Annotation("SqlServer:Identity", "1, 1"),
                    WINDREAM_SEARCH_TO_DEPARTMENT_ID = table.Column<int>(type: "int", nullable: false),
                    WINDREAM_INDEX_ID = table.Column<int>(type: "int", nullable: false),
                    SEQ = table.Column<int>(type: "int", nullable: false),
                    ATTRIBUTE_SZ_COLUMN_NAME = table.Column<string>(type: "nvarchar(max)", nullable: true),
                    OBJECT_TYPE_ATTRIBUTE_SZ_NAME = table.Column<string>(type: "nvarchar(max)", nullable: true)
                },
                constraints: table =>
                {
                    table.PrimaryKey("PK_TBSTF_WINDREAM_INDEX_TO_WINDREAM_SEARCH_TO_DEPARTMENT", x => x.WINDREAM_INDEX_TO_WINDREAM_SEARCH_TO_DEPARTMENT_ID);
                });

            migrationBuilder.CreateTable(
                name: "TBSTF_WINDREAM_INPUT_FOLDER",
                schema: "dbo",
                columns: table => new
                {
                    WINDREAM_INPUT_FOLDER_ID = 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),
                    CLIENT_ID = table.Column<int>(type: "int", nullable: true)
                },
                constraints: table =>
                {
                    table.PrimaryKey("PK_TBSTF_WINDREAM_INPUT_FOLDER", x => x.WINDREAM_INPUT_FOLDER_ID);
                });

            migrationBuilder.CreateTable(
                name: "TBSTF_WINDREAM_SEARCH",
                schema: "dbo",
                columns: table => new
                {
                    WINDREAM_SEARCH_ID = 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),
                    CLIENT_ID = table.Column<int>(type: "int", nullable: false),
                    COLOR = table.Column<int>(type: "int", nullable: true),
                    SEARCH_INDEX = table.Column<int>(type: "int", nullable: true)
                },
                constraints: table =>
                {
                    table.PrimaryKey("PK_TBSTF_WINDREAM_SEARCH", x => x.WINDREAM_SEARCH_ID);
                });

            migrationBuilder.CreateTable(
                name: "TBSTF_WINDREAM_SEARCH_ITEM",
                schema: "dbo",
                columns: table => new
                {
                    WINDREAM_SEARCH_ITEM_ID = 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),
                    CLIENT_ID = table.Column<int>(type: "int", nullable: false),
                    CAPTION = table.Column<string>(type: "nvarchar(max)", nullable: true),
                    PLACE_HOLDER = table.Column<string>(type: "nvarchar(max)", nullable: true),
                    SEARCH_TEMPLATE = table.Column<string>(type: "nvarchar(max)", nullable: true),
                    CONNECTED_LIST = table.Column<string>(type: "nvarchar(max)", nullable: true),
                    ALTERNATIVE_WINDREAM_SEARCH_ITEM_ID_LIST = table.Column<string>(type: "nvarchar(max)", nullable: true)
                },
                constraints: table =>
                {
                    table.PrimaryKey("PK_TBSTF_WINDREAM_SEARCH_ITEM", x => x.WINDREAM_SEARCH_ITEM_ID);
                });

            migrationBuilder.CreateTable(
                name: "TBSTF_WINDREAM_SEARCH_ITEM_TO_WINDREAM_SEARCH_TO_DEPARTMENT",
                schema: "dbo",
                columns: table => new
                {
                    WINDREAM_SEARCH_ITEM_TO_WINDREAM_SEARCH_TO_DEPARTMENT_ID = table.Column<int>(type: "int", nullable: false)
                        .Annotation("SqlServer:Identity", "1, 1"),
                    WINDREAM_SEARCH_TO_DEPARTMENT_ID = table.Column<int>(type: "int", nullable: false),
                    SEQ = table.Column<int>(type: "int", nullable: false),
                    WINDREAM_SEARCH_ITEM_ID = table.Column<int>(type: "int", nullable: false),
                    DEPARTMENT_ID = table.Column<int>(type: "int", nullable: false),
                    WINDREAM_SEARCH_ITEM_NAME = table.Column<string>(type: "nvarchar(max)", nullable: true),
                    WINDREAM_SEARCH_ITEM_CAPTION = table.Column<string>(type: "nvarchar(max)", nullable: true),
                    WINDREAM_SEARCH_ITEM_PLACE_HOLDER = table.Column<string>(type: "nvarchar(max)", nullable: true),
                    WINDREAM_SEARCH_ITEM_SEARCH_TEMPLATE = table.Column<string>(type: "nvarchar(max)", nullable: true),
                    WINDREAM_SEARCH_ITEM_TEMPLATE = table.Column<string>(type: "nvarchar(max)", nullable: true),
                    WINDREAM_SEARCH_ITEM_CONNECTED_LIST = table.Column<string>(type: "nvarchar(max)", nullable: true),
                    WINDREAM_SEARCH_ITEM_COMMENT = table.Column<string>(type: "nvarchar(max)", nullable: true),
                    WINDREAM_SEARCH_INDEX_TYPE = table.Column<int>(type: "int", nullable: true)
                },
                constraints: table =>
                {
                    table.PrimaryKey("PK_TBSTF_WINDREAM_SEARCH_ITEM_TO_WINDREAM_SEARCH_TO_DEPARTMENT", x => x.WINDREAM_SEARCH_ITEM_TO_WINDREAM_SEARCH_TO_DEPARTMENT_ID);
                });

            migrationBuilder.CreateTable(
                name: "TBSTF_WINDREAM_SEARCH_TO_DEPARTMENT",
                schema: "dbo",
                columns: table => new
                {
                    WINDREAM_SEARCH_TO_DEPARTMENT_ID = table.Column<int>(type: "int", nullable: false)
                        .Annotation("SqlServer:Identity", "1, 1"),
                    DEPARTMENT_ID = table.Column<int>(type: "int", nullable: false),
                    WINDREAM_SEARCH_ID = table.Column<int>(type: "int", nullable: false),
                    SEQ = table.Column<int>(type: "int", nullable: false),
                    IS_ACTIVE = table.Column<bool>(type: "bit", nullable: false),
                    DEPARTMENT_NAME = table.Column<string>(type: "nvarchar(max)", nullable: true),
                    WINDREAM_SEARCH_NAME = table.Column<string>(type: "nvarchar(max)", nullable: true),
                    WINDREAM_SEARCH_XMLPATH = table.Column<string>(type: "nvarchar(max)", nullable: true),
                    WINDREAM_SEARCH_COMMENT = table.Column<string>(type: "nvarchar(max)", nullable: true),
                    WINDREAM_SEARCH_COLOR = table.Column<int>(type: "int", nullable: true)
                },
                constraints: table =>
                {
                    table.PrimaryKey("PK_TBSTF_WINDREAM_SEARCH_TO_DEPARTMENT", x => x.WINDREAM_SEARCH_TO_DEPARTMENT_ID);
                });
        }

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

            migrationBuilder.DropTable(
                name: "TBSTF_COST_CENTRE",
                schema: "dbo");

            migrationBuilder.DropTable(
                name: "TBSTF_DEPARTMENT",
                schema: "dbo");

            migrationBuilder.DropTable(
                name: "TBSTF_DEPARTMENT_TO_WEB_APP_TO_EMPLOYEE_FOR_WINDREAM",
                schema: "dbo");

            migrationBuilder.DropTable(
                name: "TBSTF_DOCUMENT_ART",
                schema: "dbo");

            migrationBuilder.DropTable(
                name: "TBSTF_DOCUMENT_ART_TO_DEPARTMENT",
                schema: "dbo");

            migrationBuilder.DropTable(
                name: "TBSTF_EMPLOYEE",
                schema: "dbo");

            migrationBuilder.DropTable(
                name: "TBSTF_EMPLOYEE_ATTRIBUTE",
                schema: "dbo");

            migrationBuilder.DropTable(
                name: "TBSTF_EMPLOYEE_STATUS",
                schema: "dbo");

            migrationBuilder.DropTable(
                name: "TBSTF_EMPLOYEE_TO_ATTRIBUTE",
                schema: "dbo");

            migrationBuilder.DropTable(
                name: "TBSTF_EMPLOYEE_TO_DEPARTMENT",
                schema: "dbo");

            migrationBuilder.DropTable(
                name: "TBSTF_EMPLOYEE_TO_WEB_APP",
                schema: "dbo");

            migrationBuilder.DropTable(
                name: "TBSTF_PROJECT",
                schema: "dbo");

            migrationBuilder.DropTable(
                name: "TBSTF_RANG",
                schema: "dbo");

            migrationBuilder.DropTable(
                name: "TBSTF_SUBSIDIARY",
                schema: "dbo");

            migrationBuilder.DropTable(
                name: "TBSTF_WEB_APP",
                schema: "dbo");

            migrationBuilder.DropTable(
                name: "TBSTF_WEB_APP_ADDITIONAL_ROLE",
                schema: "dbo");

            migrationBuilder.DropTable(
                name: "TBSTF_WEB_APP_EMPLOYEE_INFO",
                schema: "dbo");

            migrationBuilder.DropTable(
                name: "TBSTF_WEB_APP_ROLE",
                schema: "dbo");

            migrationBuilder.DropTable(
                name: "TBSTF_WEB_APP_TO_DEPARTMENT",
                schema: "dbo");

            migrationBuilder.DropTable(
                name: "TBSTF_WEB_APP_TO_WEB_APP_ADDITIONAL_ROLE",
                schema: "dbo");

            migrationBuilder.DropTable(
                name: "TBSTF_WEB_APP_TO_WEB_APP_ROLE",
                schema: "dbo");

            migrationBuilder.DropTable(
                name: "TBSTF_WEB_APP_USER",
                schema: "dbo");

            migrationBuilder.DropTable(
                name: "TBSTF_WINDREAM_COLUMNS_TO_DEPARTMENT",
                schema: "dbo");

            migrationBuilder.DropTable(
                name: "TBSTF_WINDREAM_INDEX",
                schema: "dbo");

            migrationBuilder.DropTable(
                name: "TBSTF_WINDREAM_INDEX_TO_WINDREAM_SEARCH_TO_DEPARTMENT",
                schema: "dbo");

            migrationBuilder.DropTable(
                name: "TBSTF_WINDREAM_INPUT_FOLDER",
                schema: "dbo");

            migrationBuilder.DropTable(
                name: "TBSTF_WINDREAM_SEARCH",
                schema: "dbo");

            migrationBuilder.DropTable(
                name: "TBSTF_WINDREAM_SEARCH_ITEM",
                schema: "dbo");

            migrationBuilder.DropTable(
                name: "TBSTF_WINDREAM_SEARCH_ITEM_TO_WINDREAM_SEARCH_TO_DEPARTMENT",
                schema: "dbo");

            migrationBuilder.DropTable(
                name: "TBSTF_WINDREAM_SEARCH_TO_DEPARTMENT",
                schema: "dbo");
        }
    }
}
