/// <summary> /// Configures a check constraint on the table. /// </summary> /// <param name="name"> The constraint name. </param> /// <param name="sql"> The sql expression used in the CHECK constraint. </param> /// <returns> The same builder so that multiple calls can be chained. </returns> public virtual OperationBuilder <CreateCheckConstraintOperation> CheckConstraint( [NotNull] string name, [NotNull] string sql) { Check.NotEmpty(name, nameof(name)); Check.NotNull(sql, nameof(sql)); var operation = new CreateCheckConstraintOperation { Schema = Operation.Schema, Table = Operation.Name, Name = name, Sql = sql }; Operation.CheckConstraints.Add(operation); return(new OperationBuilder <CreateCheckConstraintOperation>(operation)); }
/// <summary> /// Throws <see cref="NotSupportedException" /> since this operation requires table rebuilds, which /// are not yet supported. /// </summary> /// <param name="operation"> The operation. </param> /// <param name="model"> The target model which may be <c>null</c> if the operations exist without a model. </param> /// <param name="builder"> The command builder to use to build the commands. </param> protected override void Generate(CreateCheckConstraintOperation operation, IModel model, MigrationCommandListBuilder builder) => throw new NotSupportedException( SqliteStrings.InvalidMigrationOperation(operation.GetType().ShortDisplayName()));