| | 1 | | using System; |
| | 2 | | using Microsoft.EntityFrameworkCore.Migrations; |
| | 3 | | using Npgsql.EntityFrameworkCore.PostgreSQL.Metadata; |
| | 4 | |
|
| | 5 | | #nullable disable |
| | 6 | |
|
| | 7 | | #pragma warning disable CA1814 // Prefer jagged arrays over multidimensional |
| | 8 | |
|
| | 9 | | namespace LGDXRobotCloud.Data.Migrations |
| | 10 | | { |
| | 11 | | /// <inheritdoc /> |
| | 12 | | public partial class InitialCreate : Migration |
| | 13 | | { |
| | 14 | | /// <inheritdoc /> |
| | 15 | | protected override void Up(MigrationBuilder migrationBuilder) |
| 0 | 16 | | { |
| 0 | 17 | | migrationBuilder.CreateTable( |
| 0 | 18 | | name: "Administration.ApiKeys", |
| 0 | 19 | | columns: table => new |
| 0 | 20 | | { |
| 0 | 21 | | Id = table.Column<int>(type: "integer", nullable: false) |
| 0 | 22 | | .Annotation("Npgsql:ValueGenerationStrategy", NpgsqlValueGenerationStrategy.IdentityByDefaultCol |
| 0 | 23 | | Name = table.Column<string>(type: "character varying(50)", maxLength: 50, nullable: false), |
| 0 | 24 | | Secret = table.Column<string>(type: "character varying(200)", maxLength: 200, nullable: false), |
| 0 | 25 | | IsThirdParty = table.Column<bool>(type: "boolean", nullable: false) |
| 0 | 26 | | }, |
| 0 | 27 | | constraints: table => |
| 0 | 28 | | { |
| 0 | 29 | | table.PrimaryKey("PK_Administration.ApiKeys", x => x.Id); |
| 0 | 30 | | }); |
| | 31 | |
|
| 0 | 32 | | migrationBuilder.CreateTable( |
| 0 | 33 | | name: "AspNetRoles", |
| 0 | 34 | | columns: table => new |
| 0 | 35 | | { |
| 0 | 36 | | Id = table.Column<string>(type: "text", nullable: false), |
| 0 | 37 | | Description = table.Column<string>(type: "text", nullable: true), |
| 0 | 38 | | Name = table.Column<string>(type: "character varying(256)", maxLength: 256, nullable: true), |
| 0 | 39 | | NormalizedName = table.Column<string>(type: "character varying(256)", maxLength: 256, nullable: true |
| 0 | 40 | | ConcurrencyStamp = table.Column<string>(type: "text", nullable: true) |
| 0 | 41 | | }, |
| 0 | 42 | | constraints: table => |
| 0 | 43 | | { |
| 0 | 44 | | table.PrimaryKey("PK_AspNetRoles", x => x.Id); |
| 0 | 45 | | }); |
| | 46 | |
|
| 0 | 47 | | migrationBuilder.CreateTable( |
| 0 | 48 | | name: "AspNetUsers", |
| 0 | 49 | | columns: table => new |
| 0 | 50 | | { |
| 0 | 51 | | Id = table.Column<string>(type: "text", nullable: false), |
| 0 | 52 | | Name = table.Column<string>(type: "text", nullable: true), |
| 0 | 53 | | RefreshTokenHash = table.Column<string>(type: "character varying(64)", maxLength: 64, nullable: true |
| 0 | 54 | | UserName = table.Column<string>(type: "character varying(256)", maxLength: 256, nullable: true), |
| 0 | 55 | | NormalizedUserName = table.Column<string>(type: "character varying(256)", maxLength: 256, nullable: |
| 0 | 56 | | Email = table.Column<string>(type: "character varying(256)", maxLength: 256, nullable: true), |
| 0 | 57 | | NormalizedEmail = table.Column<string>(type: "character varying(256)", maxLength: 256, nullable: tru |
| 0 | 58 | | EmailConfirmed = table.Column<bool>(type: "boolean", nullable: false), |
| 0 | 59 | | PasswordHash = table.Column<string>(type: "text", nullable: true), |
| 0 | 60 | | SecurityStamp = table.Column<string>(type: "text", nullable: true), |
| 0 | 61 | | ConcurrencyStamp = table.Column<string>(type: "text", nullable: true), |
| 0 | 62 | | PhoneNumber = table.Column<string>(type: "text", nullable: true), |
| 0 | 63 | | PhoneNumberConfirmed = table.Column<bool>(type: "boolean", nullable: false), |
| 0 | 64 | | TwoFactorEnabled = table.Column<bool>(type: "boolean", nullable: false), |
| 0 | 65 | | LockoutEnd = table.Column<DateTimeOffset>(type: "timestamp with time zone", nullable: true), |
| 0 | 66 | | LockoutEnabled = table.Column<bool>(type: "boolean", nullable: false), |
| 0 | 67 | | AccessFailedCount = table.Column<int>(type: "integer", nullable: false) |
| 0 | 68 | | }, |
| 0 | 69 | | constraints: table => |
| 0 | 70 | | { |
| 0 | 71 | | table.PrimaryKey("PK_AspNetUsers", x => x.Id); |
| 0 | 72 | | }); |
| | 73 | |
|
| 0 | 74 | | migrationBuilder.CreateTable( |
| 0 | 75 | | name: "Automation.Flows", |
| 0 | 76 | | columns: table => new |
| 0 | 77 | | { |
| 0 | 78 | | Id = table.Column<int>(type: "integer", nullable: false) |
| 0 | 79 | | .Annotation("Npgsql:ValueGenerationStrategy", NpgsqlValueGenerationStrategy.IdentityByDefaultCol |
| 0 | 80 | | Name = table.Column<string>(type: "character varying(50)", maxLength: 50, nullable: false) |
| 0 | 81 | | }, |
| 0 | 82 | | constraints: table => |
| 0 | 83 | | { |
| 0 | 84 | | table.PrimaryKey("PK_Automation.Flows", x => x.Id); |
| 0 | 85 | | }); |
| | 86 | |
|
| 0 | 87 | | migrationBuilder.CreateTable( |
| 0 | 88 | | name: "Automation.Progresses", |
| 0 | 89 | | columns: table => new |
| 0 | 90 | | { |
| 0 | 91 | | Id = table.Column<int>(type: "integer", nullable: false) |
| 0 | 92 | | .Annotation("Npgsql:ValueGenerationStrategy", NpgsqlValueGenerationStrategy.IdentityByDefaultCol |
| 0 | 93 | | Name = table.Column<string>(type: "character varying(50)", maxLength: 50, nullable: false), |
| 0 | 94 | | System = table.Column<bool>(type: "boolean", nullable: false), |
| 0 | 95 | | Reserved = table.Column<bool>(type: "boolean", nullable: false) |
| 0 | 96 | | }, |
| 0 | 97 | | constraints: table => |
| 0 | 98 | | { |
| 0 | 99 | | table.PrimaryKey("PK_Automation.Progresses", x => x.Id); |
| 0 | 100 | | }); |
| | 101 | |
|
| 0 | 102 | | migrationBuilder.CreateTable( |
| 0 | 103 | | name: "Navigation.Realms", |
| 0 | 104 | | columns: table => new |
| 0 | 105 | | { |
| 0 | 106 | | Id = table.Column<int>(type: "integer", nullable: false) |
| 0 | 107 | | .Annotation("Npgsql:ValueGenerationStrategy", NpgsqlValueGenerationStrategy.IdentityByDefaultCol |
| 0 | 108 | | Name = table.Column<string>(type: "character varying(50)", maxLength: 50, nullable: false), |
| 0 | 109 | | Description = table.Column<string>(type: "character varying(200)", maxLength: 200, nullable: true), |
| 0 | 110 | | Image = table.Column<byte[]>(type: "bytea", nullable: false), |
| 0 | 111 | | Resolution = table.Column<double>(type: "double precision", nullable: false), |
| 0 | 112 | | OriginX = table.Column<double>(type: "double precision", nullable: false), |
| 0 | 113 | | OriginY = table.Column<double>(type: "double precision", nullable: false), |
| 0 | 114 | | OriginRotation = table.Column<double>(type: "double precision", nullable: false) |
| 0 | 115 | | }, |
| 0 | 116 | | constraints: table => |
| 0 | 117 | | { |
| 0 | 118 | | table.PrimaryKey("PK_Navigation.Realms", x => x.Id); |
| 0 | 119 | | }); |
| | 120 | |
|
| 0 | 121 | | migrationBuilder.CreateTable( |
| 0 | 122 | | name: "Automation.Triggers", |
| 0 | 123 | | columns: table => new |
| 0 | 124 | | { |
| 0 | 125 | | Id = table.Column<int>(type: "integer", nullable: false) |
| 0 | 126 | | .Annotation("Npgsql:ValueGenerationStrategy", NpgsqlValueGenerationStrategy.IdentityByDefaultCol |
| 0 | 127 | | Name = table.Column<string>(type: "character varying(50)", maxLength: 50, nullable: false), |
| 0 | 128 | | Url = table.Column<string>(type: "character varying(200)", maxLength: 200, nullable: false), |
| 0 | 129 | | HttpMethodId = table.Column<int>(type: "integer", nullable: false), |
| 0 | 130 | | Body = table.Column<string>(type: "text", nullable: true), |
| 0 | 131 | | SkipOnFailure = table.Column<bool>(type: "boolean", nullable: false), |
| 0 | 132 | | ApiKeyInsertLocationId = table.Column<int>(type: "integer", nullable: true), |
| 0 | 133 | | ApiKeyFieldName = table.Column<string>(type: "character varying(50)", maxLength: 50, nullable: true) |
| 0 | 134 | | ApiKeyId = table.Column<int>(type: "integer", nullable: true) |
| 0 | 135 | | }, |
| 0 | 136 | | constraints: table => |
| 0 | 137 | | { |
| 0 | 138 | | table.PrimaryKey("PK_Automation.Triggers", x => x.Id); |
| 0 | 139 | | table.ForeignKey( |
| 0 | 140 | | name: "FK_Automation.Triggers_Administration.ApiKeys_ApiKeyId", |
| 0 | 141 | | column: x => x.ApiKeyId, |
| 0 | 142 | | principalTable: "Administration.ApiKeys", |
| 0 | 143 | | principalColumn: "Id", |
| 0 | 144 | | onDelete: ReferentialAction.SetNull); |
| 0 | 145 | | }); |
| | 146 | |
|
| 0 | 147 | | migrationBuilder.CreateTable( |
| 0 | 148 | | name: "AspNetRoleClaims", |
| 0 | 149 | | columns: table => new |
| 0 | 150 | | { |
| 0 | 151 | | Id = table.Column<int>(type: "integer", nullable: false) |
| 0 | 152 | | .Annotation("Npgsql:ValueGenerationStrategy", NpgsqlValueGenerationStrategy.IdentityByDefaultCol |
| 0 | 153 | | RoleId = table.Column<string>(type: "text", nullable: false), |
| 0 | 154 | | ClaimType = table.Column<string>(type: "text", nullable: true), |
| 0 | 155 | | ClaimValue = table.Column<string>(type: "text", nullable: true) |
| 0 | 156 | | }, |
| 0 | 157 | | constraints: table => |
| 0 | 158 | | { |
| 0 | 159 | | table.PrimaryKey("PK_AspNetRoleClaims", x => x.Id); |
| 0 | 160 | | table.ForeignKey( |
| 0 | 161 | | name: "FK_AspNetRoleClaims_AspNetRoles_RoleId", |
| 0 | 162 | | column: x => x.RoleId, |
| 0 | 163 | | principalTable: "AspNetRoles", |
| 0 | 164 | | principalColumn: "Id", |
| 0 | 165 | | onDelete: ReferentialAction.Cascade); |
| 0 | 166 | | }); |
| | 167 | |
|
| 0 | 168 | | migrationBuilder.CreateTable( |
| 0 | 169 | | name: "AspNetUserClaims", |
| 0 | 170 | | columns: table => new |
| 0 | 171 | | { |
| 0 | 172 | | Id = table.Column<int>(type: "integer", nullable: false) |
| 0 | 173 | | .Annotation("Npgsql:ValueGenerationStrategy", NpgsqlValueGenerationStrategy.IdentityByDefaultCol |
| 0 | 174 | | UserId = table.Column<string>(type: "text", nullable: false), |
| 0 | 175 | | ClaimType = table.Column<string>(type: "text", nullable: true), |
| 0 | 176 | | ClaimValue = table.Column<string>(type: "text", nullable: true) |
| 0 | 177 | | }, |
| 0 | 178 | | constraints: table => |
| 0 | 179 | | { |
| 0 | 180 | | table.PrimaryKey("PK_AspNetUserClaims", x => x.Id); |
| 0 | 181 | | table.ForeignKey( |
| 0 | 182 | | name: "FK_AspNetUserClaims_AspNetUsers_UserId", |
| 0 | 183 | | column: x => x.UserId, |
| 0 | 184 | | principalTable: "AspNetUsers", |
| 0 | 185 | | principalColumn: "Id", |
| 0 | 186 | | onDelete: ReferentialAction.Cascade); |
| 0 | 187 | | }); |
| | 188 | |
|
| 0 | 189 | | migrationBuilder.CreateTable( |
| 0 | 190 | | name: "AspNetUserLogins", |
| 0 | 191 | | columns: table => new |
| 0 | 192 | | { |
| 0 | 193 | | LoginProvider = table.Column<string>(type: "text", nullable: false), |
| 0 | 194 | | ProviderKey = table.Column<string>(type: "text", nullable: false), |
| 0 | 195 | | ProviderDisplayName = table.Column<string>(type: "text", nullable: true), |
| 0 | 196 | | UserId = table.Column<string>(type: "text", nullable: false) |
| 0 | 197 | | }, |
| 0 | 198 | | constraints: table => |
| 0 | 199 | | { |
| 0 | 200 | | table.PrimaryKey("PK_AspNetUserLogins", x => new { x.LoginProvider, x.ProviderKey }); |
| 0 | 201 | | table.ForeignKey( |
| 0 | 202 | | name: "FK_AspNetUserLogins_AspNetUsers_UserId", |
| 0 | 203 | | column: x => x.UserId, |
| 0 | 204 | | principalTable: "AspNetUsers", |
| 0 | 205 | | principalColumn: "Id", |
| 0 | 206 | | onDelete: ReferentialAction.Cascade); |
| 0 | 207 | | }); |
| | 208 | |
|
| 0 | 209 | | migrationBuilder.CreateTable( |
| 0 | 210 | | name: "AspNetUserRoles", |
| 0 | 211 | | columns: table => new |
| 0 | 212 | | { |
| 0 | 213 | | UserId = table.Column<string>(type: "text", nullable: false), |
| 0 | 214 | | RoleId = table.Column<string>(type: "text", nullable: false) |
| 0 | 215 | | }, |
| 0 | 216 | | constraints: table => |
| 0 | 217 | | { |
| 0 | 218 | | table.PrimaryKey("PK_AspNetUserRoles", x => new { x.UserId, x.RoleId }); |
| 0 | 219 | | table.ForeignKey( |
| 0 | 220 | | name: "FK_AspNetUserRoles_AspNetRoles_RoleId", |
| 0 | 221 | | column: x => x.RoleId, |
| 0 | 222 | | principalTable: "AspNetRoles", |
| 0 | 223 | | principalColumn: "Id", |
| 0 | 224 | | onDelete: ReferentialAction.Cascade); |
| 0 | 225 | | table.ForeignKey( |
| 0 | 226 | | name: "FK_AspNetUserRoles_AspNetUsers_UserId", |
| 0 | 227 | | column: x => x.UserId, |
| 0 | 228 | | principalTable: "AspNetUsers", |
| 0 | 229 | | principalColumn: "Id", |
| 0 | 230 | | onDelete: ReferentialAction.Cascade); |
| 0 | 231 | | }); |
| | 232 | |
|
| 0 | 233 | | migrationBuilder.CreateTable( |
| 0 | 234 | | name: "AspNetUserTokens", |
| 0 | 235 | | columns: table => new |
| 0 | 236 | | { |
| 0 | 237 | | UserId = table.Column<string>(type: "text", nullable: false), |
| 0 | 238 | | LoginProvider = table.Column<string>(type: "text", nullable: false), |
| 0 | 239 | | Name = table.Column<string>(type: "text", nullable: false), |
| 0 | 240 | | Value = table.Column<string>(type: "text", nullable: true) |
| 0 | 241 | | }, |
| 0 | 242 | | constraints: table => |
| 0 | 243 | | { |
| 0 | 244 | | table.PrimaryKey("PK_AspNetUserTokens", x => new { x.UserId, x.LoginProvider, x.Name }); |
| 0 | 245 | | table.ForeignKey( |
| 0 | 246 | | name: "FK_AspNetUserTokens_AspNetUsers_UserId", |
| 0 | 247 | | column: x => x.UserId, |
| 0 | 248 | | principalTable: "AspNetUsers", |
| 0 | 249 | | principalColumn: "Id", |
| 0 | 250 | | onDelete: ReferentialAction.Cascade); |
| 0 | 251 | | }); |
| | 252 | |
|
| 0 | 253 | | migrationBuilder.CreateTable( |
| 0 | 254 | | name: "Navigation.Robots", |
| 0 | 255 | | columns: table => new |
| 0 | 256 | | { |
| 0 | 257 | | Id = table.Column<Guid>(type: "uuid", nullable: false), |
| 0 | 258 | | Name = table.Column<string>(type: "character varying(50)", maxLength: 50, nullable: false), |
| 0 | 259 | | RealmId = table.Column<int>(type: "integer", nullable: false), |
| 0 | 260 | | IsRealtimeExchange = table.Column<bool>(type: "boolean", nullable: false), |
| 0 | 261 | | IsProtectingHardwareSerialNumber = table.Column<bool>(type: "boolean", nullable: false) |
| 0 | 262 | | }, |
| 0 | 263 | | constraints: table => |
| 0 | 264 | | { |
| 0 | 265 | | table.PrimaryKey("PK_Navigation.Robots", x => x.Id); |
| 0 | 266 | | table.ForeignKey( |
| 0 | 267 | | name: "FK_Navigation.Robots_Navigation.Realms_RealmId", |
| 0 | 268 | | column: x => x.RealmId, |
| 0 | 269 | | principalTable: "Navigation.Realms", |
| 0 | 270 | | principalColumn: "Id", |
| 0 | 271 | | onDelete: ReferentialAction.Restrict); |
| 0 | 272 | | }); |
| | 273 | |
|
| 0 | 274 | | migrationBuilder.CreateTable( |
| 0 | 275 | | name: "Navigation.Waypoints", |
| 0 | 276 | | columns: table => new |
| 0 | 277 | | { |
| 0 | 278 | | Id = table.Column<int>(type: "integer", nullable: false) |
| 0 | 279 | | .Annotation("Npgsql:ValueGenerationStrategy", NpgsqlValueGenerationStrategy.IdentityByDefaultCol |
| 0 | 280 | | Name = table.Column<string>(type: "character varying(100)", maxLength: 100, nullable: false), |
| 0 | 281 | | RealmId = table.Column<int>(type: "integer", nullable: false), |
| 0 | 282 | | X = table.Column<double>(type: "double precision", nullable: false), |
| 0 | 283 | | Y = table.Column<double>(type: "double precision", nullable: false), |
| 0 | 284 | | Rotation = table.Column<double>(type: "double precision", nullable: false), |
| 0 | 285 | | IsParking = table.Column<bool>(type: "boolean", nullable: false), |
| 0 | 286 | | HasCharger = table.Column<bool>(type: "boolean", nullable: false), |
| 0 | 287 | | IsReserved = table.Column<bool>(type: "boolean", nullable: false) |
| 0 | 288 | | }, |
| 0 | 289 | | constraints: table => |
| 0 | 290 | | { |
| 0 | 291 | | table.PrimaryKey("PK_Navigation.Waypoints", x => x.Id); |
| 0 | 292 | | table.ForeignKey( |
| 0 | 293 | | name: "FK_Navigation.Waypoints_Navigation.Realms_RealmId", |
| 0 | 294 | | column: x => x.RealmId, |
| 0 | 295 | | principalTable: "Navigation.Realms", |
| 0 | 296 | | principalColumn: "Id", |
| 0 | 297 | | onDelete: ReferentialAction.Restrict); |
| 0 | 298 | | }); |
| | 299 | |
|
| 0 | 300 | | migrationBuilder.CreateTable( |
| 0 | 301 | | name: "Automation.FlowDetails", |
| 0 | 302 | | columns: table => new |
| 0 | 303 | | { |
| 0 | 304 | | Id = table.Column<int>(type: "integer", nullable: false) |
| 0 | 305 | | .Annotation("Npgsql:ValueGenerationStrategy", NpgsqlValueGenerationStrategy.IdentityByDefaultCol |
| 0 | 306 | | Order = table.Column<int>(type: "integer", nullable: false), |
| 0 | 307 | | ProgressId = table.Column<int>(type: "integer", nullable: false), |
| 0 | 308 | | AutoTaskNextControllerId = table.Column<int>(type: "integer", nullable: false), |
| 0 | 309 | | TriggerId = table.Column<int>(type: "integer", nullable: true), |
| 0 | 310 | | FlowId = table.Column<int>(type: "integer", nullable: false) |
| 0 | 311 | | }, |
| 0 | 312 | | constraints: table => |
| 0 | 313 | | { |
| 0 | 314 | | table.PrimaryKey("PK_Automation.FlowDetails", x => x.Id); |
| 0 | 315 | | table.ForeignKey( |
| 0 | 316 | | name: "FK_Automation.FlowDetails_Automation.Flows_FlowId", |
| 0 | 317 | | column: x => x.FlowId, |
| 0 | 318 | | principalTable: "Automation.Flows", |
| 0 | 319 | | principalColumn: "Id", |
| 0 | 320 | | onDelete: ReferentialAction.Cascade); |
| 0 | 321 | | table.ForeignKey( |
| 0 | 322 | | name: "FK_Automation.FlowDetails_Automation.Progresses_ProgressId", |
| 0 | 323 | | column: x => x.ProgressId, |
| 0 | 324 | | principalTable: "Automation.Progresses", |
| 0 | 325 | | principalColumn: "Id", |
| 0 | 326 | | onDelete: ReferentialAction.Restrict); |
| 0 | 327 | | table.ForeignKey( |
| 0 | 328 | | name: "FK_Automation.FlowDetails_Automation.Triggers_TriggerId", |
| 0 | 329 | | column: x => x.TriggerId, |
| 0 | 330 | | principalTable: "Automation.Triggers", |
| 0 | 331 | | principalColumn: "Id", |
| 0 | 332 | | onDelete: ReferentialAction.Restrict); |
| 0 | 333 | | }); |
| | 334 | |
|
| 0 | 335 | | migrationBuilder.CreateTable( |
| 0 | 336 | | name: "Automation.AutoTasks", |
| 0 | 337 | | columns: table => new |
| 0 | 338 | | { |
| 0 | 339 | | Id = table.Column<int>(type: "integer", nullable: false) |
| 0 | 340 | | .Annotation("Npgsql:ValueGenerationStrategy", NpgsqlValueGenerationStrategy.IdentityByDefaultCol |
| 0 | 341 | | Name = table.Column<string>(type: "character varying(50)", maxLength: 50, nullable: true), |
| 0 | 342 | | Priority = table.Column<int>(type: "integer", nullable: false), |
| 0 | 343 | | FlowId = table.Column<int>(type: "integer", nullable: true), |
| 0 | 344 | | RealmId = table.Column<int>(type: "integer", nullable: false), |
| 0 | 345 | | AssignedRobotId = table.Column<Guid>(type: "uuid", nullable: true), |
| 0 | 346 | | CurrentProgressId = table.Column<int>(type: "integer", nullable: false), |
| 0 | 347 | | CurrentProgressOrder = table.Column<int>(type: "integer", nullable: true), |
| 0 | 348 | | NextToken = table.Column<string>(type: "character varying(32)", maxLength: 32, nullable: true) |
| 0 | 349 | | }, |
| 0 | 350 | | constraints: table => |
| 0 | 351 | | { |
| 0 | 352 | | table.PrimaryKey("PK_Automation.AutoTasks", x => x.Id); |
| 0 | 353 | | table.ForeignKey( |
| 0 | 354 | | name: "FK_Automation.AutoTasks_Automation.Flows_FlowId", |
| 0 | 355 | | column: x => x.FlowId, |
| 0 | 356 | | principalTable: "Automation.Flows", |
| 0 | 357 | | principalColumn: "Id", |
| 0 | 358 | | onDelete: ReferentialAction.SetNull); |
| 0 | 359 | | table.ForeignKey( |
| 0 | 360 | | name: "FK_Automation.AutoTasks_Automation.Progresses_CurrentProgressId", |
| 0 | 361 | | column: x => x.CurrentProgressId, |
| 0 | 362 | | principalTable: "Automation.Progresses", |
| 0 | 363 | | principalColumn: "Id", |
| 0 | 364 | | onDelete: ReferentialAction.Restrict); |
| 0 | 365 | | table.ForeignKey( |
| 0 | 366 | | name: "FK_Automation.AutoTasks_Navigation.Realms_RealmId", |
| 0 | 367 | | column: x => x.RealmId, |
| 0 | 368 | | principalTable: "Navigation.Realms", |
| 0 | 369 | | principalColumn: "Id", |
| 0 | 370 | | onDelete: ReferentialAction.Cascade); |
| 0 | 371 | | table.ForeignKey( |
| 0 | 372 | | name: "FK_Automation.AutoTasks_Navigation.Robots_AssignedRobotId", |
| 0 | 373 | | column: x => x.AssignedRobotId, |
| 0 | 374 | | principalTable: "Navigation.Robots", |
| 0 | 375 | | principalColumn: "Id", |
| 0 | 376 | | onDelete: ReferentialAction.SetNull); |
| 0 | 377 | | }); |
| | 378 | |
|
| 0 | 379 | | migrationBuilder.CreateTable( |
| 0 | 380 | | name: "Navigation.RobotCertificates", |
| 0 | 381 | | columns: table => new |
| 0 | 382 | | { |
| 0 | 383 | | Id = table.Column<Guid>(type: "uuid", nullable: false), |
| 0 | 384 | | Thumbprint = table.Column<string>(type: "character varying(40)", maxLength: 40, nullable: false), |
| 0 | 385 | | ThumbprintBackup = table.Column<string>(type: "character varying(40)", maxLength: 40, nullable: true |
| 0 | 386 | | NotBefore = table.Column<DateTime>(type: "timestamp(0) with time zone", precision: 0, nullable: fals |
| 0 | 387 | | NotAfter = table.Column<DateTime>(type: "timestamp(0) with time zone", precision: 0, nullable: false |
| 0 | 388 | | RobotId = table.Column<Guid>(type: "uuid", nullable: false) |
| 0 | 389 | | }, |
| 0 | 390 | | constraints: table => |
| 0 | 391 | | { |
| 0 | 392 | | table.PrimaryKey("PK_Navigation.RobotCertificates", x => x.Id); |
| 0 | 393 | | table.ForeignKey( |
| 0 | 394 | | name: "FK_Navigation.RobotCertificates_Navigation.Robots_RobotId", |
| 0 | 395 | | column: x => x.RobotId, |
| 0 | 396 | | principalTable: "Navigation.Robots", |
| 0 | 397 | | principalColumn: "Id", |
| 0 | 398 | | onDelete: ReferentialAction.Cascade); |
| 0 | 399 | | }); |
| | 400 | |
|
| 0 | 401 | | migrationBuilder.CreateTable( |
| 0 | 402 | | name: "Navigation.RobotChassisInfos", |
| 0 | 403 | | columns: table => new |
| 0 | 404 | | { |
| 0 | 405 | | Id = table.Column<int>(type: "integer", nullable: false) |
| 0 | 406 | | .Annotation("Npgsql:ValueGenerationStrategy", NpgsqlValueGenerationStrategy.IdentityByDefaultCol |
| 0 | 407 | | RobotTypeId = table.Column<int>(type: "integer", nullable: false), |
| 0 | 408 | | ChassisLengthX = table.Column<double>(type: "double precision", nullable: false), |
| 0 | 409 | | ChassisLengthY = table.Column<double>(type: "double precision", nullable: false), |
| 0 | 410 | | ChassisWheelCount = table.Column<int>(type: "integer", nullable: false), |
| 0 | 411 | | ChassisWheelRadius = table.Column<double>(type: "double precision", nullable: false), |
| 0 | 412 | | BatteryCount = table.Column<int>(type: "integer", nullable: false), |
| 0 | 413 | | BatteryMaxVoltage = table.Column<double>(type: "double precision", nullable: false), |
| 0 | 414 | | BatteryMinVoltage = table.Column<double>(type: "double precision", nullable: false), |
| 0 | 415 | | RobotId = table.Column<Guid>(type: "uuid", nullable: false) |
| 0 | 416 | | }, |
| 0 | 417 | | constraints: table => |
| 0 | 418 | | { |
| 0 | 419 | | table.PrimaryKey("PK_Navigation.RobotChassisInfos", x => x.Id); |
| 0 | 420 | | table.ForeignKey( |
| 0 | 421 | | name: "FK_Navigation.RobotChassisInfos_Navigation.Robots_RobotId", |
| 0 | 422 | | column: x => x.RobotId, |
| 0 | 423 | | principalTable: "Navigation.Robots", |
| 0 | 424 | | principalColumn: "Id", |
| 0 | 425 | | onDelete: ReferentialAction.Cascade); |
| 0 | 426 | | }); |
| | 427 | |
|
| 0 | 428 | | migrationBuilder.CreateTable( |
| 0 | 429 | | name: "Navigation.RobotSystemInfos", |
| 0 | 430 | | columns: table => new |
| 0 | 431 | | { |
| 0 | 432 | | Id = table.Column<int>(type: "integer", nullable: false) |
| 0 | 433 | | .Annotation("Npgsql:ValueGenerationStrategy", NpgsqlValueGenerationStrategy.IdentityByDefaultCol |
| 0 | 434 | | Cpu = table.Column<string>(type: "character varying(100)", maxLength: 100, nullable: false), |
| 0 | 435 | | IsLittleEndian = table.Column<bool>(type: "boolean", nullable: false), |
| 0 | 436 | | Motherboard = table.Column<string>(type: "character varying(100)", maxLength: 100, nullable: false), |
| 0 | 437 | | MotherboardSerialNumber = table.Column<string>(type: "character varying(100)", maxLength: 100, nulla |
| 0 | 438 | | RamMiB = table.Column<int>(type: "integer", nullable: false), |
| 0 | 439 | | Gpu = table.Column<string>(type: "character varying(100)", maxLength: 100, nullable: true), |
| 0 | 440 | | Os = table.Column<string>(type: "character varying(100)", maxLength: 100, nullable: false), |
| 0 | 441 | | Is32Bit = table.Column<bool>(type: "boolean", nullable: false), |
| 0 | 442 | | McuSerialNumber = table.Column<string>(type: "character varying(100)", maxLength: 100, nullable: tru |
| 0 | 443 | | RobotId = table.Column<Guid>(type: "uuid", nullable: false) |
| 0 | 444 | | }, |
| 0 | 445 | | constraints: table => |
| 0 | 446 | | { |
| 0 | 447 | | table.PrimaryKey("PK_Navigation.RobotSystemInfos", x => x.Id); |
| 0 | 448 | | table.ForeignKey( |
| 0 | 449 | | name: "FK_Navigation.RobotSystemInfos_Navigation.Robots_RobotId", |
| 0 | 450 | | column: x => x.RobotId, |
| 0 | 451 | | principalTable: "Navigation.Robots", |
| 0 | 452 | | principalColumn: "Id", |
| 0 | 453 | | onDelete: ReferentialAction.Cascade); |
| 0 | 454 | | }); |
| | 455 | |
|
| 0 | 456 | | migrationBuilder.CreateTable( |
| 0 | 457 | | name: "Automation.AutoTaskDetails", |
| 0 | 458 | | columns: table => new |
| 0 | 459 | | { |
| 0 | 460 | | Id = table.Column<int>(type: "integer", nullable: false) |
| 0 | 461 | | .Annotation("Npgsql:ValueGenerationStrategy", NpgsqlValueGenerationStrategy.IdentityByDefaultCol |
| 0 | 462 | | Order = table.Column<int>(type: "integer", nullable: false), |
| 0 | 463 | | CustomX = table.Column<double>(type: "double precision", nullable: true), |
| 0 | 464 | | CustomY = table.Column<double>(type: "double precision", nullable: true), |
| 0 | 465 | | CustomRotation = table.Column<double>(type: "double precision", nullable: true), |
| 0 | 466 | | WaypointId = table.Column<int>(type: "integer", nullable: true), |
| 0 | 467 | | AutoTaskId = table.Column<int>(type: "integer", nullable: false) |
| 0 | 468 | | }, |
| 0 | 469 | | constraints: table => |
| 0 | 470 | | { |
| 0 | 471 | | table.PrimaryKey("PK_Automation.AutoTaskDetails", x => x.Id); |
| 0 | 472 | | table.ForeignKey( |
| 0 | 473 | | name: "FK_Automation.AutoTaskDetails_Automation.AutoTasks_AutoTaskId", |
| 0 | 474 | | column: x => x.AutoTaskId, |
| 0 | 475 | | principalTable: "Automation.AutoTasks", |
| 0 | 476 | | principalColumn: "Id", |
| 0 | 477 | | onDelete: ReferentialAction.Cascade); |
| 0 | 478 | | table.ForeignKey( |
| 0 | 479 | | name: "FK_Automation.AutoTaskDetails_Navigation.Waypoints_WaypointId", |
| 0 | 480 | | column: x => x.WaypointId, |
| 0 | 481 | | principalTable: "Navigation.Waypoints", |
| 0 | 482 | | principalColumn: "Id", |
| 0 | 483 | | onDelete: ReferentialAction.SetNull); |
| 0 | 484 | | }); |
| | 485 | |
|
| 0 | 486 | | migrationBuilder.CreateTable( |
| 0 | 487 | | name: "Automation.TriggerRetries", |
| 0 | 488 | | columns: table => new |
| 0 | 489 | | { |
| 0 | 490 | | Id = table.Column<int>(type: "integer", nullable: false) |
| 0 | 491 | | .Annotation("Npgsql:ValueGenerationStrategy", NpgsqlValueGenerationStrategy.IdentityByDefaultCol |
| 0 | 492 | | TriggerId = table.Column<int>(type: "integer", nullable: false), |
| 0 | 493 | | AutoTaskId = table.Column<int>(type: "integer", nullable: false), |
| 0 | 494 | | Body = table.Column<string>(type: "TEXT", nullable: false), |
| 0 | 495 | | CreatedAt = table.Column<DateTime>(type: "timestamp(3) with time zone", precision: 3, nullable: fals |
| 0 | 496 | | }, |
| 0 | 497 | | constraints: table => |
| 0 | 498 | | { |
| 0 | 499 | | table.PrimaryKey("PK_Automation.TriggerRetries", x => x.Id); |
| 0 | 500 | | table.ForeignKey( |
| 0 | 501 | | name: "FK_Automation.TriggerRetries_Automation.AutoTasks_AutoTaskId", |
| 0 | 502 | | column: x => x.AutoTaskId, |
| 0 | 503 | | principalTable: "Automation.AutoTasks", |
| 0 | 504 | | principalColumn: "Id", |
| 0 | 505 | | onDelete: ReferentialAction.Cascade); |
| 0 | 506 | | table.ForeignKey( |
| 0 | 507 | | name: "FK_Automation.TriggerRetries_Automation.Triggers_TriggerId", |
| 0 | 508 | | column: x => x.TriggerId, |
| 0 | 509 | | principalTable: "Automation.Triggers", |
| 0 | 510 | | principalColumn: "Id", |
| 0 | 511 | | onDelete: ReferentialAction.Cascade); |
| 0 | 512 | | }); |
| | 513 | |
|
| 0 | 514 | | migrationBuilder.InsertData( |
| 0 | 515 | | table: "Automation.Progresses", |
| 0 | 516 | | columns: new[] { "Id", "Name", "Reserved", "System" }, |
| 0 | 517 | | values: new object[,] |
| 0 | 518 | | { |
| 0 | 519 | | { 1, "Template", true, true }, |
| 0 | 520 | | { 2, "Waiting", true, true }, |
| 0 | 521 | | { 3, "Completed", true, true }, |
| 0 | 522 | | { 4, "Aborted", true, true }, |
| 0 | 523 | | { 5, "Starting", false, true }, |
| 0 | 524 | | { 6, "Loading", false, true }, |
| 0 | 525 | | { 7, "PreMoving", false, true }, |
| 0 | 526 | | { 8, "Moving", false, true }, |
| 0 | 527 | | { 9, "Unloading", false, true }, |
| 0 | 528 | | { 10, "Completing", false, true }, |
| 0 | 529 | | { 99, "Reserved", true, true } |
| 0 | 530 | | }); |
| | 531 | |
|
| 0 | 532 | | migrationBuilder.InsertData( |
| 0 | 533 | | table: "Navigation.Realms", |
| 0 | 534 | | columns: new[] { "Id", "Description", "Image", "Name", "OriginRotation", "OriginX", "OriginY", "Resoluti |
| 0 | 535 | | values: new object[] { 1, "Please update this realm", new byte[0], "First Realm", 0.0, 0.0, 0.0, 0.0 }); |
| | 536 | |
|
| 0 | 537 | | migrationBuilder.CreateIndex( |
| 0 | 538 | | name: "IX_AspNetRoleClaims_RoleId", |
| 0 | 539 | | table: "AspNetRoleClaims", |
| 0 | 540 | | column: "RoleId"); |
| | 541 | |
|
| 0 | 542 | | migrationBuilder.CreateIndex( |
| 0 | 543 | | name: "RoleNameIndex", |
| 0 | 544 | | table: "AspNetRoles", |
| 0 | 545 | | column: "NormalizedName", |
| 0 | 546 | | unique: true); |
| | 547 | |
|
| 0 | 548 | | migrationBuilder.CreateIndex( |
| 0 | 549 | | name: "IX_AspNetUserClaims_UserId", |
| 0 | 550 | | table: "AspNetUserClaims", |
| 0 | 551 | | column: "UserId"); |
| | 552 | |
|
| 0 | 553 | | migrationBuilder.CreateIndex( |
| 0 | 554 | | name: "IX_AspNetUserLogins_UserId", |
| 0 | 555 | | table: "AspNetUserLogins", |
| 0 | 556 | | column: "UserId"); |
| | 557 | |
|
| 0 | 558 | | migrationBuilder.CreateIndex( |
| 0 | 559 | | name: "IX_AspNetUserRoles_RoleId", |
| 0 | 560 | | table: "AspNetUserRoles", |
| 0 | 561 | | column: "RoleId"); |
| | 562 | |
|
| 0 | 563 | | migrationBuilder.CreateIndex( |
| 0 | 564 | | name: "EmailIndex", |
| 0 | 565 | | table: "AspNetUsers", |
| 0 | 566 | | column: "NormalizedEmail"); |
| | 567 | |
|
| 0 | 568 | | migrationBuilder.CreateIndex( |
| 0 | 569 | | name: "UserNameIndex", |
| 0 | 570 | | table: "AspNetUsers", |
| 0 | 571 | | column: "NormalizedUserName", |
| 0 | 572 | | unique: true); |
| | 573 | |
|
| 0 | 574 | | migrationBuilder.CreateIndex( |
| 0 | 575 | | name: "IX_Automation.AutoTaskDetails_AutoTaskId", |
| 0 | 576 | | table: "Automation.AutoTaskDetails", |
| 0 | 577 | | column: "AutoTaskId"); |
| | 578 | |
|
| 0 | 579 | | migrationBuilder.CreateIndex( |
| 0 | 580 | | name: "IX_Automation.AutoTaskDetails_Order", |
| 0 | 581 | | table: "Automation.AutoTaskDetails", |
| 0 | 582 | | column: "Order"); |
| | 583 | |
|
| 0 | 584 | | migrationBuilder.CreateIndex( |
| 0 | 585 | | name: "IX_Automation.AutoTaskDetails_WaypointId", |
| 0 | 586 | | table: "Automation.AutoTaskDetails", |
| 0 | 587 | | column: "WaypointId"); |
| | 588 | |
|
| 0 | 589 | | migrationBuilder.CreateIndex( |
| 0 | 590 | | name: "IX_Automation.AutoTasks_AssignedRobotId", |
| 0 | 591 | | table: "Automation.AutoTasks", |
| 0 | 592 | | column: "AssignedRobotId"); |
| | 593 | |
|
| 0 | 594 | | migrationBuilder.CreateIndex( |
| 0 | 595 | | name: "IX_Automation.AutoTasks_CurrentProgressId", |
| 0 | 596 | | table: "Automation.AutoTasks", |
| 0 | 597 | | column: "CurrentProgressId"); |
| | 598 | |
|
| 0 | 599 | | migrationBuilder.CreateIndex( |
| 0 | 600 | | name: "IX_Automation.AutoTasks_FlowId", |
| 0 | 601 | | table: "Automation.AutoTasks", |
| 0 | 602 | | column: "FlowId"); |
| | 603 | |
|
| 0 | 604 | | migrationBuilder.CreateIndex( |
| 0 | 605 | | name: "IX_Automation.AutoTasks_RealmId_AssignedRobotId", |
| 0 | 606 | | table: "Automation.AutoTasks", |
| 0 | 607 | | columns: new[] { "RealmId", "AssignedRobotId" }); |
| | 608 | |
|
| 0 | 609 | | migrationBuilder.CreateIndex( |
| 0 | 610 | | name: "IX_Automation.FlowDetails_FlowId", |
| 0 | 611 | | table: "Automation.FlowDetails", |
| 0 | 612 | | column: "FlowId"); |
| | 613 | |
|
| 0 | 614 | | migrationBuilder.CreateIndex( |
| 0 | 615 | | name: "IX_Automation.FlowDetails_Order", |
| 0 | 616 | | table: "Automation.FlowDetails", |
| 0 | 617 | | column: "Order"); |
| | 618 | |
|
| 0 | 619 | | migrationBuilder.CreateIndex( |
| 0 | 620 | | name: "IX_Automation.FlowDetails_ProgressId", |
| 0 | 621 | | table: "Automation.FlowDetails", |
| 0 | 622 | | column: "ProgressId"); |
| | 623 | |
|
| 0 | 624 | | migrationBuilder.CreateIndex( |
| 0 | 625 | | name: "IX_Automation.FlowDetails_TriggerId", |
| 0 | 626 | | table: "Automation.FlowDetails", |
| 0 | 627 | | column: "TriggerId"); |
| | 628 | |
|
| 0 | 629 | | migrationBuilder.CreateIndex( |
| 0 | 630 | | name: "IX_Automation.TriggerRetries_AutoTaskId", |
| 0 | 631 | | table: "Automation.TriggerRetries", |
| 0 | 632 | | column: "AutoTaskId"); |
| | 633 | |
|
| 0 | 634 | | migrationBuilder.CreateIndex( |
| 0 | 635 | | name: "IX_Automation.TriggerRetries_TriggerId", |
| 0 | 636 | | table: "Automation.TriggerRetries", |
| 0 | 637 | | column: "TriggerId"); |
| | 638 | |
|
| 0 | 639 | | migrationBuilder.CreateIndex( |
| 0 | 640 | | name: "IX_Automation.Triggers_ApiKeyId", |
| 0 | 641 | | table: "Automation.Triggers", |
| 0 | 642 | | column: "ApiKeyId"); |
| | 643 | |
|
| 0 | 644 | | migrationBuilder.CreateIndex( |
| 0 | 645 | | name: "IX_Automation.Triggers_ApiKeyInsertLocationId", |
| 0 | 646 | | table: "Automation.Triggers", |
| 0 | 647 | | column: "ApiKeyInsertLocationId"); |
| | 648 | |
|
| 0 | 649 | | migrationBuilder.CreateIndex( |
| 0 | 650 | | name: "IX_Navigation.RobotCertificates_RobotId", |
| 0 | 651 | | table: "Navigation.RobotCertificates", |
| 0 | 652 | | column: "RobotId", |
| 0 | 653 | | unique: true); |
| | 654 | |
|
| 0 | 655 | | migrationBuilder.CreateIndex( |
| 0 | 656 | | name: "IX_Navigation.RobotChassisInfos_RobotId", |
| 0 | 657 | | table: "Navigation.RobotChassisInfos", |
| 0 | 658 | | column: "RobotId", |
| 0 | 659 | | unique: true); |
| | 660 | |
|
| 0 | 661 | | migrationBuilder.CreateIndex( |
| 0 | 662 | | name: "IX_Navigation.Robots_RealmId", |
| 0 | 663 | | table: "Navigation.Robots", |
| 0 | 664 | | column: "RealmId"); |
| | 665 | |
|
| 0 | 666 | | migrationBuilder.CreateIndex( |
| 0 | 667 | | name: "IX_Navigation.RobotSystemInfos_RobotId", |
| 0 | 668 | | table: "Navigation.RobotSystemInfos", |
| 0 | 669 | | column: "RobotId", |
| 0 | 670 | | unique: true); |
| | 671 | |
|
| 0 | 672 | | migrationBuilder.CreateIndex( |
| 0 | 673 | | name: "IX_Navigation.Waypoints_RealmId", |
| 0 | 674 | | table: "Navigation.Waypoints", |
| 0 | 675 | | column: "RealmId"); |
| 0 | 676 | | } |
| | 677 | |
|
| | 678 | | /// <inheritdoc /> |
| | 679 | | protected override void Down(MigrationBuilder migrationBuilder) |
| 0 | 680 | | { |
| 0 | 681 | | migrationBuilder.DropTable( |
| 0 | 682 | | name: "AspNetRoleClaims"); |
| | 683 | |
|
| 0 | 684 | | migrationBuilder.DropTable( |
| 0 | 685 | | name: "AspNetUserClaims"); |
| | 686 | |
|
| 0 | 687 | | migrationBuilder.DropTable( |
| 0 | 688 | | name: "AspNetUserLogins"); |
| | 689 | |
|
| 0 | 690 | | migrationBuilder.DropTable( |
| 0 | 691 | | name: "AspNetUserRoles"); |
| | 692 | |
|
| 0 | 693 | | migrationBuilder.DropTable( |
| 0 | 694 | | name: "AspNetUserTokens"); |
| | 695 | |
|
| 0 | 696 | | migrationBuilder.DropTable( |
| 0 | 697 | | name: "Automation.AutoTaskDetails"); |
| | 698 | |
|
| 0 | 699 | | migrationBuilder.DropTable( |
| 0 | 700 | | name: "Automation.FlowDetails"); |
| | 701 | |
|
| 0 | 702 | | migrationBuilder.DropTable( |
| 0 | 703 | | name: "Automation.TriggerRetries"); |
| | 704 | |
|
| 0 | 705 | | migrationBuilder.DropTable( |
| 0 | 706 | | name: "Navigation.RobotCertificates"); |
| | 707 | |
|
| 0 | 708 | | migrationBuilder.DropTable( |
| 0 | 709 | | name: "Navigation.RobotChassisInfos"); |
| | 710 | |
|
| 0 | 711 | | migrationBuilder.DropTable( |
| 0 | 712 | | name: "Navigation.RobotSystemInfos"); |
| | 713 | |
|
| 0 | 714 | | migrationBuilder.DropTable( |
| 0 | 715 | | name: "AspNetRoles"); |
| | 716 | |
|
| 0 | 717 | | migrationBuilder.DropTable( |
| 0 | 718 | | name: "AspNetUsers"); |
| | 719 | |
|
| 0 | 720 | | migrationBuilder.DropTable( |
| 0 | 721 | | name: "Navigation.Waypoints"); |
| | 722 | |
|
| 0 | 723 | | migrationBuilder.DropTable( |
| 0 | 724 | | name: "Automation.AutoTasks"); |
| | 725 | |
|
| 0 | 726 | | migrationBuilder.DropTable( |
| 0 | 727 | | name: "Automation.Triggers"); |
| | 728 | |
|
| 0 | 729 | | migrationBuilder.DropTable( |
| 0 | 730 | | name: "Automation.Flows"); |
| | 731 | |
|
| 0 | 732 | | migrationBuilder.DropTable( |
| 0 | 733 | | name: "Automation.Progresses"); |
| | 734 | |
|
| 0 | 735 | | migrationBuilder.DropTable( |
| 0 | 736 | | name: "Navigation.Robots"); |
| | 737 | |
|
| 0 | 738 | | migrationBuilder.DropTable( |
| 0 | 739 | | name: "Administration.ApiKeys"); |
| | 740 | |
|
| 0 | 741 | | migrationBuilder.DropTable( |
| 0 | 742 | | name: "Navigation.Realms"); |
| 0 | 743 | | } |
| | 744 | | } |
| | 745 | | } |