using System; using Microsoft.EntityFrameworkCore.Migrations; #nullable disable namespace FiscalOS.Infra.Migrations { /// public partial class InstitutionAndMetadata : Migration { /// protected override void Up(MigrationBuilder migrationBuilder) { migrationBuilder.CreateTable( name: "Institution", columns: table => new { Id = table.Column(type: "TEXT", nullable: false), UserId = table.Column(type: "TEXT", nullable: false), Name = table.Column(type: "TEXT", nullable: false), CreatedAt = table.Column(type: "TEXT", nullable: false), UpdatedAt = table.Column(type: "TEXT", nullable: false) }, constraints: table => { table.PrimaryKey("PK_Institution", x => x.Id); table.ForeignKey( name: "FK_Institution_Users_UserId", column: x => x.UserId, principalTable: "Users", principalColumn: "Id", onDelete: ReferentialAction.Cascade); }); migrationBuilder.CreateTable( name: "InstitutionMetadata", columns: table => new { Id = table.Column(type: "TEXT", nullable: false), Type = table.Column(type: "TEXT", maxLength: 21, nullable: false), InstitutionId = table.Column(type: "TEXT", nullable: false), PlaidId = table.Column(type: "TEXT", nullable: true), PlaidName = table.Column(type: "TEXT", nullable: true), EncryptedAccessToken = table.Column(type: "TEXT", nullable: true), CreatedAt = table.Column(type: "TEXT", nullable: false), UpdatedAt = table.Column(type: "TEXT", nullable: false) }, constraints: table => { table.PrimaryKey("PK_InstitutionMetadata", x => x.Id); table.ForeignKey( name: "FK_InstitutionMetadata_Institution_InstitutionId", column: x => x.InstitutionId, principalTable: "Institution", principalColumn: "Id", onDelete: ReferentialAction.Cascade); }); migrationBuilder.CreateIndex( name: "IX_Institution_UserId", table: "Institution", column: "UserId"); migrationBuilder.CreateIndex( name: "IX_InstitutionMetadata_InstitutionId", table: "InstitutionMetadata", column: "InstitutionId", unique: true); } /// protected override void Down(MigrationBuilder migrationBuilder) { migrationBuilder.DropTable( name: "InstitutionMetadata"); migrationBuilder.DropTable( name: "Institution"); } } }