| | | 1 | | using System; |
| | | 2 | | using Elsa.Persistence.EFCore; |
| | | 3 | | using Microsoft.EntityFrameworkCore.Migrations; |
| | | 4 | | |
| | | 5 | | #nullable disable |
| | | 6 | | |
| | | 7 | | namespace Elsa.Secrets.Persistence.EFCore.SqlServer.Migrations.Secrets |
| | | 8 | | { |
| | | 9 | | /// <inheritdoc /> |
| | | 10 | | public partial class Initial : Migration |
| | | 11 | | { |
| | | 12 | | private readonly IElsaDbContextSchema _schema; |
| | | 13 | | |
| | 2 | 14 | | public Initial(IElsaDbContextSchema schema) |
| | | 15 | | { |
| | 2 | 16 | | _schema = schema ?? throw new ArgumentNullException(nameof(schema)); |
| | 2 | 17 | | } |
| | | 18 | | |
| | | 19 | | /// <inheritdoc /> |
| | | 20 | | protected override void Up(MigrationBuilder migrationBuilder) |
| | | 21 | | { |
| | 2 | 22 | | migrationBuilder.EnsureSchema( |
| | 2 | 23 | | name: _schema.Schema); |
| | | 24 | | |
| | 2 | 25 | | migrationBuilder.CreateTable( |
| | 2 | 26 | | name: "Secrets", |
| | 2 | 27 | | schema: _schema.Schema, |
| | 2 | 28 | | columns: table => new |
| | 2 | 29 | | { |
| | 2 | 30 | | Id = table.Column<string>(type: "nvarchar(450)", nullable: false), |
| | 2 | 31 | | Name = table.Column<string>(type: "nvarchar(200)", maxLength: 200, nullable: false), |
| | 2 | 32 | | NormalizedName = table.Column<string>(type: "nvarchar(200)", maxLength: 200, nullable: false), |
| | 2 | 33 | | DisplayName = table.Column<string>(type: "nvarchar(200)", maxLength: 200, nullable: false), |
| | 2 | 34 | | Description = table.Column<string>(type: "nvarchar(max)", nullable: true), |
| | 2 | 35 | | TypeName = table.Column<string>(type: "nvarchar(100)", maxLength: 100, nullable: false), |
| | 2 | 36 | | StoreName = table.Column<string>(type: "nvarchar(100)", maxLength: 100, nullable: false), |
| | 2 | 37 | | Scope = table.Column<string>(type: "nvarchar(200)", maxLength: 200, nullable: true), |
| | 2 | 38 | | Status = table.Column<string>(type: "nvarchar(32)", maxLength: 32, nullable: false), |
| | 2 | 39 | | CreatedAt = table.Column<DateTimeOffset>(type: "datetimeoffset", nullable: false), |
| | 2 | 40 | | UpdatedAt = table.Column<DateTimeOffset>(type: "datetimeoffset", nullable: true), |
| | 2 | 41 | | Tags = table.Column<string>(type: "nvarchar(max)", nullable: false), |
| | 2 | 42 | | Versions = table.Column<string>(type: "nvarchar(max)", nullable: false) |
| | 2 | 43 | | }, |
| | 2 | 44 | | constraints: table => |
| | 2 | 45 | | { |
| | 2 | 46 | | table.PrimaryKey("PK_Secrets", x => x.Id); |
| | 4 | 47 | | }); |
| | | 48 | | |
| | 2 | 49 | | migrationBuilder.CreateIndex( |
| | 2 | 50 | | name: "IX_Secret_NormalizedName", |
| | 2 | 51 | | schema: _schema.Schema, |
| | 2 | 52 | | table: "Secrets", |
| | 2 | 53 | | column: "NormalizedName", |
| | 2 | 54 | | unique: true); |
| | | 55 | | |
| | 2 | 56 | | migrationBuilder.CreateIndex( |
| | 2 | 57 | | name: "IX_Secret_Scope", |
| | 2 | 58 | | schema: _schema.Schema, |
| | 2 | 59 | | table: "Secrets", |
| | 2 | 60 | | column: "Scope"); |
| | | 61 | | |
| | 2 | 62 | | migrationBuilder.CreateIndex( |
| | 2 | 63 | | name: "IX_Secret_Status", |
| | 2 | 64 | | schema: _schema.Schema, |
| | 2 | 65 | | table: "Secrets", |
| | 2 | 66 | | column: "Status"); |
| | | 67 | | |
| | 2 | 68 | | migrationBuilder.CreateIndex( |
| | 2 | 69 | | name: "IX_Secret_StoreName", |
| | 2 | 70 | | schema: _schema.Schema, |
| | 2 | 71 | | table: "Secrets", |
| | 2 | 72 | | column: "StoreName"); |
| | | 73 | | |
| | 2 | 74 | | migrationBuilder.CreateIndex( |
| | 2 | 75 | | name: "IX_Secret_TypeName", |
| | 2 | 76 | | schema: _schema.Schema, |
| | 2 | 77 | | table: "Secrets", |
| | 2 | 78 | | column: "TypeName"); |
| | 2 | 79 | | } |
| | | 80 | | |
| | | 81 | | /// <inheritdoc /> |
| | | 82 | | protected override void Down(MigrationBuilder migrationBuilder) |
| | | 83 | | { |
| | 0 | 84 | | migrationBuilder.DropTable( |
| | 0 | 85 | | name: "Secrets", |
| | 0 | 86 | | schema: _schema.Schema); |
| | 0 | 87 | | } |
| | | 88 | | } |
| | | 89 | | } |