Class AbstractModelExporter

java.lang.Object
org.pgcodekeeper.core.database.base.project.AbstractModelExporter
All Implemented Interfaces:
IModelExporter
Direct Known Subclasses:
AbstractOverridesModelExporter, ChModelExporter, MsModelExporter, PgModelExporter

public abstract class AbstractModelExporter extends Object implements IModelExporter
Abstract base class for database model exporters that provides common export functionality for different database types (PostgreSQL, MS SQL, ClickHouse).

Subclasses must implement database-specific methods for directory structure and file paths.

  • Field Details

  • Method Details

    • exportFull

      public void exportFull() throws IOException
      Description copied from interface: IModelExporter
      Exports the complete database schema to directory structure. Creates output directory and exports all database objects as SQL files.
      Specified by:
      exportFull in interface IModelExporter
      Throws:
      IOException - if export operation fails
    • exportPartial

      public void exportPartial() throws IOException, PgCodeKeeperException
      Description copied from interface: IModelExporter
      Exports only changed objects based on comparison between old and new schemas. Handles object additions, deletions, and modifications.
      Specified by:
      exportPartial in interface IModelExporter
      Throws:
      IOException - if export operation fails
      PgCodeKeeperException - if old database is null or directory issues occur
    • exportProject

      public void exportProject() throws IOException
      Description copied from interface: IModelExporter
      Exports selected objects as a new project structure. Creates clean directory structure with only specified objects.
      Specified by:
      exportProject in interface IModelExporter
      Throws:
      IOException - if export operation fails
    • getDumpSql

      public String getDumpSql(IStatement statement)
    • getExportedFilenameSql

      public static String getExportedFilenameSql(String name)
      Gets the SQL filename with .sql extension.
      Parameters:
      name - the base name
      Returns:
      filename with .sql extension
    • writeProjVersion

      public static void writeProjVersion(Path path) throws IOException
      Writes project version marker file.
      Parameters:
      path - the path to write version file
      Throws:
      IOException - if writing fails