Package er.uber.migrations

Source Code of er.uber.migrations.Uber1

package er.uber.migrations;

import com.webobjects.eocontrol.EOEditingContext;
import com.webobjects.foundation.NSArray;

import er.extensions.migration.ERXMigrationDatabase;
import er.extensions.migration.ERXMigrationTable;
import er.extensions.migration.ERXModelVersion;

public class Uber1 extends ERXMigrationDatabase.Migration {
  @Override
  public NSArray<ERXModelVersion> modelDependencies() {
    return null;
  }

  @Override
  public void downgrade(EOEditingContext editingContext, ERXMigrationDatabase database) throws Throwable {
    // DO NOTHING
  }

  @Override
  public void upgrade(EOEditingContext editingContext, ERXMigrationDatabase database) throws Throwable {
    ERXMigrationTable companyTable = database.existingTableNamed("Company");
    companyTable.newIntegerColumn("logoID", true);
    companyTable.addIndex("name");

    ERXMigrationTable employeeTable = database.existingTableNamed("Employee");
    employeeTable.addIndex("lastName");

    companyTable.addForeignKey("logoID", "ERAttachment", "id");
  }
}
TOP

Related Classes of er.uber.migrations.Uber1

TOP
Copyright © 2018 www.massapi.com. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.