From: NHibernate J. <mik...@us...> - 2006-11-13 18:18:22
|
[ http://jira.nhibernate.org/browse/NH-421?page=all ] Sergey Koshcheyev updated NH-421: --------------------------------- Fix Version: (was: 1.2.0.CR1) LATER > Dialect Improvements > -------------------- > > Key: NH-421 > URL: http://jira.nhibernate.org/browse/NH-421 > Project: NHibernate > Type: Improvement > Components: Core > Versions: 1.0 > Reporter: Mike Doerfler > Fix For: LATER > > While working on the if exists and drop table issue for MS SQL I came across some areas to make improvements. > It would be good to take advantage of the String.Format() capabilities instead of doing string building in Dialect based on multiple properties being true. The best example of this is the GetDropTableString(string tableName). It would be good to add a virtual property to Dialect called DropTableString{get;} that would be a string that could be formatted with one value. Other Dialects could implement the property DropTableString instead of the properties SupportsIfExistsBeforeTableName and SupportsIfExistsAfterTableName. > This same thing applies to GetDropForeignKeyConstraintString(string constraintName). It would also be good to pass the table name so the signature becomes GetDropForeignKeyConstraintString(string tableName, string constraintName) and that would remove the ddl from NHibernate.Mapping.ForeignKey.SqlDropString. The way it is coded now (without modifying a public API) does not allow for an IF EXISTS check before altering the table. The sql to drop a FK in MS SQL is : > if exists (select * from dbo.sysobjects where id = object_id(N'{constraintName}') and OBJECTPROPERTY(id, N'IsForeignKey') = 1) > ALTER TABLE {tableName} DROP CONSTRAINT {constraintName} > GO -- This message is automatically generated by JIRA. - If you think it was sent incorrectly contact one of the administrators: http://jira.nhibernate.org/secure/Administrators.jspa - For more information on JIRA, see: http://www.atlassian.com/software/jira |