using System; using Microsoft.EntityFrameworkCore.Migrations; using NodaTime; #nullable disable namespace DysonNetwork.Sphere.Migrations { /// public partial class AddPostAwardScore : Migration { /// protected override void Up(MigrationBuilder migrationBuilder) { migrationBuilder.AddColumn( name: "awarded_score", table: "posts", type: "numeric", nullable: false, defaultValue: 0m); migrationBuilder.CreateTable( name: "post_awards", columns: table => new { id = table.Column(type: "uuid", nullable: false), amount = table.Column(type: "numeric", nullable: false), attitude = table.Column(type: "integer", nullable: false), message = table.Column(type: "character varying(4096)", maxLength: 4096, nullable: true), post_id = table.Column(type: "uuid", nullable: false), account_id = table.Column(type: "uuid", nullable: false), created_at = table.Column(type: "timestamp with time zone", nullable: false), updated_at = table.Column(type: "timestamp with time zone", nullable: false), deleted_at = table.Column(type: "timestamp with time zone", nullable: true) }, constraints: table => { table.PrimaryKey("pk_post_awards", x => x.id); table.ForeignKey( name: "fk_post_awards_posts_post_id", column: x => x.post_id, principalTable: "posts", principalColumn: "id", onDelete: ReferentialAction.Cascade); }); migrationBuilder.CreateIndex( name: "ix_post_awards_post_id", table: "post_awards", column: "post_id"); } /// protected override void Down(MigrationBuilder migrationBuilder) { migrationBuilder.DropTable( name: "post_awards"); migrationBuilder.DropColumn( name: "awarded_score", table: "posts"); } } }