public override string Generate(DeleteConstraintExpression expression)
 {
     return string.Format(DeleteConstraint, Quoter.QuoteTableName(expression.Constraint.TableName), Quoter.Quote(expression.Constraint.ConstraintName));
 }
Ejemplo n.º 2
0
 public override string Generate(DeleteConstraintExpression expression)
 {
     truncator.Truncate(expression);
     return base.Generate(expression);
 }
 public IDeleteConstraintOnTableSyntax UniqueConstraint(string constraintName)
 {
     var expression = new DeleteConstraintExpression(ConstraintType.Unique);
     expression.Constraint.ConstraintName = constraintName;
     _context.Expressions.Add(expression);
     return new DeleteConstraintExpressionBuilder(expression);
 }
 public IDeleteConstraintOnTableSyntax PrimaryKey(string primaryKeyName)
 {
     var expression = new DeleteConstraintExpression(ConstraintType.PrimaryKey);
     expression.Constraint.ConstraintName = primaryKeyName;
     _context.Expressions.Add(expression);
     return new DeleteConstraintExpressionBuilder(expression);
 }
Ejemplo n.º 5
0
 public static DeleteConstraintExpression GetDeleteUniqueConstraintExpression()
 {
     var expression = new DeleteConstraintExpression(ConstraintType.Unique);
     expression.Constraint.TableName = TestTableName1;
     expression.Constraint.ConstraintName = "TESTUNIQUECONSTRAINT";
     return expression;
 }
 public override string Generate(DeleteConstraintExpression expression)
 {
     return string.Format("ALTER TABLE {0}.{1} DROP CONSTRAINT {2}", Quoter.QuoteSchemaName(expression.Constraint.SchemaName), Quoter.QuoteTableName(expression.Constraint.TableName), Quoter.Quote(expression.Constraint.ConstraintName));
 }
 public void Truncate(DeleteConstraintExpression expression)
 {
     Truncate(expression.Constraint);
 }
Ejemplo n.º 8
0
 public static DeleteConstraintExpression GetDeletePrimaryKeyExpression()
 {
     var expression = new DeleteConstraintExpression(ConstraintType.PrimaryKey);
     expression.Constraint.TableName = TestTableName1;
     expression.Constraint.ConstraintName = "TESTPRIMARYKEY";
     return expression;
 }
Ejemplo n.º 9
0
 public abstract string Generate(DeleteConstraintExpression expression);
 public void ErrorIsNotReturnedWhenTableNameIsNotNullEmptyString()
 {
     var expression = new DeleteConstraintExpression(ConstraintType.Unique) { Constraint = { TableName = "aTable" } };
     var errors = ValidationHelper.CollectErrors(expression);
     errors.ShouldNotContain(ErrorMessages.TableNameCannotBeNullOrEmpty);
 }
Ejemplo n.º 11
0
 public override string Generate(DeleteConstraintExpression expression)
 {
     return string.Format("ALTER TABLE {0}.{1}", Quoter.QuoteSchemaName(expression.Constraint.SchemaName), base.Generate(expression));
 }
Ejemplo n.º 12
0
 public virtual void Process(DeleteConstraintExpression expression)
 {
     Process(Generator.Generate(expression));
 }
        public void CanDeleteConstraintWithSchema()
        {
            var expression = new DeleteConstraintExpression(ConstraintType.Unique);
            expression.Constraint.TableName = "ConstraintTable";
            expression.Constraint.SchemaName = "Schema";
            expression.Constraint.ConstraintName = "Constraint";

            string sql = generator.Generate(expression);
            sql.ShouldBe("ALTER TABLE \"Schema\".\"ConstraintTable\" DROP CONSTRAINT \"Constraint\"");
        }
Ejemplo n.º 14
0
 public override string Generate(DeleteConstraintExpression expression)
 {
     return string.Format("{0};", base.Generate(expression));
 }
Ejemplo n.º 15
0
 public override string Generate(DeleteConstraintExpression expression)
 {
     if (expression.Constraint.IsPrimaryKeyConstraint)
     {
         return string.Format(DeleteConstraint, Quoter.QuoteTableName(expression.Constraint.TableName), "PRIMARY KEY","");
     }
     return string.Format(DeleteConstraint, Quoter.QuoteTableName(expression.Constraint.TableName),"INDEX ", Quoter.Quote(expression.Constraint.ConstraintName));
 }