In my backend project with Java and Spring Boot I want to document the SQL code uses the ORM, there is in the root of my project docs/sql/
, for now I have the database schema. But I GitHub doesn't detect the SQL code. I saw in many repos detects SQL and other languages at same time, but I can't get it. https://github.com/FrancoBujakiewicz/latte
I tried those options:
*.sql linguist-detectable
*.sql linguist-language=SQL # also tried lowercase: 'sql'
*.sql text
query/** linguist-detectable
query/** linguist-language=SQL
query/** linguist-documentation=false
# Kotlin is detected properly.
# By default in my repo will be Gradle build files
# (I'm using Kotlin DSL for Gradle build files),
# but with this are detected as Kotlin
*.kts linguist-detectable=true
*.kts linguist-language=Kotlin
SQL code should follow some standart to be detected?
CREATE TABLE action (
id INTEGER,
created_at TIMESTAMP,
updated_at TIMESTAMP,
description VARCHAR(255),
name VARCHAR(75) NOT NULL UNIQUE,
PRIMARY KEY (id)
);
CREATE TABLE brand (
id INTEGER,
created_at TIMESTAMP,
updated_at TIMESTAMP,
description VARCHAR(255),
name VARCHAR(75) NOT NULL UNIQUE,
PRIMARY KEY (id)
);
CREATE TABLE flavor (
id INTEGER,
created_at TIMESTAMP,
updated_at TIMESTAMP,
description VARCHAR(255),
name VARCHAR(75) NOT NULL UNIQUE,
available BOOLEAN NOT NULL,
PRIMARY KEY (id)
);
CREATE TABLE product (
id INTEGER,
created_at TIMESTAMP,
updated_at TIMESTAMP,
description VARCHAR(255),
name VARCHAR(75) NOT NULL UNIQUE,
price NUMERIC(8,2) NOT NULL,
stock INTEGER NOT NULL,
brand_id BIGINT NOT NULL,
PRIMARY KEY (id)
);
CREATE TABLE role (
id INTEGER,
created_at TIMESTAMP,
updated_at TIMESTAMP,
description VARCHAR(255),
name VARCHAR(75) NOT NULL UNIQUE,
PRIMARY KEY (id)
);
CREATE TABLE role_action (
role_id BIGINT NOT NULL,
action_id BIGINT NOT NULL,
PRIMARY KEY (role_id, action_id)
);
CREATE TABLE size (
id INTEGER,
created_at TIMESTAMP,
updated_at TIMESTAMP,
description VARCHAR(255),
name VARCHAR(75) NOT NULL UNIQUE,
available BOOLEAN NOT NULL,
price NUMERIC(8,2) NOT NULL,
PRIMARY KEY (id)
);
CREATE TABLE user (
id INTEGER,
created_at TIMESTAMP,
updated_at TIMESTAMP,
passwd_hash VARCHAR(60) NOT NULL UNIQUE,
phone_number VARCHAR(30) NOT NULL UNIQUE,
salt VARCHAR(50) NOT NULL UNIQUE,
username VARCHAR(50) NOT NULL UNIQUE,
role_id BIGINT NOT NULL,
PRIMARY KEY (id)
);
It looks like the problem is that linguist by default excludes documentation files: anything that matches a path like docs
(as in your case) is considered documentation, see documentation.yml
:
- ^[Dd]ocs?/
You can "unmark" a path as documentation; in your case, adding something like this to .gitattributes
should do it:
docs/sql/** -linguist-documentation