using Microsoft.EntityFrameworkCore.Migrations; using NodaTime; #nullable disable namespace DysonNetwork.Sphere.Migrations { /// public partial class AddRelationship : Migration { /// protected override void Up(MigrationBuilder migrationBuilder) { migrationBuilder.CreateTable( name: "account_relationships", columns: table => new { from_account_id = table.Column(type: "bigint", nullable: false), to_account_id = table.Column(type: "bigint", nullable: false), type = table.Column(type: "integer", 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_account_relationships", x => new { x.from_account_id, x.to_account_id }); table.ForeignKey( name: "fk_account_relationships_accounts_from_account_id", column: x => x.from_account_id, principalTable: "accounts", principalColumn: "id", onDelete: ReferentialAction.Cascade); table.ForeignKey( name: "fk_account_relationships_accounts_to_account_id", column: x => x.to_account_id, principalTable: "accounts", principalColumn: "id", onDelete: ReferentialAction.Cascade); }); migrationBuilder.CreateIndex( name: "ix_account_relationships_to_account_id", table: "account_relationships", column: "to_account_id"); } /// protected override void Down(MigrationBuilder migrationBuilder) { migrationBuilder.DropTable( name: "account_relationships"); } } }