Changeset 3784
- Timestamp:
- Sep 25, 2007, 3:08:39 PM (16 years ago)
- Location:
- trunk/src/core/net/sf/basedb/core
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/core/net/sf/basedb/core/Install.java
r3741 r3784 104 104 method. 105 105 */ 106 public static final int NEW_SCHEMA_VERSION = Integer.valueOf(4 2).intValue();106 public static final int NEW_SCHEMA_VERSION = Integer.valueOf(43).intValue(); 107 107 108 108 public static synchronized void createTables(boolean update, final ProgressReporter progress) -
trunk/src/core/net/sf/basedb/core/Update.java
r3741 r3784 474 474 <td>40</td> 475 475 <td> 476 Change invalid property filter on 'guiContexts.itemType' to 477 '$ctx.itemType'. 476 Used to "Change invalid property filter on 'guiContexts.itemType' to 477 '$ctx.itemType'", but since the source problem never was fixed this is now 478 done in 43. 478 479 </td> 479 480 </tr> … … 499 500 The update will query the database or check the CDF file to get 500 501 the information. 502 </td> 503 </tr> 504 505 <tr> 506 <td>43</td> 507 <td> 508 Change invalid property filter on 'guiContexts.itemType' to 509 '$ctx.itemType'". Was originally fixed by 40, but since the source 510 problem never was fixed it must be done again. 501 511 </td> 502 512 </tr> … … 697 707 schemaVersion = updateToSchemaVersion39(session); 698 708 } 699 700 if (schemaVersion < 40) 701 { 702 if (progress != null) progress.display((int)(39*progress_factor), "--Updating schema version: " + schemaVersion + " -> 40..."); 703 schemaVersion = updateToSchemaVersion40(session); 704 } 705 709 706 710 if (schemaVersion < 41) 707 711 { … … 714 718 if (progress != null) progress.display((int)(41*progress_factor), "--Updating schema version: " + schemaVersion + " -> 42..."); 715 719 schemaVersion = updateToSchemaVersion42(session); 720 } 721 722 if (schemaVersion < 43) 723 { 724 if (progress != null) progress.display((int)(42*progress_factor), "--Updating schema version: " + schemaVersion + " -> 43..."); 725 schemaVersion = updateToSchemaVersion43(session); 716 726 } 717 727 … … 1589 1599 if (tx != null) HibernateUtil.rollback(tx); 1590 1600 log.error("updateToSchemaVersion39: FAILED", ex); 1591 throw ex;1592 }1593 return schemaVersion;1594 }1595 1596 /**1597 Update property filter on 'guiContexts.itemType' to '$ctx.itemType'1598 @return The new schema version (=40)1599 */1600 private static int updateToSchemaVersion40(org.hibernate.Session session)1601 {1602 final int schemaVersion = 40;1603 org.hibernate.Transaction tx = null;1604 try1605 {1606 tx = HibernateUtil.newTransaction(session);1607 1608 // Change property values1609 org.hibernate.Query query = HibernateUtil.getPredefinedSQLQuery(session,1610 "UPDATE_PROPERTY_FILTER");1611 /*1612 UPDATE PropertyFilters pf1613 SET pf.property = :newProperty1614 WHERE pf.property = :oldProperty1615 */1616 query.setString("oldProperty", "guiContexts.itemType");1617 query.setString("newProperty", "$ctx.itemType");1618 HibernateUtil.executeUpdate(query);1619 1620 // Update the schema version number1621 setSchemaVersion(session, schemaVersion);1622 1623 // Commit the changes1624 HibernateUtil.commit(tx);1625 log.info("updateToSchemaVersion40: OK");1626 }1627 catch (BaseException ex)1628 {1629 if (tx != null) HibernateUtil.rollback(tx);1630 log.error("updateToSchemaVersion40: FAILED", ex);1631 1601 throw ex; 1632 1602 } … … 1718 1688 } 1719 1689 1720 1690 /** 1691 Update property filter on 'guiContexts.itemType' to '$ctx.itemType' 1692 @return The new schema version (=43) 1693 */ 1694 private static int updateToSchemaVersion43(org.hibernate.Session session) 1695 { 1696 final int schemaVersion = 43; 1697 org.hibernate.Transaction tx = null; 1698 try 1699 { 1700 tx = HibernateUtil.newTransaction(session); 1701 1702 // Change property values 1703 org.hibernate.Query query = HibernateUtil.getPredefinedSQLQuery(session, 1704 "UPDATE_PROPERTY_FILTER"); 1705 /* 1706 UPDATE PropertyFilters pf 1707 SET pf.property = :newProperty 1708 WHERE pf.property = :oldProperty 1709 */ 1710 query.setString("oldProperty", "guiContexts.itemType"); 1711 query.setString("newProperty", "$ctx.itemType"); 1712 HibernateUtil.executeUpdate(query); 1713 1714 // Update the schema version number 1715 setSchemaVersion(session, schemaVersion); 1716 1717 // Commit the changes 1718 HibernateUtil.commit(tx); 1719 log.info("updateToSchemaVersion40: OK"); 1720 } 1721 catch (BaseException ex) 1722 { 1723 if (tx != null) HibernateUtil.rollback(tx); 1724 log.error("updateToSchemaVersion40: FAILED", ex); 1725 throw ex; 1726 } 1727 return schemaVersion; 1728 } 1729 1721 1730 /** 1722 1731 Adjust the existing items in the database to be compatible with the latest mappings.
Note: See TracChangeset
for help on using the changeset viewer.