コード例 #1
0
        protected override void Up(MigrationBuilder migrationBuilder)
        {
            migrationBuilder.CreateTable(
                name: "SearchCaches",
                columns: table => new
            {
                Id = table.Column <int>(type: "integer", nullable: false)
                     .Annotation("Npgsql:ValueGenerationStrategy", NpgsqlValueGenerationStrategy.IdentityByDefaultColumn),
                TrackId = table.Column <int>(type: "integer", nullable: false),
                Cache   = table.Column <NpgsqlTsVector>(type: "tsvector", nullable: true)
            },
                constraints: table =>
            {
                table.PrimaryKey("PK_SearchCaches", x => x.Id);
                table.ForeignKey(
                    name: "FK_SearchCaches_Tracks_TrackId",
                    column: x => x.TrackId,
                    principalTable: "Tracks",
                    principalColumn: "Id",
                    onDelete: ReferentialAction.Cascade);
            });

            migrationBuilder.CreateIndex(
                name: "IX_SearchCaches_TrackId",
                table: "SearchCaches",
                column: "TrackId");

            DatabaseSqlFilesExecuter.ExcuteSqlFilesForMigration(nameof(AddSearchCache), migrationBuilder);
        }
コード例 #2
0
 protected override void Up(MigrationBuilder migrationBuilder)
 {
     DatabaseSqlFilesExecuter.ExcuteSqlFilesForMigration(nameof(FillInitialData), migrationBuilder);
 }