use of org.obeonetwork.dsl.database.Table in project InformationSystem by ObeoNetwork.
the class ColumnSpec method addToPrimaryKey.
@Override
public void addToPrimaryKey() {
// Do nothing if the column is already a PK column or if it does not belong to a table
if (isInPrimaryKey() == false && getOwner() != null && getOwner() instanceof Table) {
Table table = (Table) getOwner();
// First, ensure there is a Primary Key defined on this table
PrimaryKey pk = table.getPrimaryKey();
if (pk == null) {
// Create a new PK
pk = DatabaseFactory.eINSTANCE.createPrimaryKey();
pk.setName(table.getName() + "_PK");
table.setPrimaryKey(pk);
}
// Then attach the column to the primary key
pk.getColumns().add(this);
}
}
use of org.obeonetwork.dsl.database.Table in project InformationSystem by ObeoNetwork.
the class RenameTableChangeImpl method setNewTable.
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
public void setNewTable(Table newNewTable) {
Table oldNewTable = newTable;
newTable = newNewTable;
if (eNotificationRequired())
eNotify(new ENotificationImpl(this, Notification.SET, DbevolutionPackage.RENAME_TABLE_CHANGE__NEW_TABLE, oldNewTable, newTable));
}
use of org.obeonetwork.dsl.database.Table in project InformationSystem by ObeoNetwork.
the class UpdateTableCommentChangeImpl method setNewTable.
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
public void setNewTable(Table newNewTable) {
Table oldNewTable = newTable;
newTable = newNewTable;
if (eNotificationRequired())
eNotify(new ENotificationImpl(this, Notification.SET, DbevolutionPackage.UPDATE_TABLE_COMMENT_CHANGE__NEW_TABLE, oldNewTable, newTable));
}
use of org.obeonetwork.dsl.database.Table in project InformationSystem by ObeoNetwork.
the class ColumnServicesTest method isMandatoryNullTest.
@Test
public void isMandatoryNullTest() {
Table table = getGSSerieTable();
Column col = getColumn(table, "No table");
assertEquals("No", new ColumnServices().isMandatory(col));
}
use of org.obeonetwork.dsl.database.Table in project InformationSystem by ObeoNetwork.
the class ColumnServicesTest method checkForeignKeyNullTest.
@Test
public void checkForeignKeyNullTest() {
Table table = getGSSerieTable();
Column col = getColumn(table, "No table");
assertEquals("", new ColumnServices().checkInForeignKey(col));
}
Aggregations