Example Step 7: Update the Database
For the latest version of Commerce Server 2007 Help, see the Microsoft Web site.
This topic describes how to update the database to store instances of virtual gift certificates and associate the virtual gift certificates with an order.
To update the database
Define the VirtualGiftCertificates table in the transactions database.
The SQL query to add the table will look as follows:
CREATE TABLE [dbo].[VirtualGiftCertificates] ( [VirtualGiftCertificateId] [UNIQUEIDENTIFIER] NOT NULL, [OrderFormId] [UNIQUEIDENTIFIER] NOT NULL, [OrderGroupId] [UNIQUEIDENTIFIER] NOT NULL ) ON [PRIMARY] GO ALTER TABLE [dbo].[VirtualGiftCertificates] WITH NOCHECK ADD CONSTRAINT [PK_VirtualGiftCertificates] PRIMARY KEY CLUSTERED ( [VirtualGiftCertificateId] ) ON [PRIMARY], CONSTRAINT [FK_VirtualGiftCertificates_OrderForms] FOREIGN KEY ( [OrderFormId] ) REFERENCES [OrderForms] ( [OrderFormId] ) GO
Because you deployed the assembly that contains the new and extended orders classes locally instead of in the Global Assembly Cache (GAC), you must run the Order Mapping tool from the same directory that contains the configuration files. Create a new directory and copy the following files into the new directory:
Copy the OrderMapping.exe file from the %COMMERCE_SERVER_ROOT%/Tools directory.
Copy the Web.config file from the virtual root of the Web site.
Copy the OrderObjectMappings.xml file from the virtual root of the Web site.
Copy the VirtualGiftCertificates.dll assembly from the \bin directory of the virtual root of the Web site.
Open a Command Prompt window, change to the directory that you created in step 2, and type the following command:
OrderMapping.exe /w Web.config
The order mapping tool creates a file that is named OrdersStorage.sql.
If you are using SQL Server 2005, open the OrdersStorage.sql file from the SQL Management Studio and execute the query against the transactions database. If you are using SQL Server 2000, use SQL Query Analyzer to load and execute the OrdersStorage.sql file against the transactions database.
Delete the directory that you created in step 2.
See Also
Other Resources
How to Generate SQL Tables and Stored Procedures for Orders Mapped Storage