How to update existing table JHipster sample app?

前端 未结 2 1134
粉色の甜心
粉色の甜心 2021-02-09 02:38

I have created an entity called \"event\" using command yo jhipster:entity event while creating I forgot add one column let\'s say \"ev

相关标签:
2条回答
  • 2021-02-09 03:10

    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"/>
    
    0 讨论(0)
  • 2021-02-09 03:21

    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.

    0 讨论(0)
提交回复
热议问题