Back to changelog
New
2 minute read

MySQL & MariaDB: Invisible Columns

Atlas now supports invisible columns in MySQL and MariaDB. Mark a column with invisible = true in HCL (or INVISIBLE in SQL) and Atlas inspects, diffs, and migrates visibility changes.

An invisible column (MySQL 8.0.23+, MariaDB 10.3.10+) exists and behaves like any other column, but is excluded from SELECT * - it is only returned when referenced explicitly by name. Writes work the same, subject to the usual NOT NULL and default rules. They are commonly used to add columns to existing tables without breaking applications that rely on SELECT *, or to phase columns in and out.

What We Added

Atlas now fully supports MySQL and MariaDB invisible columns across the whole workflow:

  • Inspection - invisible columns are detected and surfaced as a column attribute, including generated invisible columns such as VIRTUAL GENERATED INVISIBLE.
  • HCL (schema-as-code) - declare a column as invisible with invisible = true; it is emitted on inspect and parsed on apply.
  • Diff & migration - visibility changes are detected and planned as a column modification, and INVISIBLE is emitted when creating or altering columns.

Declaring an Invisible Column

Add invisible = true to any column in HCL:

schema.my.hcl
table "users" {
schema = schema.example
column "id" {
type = int
}
column "email" {
type = varchar(255)
}
column "legacy_token" {
type = varchar(255)
null = true
invisible = true
}
primary_key {
columns = [column.id]
}
}

The same table in SQL:

schema.sql
CREATE TABLE `users` (
`id` int NOT NULL,
`email` varchar(255) NOT NULL,
`legacy_token` varchar(255) NULL INVISIBLE,
PRIMARY KEY (`id`)
);

Diffing Visibility Changes

Flipping a column's visibility (in either direction) is planned as a column modification - Atlas emits a single MODIFY COLUMN with or without INVISIBLE rather than dropping and recreating the column:

migrations/20260531120000_hide_legacy_token.sql
-- Modify "users" table
ALTER TABLE `users` MODIFY COLUMN `legacy_token` varchar(255) NULL INVISIBLE;

Generated Invisible Columns

Generated columns can be invisible too. Atlas handles the VIRTUAL GENERATED INVISIBLE and STORED GENERATED INVISIBLE combinations:

schema.my.hcl
column "full_name" {
type = varchar(511)
as = "concat(`first_name`,' ',`last_name`)"
invisible = true
}
featuremysqlmariadbinvisible-columnshclschema