Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Liquibase #2151

Closed
wojciechGaudnik opened this issue Oct 26, 2022 · 3 comments
Closed

Liquibase #2151

wojciechGaudnik opened this issue Oct 26, 2022 · 3 comments

Comments

@wojciechGaudnik
Copy link

Hi,
I'm trying to figure out how put proper name like "name" "tag" "context" "labels",

image

spring boot property file:
liquibase-changelogs:
data:
liquibase:
change-log: db/changelog/data/db.changelog-data.xml
login:
liquibase:
change-log: db/changelog/login/db.changelog-login.xml
method:
liquibase:
change-log: db/changelog/method/db.changelog-method.xml
search:
liquibase:
change-log: db/changelog/search/db.changelog-search.xml
system:
liquibase:
change-log: db/changelog/system/db.changelog-system.xml
workflow:
liquibase:
change-log: db/changelog/workflow/db.changelog-workflow.xml

and db.changelog structure:
image

@SteKoe
Copy link
Contributor

SteKoe commented Oct 27, 2022

Hi @wojciechGaudnik,

I am sorry, but I don’t fully understand what you would like to achieve. The values in the columns "tag", "labels" and "contexts" are read from the liquibase changelog file you implement. If you haven’t added a tag, label or context, Spring Boot Admin will not be able to show values as Spring Boot Actuators will not serve them.

Regarding the "name" property, I have just pushed a fix to correct the behavior of the UI. Usually the name of the Bean should be printed there as you can see in the attached screenshot which shows the fixed version. The screenshot shows labels, contexts and tags as well, as I have created an example changelog file which contains these information (see attached code fragment).

I hope I was able to answer your questions.

Regards,
SteKoe

Bildschirm­foto 2022-10-27 um 18 28 15

<databaseChangeLog
    xmlns="http://www.liquibase.org/xml/ns/dbchangelog"
    xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
    xmlns:ext="http://www.liquibase.org/xml/ns/dbchangelog-ext"
    xmlns:pro="http://www.liquibase.org/xml/ns/pro"
    xsi:schemaLocation="http://www.liquibase.org/xml/ns/dbchangelog
		http://www.liquibase.org/xml/ns/dbchangelog/dbchangelog-latest.xsd
		http://www.liquibase.org/xml/ns/dbchangelog-ext http://www.liquibase.org/xml/ns/dbchangelog/dbchangelog-ext.xsd
		http://www.liquibase.org/xml/ns/pro http://www.liquibase.org/xml/ns/pro/liquibase-pro-latest.xsd">
    <changeSet id="202010211812" author="SteKoe" labels="1.0" context="a context">
        <createTable tableName="house">
            <column name="id" type="bigint">
                <constraints primaryKey="true" primaryKeyName="house_id_pk" />
            </column>
            <column name="owner" type="varchar(250)">
                <constraints unique="true" uniqueConstraintName="house_owner_unq" />
            </column>
            <column name="fully_paid" type="boolean" defaultValueBoolean="false"></column>
        </createTable>
        <createTable tableName="item">
            <column name="id" type="bigint">
                <constraints primaryKey="true" primaryKeyName="item_id_pk" />
            </column>
            <column name="name" type="varchar(250)" />
            <column name="house_id" type="bigint">
                <constraints nullable="false" notNullConstraintName="item_house_id_nn" />
            </column>
        </createTable>
        <addAutoIncrement tableName="house" columnName="id" columnDataType="bigint" startWith="1" incrementBy="1" />
        <addAutoIncrement tableName="item" columnName="id" columnDataType="bigint" startWith="1" incrementBy="1" />
        <createSequence sequenceName="hibernate_sequence" incrementBy="1" startValue="1" />
        <addForeignKeyConstraint baseTableName="item" baseColumnNames="house_id" constraintName="item_house_id_fk" referencedTableName="house" referencedColumnNames="id" />

    </changeSet>
    <changeSet id="changesetid" author="SteKoe" labels="2.0">
        <tagDatabase tag="My custum tag"/>
    </changeSet>
</databaseChangeLog>

@wojciechGaudnik
Copy link
Author

wojciechGaudnik commented Oct 28, 2022

Hi Stephan
You fully understand what I wanted to achieve. Thank you very much for your explanation, it was very helpful.
Now I'm able to add context and labels.
But the naming of beans still doesn't appear.
I'm using:

<spring-boot-admin-server.version>2.7.6</spring-boot-admin-server.version>
<spring-boot-admin-server-ui-login.version>1.5.7</spring-boot-admin-server-ui-login.version>

and I'm using several data sources if it's important, and below one of them:

@Bean
@ConfigurationProperties("spring.data.liquibase")
public LiquibaseProperties dataLiquibaseProperties() {
    return new LiquibaseProperties();
}
@Bean
public SpringLiquibase dataLiquibase(@Qualifier("dataDataSource") DataSource dataSource) {
    SpringLiquibase primary = new SpringLiquibase();
    primary.setDataSource(dataSource);
    primary.setChangeLog(dataLiquibaseProperties().getChangeLog());
    return primary;
}

Manually naming a bean also does not work.
and bellow you can see the response from the actuator:

{
    "contexts": {
        "application-1": {
            "liquibaseBeans": {
                "workflowLiquibase": {
                    "changeSets": []
                },
                "methodLiquibase": {
                    "changeSets": [
                        {
                            "author": "Joe Doe",
                            "changeLog": "db/changelog/method/changelogs/db.changelog-1.0.xml",
                            "comments": "",
                            "contexts": [],
                            "dateExecuted": "2022-10-18T05:20:53.430Z",
                            "deploymentId": "6070435584",
                            "description": "sqlFile",
                            "execType": "EXECUTED",
                            "id": "1",
                            "labels": [],
                            "checksum": "8:99d4f6aceb0459187c74c256efb49d92",
                            "orderExecuted": 1,
                            "tag": null
                        },

and what I see from admin:
image

And last, maybe not relevant for Admin Service but I will take risk :) Is there a way to add the tag to changeSet with sqlFile:

<changeSet id="3" author="Jon Doe" labels="1.0" context="method" >
    <sqlFile path="db/changelog/method/sql/change-topic-tp-to-to(f)-configuration.sql"/>
</changeSet>

Greeting

@SteKoe
Copy link
Contributor

SteKoe commented Nov 11, 2022

Hi @wojciechGaudnik,

glad we were able to help! We have released version 2.7.7 recently including a fix addressing the display of names in the frontend.
Anyways, we have no in depth knowledge regarding liquibase and cannot help you at this point, sorry.

Cheers,
SteKoe

@SteKoe SteKoe closed this as completed Nov 11, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants