2014-02-14 95 views
0

我跑FluentMigrator创建表的权限被拒绝

C:\开发\迁移> MSBuild.exe \ build.proj/T:从PowerShell的迁移

fluentmigrate项目

而且收到以下错误:

!!! An error occured executing the following sql: 
CREATE TABLE [dbo].[VersionInfo] ([Version] BIGINT NOT NULL) 
The error was CREATE TABLE permission denied in database 'H2H'. 

这里是build.proj

<?xml version="1.0"?> 
<Project xmlns="http://schemas.microsoft.com/developer/msbuild/2003" 
     DefaultTargets="Migrate" ToolsVersion="4.0"> 

    <PropertyGroup> 
    <MigratorTasksDirectory>$(MSBuildProjectDirectory)\..\EqulibriumMarkets\packages\FluentMigrator.Tools.1.1.2.1\tools\AnyCPU\40\</MigratorTasksDirectory> 
    <MainProjectDirectory>$(MSBuildProjectDirectory)</MainProjectDirectory> 
     <ConnectionString>******************************</ConnectionString> 
    </PropertyGroup> 

    <UsingTask 
     TaskName="FluentMigrator.MSBuild.Migrate" AssemblyFile="$(MigratorTasksDirectory)FluentMigrator.MSBuild.dll" /> 

    <Target Name="Migrate"> 
    <Message Text="Starting FluentMigrator migration" /> 

    <!-- Important: Target must be your Migrations assembly name, not your dll file name --> 
    <Migrate Database="SqlServer2012" 
      Connection="$(ConnectionString)" 
      Target="$(MSBuildProjectDirectory)/bin/debug/EQ.DbMigration.dll" /> 
    </Target> 
</Project> 

不应该从连接字符串的用户详细信息中获取权限吗?作为数据库所有者连接

+0

这是一个管理员帐户?你是在正常模式还是高架模式下运行? – jessehouwing

+0

我以管理员身份运行powershell – Axe

+0

您的ConnectionString是否指定了一个用户,例如格式为Server = yourserver,1433; Database = somedb; User ID = User1; Password = Password1 ...' – Raf

回答

0

不应该从连接字符串用户 的详细信息中获取权限吗?作为数据库所有者连接

为了找到答案,请查看您的应用程序事件日志以了解发生此情况的时间。事件条目还应包含被拒绝权限的用户名。