using Microsoft.EntityFrameworkCore.Migrations; #nullable disable namespace Blahblah.FlowerStory.Server.Migrations { /// public partial class AddComments : Migration { /// protected override void Up(MigrationBuilder migrationBuilder) { migrationBuilder.AddColumn( name: "comments", table: "records", type: "INTEGER", nullable: true); migrationBuilder.AddColumn( name: "favs", table: "records", type: "INTEGER", nullable: true); migrationBuilder.AddColumn( name: "likes", table: "records", type: "INTEGER", nullable: true); migrationBuilder.CreateTable( name: "comments", columns: table => new { cid = table.Column(type: "INTEGER", nullable: false) .Annotation("Sqlite:Autoincrement", true), uid = table.Column(type: "INTEGER", nullable: false), date = table.Column(type: "INTEGER", nullable: false), rid = table.Column(type: "INTEGER", nullable: false), category = table.Column(type: "INTEGER", nullable: true), byuid = table.Column(type: "INTEGER", nullable: true), byname = table.Column(type: "TEXT", nullable: true), text = table.Column(type: "TEXT", nullable: true), latitude = table.Column(type: "REAL", nullable: true), longitude = table.Column(type: "REAL", nullable: true) }, constraints: table => { table.PrimaryKey("PK_comments", x => x.cid); table.ForeignKey( name: "FK_comments_records_rid", column: x => x.rid, principalTable: "records", principalColumn: "rid", onDelete: ReferentialAction.Cascade); table.ForeignKey( name: "FK_comments_users_uid", column: x => x.uid, principalTable: "users", principalColumn: "uid", onDelete: ReferentialAction.Cascade); }); migrationBuilder.CreateIndex( name: "IX_comments_rid", table: "comments", column: "rid"); migrationBuilder.CreateIndex( name: "IX_comments_uid", table: "comments", column: "uid"); } /// protected override void Down(MigrationBuilder migrationBuilder) { migrationBuilder.DropTable( name: "comments"); migrationBuilder.DropColumn( name: "comments", table: "records"); migrationBuilder.DropColumn( name: "favs", table: "records"); migrationBuilder.DropColumn( name: "likes", table: "records"); } } }