Update README.md

This commit is contained in:
Adrian Macneil 2015-11-28 23:56:17 -07:00
parent a2e16a66d2
commit 64a1b5b290

View file

@ -64,7 +64,7 @@ To write a migration, simply add your SQL to the `migrate:up` section:
```sql
-- migrate:up
CREATE TABLE users (
id INT PRIMARY KEY,
id INTEGER,
name VARCHAR,
email VARCHAR NOT NULL
);
@ -72,6 +72,8 @@ CREATE TABLE users (
-- migrate:down
```
> Note: Migration files are named in the format `[version]_[description].sql`. Only the version (defined as all leading numeric characters in the file name) is recorded in the database, so you can safely rename a migration file without having any effect on its current application state.
### Running Migrations
Run `dbmate up` to run any pending migrations.
@ -82,7 +84,7 @@ Creating: myapp_development
Applying: 20151127184807_create_users_table.sql
```
Note: `dbmate up` will create the database if it does not already exist (assuming the current user has permission to create databases). If you want to run migrations without creating the database, run `dbmate migrate`.
> Note: `dbmate up` will create the database if it does not already exist (assuming the current user has permission to create databases). If you want to run migrations without creating the database, run `dbmate migrate`.
### Rolling Back Migrations