Class WorkDirs

java.lang.Object
org.pgcodekeeper.core.WorkDirs

public final class WorkDirs extends Object
Provides directory structure definitions and path resolution utilities for different database types (PostgreSQL, Microsoft SQL, ClickHouse). Manages the organization of database objects in filesystem directories.
  • Field Details

  • Method Details

    • getDirectoryNames

      public static List<String> getDirectoryNames(DatabaseType databaseType)
      Gets the list of top-level directory names for the specified database type
      Parameters:
      databaseType - the database type (PG, MS, or CH)
      Returns:
      list of directory names
    • getDirectoryNameForType

      public static String getDirectoryNameForType(DatabaseType databaseType, DbObjType type)
      Gets the directory name for a specific database object type
      Parameters:
      databaseType - the database type
      type - the database object type
      Returns:
      directory name for the object type, or null if the object type doesn't have a dedicated directory
      Throws:
      IllegalStateException - if the object type is not supported
    • getRelativeFolderPath

      public static Path getRelativeFolderPath(PgStatement st, Path baseDir)
      Gets the relative filesystem path for a database statement
      Parameters:
      st - the database statement
      baseDir - the base directory path
      Returns:
      relative path where the statement should be stored
      Throws:
      IllegalStateException - if the object type is not supported
    • isInMsSchema

      public static boolean isInMsSchema(String dirSub)
      Checks if a Microsoft SQL Server subdirectory belongs to a schema
      Parameters:
      dirSub - the subdirectory name
      Returns:
      true if the directory is schema-related, false otherwise
    • getDirLoadOrder

      public static Set<DbObjType> getDirLoadOrder()
      Gets the loading order for PostgreSQL object types
      Returns:
      set of database object types in loading order