-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Fix failing tests, improve the comments
- Loading branch information
1 parent
2acf967
commit 3296fab
Showing
7 changed files
with
103 additions
and
90 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,44 +1,42 @@ | ||
package rove | ||
|
||
// Migration represents a database specific migration. | ||
type Migration interface { | ||
// CreateChangelogTable returns an error if there is a problem with the | ||
// query. If it already exists, it should return nil. | ||
CreateChangelogTable() error | ||
// ChangesetApplied should return an error if there is a problem with the | ||
// query. If there are no rows, that error can be returned and it will | ||
// be ignored. | ||
// Changelog represents a list of operations that can be run on a changelog. | ||
type Changelog interface { | ||
// Initialize should perform any work to set up the changelog or return an | ||
// error. | ||
Initialize() error | ||
// ChangesetApplied should return the checksum from the changelog of a | ||
// matching changeset, an error, or a blank string if the changeset doesn't | ||
// exist in the changelog. | ||
ChangesetApplied(id string, author string, filename string) (checksum string, err error) | ||
// BeginTx starts a transaction. | ||
// BeginTx should start a transaction on the changelog. | ||
BeginTx() (Transaction, error) | ||
// Count returns the number of changesets in the database and returns an | ||
// error if there is a problem with the query. | ||
// Count should return the number of changesets in the changelog or return | ||
// an error. | ||
Count() (count int, err error) | ||
// Insert will insert a new record into the database. | ||
// Insert should add a new changeset to the changelog or return an error. | ||
Insert(id, author, filename string, count int, checksum, description, version string) error | ||
// Returns a list of the changesets or it returns an error if there is an | ||
// problem running the query. | ||
Changesets(reverse bool) ([]Change, error) | ||
// Delete the changeset from the database or return an error if there is a | ||
// problem running the query. | ||
// Changesets should return a list of the changesets or return an error. | ||
Changesets(reverse bool) ([]Changeset, error) | ||
// Delete should remove the changeset from the changelog or return an error. | ||
Delete(id, author, filename string) error | ||
} | ||
|
||
// Change contains a single database record change. | ||
type Change struct { | ||
// Changeset is a single changeset. | ||
type Changeset struct { | ||
ID string | ||
Author string | ||
Filename string | ||
OrderExecuted int | ||
} | ||
|
||
// Transaction represents a database transaction. | ||
// Transaction represents a changelog transaction. | ||
type Transaction interface { | ||
// Commit will attempt to commit the changes to the database or return | ||
// an error. | ||
// Commit should attempt to commit the changes to to the changelog or | ||
// return an error. | ||
Commit() error | ||
// Rollback rollback changes to the database after a filed commit. | ||
// Rollback should undo changes to the changelog after a failed commit. | ||
Rollback() error | ||
// Exec runs a query on the database. | ||
// Exec should prepare to make a change to the changelog. | ||
Exec(query string, args ...interface{}) error | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.