mirror of
https://github.com/TECHNOFAB11/dbmate.git
synced 2025-12-12 16:10:03 +01:00
Update README.md
This commit is contained in:
parent
a2e16a66d2
commit
64a1b5b290
1 changed files with 4 additions and 2 deletions
|
|
@ -64,7 +64,7 @@ To write a migration, simply add your SQL to the `migrate:up` section:
|
||||||
```sql
|
```sql
|
||||||
-- migrate:up
|
-- migrate:up
|
||||||
CREATE TABLE users (
|
CREATE TABLE users (
|
||||||
id INT PRIMARY KEY,
|
id INTEGER,
|
||||||
name VARCHAR,
|
name VARCHAR,
|
||||||
email VARCHAR NOT NULL
|
email VARCHAR NOT NULL
|
||||||
);
|
);
|
||||||
|
|
@ -72,6 +72,8 @@ CREATE TABLE users (
|
||||||
-- migrate:down
|
-- 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
|
### Running Migrations
|
||||||
|
|
||||||
Run `dbmate up` to run any pending migrations.
|
Run `dbmate up` to run any pending migrations.
|
||||||
|
|
@ -82,7 +84,7 @@ Creating: myapp_development
|
||||||
Applying: 20151127184807_create_users_table.sql
|
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
|
### Rolling Back Migrations
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue