migrations and inserting data
migrations and inserting data
- Subject: migrations and inserting data
- From: email@hidden
- Date: Mon, 14 Jul 2008 21:30:04 -0700 (PDT)
Below is my table creation from my migration .java. I used the example from the SooperSeekrit tutorial. my problem is the insert statement at the bottom. After I run the app, I check the postgresql database and there are two entries...
assoftwareassets=# select * from t_manufacturer;
c_as_account_number | c_manufacturer_name | c_vendor_phone_number | id | c_notes
---------------------+---------------------+-----------------------+----+---------
| Quark | | 1 |
| Quark | | 2 |
Why are there two rows of data? I only inserted one.
Ted
ERXMigrationTable manufacturerTable = database.newTableNamed("t_manufacturer");
manufacturerTable.newStringColumn("c_as_account_number", 255, true);
manufacturerTable.newIntegerColumn("id", false);
manufacturerTable.newStringColumn("c_manufacturer_name", 255, false);
manufacturerTable.newStringColumn("c_vendor_phone_number", 16, true);
manufacturerTable.create();
manufacturerTable.setPrimaryKey("id");
ERXMigrationTable assetTable = database.newTableNamed("t_asset");
assetTable.newIntegerColumn("id", false);
assetTable.newIntegerColumn("manufacturer_id", false);
assetTable.newStringColumn("c_serial_number", 255, true);
assetTable.newStringColumn("c_title", 255, true);
assetTable.create();
assetTable.setPrimaryKey("id");
assetTable.addForeignKey("manufacturer_id", "t_manufacturer", "id");
ERXJDBCUtilities.executeUpdate(database.adaptorChannel(), "INSERT INTO t_manufacturer (c_manufacturer_name) VALUES ('Quark')");
_______________________________________________
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