Creating migrations files to create movies table and add movies check constraints. Updating API version number. Updating README.md adding 'SQL Migrations' section. Updating deployment file to make migrations before building API. Adding some .idea files into .gitignore.
Some checks failed
Deploy Greenlight API / deploy (push) Failing after 40s
Some checks failed
Deploy Greenlight API / deploy (push) Failing after 40s
This commit is contained in:
15
README.md
15
README.md
@@ -44,6 +44,21 @@ There are two comon approaches to doing this :
|
||||
|
||||
From an HTTP semantics point of view, using headers to convey the API version is the 'purer' approach. But from a user-experience point of view, using a URL prefix is arguably better. It makes it possible for developers to see which version of the API is being used at a glance, and it also means that the API can still be explored using a regular web browser (which is harder if custom headers are required).
|
||||
|
||||
## SQL Migrations
|
||||
|
||||
The first thing we need to do is generate a pair of _migration files_ using the **migrate create** command :
|
||||
|
||||
```bash
|
||||
migrate create -seq -ext=.sql -dir=./migrations create_movies_table
|
||||
```
|
||||
|
||||
In this command:
|
||||
|
||||
- The **-seq** flag indicates that we want to use sequential numbering like **0001, 0002, ...** for the migration files (instead of a Unix timestamp, which is the default).
|
||||
- The **-ext** flag indicates that we want to give the migration files the extension **.sql**.
|
||||
- The **-dir** flag indicates that we want to store the migration files in the **./migrations** directory (which will be created automatically if it doesn't already exist).
|
||||
- The name **create_movies_table** is a descriptive label that we give the migration files to signify their contents.
|
||||
|
||||
## Additional Information
|
||||
|
||||
### How different Go Types are encoded
|
||||
|
||||
Reference in New Issue
Block a user