-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
37 changed files
with
1,157 additions
and
42 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
13 changes: 13 additions & 0 deletions
13
src/VirtoCommerce.ImportModule.Data.MySql/DbContextOptionsBuilderExtensions.cs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
using Microsoft.EntityFrameworkCore; | ||
|
||
namespace VirtoCommerce.ImportModule.Data.MySql; | ||
|
||
public static class DbContextOptionsBuilderExtensions | ||
{ | ||
/// <summary> | ||
/// Configures the context to use MySql. | ||
/// </summary> | ||
public static DbContextOptionsBuilder UseMySqlDatabase(this DbContextOptionsBuilder builder, string connectionString) => | ||
builder.UseMySql(connectionString, ServerVersion.AutoDetect(connectionString), db => db | ||
.MigrationsAssembly(typeof(MySqlDbContextFactory).Assembly.GetName().Name)); | ||
} |
150 changes: 150 additions & 0 deletions
150
src/VirtoCommerce.ImportModule.Data.MySql/Migrations/20230711152148_Initial.Designer.cs
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
110 changes: 110 additions & 0 deletions
110
src/VirtoCommerce.ImportModule.Data.MySql/Migrations/20230711152148_Initial.cs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,110 @@ | ||
using System; | ||
using Microsoft.EntityFrameworkCore.Migrations; | ||
|
||
#nullable disable | ||
|
||
namespace VirtoCommerce.ImportModule.Data.MySql.Migrations | ||
{ | ||
public partial class Initial : Migration | ||
{ | ||
protected override void Up(MigrationBuilder migrationBuilder) | ||
{ | ||
migrationBuilder.AlterDatabase() | ||
.Annotation("MySql:CharSet", "utf8mb4"); | ||
|
||
migrationBuilder.CreateTable( | ||
name: "ImportProfile", | ||
columns: table => new | ||
{ | ||
Id = table.Column<string>(type: "varchar(128)", maxLength: 128, nullable: false) | ||
.Annotation("MySql:CharSet", "utf8mb4"), | ||
Name = table.Column<string>(type: "varchar(1024)", maxLength: 1024, nullable: false) | ||
.Annotation("MySql:CharSet", "utf8mb4"), | ||
DataImporterType = table.Column<string>(type: "varchar(254)", maxLength: 254, nullable: false) | ||
.Annotation("MySql:CharSet", "utf8mb4"), | ||
UserId = table.Column<string>(type: "varchar(128)", maxLength: 128, nullable: false) | ||
.Annotation("MySql:CharSet", "utf8mb4"), | ||
UserName = table.Column<string>(type: "varchar(254)", maxLength: 254, nullable: false) | ||
.Annotation("MySql:CharSet", "utf8mb4"), | ||
CreatedDate = table.Column<DateTime>(type: "datetime(6)", nullable: false), | ||
ModifiedDate = table.Column<DateTime>(type: "datetime(6)", nullable: true), | ||
CreatedBy = table.Column<string>(type: "varchar(64)", maxLength: 64, nullable: true) | ||
.Annotation("MySql:CharSet", "utf8mb4"), | ||
ModifiedBy = table.Column<string>(type: "varchar(64)", maxLength: 64, nullable: true) | ||
.Annotation("MySql:CharSet", "utf8mb4") | ||
}, | ||
constraints: table => | ||
{ | ||
table.PrimaryKey("PK_ImportProfile", x => x.Id); | ||
}) | ||
.Annotation("MySql:CharSet", "utf8mb4"); | ||
|
||
migrationBuilder.CreateTable( | ||
name: "ImportRunHistory", | ||
columns: table => new | ||
{ | ||
Id = table.Column<string>(type: "varchar(128)", maxLength: 128, nullable: false) | ||
.Annotation("MySql:CharSet", "utf8mb4"), | ||
UserId = table.Column<string>(type: "varchar(128)", maxLength: 128, nullable: false) | ||
.Annotation("MySql:CharSet", "utf8mb4"), | ||
ProfileId = table.Column<string>(type: "varchar(128)", maxLength: 128, nullable: false) | ||
.Annotation("MySql:CharSet", "utf8mb4"), | ||
ProfileName = table.Column<string>(type: "varchar(1024)", maxLength: 1024, nullable: true) | ||
.Annotation("MySql:CharSet", "utf8mb4"), | ||
JobId = table.Column<string>(type: "varchar(128)", maxLength: 128, nullable: true) | ||
.Annotation("MySql:CharSet", "utf8mb4"), | ||
Executed = table.Column<DateTime>(type: "datetime(6)", nullable: false), | ||
Finished = table.Column<DateTime>(type: "datetime(6)", nullable: true), | ||
TotalCount = table.Column<int>(type: "int", nullable: false), | ||
ProcessedCount = table.Column<int>(type: "int", nullable: false), | ||
ErrorsCount = table.Column<int>(type: "int", nullable: false), | ||
Errors = table.Column<string>(type: "longtext", nullable: true) | ||
.Annotation("MySql:CharSet", "utf8mb4"), | ||
FileUrl = table.Column<string>(type: "varchar(2048)", maxLength: 2048, nullable: true) | ||
.Annotation("MySql:CharSet", "utf8mb4"), | ||
ReportUrl = table.Column<string>(type: "varchar(2048)", maxLength: 2048, nullable: true) | ||
.Annotation("MySql:CharSet", "utf8mb4"), | ||
CreatedDate = table.Column<DateTime>(type: "datetime(6)", nullable: false), | ||
ModifiedDate = table.Column<DateTime>(type: "datetime(6)", nullable: true), | ||
CreatedBy = table.Column<string>(type: "varchar(64)", maxLength: 64, nullable: true) | ||
.Annotation("MySql:CharSet", "utf8mb4"), | ||
ModifiedBy = table.Column<string>(type: "varchar(64)", maxLength: 64, nullable: true) | ||
.Annotation("MySql:CharSet", "utf8mb4") | ||
}, | ||
constraints: table => | ||
{ | ||
table.PrimaryKey("PK_ImportRunHistory", x => x.Id); | ||
}) | ||
.Annotation("MySql:CharSet", "utf8mb4"); | ||
|
||
migrationBuilder.CreateIndex( | ||
name: "IX_ImportProfile_UserId_Name", | ||
table: "ImportProfile", | ||
columns: new[] { "UserId", "Name" }); | ||
|
||
migrationBuilder.CreateIndex( | ||
name: "IX_ImportRunHistory_JobId", | ||
table: "ImportRunHistory", | ||
column: "JobId"); | ||
|
||
migrationBuilder.CreateIndex( | ||
name: "IX_ImportRunHistory_ProfileId", | ||
table: "ImportRunHistory", | ||
column: "ProfileId"); | ||
|
||
migrationBuilder.CreateIndex( | ||
name: "IX_ImportRunHistory_UserId", | ||
table: "ImportRunHistory", | ||
column: "UserId"); | ||
} | ||
|
||
protected override void Down(MigrationBuilder migrationBuilder) | ||
{ | ||
migrationBuilder.DropTable( | ||
name: "ImportProfile"); | ||
|
||
migrationBuilder.DropTable( | ||
name: "ImportRunHistory"); | ||
} | ||
} | ||
} |
Oops, something went wrong.