using Microsoft.EntityFrameworkCore.Migrations; using NodaTime; using Npgsql.EntityFrameworkCore.PostgreSQL.Metadata; #nullable disable namespace DysonNetwork.Sphere.Migrations { /// public partial class InitialMigration : Migration { /// protected override void Up(MigrationBuilder migrationBuilder) { migrationBuilder.CreateTable( name: "accounts", columns: table => new { id = table.Column(type: "bigint", nullable: false) .Annotation("Npgsql:ValueGenerationStrategy", NpgsqlValueGenerationStrategy.IdentityByDefaultColumn), name = table.Column(type: "character varying(256)", maxLength: 256, nullable: false), nick = table.Column(type: "character varying(256)", maxLength: 256, 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_accounts", x => x.id); }); migrationBuilder.CreateTable( name: "account_auth_factors", columns: table => new { id = table.Column(type: "bigint", nullable: false) .Annotation("Npgsql:ValueGenerationStrategy", NpgsqlValueGenerationStrategy.IdentityByDefaultColumn), type = table.Column(type: "integer", nullable: false), secret = table.Column(type: "text", nullable: true), account_id = table.Column(type: "bigint", 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_auth_factors", x => x.id); table.ForeignKey( name: "fk_account_auth_factors_accounts_account_id", column: x => x.account_id, principalTable: "accounts", principalColumn: "id", onDelete: ReferentialAction.Cascade); }); migrationBuilder.CreateTable( name: "account_contacts", columns: table => new { id = table.Column(type: "bigint", nullable: false) .Annotation("Npgsql:ValueGenerationStrategy", NpgsqlValueGenerationStrategy.IdentityByDefaultColumn), type = table.Column(type: "integer", nullable: false), verified_at = table.Column(type: "timestamp with time zone", nullable: true), content = table.Column(type: "character varying(1024)", maxLength: 1024, nullable: false), account_id = table.Column(type: "bigint", 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_contacts", x => x.id); table.ForeignKey( name: "fk_account_contacts_accounts_account_id", column: x => x.account_id, principalTable: "accounts", principalColumn: "id", onDelete: ReferentialAction.Cascade); }); migrationBuilder.CreateIndex( name: "ix_account_auth_factors_account_id", table: "account_auth_factors", column: "account_id"); migrationBuilder.CreateIndex( name: "ix_account_contacts_account_id", table: "account_contacts", column: "account_id"); } /// protected override void Down(MigrationBuilder migrationBuilder) { migrationBuilder.DropTable( name: "account_auth_factors"); migrationBuilder.DropTable( name: "account_contacts"); migrationBuilder.DropTable( name: "accounts"); } } }