using System; using Microsoft.EntityFrameworkCore.Migrations; #nullable disable namespace CodeLiturgy.Views.Migrations.SiteDb { /// public partial class first : Migration { /// protected override void Up(MigrationBuilder migrationBuilder) { migrationBuilder.CreateTable( name: "ApplicationUser", columns: table => new { Id = table.Column(type: "text", nullable: false), UserName = table.Column(type: "text", nullable: true), NormalizedUserName = table.Column(type: "text", nullable: true), Email = table.Column(type: "text", nullable: true), NormalizedEmail = table.Column(type: "text", nullable: true), EmailConfirmed = table.Column(type: "boolean", nullable: false), PasswordHash = table.Column(type: "text", nullable: true), SecurityStamp = table.Column(type: "text", nullable: true), ConcurrencyStamp = table.Column(type: "text", nullable: true), PhoneNumber = table.Column(type: "text", nullable: true), PhoneNumberConfirmed = table.Column(type: "boolean", nullable: false), TwoFactorEnabled = table.Column(type: "boolean", nullable: false), LockoutEnd = table.Column(type: "timestamp with time zone", nullable: true), LockoutEnabled = table.Column(type: "boolean", nullable: false), AccessFailedCount = table.Column(type: "integer", nullable: false) }, constraints: table => { table.PrimaryKey("PK_ApplicationUser", x => x.Id); }); migrationBuilder.CreateTable( name: "Environments", columns: table => new { Id = table.Column(type: "text", nullable: false), Name = table.Column(type: "text", nullable: true), UserId = table.Column(type: "text", nullable: true) }, constraints: table => { table.PrimaryKey("PK_Environments", x => x.Id); table.ForeignKey( name: "FK_Environments_ApplicationUser_UserId", column: x => x.UserId, principalTable: "ApplicationUser", principalColumn: "Id"); }); migrationBuilder.CreateTable( name: "Sites", columns: table => new { Id = table.Column(type: "text", nullable: false), EnvironmentId = table.Column(type: "text", nullable: true), Domain = table.Column(type: "text", nullable: true), UrlAddress = table.Column(type: "text", nullable: true), EnvironmentType = table.Column(type: "integer", nullable: false), CreatedDate = table.Column(type: "timestamp with time zone", nullable: false), LastChanged = table.Column(type: "timestamp with time zone", nullable: false) }, constraints: table => { table.PrimaryKey("PK_Sites", x => x.Id); table.ForeignKey( name: "FK_Sites_Environments_EnvironmentId", column: x => x.EnvironmentId, principalTable: "Environments", principalColumn: "Id"); }); migrationBuilder.CreateIndex( name: "IX_Environments_UserId", table: "Environments", column: "UserId"); migrationBuilder.CreateIndex( name: "IX_Sites_EnvironmentId", table: "Sites", column: "EnvironmentId"); } /// protected override void Down(MigrationBuilder migrationBuilder) { migrationBuilder.DropTable( name: "Sites"); migrationBuilder.DropTable( name: "Environments"); migrationBuilder.DropTable( name: "ApplicationUser"); } } }