using System; using Microsoft.EntityFrameworkCore.Migrations; using Npgsql.EntityFrameworkCore.PostgreSQL.Metadata; #nullable disable namespace Yavsc.Migrations { /// public partial class ResourceUsageRecords : Migration { /// protected override void Up(MigrationBuilder migrationBuilder) { migrationBuilder.CreateTable( name: "ResourceUsageRecords", columns: table => new { Id = table.Column(type: "bigint", nullable: false) .Annotation("Npgsql:ValueGenerationStrategy", NpgsqlValueGenerationStrategy.IdentityByDefaultColumn), UserId = table.Column(type: "character varying(256)", maxLength: 256, nullable: false), UserName = table.Column(type: "character varying(256)", maxLength: 256, nullable: false), RecordedAtUtc = table.Column(type: "timestamp with time zone", nullable: false), ApiCalls = table.Column(type: "numeric", nullable: false), CpuSeconds = table.Column(type: "numeric", nullable: false), BandwidthMb = table.Column(type: "numeric", nullable: false), StorageMb = table.Column(type: "numeric", nullable: false), EstimatedCompensation = table.Column(type: "numeric", nullable: false), Currency = table.Column(type: "character varying(8)", maxLength: 8, nullable: false, defaultValue: "EUR"), DateCreated = table.Column(type: "timestamp with time zone", nullable: false), UserCreated = table.Column(type: "text", nullable: true), DateModified = table.Column(type: "timestamp with time zone", nullable: false), UserModified = table.Column(type: "text", nullable: true) }, constraints: table => { table.PrimaryKey("PK_ResourceUsageRecords", x => x.Id); }); migrationBuilder.CreateIndex( name: "IX_ResourceUsageRecords_UserId_RecordedAtUtc", table: "ResourceUsageRecords", columns: new[] { "UserId", "RecordedAtUtc" }); } /// protected override void Down(MigrationBuilder migrationBuilder) { migrationBuilder.DropTable( name: "ResourceUsageRecords"); } } }