only mysql8

atlas migrate hash
atlas migrate apply --url URL --env dev --var "url=URL" --var "pattern=script_cli_migrate_apply_datasrc"
stdout 'Migrating to version 1 \(1 migrations in total\):'

-- atlas.hcl --
variable "url" {
  type = string
}

variable "pattern" {
  type = string
}

data "sql" "tenants" {
  url = var.url
  query = <<EOS
SELECT `schema_name`
  FROM `information_schema`.`schemata`
  WHERE `schema_name` LIKE ?
EOS
  args = [var.pattern]
}

env "dev" {
  for_each = toset(data.sql.tenants.values)
  url      = urlsetpath(var.url, each.value)
}

-- migrations/1_create_users.sql --
CREATE TABLE `users` (
  `id` bigint NOT NULL AUTO_INCREMENT,
  PRIMARY KEY (`id`)
)

