| | | 1 | | using Microsoft.EntityFrameworkCore.Migrations; |
| | | 2 | | |
| | | 3 | | #nullable disable |
| | | 4 | | |
| | | 5 | | namespace Elsa.Persistence.EFCore.Sqlite.Migrations.Identity |
| | | 6 | | { |
| | | 7 | | /// <inheritdoc /> |
| | | 8 | | public partial class Initial : Migration |
| | | 9 | | { |
| | | 10 | | /// <inheritdoc /> |
| | | 11 | | protected override void Up(MigrationBuilder migrationBuilder) |
| | | 12 | | { |
| | 0 | 13 | | migrationBuilder.CreateTable( |
| | 0 | 14 | | name: "Applications", |
| | 0 | 15 | | columns: table => new |
| | 0 | 16 | | { |
| | 0 | 17 | | Id = table.Column<string>(type: "TEXT", nullable: false), |
| | 0 | 18 | | ClientId = table.Column<string>(type: "TEXT", nullable: false), |
| | 0 | 19 | | HashedClientSecret = table.Column<string>(type: "TEXT", nullable: false), |
| | 0 | 20 | | HashedClientSecretSalt = table.Column<string>(type: "TEXT", nullable: false), |
| | 0 | 21 | | Name = table.Column<string>(type: "TEXT", nullable: false), |
| | 0 | 22 | | HashedApiKey = table.Column<string>(type: "TEXT", nullable: false), |
| | 0 | 23 | | HashedApiKeySalt = table.Column<string>(type: "TEXT", nullable: false), |
| | 0 | 24 | | Roles = table.Column<string>(type: "TEXT", nullable: false) |
| | 0 | 25 | | }, |
| | 0 | 26 | | constraints: table => |
| | 0 | 27 | | { |
| | 0 | 28 | | table.PrimaryKey("PK_Applications", x => x.Id); |
| | 0 | 29 | | }); |
| | | 30 | | |
| | 0 | 31 | | migrationBuilder.CreateTable( |
| | 0 | 32 | | name: "Roles", |
| | 0 | 33 | | columns: table => new |
| | 0 | 34 | | { |
| | 0 | 35 | | Id = table.Column<string>(type: "TEXT", nullable: false), |
| | 0 | 36 | | Name = table.Column<string>(type: "TEXT", nullable: false), |
| | 0 | 37 | | Permissions = table.Column<string>(type: "TEXT", nullable: false) |
| | 0 | 38 | | }, |
| | 0 | 39 | | constraints: table => |
| | 0 | 40 | | { |
| | 0 | 41 | | table.PrimaryKey("PK_Roles", x => x.Id); |
| | 0 | 42 | | }); |
| | | 43 | | |
| | 0 | 44 | | migrationBuilder.CreateTable( |
| | 0 | 45 | | name: "Users", |
| | 0 | 46 | | columns: table => new |
| | 0 | 47 | | { |
| | 0 | 48 | | Id = table.Column<string>(type: "TEXT", nullable: false), |
| | 0 | 49 | | Name = table.Column<string>(type: "TEXT", nullable: false), |
| | 0 | 50 | | HashedPassword = table.Column<string>(type: "TEXT", nullable: false), |
| | 0 | 51 | | HashedPasswordSalt = table.Column<string>(type: "TEXT", nullable: false), |
| | 0 | 52 | | Roles = table.Column<string>(type: "TEXT", nullable: false) |
| | 0 | 53 | | }, |
| | 0 | 54 | | constraints: table => |
| | 0 | 55 | | { |
| | 0 | 56 | | table.PrimaryKey("PK_Users", x => x.Id); |
| | 0 | 57 | | }); |
| | | 58 | | |
| | 0 | 59 | | migrationBuilder.CreateIndex( |
| | 0 | 60 | | name: "IX_Application_ClientId", |
| | 0 | 61 | | table: "Applications", |
| | 0 | 62 | | column: "ClientId", |
| | 0 | 63 | | unique: true); |
| | | 64 | | |
| | 0 | 65 | | migrationBuilder.CreateIndex( |
| | 0 | 66 | | name: "IX_Application_Name", |
| | 0 | 67 | | table: "Applications", |
| | 0 | 68 | | column: "Name", |
| | 0 | 69 | | unique: true); |
| | | 70 | | |
| | 0 | 71 | | migrationBuilder.CreateIndex( |
| | 0 | 72 | | name: "IX_Role_Name", |
| | 0 | 73 | | table: "Roles", |
| | 0 | 74 | | column: "Name", |
| | 0 | 75 | | unique: true); |
| | | 76 | | |
| | 0 | 77 | | migrationBuilder.CreateIndex( |
| | 0 | 78 | | name: "IX_User_Name", |
| | 0 | 79 | | table: "Users", |
| | 0 | 80 | | column: "Name", |
| | 0 | 81 | | unique: true); |
| | 0 | 82 | | } |
| | | 83 | | |
| | | 84 | | /// <inheritdoc /> |
| | | 85 | | protected override void Down(MigrationBuilder migrationBuilder) |
| | | 86 | | { |
| | 0 | 87 | | migrationBuilder.DropTable( |
| | 0 | 88 | | name: "Applications"); |
| | | 89 | | |
| | 0 | 90 | | migrationBuilder.DropTable( |
| | 0 | 91 | | name: "Roles"); |
| | | 92 | | |
| | 0 | 93 | | migrationBuilder.DropTable( |
| | 0 | 94 | | name: "Users"); |
| | 0 | 95 | | } |
| | | 96 | | } |
| | | 97 | | } |