|
DataBridge Documentation 2.0.18
A Java library for managing database connections and transactions
|
Public Member Functions | |
| int | compareTo (Object other) |
| String | getChecksum () |
| String | getChecksumUp () |
| String | getDescription () |
| String | getDownScript () |
| String | getFile () |
| String | getScript () |
| String | getUpScript () |
| int | getVersion () |
| boolean | isValid () |
| Migration (int version, String description) | |
| Migration (String path) | |
| Migration (String path, int version, String description, String upScript, String downScript) | |
| String | toShortString () |
| String | toString () |
Static Public Member Functions | |
| static String | generateChecksum (String script) throws IOException, NoSuchAlgorithmException |
| static void | templateMigration () throws IOException |
The Migration class represents a database migration script, which includes versioning, descriptions, and the SQL scripts required for upgrading and downgrading a database schema.
A migration consists of an "up" script, which applies changes to the database, and a "down" script, which reverts those changes. Migrations are identified by a version number and a description.
The Migration class provides methods for reading migration files, validating migration data, generating checksums, and comparing migrations by version.
| io.github.kdesp73.databridge.migration.Migration.Migration | ( | String | path | ) |
Constructs a Migration object by reading the migration script from the specified path.
| path | The path to the migration script file. |
| io.github.kdesp73.databridge.migration.Migration.Migration | ( | int | version, |
| String | description ) |
Constructs a Migration object with the specified version and description.
| version | The version of the migration. |
| description | A description of the migration. |
| io.github.kdesp73.databridge.migration.Migration.Migration | ( | String | path, |
| int | version, | ||
| String | description, | ||
| String | upScript, | ||
| String | downScript ) |
Constructs a Migration object with the specified path, version, description, up script, and down script.
| path | The path to the migration script file. |
| version | The version of the migration. |
| description | A description of the migration. |
| upScript | The SQL script for applying the migration. |
| downScript | The SQL script for reverting the migration. |
| boolean io.github.kdesp73.databridge.migration.Migration.isValid | ( | ) |
Validates the migration by ensuring it has a valid version and an "up" script.
| String io.github.kdesp73.databridge.migration.Migration.toString | ( | ) |
| String io.github.kdesp73.databridge.migration.Migration.getFile | ( | ) |
Returns the file path of the migration script.
| String io.github.kdesp73.databridge.migration.Migration.getScript | ( | ) |
Returns the full migration script, including version, description, up and down scripts.
| String io.github.kdesp73.databridge.migration.Migration.getUpScript | ( | ) |
Returns the "up" script of the migration.
| String io.github.kdesp73.databridge.migration.Migration.getDownScript | ( | ) |
Returns the "down" script of the migration.
| int io.github.kdesp73.databridge.migration.Migration.getVersion | ( | ) |
Returns the version of the migration.
| String io.github.kdesp73.databridge.migration.Migration.getDescription | ( | ) |
Returns the description of the migration.
| String io.github.kdesp73.databridge.migration.Migration.getChecksum | ( | ) |
Returns the checksum of the entire migration script.
| String io.github.kdesp73.databridge.migration.Migration.getChecksumUp | ( | ) |
Returns the checksum of the "up" script.
|
static |
Generates the checksum of the provided script using MD5 hashing.
| script | The script to generate the checksum for. |
| IOException | If an I/O error occurs while processing the script. |
| NoSuchAlgorithmException | If the MD5 algorithm is unavailable. |
| int io.github.kdesp73.databridge.migration.Migration.compareTo | ( | Object | other | ) |
Compares this migration to another based on their version numbers.
| other | The other migration to compare to. |
| String io.github.kdesp73.databridge.migration.Migration.toShortString | ( | ) |
Returns a string representing the path and version of this migration.
|
static |
Generates a template migration file in the current working directory
| IOException |