Compare commits

..

No commits in common. "38fe8ba53964d7a56fe8a2016ccc83d54cce1ca1" and "0d53175b5d36b5db47eb84bc6975cf6c5703f8fa" have entirely different histories.

6 changed files with 61 additions and 36 deletions

1
.gitignore vendored
View File

@ -2,4 +2,3 @@
/db.sqlite /db.sqlite
.idea/ .idea/
.DS_Store .DS_Store
certs/

View File

@ -3,27 +3,32 @@ repos:
rev: v4.5.0 rev: v4.5.0
hooks: hooks:
- id: check-toml - id: check-toml
- id: end-of-file-fixer - id: check-vcs-permalinks
# - id: end-of-file-fixer
- id: fix-byte-order-marker - id: fix-byte-order-marker
- id: mixed-line-ending - id: mixed-line-ending
- id: trailing-whitespace - id: trailing-whitespace
- repo: local # - repo: https://github.com/tconbeer/sqlfmt
hooks: # rev: v0.18.0
- id: fmt # hooks:
name: fmt # - id: sqlfmt
description: Format # language_version: python
entry: cargo fmt
language: system
args:
- --all
types: [ rust ]
pass_filenames: false
- id: check - repo: https://github.com/sqlfluff/sqlfluff
name: check rev: 3.0.3
description: Check hooks:
entry: cargo check - id: sqlfluff-lint
language: system - id: sqlfluff-fix
types: [ rust ]
pass_filenames: false # - repo: https://github.com/pre-commit/mirrors-prettier
# rev: "v3.1.0"
# hooks:
# - id: prettier
# types_or: [ sql ]
# - repo: https://github.com/doublify/pre-commit-rust
# rev: master
# hooks:
# - id: fmt
# args: ['--verbose', '--edition', '2018', '--']

23
.sqlfluff Normal file
View File

@ -0,0 +1,23 @@
[sqlfluff]
dialect = sqlite
# exclude_rules = L016,L031,L034
[sqlfluff:indentation]
tab_space_size = 4
allow_implicit_indents = True
[sqlfluff:rules:capitalisation.keywords]
# Keywords Capitalization
capitalisation_policy = upper
[sqlfluff:rules:capitalisation.functions]
# Function Name Capitalization
extended_capitalisation_policy = upper
[sqlfluff:rules:capitalisation.literals]
# Null & Boolean Literals
capitalisation_policy = upper
[sqlfluff:rules:capitalisation.types]
# Data Type Capitalization
extended_capitalisation_policy = upper

View File

@ -1,5 +1,4 @@
CREATE TABLE users CREATE TABLE users (
(
id INTEGER PRIMARY KEY AUTOINCREMENT NOT NULL, id INTEGER PRIMARY KEY AUTOINCREMENT NOT NULL,
name STRING UNIQUE NOT NULL name STRING UNIQUE NOT NULL
); );
@ -19,8 +18,7 @@ CREATE TABLE rooms
message_count INTEGER NOT NULL DEFAULT 0 message_count INTEGER NOT NULL DEFAULT 0
); );
CREATE TABLE messages CREATE TABLE messages (
(
room_id INTEGER NOT NULL, room_id INTEGER NOT NULL,
id INTEGER NOT NULL, -- unique per room, sequential in one room id INTEGER NOT NULL, -- unique per room, sequential in one room
content STRING NOT NULL, content STRING NOT NULL,

View File

@ -1,2 +1 @@
ALTER TABLE messages ALTER TABLE messages ADD author_id INTEGER NULL REFERENCES users (id); -- noqa: PRS
ADD author_id INTEGER NULL REFERENCES users (id);

View File

@ -0,0 +1 @@
-- Add migration script here