diff --git a/applied-migration.go b/applied-migration.go index bd5c954..41cb503 100644 --- a/applied-migration.go +++ b/applied-migration.go @@ -25,7 +25,6 @@ type AppliedMigration struct { // GetAppliedMigrations retrieves all already-applied migrations in a map keyed // by the migration IDs -// func (m Migrator) GetAppliedMigrations(db Queryer) (applied map[string]*AppliedMigration, err error) { applied = make(map[string]*AppliedMigration) diff --git a/doc.go b/doc.go index 83c590c..a3e6056 100644 --- a/doc.go +++ b/doc.go @@ -7,5 +7,4 @@ // to its .Apply() method. // // See the package's README.md file for more usage instructions. -// package schema diff --git a/embed_go116.go b/embed_go116.go index 4f12df8..a2bcb17 100644 --- a/embed_go116.go +++ b/embed_go116.go @@ -14,8 +14,7 @@ import ( // // Example usage: // -// FSMigrations(embeddedFS, "my-migrations/*.sql") -// +// FSMigrations(embeddedFS, "my-migrations/*.sql") func FSMigrations(filesystem fs.FS, glob string) (migrations []*Migration, err error) { migrations = make([]*Migration, 0) diff --git a/file.go b/file.go index a305b95..7b6dc53 100644 --- a/file.go +++ b/file.go @@ -11,7 +11,6 @@ import ( // MigrationIDFromFilename removes directory paths and extensions // from the filename to make a friendlier Migration ID -// func MigrationIDFromFilename(filename string) string { return strings.TrimSuffix(filepath.Base(filename), filepath.Ext(filename)) } diff --git a/main_test.go b/main_test.go index b94bdc5..781d3d7 100644 --- a/main_test.go +++ b/main_test.go @@ -17,7 +17,6 @@ import ( // Docker running on the local machine and launches testing database // containers to which we then connect and store the connection in a package // global variable -// func TestMain(m *testing.M) { pool, err := dockertest.NewPool("") if err != nil { diff --git a/migrator_test.go b/migrator_test.go index 276cde5..54ea4ea 100644 --- a/migrator_test.go +++ b/migrator_test.go @@ -58,7 +58,6 @@ func TestLockAndUnlock(t *testing.T) { // lexical order rather than the order they were provided in the slice. This is // also the primary test to assert that the data in the tracking table is // all correct. -// func TestApplyInLexicalOrder(t *testing.T) { withEachTestDB(t, func(t *testing.T, tdb *TestDB) { @@ -117,7 +116,6 @@ func TestApplyInLexicalOrder(t *testing.T) { // TestFailedMigration ensures that a migration with a syntax error triggers // an expected error when Apply() is run. This test is run on every dialect // and every test database instance -// func TestFailedMigration(t *testing.T) { withEachTestDB(t, func(t *testing.T, tdb *TestDB) { @@ -154,7 +152,6 @@ func TestFailedMigration(t *testing.T) { // connections to each test database and attempts to call .Apply() on them all // concurrently. The migrations include an INSERT statement, which allows us // to count to ensure that each unique migration was only run once. -// func TestSimultaneousApply(t *testing.T) { concurrency := 4 dataTable := fmt.Sprintf("data%d", rand.Int()) // #nosec we don't need cryptographic security here @@ -278,7 +275,6 @@ func TestMultiSchemaSupport(t *testing.T) { // TestRunFailure ensures that a low-level connection or query-related failure // triggers an expected error. -// func TestRunFailure(t *testing.T) { bq := BadQueryer{} m := makeTestMigrator() diff --git a/mysql.go b/mysql.go index a56ef62..0aeac56 100644 --- a/mysql.go +++ b/mysql.go @@ -64,7 +64,6 @@ func (m mysqlDialect) InsertAppliedMigration(ctx context.Context, tx Queryer, ta } // GetAppliedMigrations retrieves all data from the migrations tracking table -// func (m mysqlDialect) GetAppliedMigrations(ctx context.Context, tx Queryer, tableName string) (migrations []*AppliedMigration, err error) { migrations = make([]*AppliedMigration, 0) @@ -96,7 +95,6 @@ func (m mysqlDialect) GetAppliedMigrations(ctx context.Context, tx Queryer, tabl // QuotedTableName returns the string value of the name of the migration // tracking table after it has been quoted for MySQL -// func (m mysqlDialect) QuotedTableName(schemaName, tableName string) string { if schemaName == "" { return m.quotedIdent(tableName) diff --git a/options.go b/options.go index 3f96afe..33b1e55 100644 --- a/options.go +++ b/options.go @@ -9,7 +9,6 @@ type Option func(m Migrator) Migrator // WithDialect builds an Option which will set the supplied // dialect on a Migrator. Usage: NewMigrator(WithDialect(MySQL)) -// func WithDialect(dialect Dialect) Option { return func(m Migrator) Migrator { m.Dialect = dialect @@ -23,7 +22,6 @@ func WithDialect(dialect Dialect) Option { // qualifier (for example, WithTableName("public", "schema_migrations") would // assign the table named "schema_migrations" in the the default "public" // schema for Postgres) -// func WithTableName(names ...string) Option { return func(m Migrator) Migrator { switch len(names) { @@ -57,7 +55,6 @@ type Logger interface { // WithLogger builds an Option which will set the supplied Logger // on a Migrator. Usage: NewMigrator(WithLogger(logrus.New())) -// func WithLogger(logger Logger) Option { return func(m Migrator) Migrator { m.Logger = logger diff --git a/postgres.go b/postgres.go index dce6c03..74bedae 100644 --- a/postgres.go +++ b/postgres.go @@ -67,7 +67,6 @@ func (p postgresDialect) InsertAppliedMigration(ctx context.Context, tx Queryer, } // GetAppliedMigrations retrieves all data from the migrations tracking table -// func (p postgresDialect) GetAppliedMigrations(ctx context.Context, tx Queryer, tableName string) (migrations []*AppliedMigration, err error) { migrations = make([]*AppliedMigration, 0) @@ -97,7 +96,6 @@ func (p postgresDialect) GetAppliedMigrations(ctx context.Context, tx Queryer, t // QuotedTableName returns the string value of the name of the migration // tracking table after it has been quoted for Postgres -// func (p postgresDialect) QuotedTableName(schemaName, tableName string) string { if schemaName == "" { return p.QuotedIdent(tableName) diff --git a/schema.go b/schema.go index e9af847..68da699 100644 --- a/schema.go +++ b/schema.go @@ -34,7 +34,6 @@ type Queryer interface { } // Transactor defines the interface for the Begin method from the *sql.DB -// type Transactor interface { BeginTx(ctx context.Context, opts *sql.TxOptions) (*sql.Tx, error) } diff --git a/sqlite.go b/sqlite.go index 38124f7..658251c 100644 --- a/sqlite.go +++ b/sqlite.go @@ -44,7 +44,6 @@ func (s *sqliteDialect) InsertAppliedMigration(ctx context.Context, tx Queryer, } // GetAppliedMigrations retrieves all data from the migrations tracking table -// func (s sqliteDialect) GetAppliedMigrations(ctx context.Context, tx Queryer, tableName string) (migrations []*AppliedMigration, err error) { migrations = make([]*AppliedMigration, 0) diff --git a/testdb_test.go b/testdb_test.go index 6026c26..1605a09 100644 --- a/testdb_test.go +++ b/testdb_test.go @@ -15,7 +15,6 @@ import ( // TestDB represents a specific database instance against which we would like // to run database migration tests. -// type TestDB struct { Dialect Dialect Driver string @@ -55,7 +54,6 @@ func (c *TestDB) DatabaseName() string { // Port asks Docker for the host-side port we can use to connect to the // relevant container's database port. -// func (c *TestDB) Port() string { switch c.Driver { case MySQLDriverName: @@ -78,7 +76,6 @@ func (c *TestDB) IsSQLite() bool { // DockerEnvars computes the environment variables that are needed for a // docker instance. -// func (c *TestDB) DockerEnvars() []string { switch c.Driver { case PostgresDriverName: @@ -156,7 +153,6 @@ func (c *TestDB) DSN() string { // instances, this function triggers the `docker run` call. For SQLite-based // test instances, this creates the data file. In all cases, we verify that // the database is connectable via a test connection. -// func (c *TestDB) Init(pool *dockertest.Pool) { var err error @@ -208,7 +204,6 @@ func (c *TestDB) Init(pool *dockertest.Pool) { // Connect creates an additional *database/sql.DB connection for a particular // test database. -// func (c *TestDB) Connect(t *testing.T) *sql.DB { db, err := sql.Open(c.Driver, c.DSN()) if err != nil { @@ -220,7 +215,6 @@ func (c *TestDB) Connect(t *testing.T) *sql.DB { // Cleanup should be called after all tests with a database instance are // complete. For dockertest-based tests, it deletes the docker containers. // For SQLite tests, it deletes the database file from the temp directory. -// func (c *TestDB) Cleanup(pool *dockertest.Pool) { var err error