Untitled

mail@pastecode.io avatar
unknown
csharp
2 years ago
5.6 kB
1
Indexable
Never
using FluentMigrator;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace Ideo.Core.Migrations.Scripts._2022._11
{
    [MigrationDateTime("2022-11-22 08:28", "Dodanie tabeli do zapisywania wyszukanych danych przez użytkownika dla SpecificSearch")]
    public class CreateShopSpecificSearchLogsTable : Migration
    {
        public override void Up()
        {
            // SPECIFIC SEARCH LOGS
            if (!Schema.Table("shop_specific_search_logs").Exists())
            {
                Create.Table("shop_specific_search_logs")
                     .WithId()
                     .WithIndexedPublicId("shop_specific_search_logs")
                     .WithIndexedAuditable("shop_specific_search_logs")
                     .WithColumn("IndexedDataOne")
                        .AsString().Nullable().Indexed("IX_shop_specific_search_logs_IndexedDataOne")
                     .WithColumn("IndexedDataTwo")
                        .AsString().Nullable().Indexed("IX_shop_specific_search_logs_IndexedDataTwo")
                     .WithColumn("IndexedDataThree")
                        .AsString().Nullable().Indexed("IX_shop_specific_search_logs_IndexedDataThree")
                     .WithColumn("IndexedDataFour")
                        .AsString().Nullable().Indexed("IX_shop_specific_search_logs_IndexedDataFour")
                     .WithColumn("IndexedDataFive")
                        .AsString().Nullable().Indexed("IX_shop_specific_search_logs_IndexedDataFive")
                     .WithColumn("IndexedDataSix")
                        .AsString().Nullable().Indexed("IX_shop_specific_search_logs_IndexedDataSix")
                     .WithColumn("IndexedDataSeven")
                        .AsString().Nullable().Indexed("IX_shop_specific_search_logs_IndexedDataSeven")
                     .WithColumn("IndexedDataEight")
                        .AsString().Nullable().Indexed("IX_shop_specific_search_logs_IndexedDataEight")
                     .WithColumn("IndexedDataNine")
                        .AsString().Nullable().Indexed("IX_shop_specific_search_logs_IndexedDataNine")
                     .WithColumn("IndexedDataTen")
                        .AsString().Nullable().Indexed("IX_shop_specific_search_logs_IndexedDataTen")
                     .WithColumn("IndexedDataEleven")
                        .AsString().Nullable().Indexed("IX_shop_specific_search_logs_IndexedDataEleven")
                     .WithColumn("IndexedDataTwelve")
                        .AsString().Nullable().Indexed("IX_shop_specific_search_logs_IndexedDataTwelve")
                     .WithColumn("IndexedDataThirteen")
                        .AsString().Nullable().Indexed("IX_shop_specific_search_logs_IndexedDataThirteen")
                     .WithColumn("IndexedDataFourteen")
                        .AsString().Nullable().Indexed("IX_shop_specific_search_logs_IndexedDataFourteen")
                     .WithColumn("IndexedDataFifteen")
                        .AsString().Nullable().Indexed("IX_shop_specific_search_logs_IndexedDataFifteen")
                     .WithColumn("IndexedDataSixteen")
                        .AsString().Nullable().Indexed("IX_shop_specific_search_logs_IndexedDataSixteen")
                     .WithColumn("IndexedDataSeventeen")
                        .AsString().Nullable().Indexed("IX_shop_specific_search_logs_IndexedDataSeventeen")
                     .WithColumn("IndexedDataEighteen")
                        .AsString().Nullable().Indexed("IX_shop_specific_search_logs_IndexedDataEighteen")
                     .WithColumn("IndexedDataNineteen")
                        .AsString().Nullable().Indexed("IX_shop_specific_search_logs_IndexedDataNineteen")
                     .WithColumn("IndexedDataTwenty")
                        .AsString().Nullable().Indexed("IX_shop_specific_search_logs_IndexedDataTwenty")
                     .WithColumn("AdditionalDataOne")
                        .AsString().Nullable()
                     .WithColumn("AdditionalDataTwo")
                        .AsString().Nullable()
                     .WithColumn("AdditionalDataThree")
                        .AsString().Nullable()
                     .WithColumn("AdditionalDataFour")
                        .AsString().Nullable()
                     .WithColumn("AdditionalDataFive")
                        .AsString().Nullable()
                     .WithColumn("DescriptionDataOne")
                        .AsText().Nullable()
                     .WithColumn("DescriptionDataTwo")
                        .AsText().Nullable()
                     .WithColumn("DescriptionDataThree")
                        .AsText().Nullable()
                     .WithColumn("DescriptionDataFour")
                        .AsText().Nullable()
                     .WithColumn("DescriptionDataFive")
                        .AsText().Nullable()
                     .WithColumn("SpecificSearchId")
                        .AsLong().NotNullable().ForeignKey("FK_shop_specific_search_logs_SpecificSearchId", "shop_specific_search_configurations", "Id").Indexed("IX_shop_specific_search_logs_SpecificSearchId");
            }
        }
        public override void Down()
        {
            // SPECIFIC SEARCH LOGS
            if (Schema.Table("shop_specific_search_logs").Exists())
                Delete.Table("shop_specific_search_logs");
        }
    }
}