You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardexpand all lines: GETTING_STARTED.md
+1-1
Original file line number
Diff line number
Diff line change
@@ -28,7 +28,7 @@ migrate -database YOUR_DATABASE_URL -path PATH_TO_YOUR_MIGRATIONS up
28
28
29
29
Just add the code to your app and you're ready to go!
30
30
31
-
Before commiting your migrations you should run your migrations up, down, and then up again to see if migrations are working properly both ways.
31
+
Before committing your migrations you should run your migrations up, down, and then up again to see if migrations are working properly both ways.
32
32
(e.g. if you created a table in a migration but reverse migration did not delete it, you will encounter an error when running the forward migration again)
33
33
It's also worth checking your migrations in a separate, containerized environment. You can find some tools at the [end of this document](#further-reading).
Copy file name to clipboardexpand all lines: database/postgres/TUTORIAL.md
+5-5
Original file line number
Diff line number
Diff line change
@@ -27,7 +27,7 @@ If there were no errors, we should have two files available under `db/migrations
27
27
Note the `sql` extension that we provided.
28
28
29
29
In the `.up.sql` file let's create the table:
30
-
```
30
+
```sql
31
31
CREATETABLEIF NOT EXISTS users(
32
32
user_id serialPRIMARY KEY,
33
33
username VARCHAR (50) UNIQUE NOT NULL,
@@ -36,7 +36,7 @@ CREATE TABLE IF NOT EXISTS users(
36
36
);
37
37
```
38
38
And in the `.down.sql` let's delete it:
39
-
```
39
+
```sql
40
40
DROPTABLE IF EXISTS users;
41
41
```
42
42
By adding `IF EXISTS/IF NOT EXISTS` we are making migrations idempotent - you can read more about idempotency in [getting started](../../GETTING_STARTED.md#create-migrations)
@@ -79,7 +79,7 @@ Again, it should create for us two migrations files:
79
79
In Postgres, when we want our queries to be done in a transaction, we need to wrap it with `BEGIN` and `COMMIT` commands.
80
80
In our example, we are going to add a column to our database that can only accept enumerable values or NULL.
The `rqlite` url scheme is used for both secure and insecure connections. If connecting to an insecure database, pass `x-connect-insecure` in your URL query, or use `WithInstance` to pass an established connection.
6
+
7
+
The migrations table name is configurable through the `x-migrations-table` URL query parameter, or by using `WithInstance` and passing `MigrationsTable` through `Config`.
8
+
9
+
Other connect parameters are directly passed through to the database driver. For examples of connection strings, see https://github.com/rqlite/gorqlite#examples.
0 commit comments