是否可以将 table 名称作为 liquibase 变更集中的参数传递?

Is it possible to pass table name as as argument in liquibase changeset?

I am excuting liquibase chnageset when spring application starts

<changeSet author="kbatra" id="1.2">
        <createTable schemaName="public" tableName="table_a">
            <column name="id" autoIncrement="true" type="BIGINT">
                <constraints primaryKey="true" />
            </column>
            <column name="first_name" type="varchar(255)" />
            <column name="last_name" type="varchar(255)" />
            <column name="username" type="varchar(255)">
                <constraints unique="true" />
            </column>
            <column name="password" type="varchar(1000)" />
            <column name="email" type="varchar(255)" />
        </createTable>
    </changeSet>

Now what i want is i want to execute same changeSet but with the different table name is it possible to pass the table name in liquibase as an argument through spring? Is there any other to acheive this same scenario?

I am working on one module of spring hibernate application where i have to generate same sql schema structure but with different table name at run time as per the users requirement if this is not possible through liquibase then how can i acheive this scenario can anyone please help me to design architecture for this module?

您需要在变更集中使用可替换参数,然后在部署变更集时设置这些参数。您的变更集可能如下所示:

<changeSet author="kbatra" id="1.2">
        <createTable schemaName="public" tableName="${USER_TABLE_NAME}">
            <column name="id" autoIncrement="true" type="BIGINT">
                <constraints primaryKey="true" />
            </column>
            <column name="first_name" type="varchar(255)" />
            <column name="last_name" type="varchar(255)" />
            <column name="username" type="varchar(255)">
                <constraints unique="true" />
            </column>
            <column name="password" type="varchar(1000)" />
            <column name="email" type="varchar(255)" />
        </createTable>
    </changeSet>

然后您需要在 运行 liquibase update 命令时设置 USER_TABLE_NAME 的值,即当您的应用程序启动时 运行ning。