protected override string GetSql() { var table = new TableDefinition { Name = TableName, SchemaName = SchemaName, Columns = Columns }; return(string.Format(SqlSyntax.Format(table))); }
public override string ToString() { var table = new TableDefinition { Name = TableName, SchemaName = SchemaName, Columns = Columns }; return(string.Format(SqlSyntax.Format(table))); }
public override string ToString() { if (IsExpressionSupported() == false) { return(string.Empty); } return(SqlSyntax.Format(ForeignKey)); }
protected void AlterColumn <T>(string tableName, string columnName) { var table = DefinitionFactory.GetTableDefinition(typeof(T), SqlSyntax); var column = table.Columns.First(x => x.Name == columnName); SqlSyntax.Format(column, SqlSyntax.GetQuotedTableName(tableName), out var sqls); foreach (var sql in sqls) { Execute.Sql(sql).Do(); } }
protected override string GetSql() { if (string.IsNullOrEmpty(Column.TableName)) { Column.TableName = TableName; } return(string.Format(SqlSyntax.AddColumn, SqlSyntax.GetQuotedTableName(Column.TableName), SqlSyntax.Format(Column))); }
private void AddColumn(TableDefinition table, string tableName, string columnName) { if (ColumnExists(tableName, columnName)) { return; } var column = table.Columns.First(x => x.Name == columnName); var createSql = SqlSyntax.Format(column); Execute.Sql(string.Format(SqlSyntax.AddColumn, SqlSyntax.GetQuotedTableName(tableName), createSql)).Do(); }
private void AddColumn(TableDefinition table, string tableName, string columnName, out IEnumerable <string> sqls) { if (ColumnExists(tableName, columnName)) { sqls = Enumerable.Empty <string>(); return; } var column = table.Columns.First(x => x.Name == columnName); var createSql = SqlSyntax.Format(column, SqlSyntax.GetQuotedTableName(tableName), out sqls); Execute.Sql(string.Format(SqlSyntax.AddColumn, SqlSyntax.GetQuotedTableName(tableName), createSql)).Do(); }
public override void Migrate() { // cannot delete the column without this, of course Delete.KeysAndIndexes().Do(); Delete.Column("id").FromTable("umbracoUser").Do(); var table = DefinitionFactory.GetTableDefinition(typeof(UserDto), SqlSyntax); var column = table.Columns.First(x => x.Name == "id"); var create = SqlSyntax.Format(column); // returns [id] INTEGER NOT NULL IDENTITY(1060,1) Database.Execute($"ALTER TABLE {SqlSyntax.GetQuotedTableName("umbracoUser")} ADD " + create); }
public override string ToString() { //string columnNameFormat = string.Format("{0} {1}", // SqlSyntaxContext.SqlSyntaxProvider.GetQuotedColumnName(Column.Name), // SqlSyntaxContext.SqlSyntaxProvider.Format(Column)); return(string.Format(SqlSyntax.AlterColumn, SqlSyntax.GetQuotedTableName(TableName), SqlSyntax.Format(Column))); //return string.Format(SqlSyntaxContext.SqlSyntaxProvider.AlterColumn, // SqlSyntaxContext.SqlSyntaxProvider.GetQuotedTableName(TableName), // SqlSyntaxContext.SqlSyntaxProvider.GetQuotedColumnName(Column.Name)); }
public override string ToString() { if (IsExpressionSupported() == false) { return(string.Empty); } if (string.IsNullOrEmpty(Column.TableName)) { Column.TableName = TableName; } return(string.Format(SqlSyntax.AddColumn, SqlSyntax.GetQuotedTableName(Column.TableName), SqlSyntax.Format(Column))); }
protected override string GetSql() { return(SqlSyntax.Format(Index)); }
protected override string GetSql() { return(string.Format(SqlSyntax.AlterColumn, SqlSyntax.GetQuotedTableName(TableName), SqlSyntax.Format(Column))); }
public override string ToString() { return(SqlSyntax.Format(Index)); }
protected override string GetSql() { return(SqlSyntax.Format(ForeignKey)); }