Database schema not updating after service module deploymentDatabase schema not updating after service module deploymenthttps://liferay.dev/en/c/message_boards/find_thread?p_l_id=119785333&threadId=1194450092024-03-29T00:47:04Z2024-03-29T00:47:04ZRE: Database schema not updating after service module deploymentAlberto Chaparrohttps://liferay.dev/en/c/message_boards/find_message?p_l_id=119785333&messageId=1195804062020-07-12T03:44:56Z2020-07-12T03:44:56ZHi Afriland,<br />For the first option I guess you would need to generate a file with the definition of the table during the upgrade using <strong><strong>gradle buildUpgradeTable<br /><br /><br /></strong></strong>Anyway, I think the second option you took is better for your case. Use runSQL to execute the required SQL statements. However I don't understand your previous comment <em>"This worked, the table was successfully created but it had no link with the newly added entity. This means that an update on the entity wouldn't affect this table because the latter wasn't created from the entity", </em>can you elaborate more on that?<br /><br />In general, if you don't need the data already generated in the database, you can remove the release record and the tables already created associated with your service module and then, the table will be recreated once you deploy the new version of the module. If you don't want to lose already present in the database, you can create an upgrade process as you mentioned before.<br />I hope it helps.Alberto Chaparro2020-07-12T03:44:56ZRE: Database schema not updating after service module deploymentAfriland Liferayhttps://liferay.dev/en/c/message_boards/find_message?p_l_id=119785333&messageId=1195475302020-07-06T15:30:37Z2020-07-06T15:30:37ZHello all,<br /><br />I am using Liferay DXP 7.2 with service-builder. I deployed my service module without any issue. Later, I had to create new entities within my service, but after deployment the corresponding tables were not created. After some search on the internet, I came accross the official procedure of creating "Upgrade Processes" to dictate how liferay updates its database after module deployments: <br /><a href="https://help.liferay.com/hc/en-us/articles/360031165751-Creating-Upgrade-Processes-for-Modules">https://help.liferay.com/hc/en-us/articles/360031165751-Creating-Upgrade-Processes-for-Modules</a><br /><br />According to this article, they have an example of an update of a table. What about the creation of a new table? <br /><br />We tried the following:<br /><br />alter(AfbTestModelImpl.class,<br />new AlterTableAddColumn("afbTestId"),<br />new AlterTableAddColumn("groupId"),<br />new AlterTableAddColumn("companyId"),<br />new AlterTableAddColumn("userId"),<br />new AlterTableAddColumn("userName"),<br />new AlterTableAddColumn("createDate"),<br />new AlterTableAddColumn("modifiedDate"),<br />new AlterTableAddColumn("testName"));<br /><br />But this gave us the error attached to this post.<br /><br />Then, we tried this:<br /><br />runSQL("CREATE TABLE AfbTest (afbTestId BIGINT, "<br />+ "groupId BIGINT, companyId BIGINT, userId BIGINT, "<br />+ " userName VARCHAR(75),"<br />+ "createDate TIMESTAMP, modifiedDate TIMESTAMP,"<br />+ "testName VARCHAR(75)"<br />+ ") ");<br /><br />This worked, the table was successfully created but it had no link with the newly added entity. This means that an update on the entity wouldn't affect this table because the latter wasn't created from the entity.<br /><br />What we are looking for is the creation of a new table from the definition of a corresponding entity in the service.xml file of the service-builder.<br /><br />Thanks in advance for any hints.Afriland Liferay2020-07-06T15:30:37ZRE: Database schema not updating after service module deploymentAfriland Liferayhttps://liferay.dev/en/c/message_boards/find_message?p_l_id=119785333&messageId=1194513182020-06-19T15:47:24Z2020-06-19T15:47:24ZThank you David. I tried to deploy an updated version, but still no change. I think I will just use a new database for now, then as soon as I am done, I will check how to do Upgrade Processes and apply that so that when we go to production we are alright and supported. <br />Thanks.Afriland Liferay2020-06-19T15:47:24ZRE: Database schema not updating after service module deploymentDavid H Nebingerhttps://liferay.dev/en/c/message_boards/find_message?p_l_id=119785333&messageId=1194480162020-06-19T12:46:25Z2020-06-19T12:46:25ZThat property is for development only, you certainly wouldn't be setting this in production.<br /><br />In the production environment, there you need to build out UpgradeProcess implementations to manage affecting these changes in production, so the sooner you wrap your head around that, the better.<br /><br />On this particular issue, the property will only apply itself when the bundle is being initially deployed. Once that version is established, setting the property will do nothing. So you need to set the property and deploy an updated version.David H Nebinger2020-06-19T12:46:25ZDatabase schema not updating after service module deploymentAfriland Liferayhttps://liferay.dev/en/c/message_boards/find_message?p_l_id=119785333&messageId=1194450082020-06-19T10:37:49Z2020-06-19T10:37:49ZHello all, I am using Liferay dxp 7.2 and I am doing some customizations using service-builder. On my local computer, I added the attribute "schema.module.build.auto.upgrade = true" in my portal-ext.properties file, then deployed my OSGI service module. My database tables were created/updated correctly. <br /><br />However, I deployed the same service module on another server, and my database tables were not created nor updated. That environment already had some data including 6 of my new database tables. I was expecting two new database tables to be created, but they weren't. After deployment, I realized that I had forgotten to include the "schema.module.build.auto.upgrade = true" in my portal-ext.properties file. I then did the corrections, deployed my service module and restarted the server as well. However, there was still no change.<br /><br /> I have been searching all over the internet for solutions to fix this problem but I found articles suggesting to add "schema.module.build.auto.upgrade = true" in my portal-ext.properties file as I did, or to use a data upgrade process. Since we are still in testing environment, I don't want to do the data upgrade process right now (plus I don't understand very well how to do it). Please can someone help me in solving this issue?<br /><br />NB: I tried deploying the same service module on a Liferay serv