• Open Menu Close Menu
  • Apple
  • Shopping Bag
  • Apple
  • Mac
  • iPad
  • iPhone
  • Watch
  • TV
  • Music
  • Support
  • Search apple.com
  • Shopping Bag

Lists

Open Menu Close Menu
  • Terms and Conditions
  • Lists hosted on this site
  • Email the Postmaster
  • Tips for posting to public mailing lists
Re: Migration Issue with 0 level migration
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Migration Issue with 0 level migration


  • Subject: Re: Migration Issue with 0 level migration
  • From: Chuck Hill <email@hidden>
  • Date: Fri, 04 Nov 2011 12:30:10 -0700

DB plugin not added to project.


On 2011-11-04, at 12:15 PM, James Cicenia wrote:

> Hello -
>
> I am developing another D2WApp and using Migrations from the very start.
>
> However, when I first start my application I get this error:
>
> Executing alter table ERAttachment null available VARCHAR(5) NOT NULL
>
> I am using ERAttachment and here is my migration file:
>
> Anything seem obvious?
>
> James
>
>
> ==============
> package com.jimijon.mwf.migrations;
>
>
> import com.webobjects.eocontrol.EOEditingContext;
> import com.webobjects.foundation.NSArray;
>
> import er.extensions.jdbc.ERXSQLHelper.ColumnIndex;
> import er.extensions.migration.ERXMigrationDatabase;
> import er.extensions.migration.ERXMigrationIndex;
> import er.extensions.migration.ERXMigrationTable;
> import er.extensions.migration.ERXModelVersion;
>
> public class MidwestFoodsModel0 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 foodFamilyTable = database.newTableNamed("food_family");
> 		foodFamilyTable.newTimestampColumn("add_date", true);
> 		foodFamilyTable.newIntegerColumn("id", false);
> 		foodFamilyTable.newIntegerColumn("main_image_erattachment_id", true);
> 		foodFamilyTable.newTimestampColumn("mod_date", true);
> 		foodFamilyTable.newStringColumn("name", 255, false);
> 		foodFamilyTable.newIntegerColumn("thumbnail_erattachment_id", true);
> 		foodFamilyTable.create();
> 	 	foodFamilyTable.setPrimaryKey("id");
>
> 		ERXMigrationTable foodItemTable = database.newTableNamed("food_item");
> 		foodItemTable.newTimestampColumn("add_date", true);
> 		foodItemTable.newStringColumn("availability_status", 50, true);
> 		foodItemTable.newStringColumn("food_family", 100, true);
> 		foodItemTable.newStringColumn("fruit_or_vegetable_type", 100, true);
> 		foodItemTable.newIntegerColumn("id", false);
> 		foodItemTable.newIntegerColumn("main_image_erattachment_id", true);
> 		foodItemTable.newTimestampColumn("mod_date", true);
> 		foodItemTable.newStringColumn("name", 100, false);
> 		foodItemTable.newBigDecimalColumn("price", 38, 4, true);
> 		foodItemTable.newStringColumn("price_status", 50, false);
> 		foodItemTable.newStringColumn("quality_status", 50, false);
> 		foodItemTable.newBooleanColumn("seasonal_second_half_sep", true);
> 		foodItemTable.newStringColumn("sku", 50, true);
> 		foodItemTable.newIntegerColumn("thumbnail_erattachment_id", true);
> 		foodItemTable.create();
> 	 	foodItemTable.setPrimaryKey("id");
>
> 		ERXMigrationTable newsItemTable = database.newTableNamed("news_item");
> 		newsItemTable.newTimestampColumn("add_date", true);
> 		newsItemTable.newDateColumn("entryDate", false);
> 		newsItemTable.newIntegerColumn("food_family_id", false);
> 		newsItemTable.newIntegerColumn("food_item_id", true);
> 		newsItemTable.newIntegerColumn("id", false);
> 		newsItemTable.newTimestampColumn("mod_date", true);
> 		newsItemTable.newStringColumn("name", 255, false);
> 		newsItemTable.create();
> 	 	newsItemTable.setPrimaryKey("id");
>
> 		foodFamilyTable.addForeignKey("main_image_erattachment_id", "ERAttachment", "id");
> 		foodFamilyTable.addForeignKey("thumbnail_erattachment_id", "ERAttachment", "id");
> 		foodItemTable.addForeignKey("main_image_erattachment_id", "ERAttachment", "id");
> 		foodItemTable.addForeignKey("thumbnail_erattachment_id", "ERAttachment", "id");
> 		newsItemTable.addForeignKey("food_family_id", "food_family", "id");
> 		newsItemTable.addForeignKey("food_item_id", "food_item", "id");
> 	}
> }
>
> _______________________________________________
> Do not post admin requests to the list. They will be ignored.
> Webobjects-dev mailing list      (email@hidden)
> Help/Unsubscribe/Update your Subscription:
>
> This email sent to email@hidden

--
Chuck Hill             Senior Consultant / VP Development

Practical WebObjects - for developers who want to increase their overall knowledge of WebObjects or who are trying to solve specific problems.
http://www.global-village.net/products/practical_webobjects







 _______________________________________________
Do not post admin requests to the list. They will be ignored.
Webobjects-dev mailing list      (email@hidden)
Help/Unsubscribe/Update your Subscription:

This email sent to email@hidden

  • Follow-Ups:
    • Re: Migration Issue with 0 level migration and ERAttachement
      • From: James Cicenia <email@hidden>
    • Re: Migration Issue with 0 level migration
      • From: James Cicenia <email@hidden>
References: 
 >Migration Issue with 0 level migration (From: James Cicenia <email@hidden>)

  • Prev by Date: Migration Issue with 0 level migration
  • Next by Date: Re: Migration Issue with 0 level migration
  • Previous by thread: Migration Issue with 0 level migration
  • Next by thread: Re: Migration Issue with 0 level migration
  • Index(es):
    • Date
    • Thread