using System; using Microsoft.EntityFrameworkCore.Migrations; #nullable disable namespace HrynCo.NotificationService.DAL.EF.Migrations { /// public partial class InitialCreate : Migration { /// protected override void Up(MigrationBuilder migrationBuilder) { migrationBuilder.CreateTable( name: "email_channel_usage", columns: table => new { id = table.Column(type: "uuid", nullable: false), provider_id = table.Column(type: "uuid", nullable: false), date = table.Column(type: "date", nullable: false), sent_count = table.Column(type: "integer", nullable: false), created = table.Column(type: "timestamp with time zone", nullable: false), updated = table.Column(type: "timestamp with time zone", nullable: true) }, constraints: table => { table.PrimaryKey("PK_email_channel_usage", x => x.id); }); migrationBuilder.CreateTable( name: "email_channels", columns: table => new { id = table.Column(type: "uuid", nullable: false), service_name = table.Column(type: "character varying(100)", maxLength: 100, nullable: false), priority = table.Column(type: "integer", nullable: false), provider_type = table.Column(type: "integer", nullable: false), settings = table.Column(type: "jsonb", nullable: false), daily_limit = table.Column(type: "integer", nullable: true), monthly_limit = table.Column(type: "integer", nullable: true), warn_threshold_percent = table.Column(type: "integer", nullable: false), is_active = table.Column(type: "boolean", nullable: false), created = table.Column(type: "timestamp with time zone", nullable: false), updated = table.Column(type: "timestamp with time zone", nullable: true) }, constraints: table => { table.PrimaryKey("PK_email_channels", x => x.id); }); migrationBuilder.CreateTable( name: "email_templates", columns: table => new { id = table.Column(type: "uuid", nullable: false), service_name = table.Column(type: "character varying(100)", maxLength: 100, nullable: false), key = table.Column(type: "character varying(100)", maxLength: 100, nullable: false), language_code = table.Column(type: "character varying(10)", maxLength: 10, nullable: false), subject = table.Column(type: "text", nullable: false), html_body = table.Column(type: "text", nullable: false), text_body = table.Column(type: "text", nullable: false), created = table.Column(type: "timestamp with time zone", nullable: false), updated = table.Column(type: "timestamp with time zone", nullable: true), variables = table.Column(type: "jsonb", nullable: true) }, constraints: table => { table.PrimaryKey("PK_email_templates", x => x.id); }); migrationBuilder.CreateIndex( name: "IX_email_channel_usage_provider_id_date", table: "email_channel_usage", columns: new[] { "provider_id", "date" }, unique: true); migrationBuilder.CreateIndex( name: "IX_email_channels_service_name_priority", table: "email_channels", columns: new[] { "service_name", "priority" }); migrationBuilder.CreateIndex( name: "IX_email_templates_service_name_key_language_code", table: "email_templates", columns: new[] { "service_name", "key", "language_code" }, unique: true); } /// protected override void Down(MigrationBuilder migrationBuilder) { migrationBuilder.DropTable( name: "email_channel_usage"); migrationBuilder.DropTable( name: "email_channels"); migrationBuilder.DropTable( name: "email_templates"); } } }