public static CreateTable ForeignKey(this CreateTable @this, IEnumerable <string> columnNames, string references, IEnumerable <string> referencesColumnNames = null, ForeignKeyTriggers onDelete = default(ForeignKeyTriggers), ForeignKeyTriggers onUpdate = default(ForeignKeyTriggers), Deferrable deferrable = default(Deferrable) ) { if (referencesColumnNames == null) { referencesColumnNames = columnNames; } @this.TableConstraints.Add(new ForeignKeyConstraint() { ColumnNames = columnNames, ReferenceColumnNames = referencesColumnNames, OnDelete = onDelete, OnUpdate = onUpdate, Deferrable = deferrable, }); return(@this); }
public static CreateTable PrimaryKey(this CreateTable @this, string columnName) { @this.TableConstraints.Add(new PrimaryKeyConstraint() { ColumnNames = new string[] { columnName } }); return(@this); }
public static CreateTable WithColumns(this CreateTable @this, IEnumerable <ColumnInfo> columns) { foreach (var c in columns) { @this.Columns.Add(c); } return(@this); }
public static CreateTable WithTableConstraints(this CreateTable @this, IEnumerable <TableConstraint> tableConstraints) { foreach (var tc in tableConstraints) { @this.TableConstraints.Add(tc); } return(@this); }
public static CreateTable WithTableConstraints(this CreateTable @this, IEnumerable <string> tableConstraints) { foreach (var tc in tableConstraints) { @this.TableConstraints.Add(new GenericConstraint(tc)); } return(@this); }
public static CreateTable Check(this CreateTable @this, string expression) { if (expression == null) { throw new ArgumentNullException("expression"); } @this.TableConstraints.Add(new CheckConstraint(expression)); return(@this); }
public static CreateTable Unique(this CreateTable @this, string columnName, string onConflict = null) { if (columnName == null) { throw new ArgumentNullException("columnName"); } @this.TableConstraints.Add(new UniqueConstraint() { ColumnNames = new string[] { columnName }, ConflictOption = onConflict }); return(@this); }