<!-- Source: @site/projects/sqlens-for-laravel/docs/rules/my-l6-lower-case-table-names-risk.md -->
<!-- Canonical: https://docs.pushery.com/sqlens-for-laravel/rules/my-l6-lower-case-table-names-risk/ -->

# MY.L6.LOWER_CASE_TABLE_NAMES_RISK — the development-against-production split you cannot switch off

> lower_case_table_names is fixed when a server is initialized, so a mixed-case migration can pass locally and fail in production.

- **Category:** safety
- **Level:** 6
- **Confidence:** deterministic
- **Downtime class:** none
- **Stability:** stable
- **Suites:** audit
- **Applies to:** MySQL 8.4
- **Not transferable to MariaDB:** this page describes MySQL 8.4 behavior. MariaDB answers the
  same driver and does not share these semantics, so SQLens refuses it outright rather than
  reasoning about it — see [drivers/unsupported](https://docs.pushery.com/sqlens-for-laravel/drivers/unsupported.md).

A macOS install initializes with `2`. A Linux server usually has `0`.

So a migration using mixed-case table names passes on one and fails on the other — and nothing in
the migration says which server it was written for.

## SQLens has no opinion about the right value

There isn't one. `0` is right on Linux, `2` is what macOS gives you, and which a project wants
depends on where it deploys. So this rule never asserts a value of its own. It judges against two
things it can stand behind.

### 1. What the project stated

```php
// config/sqlens.php
'audit' => [
    'expect' => [
        'lower_case_table_names' => 0,
    ],
],
```

Unset — the shipped default — this trigger says **nothing at all**. That is the right amount of
noise for a project that has never cared.

### 2. What the catalog already holds

On `0` the server is case-**sensitive**. A schema that already holds a table named `Orders` is one
where a query writing `orders` will not find it — while on a server initialized with `1` or `2` it
would. That is objectively provable without anybody stating a preference, so it fires either way.

## Flagged

```sql
CREATE TABLE Orders (id BIGINT PRIMARY KEY);
-- on a server initialized with lower_case_table_names = 0
```

## Preferred

```sql
CREATE TABLE orders (id BIGINT PRIMARY KEY);
```

## The remediation is naming, not a switch

The value is fixed when the server is initialized and **cannot be changed afterwards**. Moving it
means a new server and a dump/reload.

A rule proposing `SET GLOBAL` here would be proposing something MySQL refuses — so the finding
proposes consistent lower-case naming, which is the thing a project can do this afternoon.

## What is not reported

A catalog that could not be **read** is reported as **undetermined**, not as clean: on a
case-sensitive server, "we could not list the tables" and "no table depends on its case" are
different sentences.

## Sources

- [Identifier case sensitivity](https://dev.mysql.com/doc/refman/8.4/en/identifier-case-sensitivity.html) — MySQL 8.4
- [Server system variables](https://dev.mysql.com/doc/refman/8.4/en/server-system-variables.html) — MySQL 8.4

<!-- BEGIN generated: remediation -->
## The fix material this rule carries

A finding from this rule carries a payload whose strategy is `none`: this rule has looked,
and there is no safe standard sequence. That is a conclusion rather than an omission — a
finding with no payload at all says only that nobody wrote one.

The payload is material for you or an agent to apply. SQLens writes no migration and runs no
DDL. See [the remediation payload](https://docs.pushery.com/sqlens-for-laravel/remediation-schema.md) for every field, the placeholder
semantics, and the version rules a consumer has to follow.
<!-- END generated: remediation -->
