Using sequences

any idea where this javadoc is? Im not doing any migration. Just need a sequence generator.

I meant this Javadoc on deprecated CUBA class: https://github.com/jmix-framework/jmix/blob/master/jmix-cuba/cuba/src/main/java/com/haulmont/cuba/core/app/UniqueNumbersAPI.java#L19

So in Jmix you can use this interface: https://github.com/jmix-framework/jmix/blob/master/jmix-data/data/src/main/java/io/jmix/data/Sequences.java

thank you… please check in liquibase with my SQL… change log wants to delete this table… i had to create manually.

DROP TABLE IF EXISTS sys_sequence;
CREATE TABLE sys_sequence (
NAME varchar(100) CHARACTER SET utf8mb4 COLLATE utf8mb4_0900_ai_ci NOT NULL,
INCREMENT int NULL DEFAULT 1,
CURR_VALUE bigint NULL DEFAULT 0,
PRIMARY KEY (NAME) USING BTREE
) ENGINE = InnoDB CHARACTER SET = utf8mb4 COLLATE = utf8mb4_0900_ai_ci ROW_FORMAT = DYNAMIC;


– Records of sys_sequence


INSERT INTO sys_sequence VALUES (‘seq_test’, 1, 179);
INSERT INTO sys_sequence VALUES (‘seq_test_batch’, 1, 4);
INSERT INTO sys_sequence VALUES (‘seq_test_suite’, 1, 3);

SET FOREIGN_KEY_CHECKS = 1;

Your application.properties file should contain this property after migration:

main.datasource.studio.liquibase.exclude-prefixes=audit_,email_,sec_,sys_,ui_

Then Studio will not try to handle tables with sys_ and other listed prefixes.

I was not migrating from cuba. Thats the funny part.

I cannot reproduce that.
This is true that on MySQL the framework creates the sys_sequence table when you call Sequences.createNextValue(). But in my test project Studio doesn’t generate changelogs to remove it.

Could you attach the changelog? Is it generated on the app start?

    <?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-4.5.xsd"
        objectQuotingStrategy="QUOTE_ONLY_RESERVED_WORDS">
    <changeSet id="1" author="apt" dbms="mysql">
        <addColumn tableName="APT_PROFESSIONAL_WORKER">
            <column defaultValueDate="1000-01-01T00:00:00" name="DELETED_DATE_NN" type="datetime">
                <constraints nullable="false"/>
            </column>
        </addColumn>

        <createIndex indexName="IDX_UC_APTPROFESSIONALWORKER_CODE" tableName="APT_PROFESSIONAL_WORKER" unique="true">
            <column name="CODE"/>
            <column name="DELETED_DATE_NN"/>
        </createIndex>

        <sql endDelimiter=";\ndelimiter $$">create trigger APT_PROFESSIONAL_WORKER_DELETED_DATE_NN_UPDATE_TRIGGER
            before update
            on APT_PROFESSIONAL_WORKER
            for each row
        begin
            if not (NEW.DELETED_DATE &lt;=&gt; OLD.DELETED_DATE) then
                set NEW.DELETED_DATE_NN = if(NEW.DELETED_DATE is null, '1000-01-01 00:00:00.000', NEW.DELETED_DATE);
            end if;
        end;</sql>

        <rollback>
            <sql>ALTER TABLE APT_PROFESSIONAL_WORKER DROP COLUMN DELETED_DATE_NN</sql>
            <sql>DROP INDEX IDX_UC_APTPROFESSIONALWORKER_CODE on APT_PROFESSIONAL_WORKER</sql>
            <sql>DROP TRIGGER APT_PROFESSIONAL_WORKER_DELETED_DATE_NN_UPDATE_TRIGGER</sql>
        </rollback>
    </changeSet>
    <changeSet id="2" author="apt">
        <dropTable cascadeConstraints="true" tableName="sys_sequence"/>
    </changeSet>
    <changeSet id="3" author="apt">
        <dropForeignKeyConstraint baseTableName="APT_BUSINESS_PROCESS_STEP"
                                  constraintName="FK_APTBUSINESS_ON_BUSINESSPRO"/>
    </changeSet>
    <changeSet id="4" author="apt">
        <addForeignKeyConstraint baseColumnNames="BUSINESS_PROCESS_DEFINITION_ID"
                                 baseTableName="APT_BUSINESS_PROCESS_STEP"
                                 constraintName="FK_APTBUSINESS_ON_BUSINESSPRO" referencedColumnNames="ID"
                                 referencedTableName="APT_BUSINESS_PROCESS_DEFINITIO"/>
    </changeSet>
    <changeSet id="5" author="apt">
        <dropForeignKeyConstraint baseTableName="APT_TEST_CASE_CONDITION"
                                  constraintName="FK_APTTESTCASE_ON_CONDITIONIT"/>

        <dropIndex indexName="IDX_TESTCASECONDITION" tableName="APT_TEST_CASE_CONDITION"/>
    </changeSet>
    <changeSet id="6" author="apt">
        <createIndex indexName="IDX_TESTCASECONDITION" tableName="APT_TEST_CASE_CONDITION" unique="false">
            <column name="CONDITION_ITEM_ID"/>
        </createIndex>

        <addForeignKeyConstraint baseColumnNames="CONDITION_ITEM_ID" baseTableName="APT_TEST_CASE_CONDITION"
                                 constraintName="FK_APTTESTCASE_ON_CONDITIONIT" referencedColumnNames="ID"
                                 referencedTableName="APT_CONDITION_ITEM"/>
    </changeSet>
</databaseChangeLog>

I have all this in the ignore changelog… otherwise app will crash…
this one keeps popping up even if ignore it… i run it… and nothing seems to happen

<rollback>
<sql>ALTER TABLE APT_PROFESSIONAL_WORKER DROP COLUMN DELETED_DATE_NN</sql>
<sql>DROP INDEX IDX_UC_APTPROFESSIONALWORKER_CODE on APT_PROFESSIONAL_WORKER</sql>
<sql>DROP TRIGGER APT_PROFESSIONAL_WORKER_DELETED_DATE_NN_UPDATE_TRIGGER</sql>

Hi,
Unfortunately, your problem could not be reproduced. Jmix plugin handles sys_sequences table correctly

I have to put ignore on the sys_sequence… liquibase always wants to delete things that do no exist in the database. Are you testing in MYSQL? This liquibase has been an issue since Jmix 0.1

image