Skip to content

Commit 71425d5

Browse files
author
Sergey Podgornyy
committed
Fix typos
1 parent 31424ad commit 71425d5

File tree

8 files changed

+65
-63
lines changed

8 files changed

+65
-63
lines changed

README.md

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
# MySQL database migrator
22

3-
<img align="right" width="159px" src="./logo.png">
3+
<img align="right" width="159px" src="https://github.com/larapulse/migrator/blob/master/logo.png">
44

55
[![Build Status](https://travis-ci.org/larapulse/migrator.svg)](https://travis-ci.org/larapulse/migrator)
66
[![Software License](https://img.shields.io/badge/license-MIT-brightgreen.svg)](LICENSE.md)
@@ -10,7 +10,7 @@
1010
[![Release](https://img.shields.io/github/release/larapulse/migrator.svg)](https://github.com/larapulse/migrator/releases)
1111
[![TODOs](https://badgen.net/https/api.tickgit.com/badgen/github.com/larapulse/migrator)](https://www.tickgit.com/browse?repo=github.com/larapulse/migrator)
1212

13-
MySQL database migrator designed to run migrations to your features and manage database schema update with intuitive go code. It is compatible with latest MySQL v8.
13+
MySQL database migrator designed to run migrations to your features and manage database schema update with intuitive go code. It is compatible with the latest MySQL v8.
1414

1515
## Installation
1616

@@ -104,7 +104,7 @@ for _, m := range migrated {
104104
fmt.Println("Migration did run successfully")
105105
```
106106

107-
After first migration run, `migrations` table will be created:
107+
After the first migration run, `migrations` table will be created:
108108

109109
```
110110
+----+-------------------------------------+-------+---------------------+
@@ -201,7 +201,7 @@ posts.Column("data", customType("json not null"))
201201
posts.Timestamps()
202202
```
203203

204-
Same logic is for adding custom commands to the Schema to be migrated or reverted, just be sure you implement `command` interface:
204+
The same logic is for adding custom commands to the Schema to be migrated or reverted, just be sure you implement `command` interface:
205205

206206
```go
207207
type customCommand string

column.go

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,7 @@ type columnType interface {
2727
buildRow() string
2828
}
2929

30-
// Integer represents integer value in DB: {tiny,small,medium,big}int
30+
// Integer represents an integer value in DB: {tiny,small,medium,big}int
3131
//
3232
// Default migrator.Integer will build a sql row: `int NOT NULL`
3333
//
@@ -87,7 +87,7 @@ func (i Integer) buildRow() string {
8787
return sql
8888
}
8989

90-
// Floatable replresents number with floating point in DB:
90+
// Floatable represents a number with a floating point in DB:
9191
// `float`, `double` or `decimal`
9292
//
9393
// Default migrator.Floatable will build a sql row: `float NOT NULL`
@@ -390,7 +390,7 @@ func (j JSON) buildRow() string {
390390
return sql
391391
}
392392

393-
// Enum represents choisable value. In database represented by: `enum` or `set`
393+
// Enum represents choosable value. In the database represented by: `enum` or `set`
394394
//
395395
// Default migrator.Enum will build a sql row: `enum('') NOT NULL`
396396
//

migration.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ type executableSQL interface {
88

99
// Migration represents migration entity
1010
//
11-
// Name should be unique name to specify migration. It is up to you to choose the name you like
11+
// Name should be a unique name to specify migration. It is up to you to choose the name you like
1212
// Up() should return Schema with prepared commands to be migrated
1313
// Down() should return Schema with prepared commands to be reverted
1414
// Transaction optinal flag to enable transaction for migration

migrator.go

Lines changed: 14 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
// Package migrator represents MySQL database migrator
22
//
33
// MySQL database migrator designed to run migrations to your features and manage database schema update with intuitive go code.
4-
// It is compatible with latest MySQL v8.
4+
// It is compatible with the latest MySQL v8.
55
package migrator
66

77
import (
@@ -15,20 +15,20 @@ import (
1515
const migrationTable = "migrations"
1616

1717
var (
18-
// ErrTableNotExists returned when migration table not found
19-
ErrTableNotExists = errors.New("Migration table does not exists")
18+
// ErrTableNotExists returns when migration table not found
19+
ErrTableNotExists = errors.New("Migration table does not exist")
2020

21-
// ErrNoMigrationDefined returned when no migations defined in the migrations pool
21+
// ErrNoMigrationDefined returns when no migrations defined in the migrations pool
2222
ErrNoMigrationDefined = errors.New("No migrations defined")
2323

24-
// ErrEmptyRollbackStack returned when nothing can be reverted
24+
// ErrEmptyRollbackStack returns when nothing can be reverted
2525
ErrEmptyRollbackStack = errors.New("Nothing to rollback, there are no migration executed")
2626

27-
// ErrMissingMigrationName returned when migration name is missing
27+
// ErrMissingMigrationName returns when migration name is missing
2828
ErrMissingMigrationName = errors.New("Missing migration name")
2929

30-
// ErrNoSQLCommandsToRun returned when migration is invalid and has not commands in the pool
31-
ErrNoSQLCommandsToRun = errors.New("There is no command to be executed")
30+
// ErrNoSQLCommandsToRun returns when migration is invalid and has no commands in the pool
31+
ErrNoSQLCommandsToRun = errors.New("There are no commands to be executed")
3232
)
3333

3434
type migrationEntry struct {
@@ -38,10 +38,10 @@ type migrationEntry struct {
3838
appliedAt time.Time
3939
}
4040

41-
// Migrator represents a struct with migrations, that should be executed
41+
// Migrator represents a struct with migrations, that should be executed.
4242
//
43-
// Default migration table name is `migrations`, but it can be re-defined
44-
// Pool is a list of migrations that should be migrated
43+
// Default migration table name is `migrations`, but it can be re-defined.
44+
// Pool is a list of migrations that should be migrated.
4545
type Migrator struct {
4646
// Name of the table to track executed migrations
4747
TableName string
@@ -50,7 +50,7 @@ type Migrator struct {
5050
executed []migrationEntry
5151
}
5252

53-
// Migrate run all migrations from pool and stores in migration table executed migration
53+
// Migrate runs all migrations from pool and stores in migration table executed migration.
5454
func (m Migrator) Migrate(db *sql.DB) (migrated []string, err error) {
5555
if len(m.Pool) == 0 {
5656
return migrated, ErrNoMigrationDefined
@@ -97,7 +97,7 @@ func (m Migrator) Migrate(db *sql.DB) (migrated []string, err error) {
9797
return migrated, nil
9898
}
9999

100-
// Rollback reverts last executed batch of migratios
100+
// Rollback reverts last executed batch of migrations.
101101
func (m Migrator) Rollback(db *sql.DB) (reverted []string, err error) {
102102
if len(m.Pool) == 0 {
103103
return reverted, ErrNoMigrationDefined
@@ -149,7 +149,7 @@ func (m Migrator) Rollback(db *sql.DB) (reverted []string, err error) {
149149
return reverted, nil
150150
}
151151

152-
// Revert reverts all executed migration from the pool
152+
// Revert reverts all executed migration from the pool.
153153
func (m Migrator) Revert(db *sql.DB) (reverted []string, err error) {
154154
if len(m.Pool) == 0 {
155155
return reverted, ErrNoMigrationDefined

migrator_test.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -665,7 +665,7 @@ func TestHasTable(t *testing.T) {
665665
assert.Equal(t, true, got)
666666
})
667667

668-
t.Run("it returns false if table does not exists", func(t *testing.T) {
668+
t.Run("it returns false if table does not exist", func(t *testing.T) {
669669
m := Migrator{}
670670
db, mock, resetDB := testDBConnection(t)
671671
defer resetDB()

schema.go

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,12 @@
11
package migrator
22

3-
// Schema allows to add commands on schema.
3+
// Schema allows adding commands on the schema.
44
// It should be used within migration to add migration commands.
55
type Schema struct {
66
pool []command
77
}
88

9-
// CreateTable allows to create table in schema
9+
// CreateTable allows creating the table in the schema.
1010
//
1111
// Example:
1212
// var s migrator.Schema
@@ -17,8 +17,8 @@ func (s *Schema) CreateTable(t Table) {
1717
s.pool = append(s.pool, createTableCommand{t})
1818
}
1919

20-
// DropTable removes table from schema
21-
// Warning ⚠️ BC incompatible
20+
// DropTable removes a table from the schema.
21+
// Warning ⚠️ BC incompatible!
2222
//
2323
// Example:
2424
// var s migrator.Schema
@@ -30,8 +30,8 @@ func (s *Schema) DropTable(name string, soft bool, option string) {
3030
s.pool = append(s.pool, dropTableCommand{name, soft, option})
3131
}
3232

33-
// DropTableIfExists removes table if exists from schema
34-
// Warning ⚠️ BC incompatible
33+
// DropTableIfExists removes table if exists from the schema.
34+
// Warning ⚠️ BC incompatible!
3535
//
3636
// Example:
3737
// var s migrator.Schema
@@ -40,8 +40,8 @@ func (s *Schema) DropTableIfExists(name string) {
4040
s.pool = append(s.pool, dropTableCommand{name, true, ""})
4141
}
4242

43-
// RenameTable executes command to rename table
44-
// Warning ⚠️ BC incompatible
43+
// RenameTable executes a command to rename the table.
44+
// Warning ⚠️ BC incompatible!
4545
//
4646
// Example:
4747
// var s migrator.Schema
@@ -50,7 +50,7 @@ func (s *Schema) RenameTable(old string, new string) {
5050
s.pool = append(s.pool, renameTableCommand{old: old, new: new})
5151
}
5252

53-
// AlterTable makes changes on table level
53+
// AlterTable makes changes on the table level.
5454
//
5555
// Example:
5656
// var s migrator.Schema
@@ -60,7 +60,7 @@ func (s *Schema) AlterTable(name string, c TableCommands) {
6060
s.pool = append(s.pool, alterTableCommand{name, c})
6161
}
6262

63-
// CustomCommand allows to add custom command to the Schema
63+
// CustomCommand allows adding the custom command to the Schema.
6464
//
6565
// Example:
6666
// type customCommand string

table.go

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -2,13 +2,13 @@ package migrator
22

33
import "strings"
44

5-
// Table is an entity to create table
5+
// Table is an entity to create a table.
66
//
7-
// Name table name
8-
// Engine default: InnoDB
9-
// Charset default: utf8mb4 or first part of collation (if set)
10-
// Collation default: utf8mb4_unicode_ci or charset with `_unicode_ci` suffix
11-
// Comment optional comment on table
7+
// - Name table name
8+
// - Engine default: InnoDB
9+
// - Charset default: utf8mb4 or first part of collation (if set)
10+
// - Collation default: utf8mb4_unicode_ci or charset with `_unicode_ci` suffix
11+
// - Comment optional comment on table
1212
type Table struct {
1313
Name string
1414
columns columns
@@ -20,12 +20,12 @@ type Table struct {
2020
Comment string
2121
}
2222

23-
// Column adds column to the table
23+
// Column adds a column to the table
2424
func (t *Table) Column(name string, c columnType) {
2525
t.columns = append(t.columns, column{field: name, definition: c})
2626
}
2727

28-
// ID adds bigint `id` column that is primary key
28+
// ID adds bigint `id` column that is the primary key
2929
func (t *Table) ID(name string) {
3030
t.Column(name, Integer{
3131
Prefix: "big",
@@ -35,13 +35,13 @@ func (t *Table) ID(name string) {
3535
t.Primary(name)
3636
}
3737

38-
// UniqueID adds unique id column (represented as UUID) that is primary key
38+
// UniqueID adds unique id column (represented as UUID) that is the primary key
3939
func (t *Table) UniqueID(name string) {
4040
t.UUID(name, "(UUID())", false)
4141
t.Primary(name)
4242
}
4343

44-
// BinaryID adds unique binary id column (represented as UUID) that is primary key
44+
// BinaryID adds unique binary id column (represented as UUID) that is the primary key
4545
func (t *Table) BinaryID(name string) {
4646
t.Column(name, Binary{Fixed: true, Precision: 16, Default: "(UUID_TO_BIN(UUID()))"})
4747
t.Primary(name)

0 commit comments

Comments
 (0)