We are excited to share the v0.8.0 release! 🎊
Atlas v0.8.0 is a minor release that includes many small improvements and a few major features to migration linting, execution, schema inspection, and project configuration.
Multi-Tenancy/Environment Support
Users can now execute migrations in multi-tenant environments using Atlas configuration language. Read more on Atlas' website.
data "sql" "tenants" {
url = var.admin_url
query = "SELECT `name` FROM `admin`.`tenants`"
}
env "prod" {
for_each = toset(data.sql.tenants.values)
url = "${local.tenant_url}/${each.value}"
migration {
dir = "file://migrations"
}
}
Custom Logging
The --log
option has been added to the migrate apply
and migrate status
commands. By using this option, users can customize the output of the execution.
env "prod" {
for_each = toset(data.sql.tenants.values)
url = "${local.base_url}/${each.value}"
log {
migrate {
// Print a JSON log containing the tenant's name.
apply = format(
"{{ json . | json_merge %q }}",
jsonencode({
Tenant : each.value
})
)
}
}
}
Migration Troubleshooting
The schema diff
and migrate status
commands have been extended to help troubleshoot and fix migration failures in production. Read the full guide here.
Installation
MacOS
curl -LO https://release.ariga.io/atlas/atlas-darwin-amd64-v0.8.1
chmod +x ./atlas-darwin-amd64-v0.8.1
sudo mv ./atlas-darwin-amd64-v0.8.1 /usr/local/bin/atlas
sudo chown root: /usr/local/bin/atlas
Linux
curl -LO https://release.ariga.io/atlas/atlas-linux-amd64-v0.8.1
sudo install -o root -g root -m 0755 ./atlas-linux-amd64-v0.8.1 /usr/local/bin/atlas
Windows
Docker
docker pull arigaio/atlas:0.8.1
docker run --rm arigaio/atlas:0.8.1
Legal
The binaries distributed in this release are released under the Ariga End User License.
If you would like to build Atlas from source follow the instructions here.
What's Changed
- cmd/atlas: update atlas package by @a8m in #1139
- sql/migrate: support the mysql client DELIMITER command by @a8m in #1140
- resolving error caused while moving ddl file by @priteshtm in #1142
- cmd/atlas: do not drop public schema on pg by @a8m in #1149
- sql/sqlcheck/datadepend: report column nullability changes that might fail by @a8m in #1150
- cmd/atlas/internal/cmdapi: add atlas migrate import command by @masseelch in #1147
- cmd/atlas/internal/cmdapi: remove force flag by @masseelch in #1152
- sql/postgres: Add support for concurrent indexes by @ivanvanderbyl in #1153
- sql/migrate: gracefully handle missing migration files by @masseelch in #1158
- cmd/atlas/internal/cmdapi: add atlas migrate set-revision by @masseelch in #1159
- sql/sqlite: toggle foreign-keys pragma before opening transactions by @a8m in #1162
- cmd/atlas: update atlas package by @a8m in #1163
- sql/sqlite: check foreign keys once before committing a transaction by @masseelch in #1164
- sql/sqlite: only check foreign-keys in before transaction commit, if … by @masseelch in #1165
- cmd/atlas/internal/migrate: template based migrate status by @masseelch in #1166
- cmd/atlas/internal/cmdapi: vercheck for updates by @rotemtam in #1167
- schemahcl: support dynamic resource blocks by @a8m in #1170
- schemahcl: accept list(T) as inputs by @a8m in #1172
- schemahcl: support assigning variable inputs of type list to attributes by @a8m in #1173
- schemahcl: add support for the for_each meta argument and stdlib functions by @a8m in #1175
- cmd/atlas/internal/cmdapi: add format query parameter to migration dir URL by @masseelch in #1174
- cmd/atlas/internal/cmdapi: schema diff works with statereaders by @masseelch in #1177
- schemahcl: add support for datasource and locals by @a8m in #1180
- cmd/atlas/internal/cmdapi/migrate: set dir value from env in migrate command by @unknowingknow in #1182
- cmd/atlas/internal/cmdapi: no longer use global variables for command… by @masseelch in #1179
- cmd/atlas: update atlas pkg by @a8m in #1188
- cmd/atlas/internal/cmdapi: add dir-format flag to migrate lint by @masseelch in #1189
- sql/postgres: support inspecting domains as user-defined types by @a8m in #1190
- sql/internal/specutil: add index-part attributes to spec by @a8m in #1194
- cmd/atlas: support multi env blocks in 'migrate apply' by @a8m in #1198
- cmd/atlas/internal/cmdapi/migrate: refactor report code in preparatio… by @masseelch in #1199
- sql/internal: check balanced quoting by @giautm in #1197
- cmd/atlas: add 'sql' data-source to config files by @a8m in #1200
- internal/integration: add example for sql data sources on mysql and postgres by @a8m in #1202
- sql/mysql: ignore innodb schema on inspection by @a8m in #1206
- internal/integration: name docker containers by @masseelch in #1209
- cmd/atlas/internal/cmdapi: make migrate apply logging template based by @masseelch in #1205
- schemahcl: support decoding struct fields by @a8m in #1210
- cmd/atlas: support multi-env logging by @a8m in #1211
- sql/sqlclient: remove DSN from the JSON output by @giautm in #1214
New Contributors
- @priteshtm made their first contribution in #1141
- @ivanvanderbyl made their first contribution in #1153
- @unknowingknow made their first contribution in #1182
- @dito made their first contribution in #1191
Full Changelog: v0.7.0...v0.8.0