How to update existing table JHipster sample app?

我们两清 提交于 2020-03-17 09:09:47

问题


I have created an entity called "event" using command yo jhipster:entity event while creating I forgot add one column let's say "event_title" so, I have added this(event_tile) column manually in liquibase changelog xml. Now how to update event table with newly added column?


回答1:


You need to include the new changelog file in your src/main/resources/config/liquibase/master.xml file.

<include file="classpath:config/liquibase/changelog/my_new_changelog.xml" 
    relativeToChangelogFile="false"/>

Next time you run the app, changes will be applied.

You can also update the database with the following maven task : mvn liquibase:update.

Here is the doc about using jhipster in development.




回答2:


I created a file on

src/main/resources/config/liquibase

Ex:

<?xml version="1.0" encoding="utf-8"?>
<databaseChangeLog
xmlns="http://www.liquibase.org/xml/ns/dbchangelog"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://www.liquibase.org/xml/ns/dbchangelog http://www.liquibase.org/xml/ns/dbchangelog/dbchangelog-3.4.xsd">

<changeSet author="lazaro" id="altertable-02">
    <addColumn catalogName="mySchema"
            schemaName="public"
            tableName="myTableName">
        <column name="atributeName" type="bigint"/>
    </addColumn>
</changeSet>

And added on

src/main/resources/config/liquibase/master.xml

A include tag:

<include file="classpath:config/liquibase/changelog/add_column_quantity_entity_Item.xml" relativeToChangelogFile="false"/>


来源:https://stackoverflow.com/questions/30004755/how-to-update-existing-table-jhipster-sample-app

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!