Compare commits

..

4 Commits

Author SHA1 Message Date
Mikhail 38fe8ba539 Add basic checks 2024-03-31 13:35:23 +02:00
Mikhail d347af4bae Format 2024-03-31 13:10:58 +02:00
Mikhail b122987a17 Ditch sqlfluff 2024-03-31 13:10:37 +02:00
Mikhail d7bb8121e8 Ignore certs 2024-03-31 13:10:17 +02:00
6 changed files with 35 additions and 60 deletions

1
.gitignore vendored
View File

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

View File

@ -3,32 +3,27 @@ repos:
rev: v4.5.0
hooks:
- id: check-toml
- id: check-vcs-permalinks
# - id: end-of-file-fixer
- id: end-of-file-fixer
- id: fix-byte-order-marker
- id: mixed-line-ending
- id: trailing-whitespace
# - repo: https://github.com/tconbeer/sqlfmt
# rev: v0.18.0
# hooks:
# - id: sqlfmt
# language_version: python
- repo: https://github.com/sqlfluff/sqlfluff
rev: 3.0.3
- repo: local
hooks:
- id: sqlfluff-lint
- id: sqlfluff-fix
- id: fmt
name: fmt
description: Format
entry: cargo fmt
language: system
args:
- --all
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', '--']
- id: check
name: check
description: Check
entry: cargo check
language: system
types: [ rust ]
pass_filenames: false

View File

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

View File

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

View File

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