github ariga/atlas v0.9.0

latest releases: v0.27.0, v0.26.1, v0.26.0...
20 months ago

We are excited to share the v0.9.0 release! 🎊

Atlas v0.9.0 introduces first-class support for SQL, JSON printing, injection of runtime variables, as well as many small improvements.

Read the announcement blogpost

Quick installation

macOS + Linux:

curl -sSf https://atlasgo.sh | sh

Homebrew:

brew install ariga/tap/atlas

Docker:

docker pull arigaio/atlas

Windows

Download

New Features

Use SQL to describe the desired state

Assuming schema.sql:

-- create table "users
CREATE TABLE users(
    id int NOT NULL,
    name varchar(100) NULL,
    PRIMARY KEY(id)
);

You can now:

atlas schema apply \
  --url "mysql://root:pass@localhost:3306/example" \
  --to "file://schema.sql" \
  --dev-url "docker://mysql/8/example"

SQL and JSON formatting for schema inspection

Atlas can be used to inspect an existing database and print its schema in multiple formats. In this version SQL and JSON were added:

SQL

atlas schema inspect \
  --url "mysql://root:pass@localhost:3306/example" \
  --log "{{ sql . }}"

JSON

atlas schema inspect \
  --url "mysql://root:pass@localhost:3306/example" \
  --log "{{ json . }}"

Inject runtime variables to project configuration files

Users may now store database credentials in external resources and pull them into the project configuration file at runtime:

data "runtimevar" "pass" {
  url = "awssecretsmanager://<secret>?region=<region>"
}

env "dev" {
  src = "schema.hcl"
  url = "mysql://root:${data.runtimevar.pass}@host:3306/database"
}

More examples

What's Changed

  • sql/postgres: support range types by @a8m in #1314
  • cmd/atlas: update ariga.io/atlas by @a8m in #1315
  • sql: add driver.Version to expose the version of the connected database by @a8m in #1316
  • cmd/atlas: Update go.work.sum by @tmc in #1312
  • cmd/atlas: initial support for runtimevar as data source by @a8m in #1318
  • cmd/atlas: correctly set env.schemas to flags by @a8m in #1319
  • doc/project: add runtimevar examples and doc by @a8m in #1320
  • sql/mysql: support native-UUID data type for MariaDB since version 10.7.0 by @michaelboke in #1302
  • sql/postgres: use shared uuid type by @a8m in #1322
  • docs/website/blog: Picking a database migration tool for Go projects in 2023 by @crossworth in #1321
  • schemahcl: validate variable type definition by @a8m in #1325
  • cmd/atlas: avoid logging errors twice by @a8m in #1328
  • cmd/atlas: basic json logging for schema inspect by @a8m in #1329
  • doc/md/guides: Add doc about AR101 by @priteshtm in #1323
  • doc/md: guide on testing with compose by @rotemtam in #1335
  • md/guides: update correct directory struct by @giautm in #1337
  • doc/md: inspect a local db in Cloud guide by @hilakashai in #1336
  • doc/website/blog: erd and json blog by @rotemtam in #1331
  • cmd/atlas: use the shared stateReader in migrate diff command by @a8m in #1338
  • doc/website: fix routing by @hilakashai in #1340
  • doc/website/blog: add json examples by @rotemtam in #1341
  • doc/website: make clickable gif in blog by @hilakashai in #1342
  • sql/mysql: implement reverse for DROP TABLE commands by @a8m in #1345
  • sql: support multi-statement reverse commands by @a8m in #1346
  • schemahcl: add support for quoted references by @a8m in #1348
  • sql/mysql/mysqlversion: ignore server build info on compare by @a8m in #1350
  • schemahcl: scan and format quoted identifiers by @a8m in #1353
  • doc/blog: atlas wilco quest announcement by @rotemtam in #1356
  • doc/blog: remove image from old post by @rotemtam in #1357
  • doc: component for installation instructions by @masseelch in #1354
  • cmd/atlas: extend sql state-reader to accept single files by @a8m in #1358
  • doc/install: add docker to instructions component by @a8m in #1359
  • cmd/atlas: add --log=sql to allow dumping sql schema on inspection by @a8m in #1360
  • cmd/atlas/docker: pass user query params to driver by @a8m in #1362
  • cmd/atlas: make schema diff output valid to execute by @a8m in #1363
  • cmd/atlas: remove short form for --to flag by @a8m in #1364
  • cmd/atlas: gracefully exit on interrupts by @a8m in #1365
  • doc: add examples to readme by @a8m in #1366
  • doc: add sql to getting started by @a8m in #1367
  • doc/md: Fly.io guide by @crossworth in #1361
  • doc: changing atlas newsletter link to Substack by @shani-a in #1369
  • doc/md: fix flyio paths by @rotemtam in #1370
  • doc: update inspection doc by @a8m in #1371
  • cmd/atlas: hide -f in 'schema apply' and improve --to comment by @a8m in #1372
  • doc: update schema apply doc with sql examples by @a8m in #1374
  • doc: add sql examples to 'schema diff' page by @a8m in #1376
  • .github/workflows: create quick boot mysql images by @ronenlu in #1375
  • .github: add popular mysql tags to builds by @a8m in #1378
  • cmd/atlas/docker: use mysql/mariadb images that boot up faster by @a8m in #1379
  • cmd/atlas: dynamically create mysql databases by @a8m in #1381
  • sql/postgres: always create 'public' schemas with IF NOT EXISTS clause by @a8m in #1382
  • sql: add default migration planners by @a8m in #1383
  • sql/mysql: setup version for default differ by @a8m in #1384
  • doc/diff: add sql schema to examples by @a8m in #1385
  • sql/sqlite: in inspect command order columns by cid by @ronenlu in #1387
  • doc/blog: v0.9.0 release by @a8m in #1390

New Contributors

Full Changelog: v0.8.3...v0.9.0

Don't miss a new atlas release

NewReleases is sending notifications on new releases.