-
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.
- Loading branch information
1 parent
b9e3b0a
commit 7d7cbf5
Showing
7 changed files
with
301 additions
and
47 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,37 +1 @@ | ||
Changelog for Test-DB | ||
|
||
0.06 2020-08-13T12:06:42 | ||
- Add release updates | ||
- Include TESTDB_TEMPLATE in driver descriptions (#21) | ||
- Include example for MSSQL, and POD taglines for all (#20) | ||
|
||
0.05 2020-08-12T21:54:22 | ||
- Built release version 0.05 | ||
- Add release updates | ||
- Implement support for MSSQL (#16) | ||
- Update .gitattributes | ||
|
||
0.04 2020-08-10T03:49:17 | ||
- Built release version 0.04 | ||
- Add release updates | ||
- Cleanup and re-launch | ||
|
||
0.03 2020-04-09T20:02:31 | ||
- Built release version 0.03 | ||
- Added release updates | ||
- Fix META data | ||
- Allow clone for SQLite and Postgres | ||
- Add examples | ||
- Add META data | ||
- Enable auto-commit which allows DDL statements | ||
|
||
0.02 2020-04-05T00:47:11 | ||
- Built release version 0.02 | ||
- Added release updates | ||
- Update documentation | ||
|
||
0.01 2020-04-05T00:17:37 | ||
- Built release version 0.01 | ||
- Added release updates | ||
- Initial implementation | ||
- Initial commit |
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
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 |
---|---|---|
|
@@ -22,7 +22,104 @@ DESCRIPTION | |
temporary databases for testing purposes. This framework requires a | ||
user (optionally with password) which has the ability to create new | ||
databases and works by creating test-specific databases owned by the | ||
user specified. | ||
user specified. Note: Test databases are not automatically destroyed | ||
and should be cleaned up manually by call the destroy method on the | ||
database-specific test database object. | ||
|
||
process | ||
|
||
on create, clone | ||
|
||
#1 | ||
|
||
Establish a connection to the DB using some "initial" database. | ||
|
||
my $tdbo = $tdb->postgres(initial => 'template0'); | ||
|
||
#2 | ||
|
||
Using the established connection, create the test/temporary database. | ||
|
||
$tdbo->create; | ||
|
||
#3 | ||
|
||
Establish a connection to the newly created test/temporary database. | ||
|
||
$tdbo->create->dbh; | ||
|
||
#4 | ||
|
||
Make the test database object immutable. | ||
|
||
$tdbo->create->database('example'); # error | ||
|
||
on destroy | ||
|
||
#1 | ||
|
||
Establish a connection to the DB using the "initial" database. | ||
|
||
# using the created test/temporary database object | ||
|
||
#2 | ||
|
||
Using the established connection, drop the test/temporary database. | ||
|
||
$tdbo->destroy; | ||
|
||
usages | ||
|
||
using DBI | ||
|
||
#1 | ||
|
||
my $tdb = Test::DB->new; | ||
my $dbh = $tdb->sqlite(%options)->dbh; | ||
|
||
using DBIx::Class | ||
|
||
#1 | ||
|
||
my $tdb = Test::DB->new; | ||
my $tdbo = $tdb->postgres(%options)->create; | ||
my $schema = DBIx::Class::Schema->connect( | ||
dsn => $tdbo->dsn, | ||
username => $tdbo->username, | ||
password => $tdbo->password, | ||
); | ||
|
||
using Mojo::mysql | ||
|
||
#1 | ||
|
||
my $tdb = Test::DB->new; | ||
my $tdbo = $tdb->mysql(%options)->create; | ||
my $mysql = Mojo::mysql->new($tdbo->uri); | ||
|
||
using Mojo::Pg | ||
|
||
#1 | ||
|
||
my $tdb = Test::DB->new; | ||
my $tdbo = $tdb->postgres(%options)->create; | ||
my $postgres = Mojo::Pg->new($tdbo->uri); | ||
|
||
using Mojo::Pg (with cloning) | ||
|
||
#1 | ||
|
||
my $tdb = Test::DB->new; | ||
my $tdbo = $tdb->postgres(%options)->clone('template0'); | ||
my $postgres = Mojo::Pg->new($tdbo->uri); | ||
|
||
using Mojo::SQLite | ||
|
||
#1 | ||
|
||
my $tdb = Test::DB->new; | ||
my $tdbo = $tdb->sqlite(%options)->create; | ||
my $sqlite = Mojo::SQLite->new($tdbo->uri); | ||
|
||
LIBRARIES | ||
|
||
|
@@ -105,6 +202,54 @@ METHODS | |
|
||
$tdb->create(database => 'sqlite'); | ||
|
||
mssql | ||
|
||
mssql(Str %options) : Maybe[InstanceOf["Test::DB::Object"]] | ||
|
||
The mssql method builds and returns a Test::DB::Mssql object. | ||
|
||
mssql example #1 | ||
|
||
# given: synopsis | ||
|
||
$tdb->mssql; | ||
|
||
mysql | ||
|
||
mysql(Str %options) : Maybe[InstanceOf["Test::DB::Object"]] | ||
|
||
The mysql method builds and returns a Test::DB::Mysql object. | ||
|
||
mysql example #1 | ||
|
||
# given: synopsis | ||
|
||
$tdb->mysql; | ||
|
||
postgres | ||
|
||
postgres(Str %options) : Maybe[InstanceOf["Test::DB::Object"]] | ||
|
||
The postgres method builds and returns a Test::DB::Postgres object. | ||
|
||
postgres example #1 | ||
|
||
# given: synopsis | ||
|
||
$tdb->postgres; | ||
|
||
sqlite | ||
|
||
sqlite(Str %options) : Maybe[InstanceOf["Test::DB::Object"]] | ||
|
||
The sqlite method builds and returns a Test::DB::Sqlite object. | ||
|
||
sqlite example #1 | ||
|
||
# given: synopsis | ||
|
||
$tdb->sqlite; | ||
|
||
AUTHOR | ||
|
||
Al Newkirk, [email protected] | ||
|
Oops, something went wrong.