<!-- Source: @site/projects/sqlens-for-laravel/docs/rules/my-l6-default-storage-engine-not-innodb.md -->
<!-- Canonical: https://docs.pushery.com/sqlens-for-laravel/rules/my-l6-default-storage-engine-not-innodb/ -->

# MY.L6.DEFAULT_STORAGE_ENGINE_NOT_INNODB — a table with no transactions and no foreign keys

> A server whose default storage engine is not InnoDB creates tables without transactions, foreign keys or crash recovery when a migration does not name one.

- **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 table created without an explicit `ENGINE` takes the server default.

Under MyISAM that table has **no transactions, no foreign keys and no crash recovery** — and none of
those absences raise anything:

- a migration wrapped in a transaction does not roll back,
- a foreign key is silently not enforced,
- an unclean shutdown leaves the table needing repair.

Laravel's schema builder emits `ENGINE` only when `database.connections.mysql.engine` is configured,
which is not the default. So the server value usually decides.

## Flagged

```sql
SET GLOBAL default_storage_engine = MyISAM;
```

## Preferred

```sql
SET GLOBAL default_storage_engine = InnoDB;
```

## The one rule here that says `pass` out loud

A server can have `default_storage_engine = MyISAM` while `disabled_storage_engines` names MyISAM.
The setting then **looks wrong and cannot bite**: no table can be created under an engine the server
refuses to load.

Reporting nothing there would be indistinguishable from a rule that never ran. Reporting a failure
would send somebody to change a setting that is already harmless. So this case is reported as a
**pass with its reason stated** — one of the very few places in SQLens where a pass is a finding
rather than silence.

Correcting the default is still worth doing. It removes a trap for whoever later shortens that
refusal list.

## What is read, and what is not

Only the **server's** value; the variable is settable per session, and a connection that set its own
says nothing about what the next `CREATE TABLE` from somewhere else will inherit.

The comparison folds case — a `my.cnf` saying `default_storage_engine=innodb` produces the same
behavior, and flagging it would be a pure spelling false positive. The refusal list is matched **per
entry**, never as a substring.

If `disabled_storage_engines` could not be read at all, the rule reports **undetermined** rather than
assuming nothing is disabled: "we could not ask" and "nothing is refused" are different sentences.

## When this is expected

A deliberately mixed engine landscape. It is rare, and it belongs on the ignore list with the reason
recorded there.

## Sources

- [Setting the storage engine](https://dev.mysql.com/doc/refman/8.4/en/storage-engine-setting.html) — MySQL 8.4
- [Server system variables](https://dev.mysql.com/doc/refman/8.4/en/server-system-variables.html) — MySQL 8.4
- [Alternative storage engines](https://dev.mysql.com/doc/refman/8.4/en/storage-engines.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 -->
