public ICreateConstraints AddForeignKeyOn(string columnNames, string parentTable, string parentColumns, ForeignKeyRelationCascade onUpdate = ForeignKeyRelationCascade.NoAction, ForeignKeyRelationCascade onDelete = ForeignKeyRelationCascade.NoAction, string keyName = null) { _current = Schema.AddForeignKey(columnNames, parentTable, parentColumns, onUpdate, onDelete, keyName); return(this); }
protected virtual void Write(ConstraintDefinition constraint) { _definition = constraint; constraint.Options.Use(Engine); if (constraint.IsRedefined(Engine)) { Builder.Append(constraint.GetDefinition(Engine)); return; } Builder.Append(" CONSTRAINT"); var name = ConstraintName(constraint.Name); if (!name.IsNullOrEmpty()) { Builder.AppendFormat(" {0} ", name); } WriteConstraintType(); Builder.Append(" ("); WriteConstraintFeature(); Builder.Append(")"); }
public IDefineSpecificConstraintsOptions this[string name] { get { name.MustNotBeEmpty(); _current = Schema.Checks.Find(d => d.Name.Equals(name, StringComparison.InvariantCultureIgnoreCase)); if (_current == null) { _current = Schema.Uniques.Find(d => d.Name.Equals(name, StringComparison.InvariantCultureIgnoreCase)); if (_current == null) { if (Schema.PrimaryKey.Name == name) { _current = Schema.PrimaryKey; } else { throw new ArgumentException("Constraint not found", name); } } } return(this); } }
protected override void Write(ConstraintDefinition constraint) { //mysql ignores checks }
public ICreateConstraints AddCheck(string expression, string constraintName) { _current = Schema.AddCheck(expression, constraintName); return(this); }
public ICreateConstraints AddUniqueConstraintOn(string columnsNames, string constraintName = null) { _current = Schema.AddUnique(columnsNames, constraintName); return(this); }