Skip to content

Commit de896e3

Browse files
author
Alexandre
authored
Merge pull request #10 from FrEaKmAn/master
README improvements and change template comment syntax
2 parents 2684c6d + fc14f07 commit de896e3

File tree

2 files changed

+32
-6
lines changed

2 files changed

+32
-6
lines changed

README.md

Lines changed: 31 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -82,21 +82,34 @@ Create a migration
8282
It is time to create our first migration file.
8383

8484
```
85-
$ ./bin/migrate migrate:create [env]
85+
$ ./bin/migrate migrate:create
8686
```
8787

8888
Migrations file are like this
8989

90-
--// add table users
90+
-- // add table users
9191
-- Migration SQL that makes the change goes here.
9292
create table users (id integer, name text);
9393
-- @UNDO
9494
-- SQL to undo the change goes here.
9595
drop table users;
9696

97+
List migrations
98+
------------------
99+
View all available migrations and their status.
100+
101+
```
102+
$ ./bin/migrate migrate:status [env]
103+
+----------------+---------+------------------+--------------------+
104+
| id | version | applied at | description |
105+
+----------------+---------+------------------+--------------------+
106+
| 14679010838251 | | | create table users |
107+
+----------------+---------+------------------+--------------------+
108+
```
109+
97110
Up and down
98111
-----------
99-
You can now up all the pending migrations. If you decided to down a migration, the last one will be downed alone to prevent from mistake. You will be asked to confirm the downgrade of your database before runing the real SQL script.
112+
You can now up all the pending migrations. If you decided to down a migration, the last one will be downed alone to prevent from mistake. You will be asked to confirm the downgrade of your database before runing the real SQL script.
100113

101114
```
102115
$ ./bin/migrate migrate:up [env]
@@ -105,11 +118,24 @@ $ ./bin/migrate migrate:up [env]
105118
For developement purpose, it is also possible to up a single migration without taking care of the other ones:
106119

107120
```
108-
$ ./bin/migrate migrate:up [env] --only=[migration]
121+
$ ./bin/migrate migrate:up [env] --only=[migrationid]
122+
```
123+
124+
or migrate to specific migration (it will run all migrations including specified migration)
125+
126+
```
127+
$ ./bin/migrate migrate:up [env] --to=[migrationid]
109128
```
110129

111130
Same thing for down:
112131

113132
```
114-
$ ./bin/migrate migrate:down [env] --only=[migration]
133+
$ ./bin/migrate migrate:down [env] --only=[migrationid]
134+
```
135+
136+
or
137+
138+
139+
```
140+
$ ./bin/migrate migrate:down [env] --to=[migrationid]
115141
```

templates/migration.tpl

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
--// {DESCRIPTION}
1+
-- // {DESCRIPTION}
22
-- Migration SQL that makes the change goes here.
33

44
-- @UNDO

0 commit comments

Comments
 (0)