Create Account Management Schema
note
Account Management API is now deprecated and we recommend that you use Account Management functionality built into Elastic Path Commerce 8.2 and later.
Pre-requisites
- Ensure that all requirements described in the Requirements are met
- Ensure that you have the URLs for the Account Management user interface, the Account Management API, and Keycloak
- Ensure that the MySQL compatible service is provisioned and the username, password, and other connectivity details are available
- Ensure that you have access to a machine which has connectivity to the MySQL service and can run Liquibase migrations
- Ensure that Keycloak is configured and deployed
- Ensure that the ID, full name, and e-mail of the seller administrator that you created in Keycloak are available.
- For more information, see the Creating new seller administrator section
Initializing Database Schema
- Create a
liquibase.properties
file with the appropriate database access credentials and schema name. - Copy the contents of the database folder from the
account-management-2.0.x.zip
andliquibase.properties
files to the computer that execute the schema creation. - Create the schema by running the following command:
./liquibase --changeLogFile=database/changelog-master.xml update
- Connect to the database and run the following query:
INSERT INTO TUSER (GUID, IDP_IDENTIFIER, NAME, EMAIL, USER_TYPE) VALUES(UUID(), "<SELLER_ADMIN_ID>", "<Seller Admin Full Name>", "<Seller Admin Email>", "SELLER_USER");
Validating Database schema
Verify that the Liquibase command is completed without any error.
Connect to the MySQL Server and verify that the schema is created.
For the verification, use the MySQL credentials that you use to authenticate the Account Management API service.
Verify that the newly added user is listed in the
TUSER
table.
Post-deployment Tasks
Following are the tasks that need to be performed after deploying the database schema:
Configuring Store Access for Associate
An associate can shop from all stores that has store codes in the TSTOREREF
table. If you want to restrict any access to a specific store, remove the corresponding store code row from the TSTOREREF
table. For a new store, add a row to the Account Management database in the TSTOREREF
table.
Use this procedure to add a new row for a store to make the store accessible from the Account Management service.
- To add a new row to the Account Management database in the
TSTOREREF
table, connect to the database and run the following query:
INSERT INTO TSTOREREF (STORECODE) VALUES (<store code from commerce>);
Setting up Seller Administrator
Use this procedure to add a new seller administrator who can manage all accounts in the Account Management service.
In the
Commerce
realm in KeyCloak, create a new user note the user ID.For more information about creating a new user in Keycloak, see the Setting up a seller administrator in keycloak section.
In the Account Management database in the
TUSER
table, add a new row by running the following query:
INSERT INTO TUSER (GUID, IDP_IDENTIFIER, NAME, EMAIL, USER_TYPE) VALUES(UUID(), "<SELLER_ADMIN_ID>", "<Seller Admin Full Name>", "<Seller Admin Email>", "SELLER_USER");