Class SchemaJournalManager

    • Method Detail

      • publishUpdate

         final Unit publishUpdate(String table, Boolean enable, Long commitId)

        Apply trace table and its Update Trigger based on DDL templates. Trace table, if it exists and has no data, recreate it. Trace table, if it exists and has data, ignore if the structure is the same, otherwise throw an error. Trigger, if trigger exists, delete and recreate it. If neither trace table nor trigger exists, create new one.

        Parameters:
        table - plain table
        enable - enable or disable
        commitId - commit id of Journal
      • publishDelete

         final Unit publishDelete(String table, Boolean enable, Long commitId)

        Apply trace table and its Delete Trigger based on DDL templates. Trace table, if it exists and has no data, recreate it. Trace table, if it exists and has data, ignore if the structure is the same, otherwise throw an error. Trigger, if trigger exists, delete and recreate it. If neither trace table nor trigger exists, create new one.

        Parameters:
        table - plain table
        enable - enable or disable
        commitId - commit id of Journal
      • publishInsert

         final Unit publishInsert(String table, Boolean enable, Long commitId)

        Apply trace table and its Insert Trigger based on DDL templates. Trace table, if it exists and has no data, recreate it. Trace table, if it exists and has data, ignore if the structure is the same, otherwise throw an error. Trigger, if trigger exists, delete and recreate it. If neither trace table nor trigger exists, create new one.

        Parameters:
        table - plain table
        enable - enable or disable
        commitId - commit id of Journal
      • manageTriggers

         final Unit manageTriggers(String table, Boolean drop)

        Check all triggers, and can ask whether to delete.

        Parameters:
        table - plain table
        drop - Whether to ask for drop, default false
      • checkAndInitDdl

         final Unit checkAndInitDdl(String table, Long commitId)

        Compare the SQL between in local and in database. If it does not exist, then save local to database. If it exists but the contents are not the same and has been APPLY then log error, otherwise update it.

        Parameters:
        table - plain table
        commitId - commit id of Journal