New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
fluentmigrator bug in SqlServerProcessor.cs #315
Comments
Nice catch! I'll get this fixed and include it in the 1.0.4 release. |
Thank you Daniel. This is the code that I made it work: public override bool IndexExists(string schemaName, string tableName, string indexName)
|
This problem also results in a SqlException when executing the following code on SQL Azure as part of a migration: In revision 98f3810 the line that needs to be changed is in file SqlServerProcessor.cs, line 82. I'm using a local instance of SQL Server 2010 (reported as SQL Server 11.0.2100) and I'm using SQL Azure (reported as SQL Server 11.0.2065). From MSFT's documentation regarding sys.sysindexes: As SQL Server 2012 has sys.sysindexes still around the above code sample works. On SQL Azure sys.sysindexes doesn't exist and we have to use sys.indexes. |
I can confirm that @NanXiong's suggestion (also) fixes the problem on SQL Azure. Just tested it in our staging environments on Azure. The dot makes the difference 'sys.indexes' works while 'sysindexes' doesn't. |
@daniellee The NuGet package version 1.0.4.0 still uses the SQL Server 2000 view 'sysindexes' instead of the current 'sys.indexes' which was supported from SQL Server 2005 forward and also works on SQL Azure. |
I'm travelling for the next 2 weeks but I can fix it when I get back if no one else has time before that. |
Hi Daniel, thank you for the prompt response. I don't have commit permissions so can't We have been using Fluent Migrator for about a year in several cloud based Thank you again. Let me know if I can be of further assistance. Kind regards, Kind regards, Manfred.Manfred Lange On Thu, Nov 15, 2012 at 10:05 PM, Daniel Lee notifications@github.comwrote:
|
Hey all, It doesn't have to wait until Daniel is back :), I'll focus on this tonight Regards |
Thanks for remarking this issue, fixed in version 1.0.5 ;) which is released as of now |
Hi Tom, Fantastic! Thank you for the quick turnaround. We'll test in the next couple of days and report back. Our tests cover Keep up the good work! We really appreciate what you are doing for the Kind regards, Kind regards, Manfred.Manfred Lange On Fri, Nov 16, 2012 at 9:33 AM, Tom Marien notifications@github.comwrote:
|
Just completed testing. It now works in our environments. Thank you again for the fast response and fix. Kind regards, Kind regards, Manfred.Manfred Lange On Fri, Nov 16, 2012 at 12:37 PM, Manfred Lange manfredmlange@gmail.comwrote:
|
Thanks for the feedback, it's good to have people like you, they give us the necessary feedback :) |
Thank you guys! We are using 1.0.5.0 now and happy! |
checking index exists is not implemented correctly for sqlserver, it ignores the schema name the index should be in:
In SqlServerProcessor.cs, the 1st line (commented out by me) of the code is incorrect, something like the 2nd line should be used:
public override bool IndexExists(string schemaName, string tableName, string indexName)
{
//return Exists("SELECT NULL FROM sysindexes WHERE name = '{0}'", FormatSqlEscape(indexName));
return Exists("SELECT NULL FROM sysindexes WHERE name = '{0}' and object_id=OBJECT_ID('{1}.{2}')", FormatSqlEscape(indexName), SafeSchemaName(schemaName), FormatSqlEscape(tableName));
}
The text was updated successfully, but these errors were encountered: