Skip to content
Permalink
Browse files

added whitespace to some meta files

  • Loading branch information...
JoshuaWise committed Sep 15, 2018
1 parent 9b48f51 commit fb19d934a85c02eb02bb67ebf6a5258675cf8ad8
Showing with 8 additions and 2 deletions.
  1. +1 −1 .travis.yml
  2. +1 −1 LICENSE
  3. +6 −0 TIPS.md
@@ -16,4 +16,4 @@ addons:
before_install:
- export CC="gcc-4.9" CXX="g++-4.9"
before_script:
- npm run install-debug
- npm run install-debug
@@ -18,4 +18,4 @@ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE.
SOFTWARE.
@@ -1,6 +1,9 @@
# Helpful tips for SQLite3

## Creating good tables

It's a good idea to use `INTEGER PRIMARY KEY AUTOINCREMENT` as one of the columns in a table. This ensures two things:

- `INTEGER PRIMARY KEY`: improved performance by reusing SQLite3's built-in `rowid` column.
- `AUTOINCREMENT`: no future row will have the same ID as an old one that was deleted. This can prevent potential bugs and security breaches.

@@ -11,9 +14,11 @@ Any column with `INTEGER PRIMARY KEY` will automatically increment when setting
It should be noted that `NULL` values count as unique from each other. This has implications when using the `UNIQUE` contraint or any other equality test.

## Default values

When a column has a `DEFAULT` value, it only gets applied when no value is specified for an `INSERT` statement. If the `INSERT` statement specifies a `NULL` value, the `DEFAULT` value is **NOT** used.

## Foreign keys

Foreign key constraints are not enforced if the child's column value is `NULL`. To ensure that a relationship is always enforced, use `NOT NULL` on the child column.

Example:
@@ -22,6 +27,7 @@ CREATE TABLE comments (value TEXT, user_id INTEGER NOT NULL REFERENCES users);
```

Foreign key clauses can be followed by `ON DELETE` and/or `ON UPDATE`, with the following possible values:

- `SET NULL`: if the parent column is deleted or updated, the child column becomes `NULL`.
- *NOTE: This still causes a constraint violation if the child column has `NOT NULL`*.
- `SET DEFAULT`: if the parent column is updated or deleted, the child column becomes its `DEFAULT` value.

0 comments on commit fb19d93

Please sign in to comment.
You can’t perform that action at this time.