I have just started a new database project to price customer bid proposals:
Some of the tables in the database will contain information that is regularly updated say for example the pricing tables.
Now new bids should always use the latest information on the database, however existing bids should continue with the data used when they started unless the bid author decides otherwise.
Matters are somewhat simplified as a bid will under no circumstances use prices across versions so even if a product was coasted and available on an older version of the pricing table, it will not be available to newer projects.
In order to achieve this I am planning to include a version column and perhaps a linked version control table. I think this will be enough.
However I feel like this must be a common database design requirement and thus there must be existing “best practices” and techniques to achieve this so I’d rather build on existing experience than poorly reinvent the wheel.
Any advice on how to resolve this problem? Also I am working with the Grails platform so any Grails specific information would be much appreciated.
I’m not sure I explained my problem correctly so here is an example:
class Bid { // Each new customer bid is stored in this table
String bidName
static hasMany = [ item: ItemList ]
static belongsTo = [ versionNumber: VersionControl]
}
class ItemList { // Products/Services are associated with a bid via this table
String description
static belongsTo = [ bid: Bid, item: Price ]
}
class Price { // The price of individual products and services the company offers
String description
Long value
static belongsTo = [ versionNumber: VersionControl]
}
class VersionControl {
/** So that when filling in the ItemList form for a bid, I can query for only
* prices with the correct version number
*/
String user
Long versionNumber
Date timestamp
static hasMany = [ bid: Bid, productOrService: Price ]
}
This example works fine, and illustrates what I want to do. I just don’t know if it is the best way to address the problem and how well it will scale – I have around 20 tables containing different parameters who’s versions I need to keep track of.
A bid will always be assigned the latest version of a pricing list, but the user must have the ability to be able to select a different version.
I should probably mention that prices will be updated in bulk, not individually, using a csv file provided by the accounting department. Each csv represents a new discreet price list version, not just as far as the database is concerned, but from an internal management perspective.
A similar philosophy will affect other tables in the DB such as exchange rates to use or geographical regions where the company operates.
The regularity with which new versions are released is also hard to predict which could make determining the endDate a problem.
There is no special Grails support for this goal, this is simly a 4th normal form. In your case it will be a header table for price entity and a subtable for value in time with limits: