Skip to content

Commit 58f7316

Browse files
authored
docs: Re-order the migration tools list (#3064)
The list for details about each migration tool didn't match the bullet-point list at the beginning of the section. It's a bit confusing for unsuspecting readers to see an item at position 2 but not find it as the second item in the expanded description.
1 parent e36cf3a commit 58f7316

File tree

1 file changed

+59
-59
lines changed

1 file changed

+59
-59
lines changed

docs/howto/ddl.md

Lines changed: 59 additions & 59 deletions
Original file line numberDiff line numberDiff line change
@@ -69,66 +69,21 @@ type Post struct {
6969
}
7070
```
7171

72-
### goose
73-
74-
```sql
75-
-- +goose Up
76-
CREATE TABLE post (
77-
id int NOT NULL,
78-
title text,
79-
body text,
80-
PRIMARY KEY(id)
81-
);
82-
83-
-- +goose Down
84-
DROP TABLE post;
85-
```
86-
87-
```go
88-
package db
89-
90-
type Post struct {
91-
ID int
92-
Title sql.NullString
93-
Body sql.NullString
94-
}
95-
```
96-
97-
### sql-migrate
72+
### dbmate
9873

9974
```sql
100-
-- +migrate Up
101-
-- SQL in section 'Up' is executed when this migration is applied
102-
CREATE TABLE people (id int);
103-
104-
105-
-- +migrate Down
106-
-- SQL section 'Down' is executed when this migration is rolled back
107-
DROP TABLE people;
108-
```
109-
110-
```go
111-
package db
112-
113-
type People struct {
114-
ID int32
115-
}
116-
```
117-
118-
### tern
75+
-- migrate:up
76+
CREATE TABLE foo (bar INT NOT NULL);
11977

120-
```sql
121-
CREATE TABLE comment (id int NOT NULL, text text NOT NULL);
122-
---- create above / drop below ----
123-
DROP TABLE comment;
78+
-- migrate:down
79+
DROP TABLE foo;
12480
```
12581

12682
```go
12783
package db
12884

129-
type Comment struct {
130-
ID int32
131-
Text string
85+
type Foo struct {
86+
Bar int32
13287
}
13388
```
13489

@@ -188,20 +143,65 @@ type Post struct {
188143
}
189144
```
190145

191-
### dbmate
146+
### goose
192147

193148
```sql
194-
-- migrate:up
195-
CREATE TABLE foo (bar INT NOT NULL);
149+
-- +goose Up
150+
CREATE TABLE post (
151+
id int NOT NULL,
152+
title text,
153+
body text,
154+
PRIMARY KEY(id)
155+
);
196156

197-
-- migrate:down
198-
DROP TABLE foo;
157+
-- +goose Down
158+
DROP TABLE post;
199159
```
200160

201161
```go
202162
package db
203163

204-
type Foo struct {
205-
Bar int32
164+
type Post struct {
165+
ID int
166+
Title sql.NullString
167+
Body sql.NullString
168+
}
169+
```
170+
171+
### sql-migrate
172+
173+
```sql
174+
-- +migrate Up
175+
-- SQL in section 'Up' is executed when this migration is applied
176+
CREATE TABLE people (id int);
177+
178+
179+
-- +migrate Down
180+
-- SQL section 'Down' is executed when this migration is rolled back
181+
DROP TABLE people;
182+
```
183+
184+
```go
185+
package db
186+
187+
type People struct {
188+
ID int32
189+
}
190+
```
191+
192+
### tern
193+
194+
```sql
195+
CREATE TABLE comment (id int NOT NULL, text text NOT NULL);
196+
---- create above / drop below ----
197+
DROP TABLE comment;
198+
```
199+
200+
```go
201+
package db
202+
203+
type Comment struct {
204+
ID int32
205+
Text string
206206
}
207207
```

0 commit comments

Comments
 (0)