aboutsummaryrefslogtreecommitdiff
path: root/BackEnd/Timeline/Migrations/20200312112552_AddImagePost.cs
blob: 7d9c661465a29bc19c40ee85cf181268d4b94b19 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
using Microsoft.EntityFrameworkCore.Migrations;
using Timeline.Models;

namespace Timeline.Migrations
{
    public partial class AddImagePost : Migration
    {
        protected override void Up(MigrationBuilder migrationBuilder)
        {
            migrationBuilder.AddColumn<string>(
                name: "content_type",
                table: "timeline_posts",
                nullable: false,
                defaultValue: "");

            migrationBuilder.AddColumn<string>(
                name: "extra_content",
                table: "timeline_posts",
                nullable: true);

            migrationBuilder.Sql($@"
UPDATE timeline_posts
SET content_type = 'text';
            ");
        }

        protected override void Down(MigrationBuilder migrationBuilder)
        {
            migrationBuilder.DropColumn(
                name: "content_type",
                table: "timeline_posts");

            migrationBuilder.DropColumn(
                name: "extra_content",
                table: "timeline_posts");
        }
    }
}