我尝试使用 FluentMigrator 迁移我的一个数据库。其中一个迁移尝试执行脚本。我想:“我只想将 DLL 发送给我的同事”所以我将 SQL 脚本作为资源文件打包到 DLL 中,现在尝试访问它,但似乎找不到脚本。
移民
[Migration(201506021451)]
public class M116_Init_RoleManagement : ForwardOnlyMigration
{
public override void Up()
{
Create.Table("Role")
.WithIdColumn()
.WithColumn("Name").AsString().NotNullable();
Insert.IntoTable("Role").Row(new { Name = "Administrator" });
Insert.IntoTable("Role").Row(new { Name = "Manager" });
Insert.IntoTable("Role").Row(new { Name = "SalesManager" });
Insert.IntoTable("Role").Row(new { Name = "Employee" });
Create.Table("EmployeeRole")
.WithIdColumn()
.WithColumn("EmployeeId").AsInt64().NotNullable()
.WithColumn("RoleId").AsInt64().NotNullable();
Execute.Script(Hsk.Migrations.Properties.Resources._2015021451_CreateSalesManagerRoles);
}
}
资源文件
项目结构
错误
201506021451:M116_Init_RoleManagement 迁移 ========================= 开始事务
回滚事务
非法登录路径