use of org.apache.cayenne.dbsync.merge.token.db.DropColumnToDb in project cayenne by apache.
the class IngresMergerTokenFactory method createDropColumnToDb.
@Override
public MergerToken createDropColumnToDb(DbEntity entity, DbAttribute column) {
return new DropColumnToDb(entity, column) {
@Override
public List<String> createSql(DbAdapter adapter) {
StringBuilder buf = new StringBuilder();
QuotingStrategy context = adapter.getQuotingStrategy();
buf.append("ALTER TABLE ");
buf.append(context.quotedFullyQualifiedName(getEntity()));
buf.append(" DROP COLUMN ");
buf.append(context.quotedName(getColumn()));
buf.append(" RESTRICT ");
return Collections.singletonList(buf.toString());
}
};
}
use of org.apache.cayenne.dbsync.merge.token.db.DropColumnToDb in project cayenne by apache.
the class SybaseMergerTokenFactory method createDropColumnToDb.
/**
* @since 3.0
*/
@Override
public MergerToken createDropColumnToDb(DbEntity entity, DbAttribute column) {
return new DropColumnToDb(entity, column) {
@Override
public List<String> createSql(DbAdapter adapter) {
StringBuilder sqlBuffer = new StringBuilder();
QuotingStrategy context = adapter.getQuotingStrategy();
sqlBuffer.append("ALTER TABLE ");
sqlBuffer.append(context.quotedFullyQualifiedName(getEntity()));
sqlBuffer.append(" DROP ");
sqlBuffer.append(context.quotedName(getColumn()));
return Collections.singletonList(sqlBuffer.toString());
}
};
}
use of org.apache.cayenne.dbsync.merge.token.db.DropColumnToDb in project cayenne by apache.
the class TokenSortTest method testToDbTokensCompare.
@Test
public void testToDbTokensCompare() throws Exception {
List<MergerToken> tokens = Arrays.<MergerToken>asList(new DropColumnToDb(null, null), new DropRelationshipToDb(null, null), new DropTableToDb(null), new AddColumnToModel(null, null), new AddRelationshipToDb(null, null), new AddColumnToDb(null, null), new CreateTableToDb(null));
Collections.sort(tokens);
List<String> actual = toClassesNames(tokens);
List<String> expected = Arrays.asList("DropRelationshipToDb", "DropColumnToDb", "DropTableToDb", "CreateTableToDb", "AddColumnToDb", "AddColumnToModel", "AddRelationshipToDb");
assertEquals(expected, actual);
}
Aggregations