complete controllers
This commit is contained in:
143
Server/Migrations/20230525082941_AddPhotos.cs
Normal file
143
Server/Migrations/20230525082941_AddPhotos.cs
Normal file
@@ -0,0 +1,143 @@
|
||||
using Microsoft.EntityFrameworkCore.Migrations;
|
||||
|
||||
#nullable disable
|
||||
|
||||
namespace Blahblah.FlowerStory.Server.Migrations
|
||||
{
|
||||
/// <inheritdoc />
|
||||
public partial class AddPhotos : Migration
|
||||
{
|
||||
/// <inheritdoc />
|
||||
protected override void Up(MigrationBuilder migrationBuilder)
|
||||
{
|
||||
migrationBuilder.DropColumn(
|
||||
name: "photo",
|
||||
table: "records");
|
||||
|
||||
migrationBuilder.DropColumn(
|
||||
name: "photo",
|
||||
table: "flowers");
|
||||
|
||||
migrationBuilder.AddColumn<int>(
|
||||
name: "fid",
|
||||
table: "records",
|
||||
type: "INTEGER",
|
||||
nullable: false,
|
||||
defaultValue: 0);
|
||||
|
||||
migrationBuilder.CreateTable(
|
||||
name: "photos",
|
||||
columns: table => new
|
||||
{
|
||||
pid = table.Column<int>(type: "INTEGER", nullable: false)
|
||||
.Annotation("Sqlite:Autoincrement", true),
|
||||
rid = table.Column<int>(type: "INTEGER", nullable: false),
|
||||
filetype = table.Column<string>(type: "TEXT", nullable: false),
|
||||
filename = table.Column<string>(type: "TEXT", nullable: false),
|
||||
path = table.Column<string>(type: "TEXT", nullable: false),
|
||||
dateupload = table.Column<long>(type: "INTEGER", nullable: false)
|
||||
},
|
||||
constraints: table =>
|
||||
{
|
||||
table.PrimaryKey("PK_photos", x => x.pid);
|
||||
table.ForeignKey(
|
||||
name: "FK_photos_records_rid",
|
||||
column: x => x.rid,
|
||||
principalTable: "records",
|
||||
principalColumn: "rid",
|
||||
onDelete: ReferentialAction.Cascade);
|
||||
});
|
||||
|
||||
migrationBuilder.CreateIndex(
|
||||
name: "IX_records_fid",
|
||||
table: "records",
|
||||
column: "fid");
|
||||
|
||||
migrationBuilder.CreateIndex(
|
||||
name: "IX_records_uid",
|
||||
table: "records",
|
||||
column: "uid");
|
||||
|
||||
migrationBuilder.CreateIndex(
|
||||
name: "IX_flowers_uid",
|
||||
table: "flowers",
|
||||
column: "uid");
|
||||
|
||||
migrationBuilder.CreateIndex(
|
||||
name: "IX_photos_rid",
|
||||
table: "photos",
|
||||
column: "rid");
|
||||
|
||||
migrationBuilder.AddForeignKey(
|
||||
name: "FK_flowers_users_uid",
|
||||
table: "flowers",
|
||||
column: "uid",
|
||||
principalTable: "users",
|
||||
principalColumn: "uid",
|
||||
onDelete: ReferentialAction.Cascade);
|
||||
|
||||
migrationBuilder.AddForeignKey(
|
||||
name: "FK_records_flowers_fid",
|
||||
table: "records",
|
||||
column: "fid",
|
||||
principalTable: "flowers",
|
||||
principalColumn: "fid",
|
||||
onDelete: ReferentialAction.Cascade);
|
||||
|
||||
migrationBuilder.AddForeignKey(
|
||||
name: "FK_records_users_uid",
|
||||
table: "records",
|
||||
column: "uid",
|
||||
principalTable: "users",
|
||||
principalColumn: "uid",
|
||||
onDelete: ReferentialAction.Cascade);
|
||||
}
|
||||
|
||||
/// <inheritdoc />
|
||||
protected override void Down(MigrationBuilder migrationBuilder)
|
||||
{
|
||||
migrationBuilder.DropForeignKey(
|
||||
name: "FK_flowers_users_uid",
|
||||
table: "flowers");
|
||||
|
||||
migrationBuilder.DropForeignKey(
|
||||
name: "FK_records_flowers_fid",
|
||||
table: "records");
|
||||
|
||||
migrationBuilder.DropForeignKey(
|
||||
name: "FK_records_users_uid",
|
||||
table: "records");
|
||||
|
||||
migrationBuilder.DropTable(
|
||||
name: "photos");
|
||||
|
||||
migrationBuilder.DropIndex(
|
||||
name: "IX_records_fid",
|
||||
table: "records");
|
||||
|
||||
migrationBuilder.DropIndex(
|
||||
name: "IX_records_uid",
|
||||
table: "records");
|
||||
|
||||
migrationBuilder.DropIndex(
|
||||
name: "IX_flowers_uid",
|
||||
table: "flowers");
|
||||
|
||||
migrationBuilder.DropColumn(
|
||||
name: "fid",
|
||||
table: "records");
|
||||
|
||||
migrationBuilder.AddColumn<byte[]>(
|
||||
name: "photo",
|
||||
table: "records",
|
||||
type: "BLOB",
|
||||
nullable: true);
|
||||
|
||||
migrationBuilder.AddColumn<byte[]>(
|
||||
name: "photo",
|
||||
table: "flowers",
|
||||
type: "BLOB",
|
||||
nullable: true);
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user