/// <summary>
		/// Get the SQL string to drop this Constraint in the database.
		/// </summary>
		/// <param name="dialect">The <see cref="Dialect.Dialect"/> to use for SQL rules.</param>
		/// <param name="defaultCatalog"></param>
		/// <param name="defaultSchema"></param>
		/// <returns>
		/// A string that contains the SQL to drop this Constraint.
		/// </returns>
		public override string SqlDropString(Dialect.Dialect dialect, string defaultCatalog, string defaultSchema)
		{
			string ifExists = dialect.GetIfExistsDropConstraint(Table, Name);
			string drop = string.Format("alter table {0}{1}", Table.GetQualifiedName(dialect, defaultCatalog, defaultSchema), dialect.GetDropPrimaryKeyConstraintString(Name));
			string end = dialect.GetIfExistsDropConstraintEnd(Table, Name);
			return ifExists + Environment.NewLine + drop + Environment.NewLine + end;
		}
Exemple #2
0
 /// <summary>
 /// Get the SQL string to drop this Constraint in the database.
 /// </summary>
 /// <param name="dialect">The <see cref="Dialect.Dialect"/> to use for SQL rules.</param>
 /// <param name="defaultCatalog"></param>
 /// <param name="defaultSchema"></param>
 /// <returns>
 /// A string that contains the SQL to drop this Constraint.
 /// </returns>
 public override string SqlDropString(Dialect.Dialect dialect, string defaultCatalog, string defaultSchema)
 {
     var useCatalog = "";
     if (!String.IsNullOrEmpty(Table.Catalog))
     {
         useCatalog = string.Format("use {0} ", Table.Catalog);
     }
     string ifExists = dialect.GetIfExistsDropConstraint(Table, Name);
     string drop = string.Format("alter table {0}{1}", Table.GetQualifiedName(dialect, defaultCatalog, defaultSchema), dialect.GetDropPrimaryKeyConstraintString(Name));
     string end = dialect.GetIfExistsDropConstraintEnd(Table, Name);
     return useCatalog + ifExists + Environment.NewLine + drop + Environment.NewLine + end;
 }
		/// <summary>
		/// Get the SQL string to drop this Constraint in the database.
		/// </summary>
		/// <param name="dialect">The <see cref="Dialect.Dialect"/> to use for SQL rules.</param>
		/// <param name="defaultSchema"></param>
		/// <returns>
		/// A string that contains the SQL to drop this Constraint.
		/// </returns>
		public override string SqlDropString(Dialect.Dialect dialect, string defaultSchema)
		{
			// TODO: NH-421
			return
				"alter table " + Table.GetQualifiedName(dialect, defaultSchema) + dialect.GetDropPrimaryKeyConstraintString(Name);
		}