Package org.pgcodekeeper.core.api
Class PgCodeKeeperApi
java.lang.Object
org.pgcodekeeper.core.api.PgCodeKeeperApi
Main API class for pgCodeKeeper database operations.
-
Method Summary
Modifier and TypeMethodDescriptionstatic Stringdiff(ISettings settings, TreeElement root, AbstractDatabase oldDb, AbstractDatabase newDb, List<Map.Entry<PgStatement, PgStatement>> additionalDependenciesOldDb, List<Map.Entry<PgStatement, PgStatement>> additionalDependenciesNewDb, Collection<String> ignoreLists) Compares two databases and generates a migration script with filtering and additional dependencies.static Stringdiff(ISettings settings, AbstractDatabase oldDb, AbstractDatabase newDb) Compares two databases and generates a migration script.static Stringdiff(ISettings settings, AbstractDatabase oldDb, AbstractDatabase newDb, Collection<String> ignoreLists) Compares two databases and generates a migration script with filtering.static Stringdiff(ISettings settings, AbstractDatabase oldDb, AbstractDatabase newDb, List<Map.Entry<PgStatement, PgStatement>> additionalDependenciesOldDb, List<Map.Entry<PgStatement, PgStatement>> additionalDependenciesNewDb, Collection<String> ignoreLists) Compares two databases and generates a migration script with filtering and additional dependencies.static voidexport(ISettings settings, AbstractDatabase dbToExport, String exportTo) Exports database schema to project files.static voidexport(ISettings settings, AbstractDatabase dbToExport, String exportTo, Collection<String> ignoreLists, IMonitor monitor) Exports database schema to project files with filtering and progress tracking.static voidupdate(ISettings settings, AbstractDatabase oldDb, AbstractDatabase newDb, String projectToUpdate) Updates project with changes from database.static voidupdate(ISettings settings, AbstractDatabase oldDb, AbstractDatabase newDb, String projectToUpdate, Collection<String> ignoreLists, IMonitor monitor) Updates project with changes from database with filtering and progress tracking.
-
Method Details
-
diff
public static String diff(ISettings settings, AbstractDatabase oldDb, AbstractDatabase newDb) throws IOException, InterruptedException Compares two databases and generates a migration script.- Parameters:
settings- ISettings objectoldDb- the old database version to compare fromnewDb- the new database version to compare to- Returns:
- the generated migration script as a string
- Throws:
IOException- if I/O operations failInterruptedException- if the thread is interrupted during the operation
-
diff
public static String diff(ISettings settings, AbstractDatabase oldDb, AbstractDatabase newDb, Collection<String> ignoreLists) throws IOException, InterruptedException Compares two databases and generates a migration script with filtering.- Parameters:
settings- ISettings objectoldDb- the old database version to compare fromnewDb- the new database version to compare toignoreLists- collection of paths to files containing objects to ignore- Returns:
- the generated migration script as a string
- Throws:
IOException- if I/O operations fail or ignore list file cannot be readInterruptedException- if the thread is interrupted during the operation
-
diff
public static String diff(ISettings settings, AbstractDatabase oldDb, AbstractDatabase newDb, List<Map.Entry<PgStatement, PgStatement>> additionalDependenciesOldDb, List<Map.Entry<PgStatement, throws IOException, InterruptedExceptionPgStatement>> additionalDependenciesNewDb, Collection<String> ignoreLists) Compares two databases and generates a migration script with filtering and additional dependencies.- Parameters:
settings- ISettings objectoldDb- the old database version to compare fromnewDb- the new database version to compare toadditionalDependenciesOldDb- additional dependencies in old databaseadditionalDependenciesNewDb- additional dependencies in new databaseignoreLists- collection of paths to files containing objects to ignore- Returns:
- the generated migration script as a string
- Throws:
IOException- if I/O operations fail or ignore list file cannot be readInterruptedException- if the thread is interrupted during the operation
-
diff
public static String diff(ISettings settings, TreeElement root, AbstractDatabase oldDb, AbstractDatabase newDb, List<Map.Entry<PgStatement, PgStatement>> additionalDependenciesOldDb, List<Map.Entry<PgStatement, throws IOExceptionPgStatement>> additionalDependenciesNewDb, Collection<String> ignoreLists) Compares two databases and generates a migration script with filtering and additional dependencies.- Parameters:
settings- ISettings objectroot- root element of treeoldDb- the old database version to compare fromnewDb- the new database version to compare toadditionalDependenciesOldDb- additional dependencies in old databaseadditionalDependenciesNewDb- additional dependencies in new databaseignoreLists- collection of paths to files containing objects to ignore- Returns:
- the generated migration script as a string
- Throws:
IOException- if I/O operations fail or ignore list file cannot be read
-
export
public static void export(ISettings settings, AbstractDatabase dbToExport, String exportTo) throws PgCodekeeperException, IOException, InterruptedException Exports database schema to project files.- Parameters:
settings- ISettings objectdbToExport- the database to exportexportTo- path to the target project directory- Throws:
IOException- if I/O operations fail, if export directory does not exist, if export directory is not empty or if path is a fileInterruptedException- if the thread is interrupted during the operationPgCodekeeperException
-
export
public static void export(ISettings settings, AbstractDatabase dbToExport, String exportTo, Collection<String> ignoreLists, IMonitor monitor) throws IOException, InterruptedException Exports database schema to project files with filtering and progress tracking.- Parameters:
settings- ISettings objectdbToExport- the database to exportexportTo- path to the target project directoryignoreLists- collection of paths to files containing objects to ignoremonitor- progress monitor for tracking the operation- Throws:
IOException- if I/O operations fail, if export directory does not exist, if export directory is not empty, if path is a file, or if ignore list file cannot be readInterruptedException- if the thread is interrupted during the operation
-
update
public static void update(ISettings settings, AbstractDatabase oldDb, AbstractDatabase newDb, String projectToUpdate) throws PgCodekeeperException, IOException, InterruptedException Updates project with changes from database.- Parameters:
settings- ISettings objectoldDb- the old database versionnewDb- the new database version with changesprojectToUpdate- path to the project directory to update- Throws:
PgCodekeeperException- if update operation fails or if parsing errors occurIOException- if I/O operations fail, if project directory does not exist or if path is a fileInterruptedException- if the thread is interrupted during the operation
-
update
public static void update(ISettings settings, AbstractDatabase oldDb, AbstractDatabase newDb, String projectToUpdate, Collection<String> ignoreLists, IMonitor monitor) throws PgCodekeeperException, IOException, InterruptedException Updates project with changes from database with filtering and progress tracking.- Parameters:
settings- ISettings objectoldDb- the old database versionnewDb- the new database version with changesprojectToUpdate- path to the project directory to updateignoreLists- collection of paths to files containing objects to ignoremonitor- progress monitor for tracking the operation- Throws:
PgCodekeeperException- if update operation fails or if parsing errors occurIOException- if I/O operations fail, if project directory does not exist, if path is a file, or if ignore list files cannot be readInterruptedException- if the thread is interrupted during the operation
-