251 lines
9.2 KiB
C#
251 lines
9.2 KiB
C#
using Microsoft.EntityFrameworkCore.Migrations;
|
|
using NpgsqlTypes;
|
|
|
|
#nullable disable
|
|
|
|
namespace OpenArchival.DataAccess.Migrations
|
|
{
|
|
/// <inheritdoc />
|
|
public partial class ArtifactGroupingsSearchVectorColumns : Migration
|
|
{
|
|
/// <inheritdoc />
|
|
protected override void Up(MigrationBuilder migrationBuilder)
|
|
{
|
|
migrationBuilder.AddColumn<string>(
|
|
name: "AllSearchString",
|
|
table: "ArtifactGroupings",
|
|
type: "text",
|
|
nullable: false,
|
|
defaultValue: "");
|
|
|
|
migrationBuilder.AddColumn<NpgsqlTsVector>(
|
|
name: "AllSearchVector",
|
|
table: "ArtifactGroupings",
|
|
type: "tsvector",
|
|
nullable: true)
|
|
.Annotation("Npgsql:TsVectorConfig", "english")
|
|
.Annotation("Npgsql:TsVectorProperties", new[] { "AllSearchString" });
|
|
|
|
migrationBuilder.AddColumn<string>(
|
|
name: "DefectsSearchString",
|
|
table: "ArtifactGroupings",
|
|
type: "text",
|
|
nullable: false,
|
|
defaultValue: "");
|
|
|
|
migrationBuilder.AddColumn<NpgsqlTsVector>(
|
|
name: "DefectsSearchVector",
|
|
table: "ArtifactGroupings",
|
|
type: "tsvector",
|
|
nullable: true)
|
|
.Annotation("Npgsql:TsVectorConfig", "english")
|
|
.Annotation("Npgsql:TsVectorProperties", new[] { "DefectsSearchString" });
|
|
|
|
migrationBuilder.AddColumn<string>(
|
|
name: "DescriptionSearchString",
|
|
table: "ArtifactGroupings",
|
|
type: "text",
|
|
nullable: false,
|
|
defaultValue: "");
|
|
|
|
migrationBuilder.AddColumn<NpgsqlTsVector>(
|
|
name: "DescriptionSearchVector",
|
|
table: "ArtifactGroupings",
|
|
type: "tsvector",
|
|
nullable: true)
|
|
.Annotation("Npgsql:TsVectorConfig", "english")
|
|
.Annotation("Npgsql:TsVectorProperties", new[] { "DescriptionSearchString" });
|
|
|
|
migrationBuilder.AddColumn<string>(
|
|
name: "FilenamesSearchString",
|
|
table: "ArtifactGroupings",
|
|
type: "text",
|
|
nullable: false,
|
|
defaultValue: "");
|
|
|
|
migrationBuilder.AddColumn<NpgsqlTsVector>(
|
|
name: "FilenamesSearchVector",
|
|
table: "ArtifactGroupings",
|
|
type: "tsvector",
|
|
nullable: false)
|
|
.Annotation("Npgsql:TsVectorConfig", "english")
|
|
.Annotation("Npgsql:TsVectorProperties", new[] { "FilenamesSearchString" });
|
|
|
|
migrationBuilder.AddColumn<string>(
|
|
name: "ListedNamesSearchString",
|
|
table: "ArtifactGroupings",
|
|
type: "text",
|
|
nullable: false,
|
|
defaultValue: "");
|
|
|
|
migrationBuilder.AddColumn<NpgsqlTsVector>(
|
|
name: "ListedNamesSearchVector",
|
|
table: "ArtifactGroupings",
|
|
type: "tsvector",
|
|
nullable: true)
|
|
.Annotation("Npgsql:TsVectorConfig", "english")
|
|
.Annotation("Npgsql:TsVectorProperties", new[] { "ListedNamesSearchString" });
|
|
|
|
migrationBuilder.AddColumn<string>(
|
|
name: "TagsSearchString",
|
|
table: "ArtifactGroupings",
|
|
type: "text",
|
|
nullable: false,
|
|
defaultValue: "");
|
|
|
|
migrationBuilder.AddColumn<NpgsqlTsVector>(
|
|
name: "TagsSearchVector",
|
|
table: "ArtifactGroupings",
|
|
type: "tsvector",
|
|
nullable: true)
|
|
.Annotation("Npgsql:TsVectorConfig", "english")
|
|
.Annotation("Npgsql:TsVectorProperties", new[] { "TagsSearchString" });
|
|
|
|
migrationBuilder.AddColumn<string>(
|
|
name: "TitleSearchString",
|
|
table: "ArtifactGroupings",
|
|
type: "text",
|
|
nullable: false,
|
|
defaultValue: "");
|
|
|
|
migrationBuilder.AddColumn<NpgsqlTsVector>(
|
|
name: "TitleSearchVector",
|
|
table: "ArtifactGroupings",
|
|
type: "tsvector",
|
|
nullable: true)
|
|
.Annotation("Npgsql:TsVectorConfig", "english")
|
|
.Annotation("Npgsql:TsVectorProperties", new[] { "TitleSearchString" });
|
|
|
|
migrationBuilder.CreateIndex(
|
|
name: "IX_ArtifactGroupings_AllSearchVector",
|
|
table: "ArtifactGroupings",
|
|
column: "AllSearchVector")
|
|
.Annotation("Npgsql:IndexMethod", "GIN");
|
|
|
|
migrationBuilder.CreateIndex(
|
|
name: "IX_ArtifactGroupings_DefectsSearchVector",
|
|
table: "ArtifactGroupings",
|
|
column: "DefectsSearchVector")
|
|
.Annotation("Npgsql:IndexMethod", "GIN");
|
|
|
|
migrationBuilder.CreateIndex(
|
|
name: "IX_ArtifactGroupings_DescriptionSearchVector",
|
|
table: "ArtifactGroupings",
|
|
column: "DescriptionSearchVector")
|
|
.Annotation("Npgsql:IndexMethod", "GIN");
|
|
|
|
migrationBuilder.CreateIndex(
|
|
name: "IX_ArtifactGroupings_FilenamesSearchVector",
|
|
table: "ArtifactGroupings",
|
|
column: "FilenamesSearchVector")
|
|
.Annotation("Npgsql:IndexMethod", "GIN");
|
|
|
|
migrationBuilder.CreateIndex(
|
|
name: "IX_ArtifactGroupings_ListedNamesSearchVector",
|
|
table: "ArtifactGroupings",
|
|
column: "ListedNamesSearchVector")
|
|
.Annotation("Npgsql:IndexMethod", "GIN");
|
|
|
|
migrationBuilder.CreateIndex(
|
|
name: "IX_ArtifactGroupings_TagsSearchVector",
|
|
table: "ArtifactGroupings",
|
|
column: "TagsSearchVector")
|
|
.Annotation("Npgsql:IndexMethod", "GIN");
|
|
|
|
migrationBuilder.CreateIndex(
|
|
name: "IX_ArtifactGroupings_TitleSearchVector",
|
|
table: "ArtifactGroupings",
|
|
column: "TitleSearchVector")
|
|
.Annotation("Npgsql:IndexMethod", "GIN");
|
|
}
|
|
|
|
/// <inheritdoc />
|
|
protected override void Down(MigrationBuilder migrationBuilder)
|
|
{
|
|
migrationBuilder.DropIndex(
|
|
name: "IX_ArtifactGroupings_AllSearchVector",
|
|
table: "ArtifactGroupings");
|
|
|
|
migrationBuilder.DropIndex(
|
|
name: "IX_ArtifactGroupings_DefectsSearchVector",
|
|
table: "ArtifactGroupings");
|
|
|
|
migrationBuilder.DropIndex(
|
|
name: "IX_ArtifactGroupings_DescriptionSearchVector",
|
|
table: "ArtifactGroupings");
|
|
|
|
migrationBuilder.DropIndex(
|
|
name: "IX_ArtifactGroupings_FilenamesSearchVector",
|
|
table: "ArtifactGroupings");
|
|
|
|
migrationBuilder.DropIndex(
|
|
name: "IX_ArtifactGroupings_ListedNamesSearchVector",
|
|
table: "ArtifactGroupings");
|
|
|
|
migrationBuilder.DropIndex(
|
|
name: "IX_ArtifactGroupings_TagsSearchVector",
|
|
table: "ArtifactGroupings");
|
|
|
|
migrationBuilder.DropIndex(
|
|
name: "IX_ArtifactGroupings_TitleSearchVector",
|
|
table: "ArtifactGroupings");
|
|
|
|
migrationBuilder.DropColumn(
|
|
name: "AllSearchString",
|
|
table: "ArtifactGroupings");
|
|
|
|
migrationBuilder.DropColumn(
|
|
name: "AllSearchVector",
|
|
table: "ArtifactGroupings");
|
|
|
|
migrationBuilder.DropColumn(
|
|
name: "DefectsSearchString",
|
|
table: "ArtifactGroupings");
|
|
|
|
migrationBuilder.DropColumn(
|
|
name: "DefectsSearchVector",
|
|
table: "ArtifactGroupings");
|
|
|
|
migrationBuilder.DropColumn(
|
|
name: "DescriptionSearchString",
|
|
table: "ArtifactGroupings");
|
|
|
|
migrationBuilder.DropColumn(
|
|
name: "DescriptionSearchVector",
|
|
table: "ArtifactGroupings");
|
|
|
|
migrationBuilder.DropColumn(
|
|
name: "FilenamesSearchString",
|
|
table: "ArtifactGroupings");
|
|
|
|
migrationBuilder.DropColumn(
|
|
name: "FilenamesSearchVector",
|
|
table: "ArtifactGroupings");
|
|
|
|
migrationBuilder.DropColumn(
|
|
name: "ListedNamesSearchString",
|
|
table: "ArtifactGroupings");
|
|
|
|
migrationBuilder.DropColumn(
|
|
name: "ListedNamesSearchVector",
|
|
table: "ArtifactGroupings");
|
|
|
|
migrationBuilder.DropColumn(
|
|
name: "TagsSearchString",
|
|
table: "ArtifactGroupings");
|
|
|
|
migrationBuilder.DropColumn(
|
|
name: "TagsSearchVector",
|
|
table: "ArtifactGroupings");
|
|
|
|
migrationBuilder.DropColumn(
|
|
name: "TitleSearchString",
|
|
table: "ArtifactGroupings");
|
|
|
|
migrationBuilder.DropColumn(
|
|
name: "TitleSearchVector",
|
|
table: "ArtifactGroupings");
|
|
}
|
|
}
|
|
}
|