Releases: ariga/atlas
v0.3.6
Atlas v0.3.6 is a patch release that includes bug fixes and improvements to the Atlas DDL and the Management UI.
Installation
macOS
curl -LO https://release.ariga.io/atlas/atlas-darwin-amd64-v0.3.6
chmod +x ./atlas-darwin-amd64-v0.3.6
sudo mv ./atlas-darwin-amd64-v0.3.6 /usr/local/bin/atlas
sudo chown root: /usr/local/bin/atlas
Linux
curl -LO https://release.ariga.io/atlas/atlas-linux-amd64-v0.3.6
sudo install -o root -g root -m 0755 ./atlas-linux-amd64-v0.3.6 /usr/local/bin/atlas
Windows
New Features
Atlas DDL
Add support for enums in foreign-keys referential actions.
foreign_key "manager_fk" {
columns = [column.manager_id]
ref_columns = [column.id]
- on_delete = "CASCADE"
+ on_delete = CASCADE
- on_update = "NO ACTION"
+ on_update = NO_ACTION
}
Management UI
This version introduces two new features:
Remote schema caching - The Management UI now caches the results of database inspection.
This is done both to reduce the time of rendering some screens and to reduce the load on the remote database. Because Atlas relies on the inspection of the remote database to be recent and accurate, we provide mechanisms in the UI to initiate a re-inspection of the remote database schema.
atlas serve
- users can now use the atlas serve
command to initiate the Management UI against persistent storage without running inspection or a migration.
Previously, to use the Management UI, users had to initiate either an inspection or migration of a remote database (by using the -w
flag on the schema inspect
or schema apply
commands). In addition, the data backing the management UI was only persisted in an in-memory database, meaning that as soon as you stopped the Atlas process, migration history, audit logs, and changes to the schema.
To use atlas serve
, run from the command line:
./atlas serve --storage "mysql://root:pass@tcp(localhost:3306)/atlas"
Where the --storage
flag points to the database where you would like the Atlas management UI metadata to be stored. If you do not specify the storage, it will use an in-memory SQLite database.
Notice: Credentials to the databases you configure to be managed by Atlas will be stored in this storage. Atlas currently stores database passwords in clear text, support for encryption at rest will be added in a future version.
- Remote schema caching by @yonidavidson
- Atlas serve by @zeevmoney
- Activity and history shows when changing schema aliases by @elad-n
And minor UI fixes
What's Changed
- sql: use enums for referential actions by @a8m in #590
- fixed sqlite escaping on migrate insert by @devnode in #591
- sql/mysql: minor diff changes by @a8m in #592
- doc/md: add homebrew installation instructions to docs by @rotemtam in #593
- cmd/action: better wording by @masseelch in #594
- sql/mysql: use default attributes when from realm is nil by @yonidavidson in #595
- sql/mysql: mysql implementation for schema.Normalize by @a8m in #598
New Contributors
Full Changelog: v0.3.5...V0.3.6
v0.3.5
Atlas v0.3.5 is a patch release that includes many small improvements to both the Atlas CLI and the Management UI.
Installation
MacOS
curl -LO https://release.ariga.io/atlas/atlas-darwin-amd64-v0.3.5
chmod +x ./atlas-darwin-amd64-v0.3.5
sudo mv ./atlas-darwin-amd64-v0.3.5 /usr/local/bin/atlas
sudo chown root: /usr/local/bin/atlas
Linux
curl -LO https://release.ariga.io/atlas/atlas-linux-amd64-v0.3.5
sudo install -o root -g root -m 0755 ./atlas-linux-amd64-v0.3.5 /usr/local/bin/atlas
Windows
New Features
Atlas DDL
- Added support for
IDENTITY
/AUTO_INCREMENT
columns - docs. - Foreign keys referential actions now support enums in addition to the string version.
foreign_key "author_id" { columns = [column.author_id] ref_columns = [column.id] on_delete = CASCADE on_update = NO_ACTION }
Management UI
In this version of Atlas we added full support for multi-schemas in the UI. Now you can add database schemas into an existing Atlas schema, as well as select multiple database schemas to import when creating a new Atlas schema.
ERD search bar that focuses in on specific tables by @hedwigz
Ability to add/remove database schemas from a schema page by @elad-n + @zeevmoney
Support for importing multiple schemas from within the UI by @elad-n + @zeevmoney
Support for adding/deleting schemas from the schema editor by @rotemtam
What's Changed
- atlas/docs: add ui doc to sidebar by @hilakashai in #574
- atlas/docs: add ui doc to sidebar fix by @hilakashai in #576
- doc/website: add section about latest release by @yonidavidson in #575
- sql/sqlite: support for auto_increment by @a8m in #577
- atlas/docs: typo in getting started ui by @hilakashai in #579
- cmd/action: add unit test for env command by @elad-n in #559
- sql/migrate: add GlobStateReader by @masseelch in #568
- atlas/docs: fix double title in doc by @hilakashai in #580
- sql/postgres: add support for inspecting and applying identity attributes by @a8m in #583
- sql/migrate: fix reverse of odd length slices by @masseelch in #582
- cmd/action: change latest url by @yonidavidson in #585
- sql/migrate: fix bug in local dir file write and add tests by @masseelch in #586
- doc/website: more info and examples to sql ddl by @a8m in #588
- sql/mysql: rename collation attribute to collate by @a8m in #589
- sql/mysql: TiDB inspector for MySQL driver by @hedwigz in #587
Full Changelog: v0.3.4...v0.3.5
v0.3.4
Atlas v0.3.4 is a patch release that includes many small improvements to both the Atlas CLI and the Management UI.
Installation
MacOS
curl -LO https://release.ariga.io/atlas/atlas-darwin-amd64-v0.3.4
chmod +x ./atlas-darwin-amd64-v0.3.4
sudo mv ./atlas-darwin-amd64-v0.3.4 /usr/local/bin/atlas
sudo chown root: /usr/local/bin/atlas
Linux
curl -LO https://release.ariga.io/atlas/atlas-linux-amd64-v0.3.4
sudo install -o root -g root -m 0755 ./atlas-linux-amd64-v0.3.4 /usr/local/bin/atlas
Windows
New Features
Database Inspection
PRs #547 and #551 improve the performance of schema inspection, by reducing the number of executed statements from a linear factor to a constant number.
Our internal benchmarks show better performance by up to a factor of 20x
Management UI
In this version of Atlas, we added multi-schema support in the UI. Now you can run the β-wβ flag with both βinspectβ and βapplyβ commands that include a realm / a list of schemas.
- Multi schema view only support by @elad-n, @zeevmoney & @rotemtam
- Ability to migrate from the schema editor by @elad-n
- Full table view in the ERD by @a8m
- More minor UI fixes.
What's Changed
- Fix/add the last slide by @elad-n in #468
- doc/website: change ent "read more" link to point to blog post by @rotemtam in #548
- sql/mysql: add support for float and decimal unsigned attribute by @masseelch in #549
- doc/md: add dsn and ssl mode documentation by @ericyd in #541
- cmd/action: env command constructor by @rotemtam in #553
- sql/internal/specutil: support local column referencing by @a8m in #554
- schema/schemaspec/schemahcl: wrap variables as objects instead of maps by @a8m in #558
- Postgres driver: don't require varchar length by @edigaryev in #539
- sql/migrate: add migration directory by @masseelch in #556
- sql/postgres: add support for custom index types by @a8m in #561
- cmd/action: fix grammar error in apply description by @masseelch in #562
- sql/mysql: support index types by @a8m in #563
- doc/md: document index-type attribute by @a8m in #569
- sql/migrate: add template formatter by @masseelch in #566
- sql/mysql: support for auto_increment attribute by @a8m in #570
- atlas/doc: add getting started with the UI by @hilakashai in #560
- sql/mysql: marshal inspected auto_increment by @a8m in #572
New Contributors
- @edigaryev made their first contribution in #539
Full Changelog: v0.3.3...0.3.4
v0.3.3
Atlas v0.3.3 is a patch release that includes many small improvements to both the Atlas CLI and the Management UI.
Installation
MacOS
curl -LO https://release.ariga.io/atlas/atlas-darwin-amd64-v0.3.3
chmod +x ./atlas-darwin-amd64-v0.3.3
sudo mv ./atlas-darwin-amd64-v0.3.3 /usr/local/bin/atlas
sudo chown root: /usr/local/bin/atlas
Linux
curl -LO https://release.ariga.io/atlas/atlas-linux-amd64-v0.3.3
sudo install -o root -g root -m 0755 ./atlas-linux-amd64-v0.3.3 /usr/local/bin/atlas
Windows
New Features
Management UI
- A redesigned migration flow (see screenshot above) by @elad-n + @yonidavidson
- Ability to abort a migration (similar to the CLI) by @elad-n
- Fix ERD edge labels bug by @hedwigz
DDL
Added support for descending (DESC
) indexes. Previously users could describe indexes on the columns:
index "idx_name" {
columns = [
table.users.column.name
]
unique = true
}
With this version, we've added a more flexible syntax that can express more use-cases for indexes. For example:
index "idx_name" {
on {
column = table.users.column.rank
}
on {
column = table.users.column.score
desc = true
}
unique = true
}
CLI
Added an auto-approve
flag to the schema apply
command, thanks @ericyd for the contribution!
And much more:
- sql/postgres: support marshal time types precision in HCL by @masseelch in #481
- schema/schemaspec: add support for omitempty by @a8m in #521
- internal/integration/testdata/mysql: add time precision test by @masseelch in #522
- internal/integration/testdata/mysql: add tests for time precision def⦠by @masseelch in #525
- doc/md: contribution guidelines by @rotemtam in #528
- .github/workflows: verify go generate clean by @rotemtam in #529
- Fix/cli tests by @masseelch in #524
- cmd/action: add unit tests for diff command by @rotemtam in #530
- internal/integration: initial testscript testing for pg by @a8m in #531
- internal/integration: composite-index test case by @a8m in #532
- Add "auto approve" flag to "schema apply" command by @ericyd in #526
- internal/integration: initial testscript testing for sqlite by @a8m in #533
- internal/integration: composite-index test case for sqlite by @a8m in #534
- doc/md: intro doc to go api by @rotemtam in #536
- doc/md: document index-part option by @a8m in #538
- doc/md: documenting inspect for go api by @rotemtam in #537
- internal/integration/testdata/postgres: add tests for time precision β¦ by @masseelch in #535
- sql: drop the InspectTable option by @a8m in #540
- doc/md: guidelines for contributing documentation by @rotemtam in #542
- fix/typos by @int-2147483647 in #544
- doc/website: fix favicon and upgrade docusaurus by @rotemtam in #546
New Contributors
- @ericyd made their first contribution in #526
- @int-2147483647 made their first contribution in #544
Full Changelog: v0.3.2...v0.3.3
v0.3.2
Atlas v0.3.2 is a patch release that includes many small improvements to both the Atlas CLI and the Management UI.
Installation
MacOS
curl -LO https://release.ariga.io/atlas/atlas-darwin-amd64-v0.3.2
chmod +x ./atlas-darwin-amd64-v0.3.2
sudo mv ./atlas-darwin-amd64-v0.3.2 /usr/local/bin/atlas
sudo chown root: /usr/local/bin/atlas
Linux
curl -LO https://release.ariga.io/atlas/atlas-linux-amd64-v0.3.2
sudo install -o root -g root -m 0755 ./atlas-linux-amd64-v0.3.2 /usr/local/bin/atlas
Windows
New Features
Dry-run mode for apply
Dry run mode connects to the target database and prints the SQL migration to bring the target database to the desired state without prompting the user to approve it.
atlas schema apply -d <dsn> -f <file> --dry-run
Multi-schema support
Previously users could select a single schema from a database to be inspected or applied, with this improvement users can omit the schema from the DSN to inspect all schemas, or specify multiple schemas using the --schema
(or -s
shorthand) flag.
Inspect:
atlas schema inspect -d "mariadb://user:pass@tcp(localhost:3306)/" --schema=schemaA,schemaB -s schemaC
Apply:
atlas schema apply -d "mysql://user:pass@tcp(localhost:3306)/" -f atlas.hcl --schema prod --schema staging
schema fmt
This versions adds a new command, atlas schema fmt
that can be used to provide basic formatting capabilities to .hcl
files.
atlas schema fmt [path]
schema diff
atlas schema diff
connects to two given databases, inspects them, calculates the difference in their schemas, and prints a plan of SQL queries to bring the "from" database to the schema of the "to" database.
What's Changed
CLI
- sql/mysql: CHECK constraints are ENFORCED by default by @a8m in #455
- sql: skip CHECK expression comparison in diff step by @a8m in #456
- cmd/atlas: support canary version: update canary logic by @yonidavidson in #454
- doc/md: fix broken link to CLI documentation by @vladdoster in #459
- doc/md/ui: improving management ui doc page by @rotemtam in #450
- doc/md: bump latest binary version by @rotemtam in #453
- readme: update download link by @rotemtam in #460
- doc/md: fmt consistency and update phrasing by @vladdoster in #461
- doc/md: add headers, update phrasing, formatting by @vladdoster in #463
- cmd/action: add dry run option to schema apply by @rotemtam in #467
- internal/integration: initial testing using testscript by @a8m in #466
- cmd/action: Parse schema name in postgres dsn by @CGA1123 in #470
- doc/website: fix sql-types generation and add information about postg⦠by @masseelch in #473
- sql/mysql: inspect: support fractional seconds precision in timestamp⦠by @masseelch in #474
- sql/postgres: inspect: support fractional seconds precision in timest⦠by @masseelch in #476
- sql/postgres: add timestamptz to type-registry by @a8m in #477
- internal: move typedoc to its own package by @a8m in #478
- sql/mysql: support marshal time types precision in HCL by @masseelch in #479
- internal/integration: test foreign-key action modification by @a8m in #480
- sql/sqlite: inspect index sort order by @a8m in #483
- sql/mysql: add support for bool/boolean types by @a8m in #482
- doc/md: update release notes to latest by @yonidavidson in #475
- sql/mysql: support marshal on update expressions in HCL by @masseelch in #486
- cmd/action: atlas schema diff command implementation by @rotemtam in #484
- sql: move the index DESC attribute to schema.Index by @a8m in #489
- sql/mysql: support unmarshal on update expressions in HCL by @masseelch in #487
- specutil/convert: fix panic on missing schema ref in table block by @zeevmoney in #488
- sql/mysql: fulltext indexes contain NULL collation by @a8m in #492
- cmd/action: add schema fmt command by @rotemtam in #491
- sql/mysql: use one form for printing boolean types by @a8m in #493
- sql/mysql: add reverse to DropIndex by @hedwigz in #452
- atlas: remove uneeded file by @rotemtam in #494
- sql/sqlspec: support unmarshaling index-part by @a8m in #495
- cmd/action: add schema flag by @yonidavidson in #490
- cmd/action: multi path support for fmt by @rotemtam in #496
- schema/schemaspec: add custom printer for string representation override by @masseelch in #497
- sql/mysql: support reverse drop fk by @hedwigz in #498
- cmd/action: allow diffing schemas with different names by @rotemtam in #499
- cmd/action: support multi schema apply by @rotemtam in #503
- sql/sqlspec: support marshaling index key parts by @a8m in #504
- schema/schemspec/schemahcl: remove redundant comma when printing lists by @a8m in #505
- sql/postgres: minor fixes for postgres before release by @a8m in #507
- sql/postgres: support drop index reverse by @hedwigz in #506
- cmd/action: change schema apply behavior by @yonidavidson in #509
- sql/postgres: support drop fk reverse by @hedwigz in #512
Management UI
- Added edge labels to the ERD by @hedwigz
New Contributors
- @vladdoster made their first contribution in #459
- @CGA1123 made their first contribution in #470
- @hedwigz made their first contribution in #452
Full Changelog: v0.3.1...v0.3.2
v0.3.1
Atlas v0.3.1 is a patch release that includes many small improvements to both the Atlas CLI and the Management UI.
Installation
MacOS
curl -LO https://release.ariga.io/atlas/atlas-darwin-amd64-v0.3.1
chmod +x ./atlas-darwin-amd64-v0.3.1
sudo mv ./atlas-darwin-amd64-v0.3.1 /usr/local/bin/atlas
sudo chown root: /usr/local/bin/atlas
Linux
curl -LO https://release.ariga.io/atlas/atlas-linux-amd64-v0.3.1
sudo install -o root -g root -m 0755 ./atlas-linux-amd64-v0.3.1 /usr/local/bin/atlas
Windows
What changed?
CLI
- sql/sqlite: detect sequence attribute on table attributes by @a8m in #419
- sql/postgres: export ParseType and improve array type parsing by @a8m in #422
- sql/postgres: minor fixes to schema/tables inspection by @a8m in #427
- sql/internal/specutil: remove unused function by @masseelch in #430
- sql/sqlspec: don't allow column to be a top-level definition in HCL by @masseelch in #429
- sql: add support for querying attached schema by @a8m in #431
- sql/schema: simplify the ExecQuerier interface. by @a8m in #433
- .github/workflows: add ci check that website builds properly by @rotemtam in #439
- atlas: preparations for referenced column types by @masseelch in #441
- sql/mysql: use DROP CHECK version that works both on MariaDB and MySQL by @a8m in #444
- sqlx: fix potential panic when array element is nil by @zeevmoney in #443
- sql/postgres: unmarshal HCL enum by @masseelch in #445
- sql/postgres: unexport internal and temporary EnumType struct by @masseelch in #446
- sql/postgres: marshal HCL enum by @masseelch in #447
- doc: add explanation on binary contents by @rotemtam in #448
- cmd/atlas: support canary version by @yonidavidson in #451
Full Changelog: v0.3.0...v0.3.1
Management UI
- Fix ERD layout and zoom. Added state to an empty ERD by @hedwigz.
- Schema now views a comment attribute as a change in the schema by @zeevmoney.
- Fixed the schema diff view when the schema is out of sync by @zeevmoney.
- Migrate button doesnβt appear when the schema is synced by @elad-n.
Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and limitations under the License.
v0.3.0
Atlas v0.3.0 adds support for running schema inspect
and schema apply
commands using a graphical user interface, as well as many improvements to database inspection, diffing and migration planning.
To run the CLI with the GUI enabled, simply add the -w
flag to the inspect
or apply
commands. For example:
atlas schema apply -d "mysql://root:pass@tcp(localhost:3306)/example" -f schema.hcl -w
Starting this release, the distributed binaries include code for a Management UI wrapping the core atlas functionality that is not currently released as open-source software. If you would like to build Atlas from source without the UI code run:
go build ./cmd/atlas
Installation
MacOS
curl -LO https://release.ariga.io/atlas/atlas-darwin-amd64-v0.3.0
chmod +x ./atlas-darwin-amd64-v0.3.0
sudo mv ./atlas-darwin-amd64-v0.3.0 /usr/local/bin/atlas
sudo chown root: /usr/local/bin/atlas
Linux
curl -LO https://release.ariga.io/atlas/atlas-linux-amd64-v0.3.0
sudo install -o root -g root -m 0755 ./atlas-linux-amd64-v0.3.0 /usr/local/bin/atlas
Windows
curl -LO https://release.ariga.io/atlas/atlas-windows-amd64-v0.3.0.exe
What's Changed
- doc: update docs for v0.2.0 by @rotemtam in #383
- doc/md/getting-started: fixing broken link by @rotemtam in #384
- cmd/action: improve error message when using bad dsn by @yonidavidson in #385
- sql/mysql: bug fixes in enum types by @a8m in #386
- sql/mysql: minor changes for AUTO_INCREMENT migration by @a8m in #387
- sql/mysql: index sub parts by @a8m in #388
- sql/internal/specutil: support marshaling unsupported types as sql() β¦ by @rotemtam in #389
- go.mod: upgrade cobra cli to v1.3.0 by @yonidavidson in #390
- Update intro.md by @masseelch in #391
- sql/mysql: avoid panic on migrate failure by @a8m in #393
- sql/mysql: allow dropping table attributes by @a8m in #394
- sql/mysql: support precision and scale in type registry by @a8m in #395
- internal/integration: add hcl drift test to sanity by @yonidavidson in #397
- sql/sqlite: export ParseType function by @a8m in #399
- sql/mysql: add json to type registry by @a8m in #401
- cmd/action: error message when using -w flag by @yonidavidson in #402
- cmd/action: adding --addr flag, small copy changes by @rotemtam in #403
- Add support for SQL comments by @masseelch in #404
- beautify code by @masseelch in #405
- sql/mysql: reject CHARSET/COLLATE attributes for non-char columns on migrate by @a8m in #407
- sql: support diffing table comments by @a8m in #408
- feat(dsl): add builders for check constraints by @masseelch in #409
- sql/postgres: support modify table comments by @a8m in #410
- sql/postgres: empty comments are equivalent to NULL by @a8m in #411
- sql/postgres: minor bug fixes for modify-enum by @a8m in #412
- schema/schemaspec: create nil-slice instead of empty slice if there a⦠by @masseelch in #413
- sql/postgres: finish handling comments creation/modification for indexes, tables and columns by @a8m in #415
- sql: add support for check constraints by @masseelch in #414
- sql/mysql: support modifying schema charset and collation attributes by @a8m in #416
- sql/mysql: reject CHECK constraints when it is not supported by the d⦠by @a8m in #417
- sql: catch unnamed/implicit indexes in diffing by @a8m in #418
Full Changelog: v0.2.0...v0.3.0
Legal
Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and limitations under the License.
v0.2.0
Version 0.2.0 adds support for inspection and migration of MariaDB and SQLite databases as well as improvements to Atlas HCL.
Summary
- Added support for inspection and migration of MariaDB and SQLite databases.
- Column type field is no longer defined using a string. Instead, each driver exposes type-safe identifiers, for instance, users can use
varchar(255)
ortext
as the type of a column. To read more see the documentation. - Added better support for column default values, including the option to fall back to an
sql()
function to capture SQL expressions that cannot be described in HCL. - Greatly improved the scope of unit and integration tests for all database drivers.
- Added "check for update". Atlas will check the GitHub REST API for newer versions of Atlas upon invocation, throttling requests to happen at most every 24 hours. To opt-out of version update checks, run Atlas with
ATLAS_NO_UPDATE_NOTIFIER=1
in the environment variables. - Added the
atlas env
subcommand that lists active Atlas environment variables and their values.
Installation
Apple Intel
curl -LO https://release.ariga.io/atlas/atlas-darwin-amd64-v0.2.0
chmod +x ./atlas-darwin-amd64-v0.2.0
sudo mv ./atlas-darwin-amd64-v0.2.0 /usr/local/bin/atlas
sudo chown root: /usr/local/bin/atlas
Linux
curl -LO https://release.ariga.io/atlas/atlas-linux-amd64-v0.2.0
sudo install -o root -g root -m 0755 ./atlas-linux-amd64-v0.2.0 /usr/local/bin/atlas
Windows
curl -LO https://release.ariga.io/atlas/atlas-windows-amd64-v0.2.0.exe
Apple Silicon
curl -LO https://release.ariga.io/atlas/atlas-darwin-arm64-v0.2.0
chmod +x ./atlas-darwin-arm64-v0.2.0
sudo mv ./atlas-darwin-arm64-v0.2.0 /usr/local/bin/atlas
sudo chown root: /usr/local/bin/atlas
v0.1.1
Version v0.1.1 includes bug fixes in column nullability inspection and support for ArrayType and UserDefinedType in PostgresSQL.
The latest version instructions can be found here
Apple Intel
curl -LO https://release.ariga.io/atlas/atlas-darwin-amd64-v0.1.1
chmod +x ./atlas-darwin-amd64-v0.1.1
sudo mv ./atlas-darwin-amd64-v0.1.1 /usr/local/bin/atlas
sudo chown root: /usr/local/bin/atlas
Linux
curl -LO https://release.ariga.io/atlas/atlas-linux-amd64-v0.1.1
sudo install -o root -g root -m 0755 ./atlas-linux-amd64-v0.1.1 /usr/local/bin/atlas
Windows
curl -LO https://release.ariga.io/atlas/atlas-windows-amd64-v0.1.1.exe
Apple Silicon
curl -LO https://release.ariga.io/atlas/atlas-darwin-arm64-v0.1.1
chmod +x ./atlas-darwin-arm64-v0.1.1
sudo mv ./atlas-darwin-arm64-v0.1.1 /usr/local/bin/atlas
sudo chown root: /usr/local/bin/atlas
v0.1.0
Our first release of Atlas π
This release contains the Atlas CLI with the following commands:
atlas schema inspect -d "mysql://root:pass@tcp(localhost:3306)/example" > atlas.hcl
Currently, Atlas supports only HCL syntax
# cat atlas.hcl
table "users" {
schema = "example"
column "id" {
null = false
type = "int"
}
column "name" {
null = false
type = "string"
size = 255
}
column "manager_id" {
null = false
type = "int"
}
primary_key {
columns = [table.users.column.id, ]
}
foreign_key "manager_fk" {
columns = [table.users.column.manager_id, ]
ref_columns = [table.users.column.id, ]
on_update = "NO ACTION"
on_delete = "CASCADE"
}
index "idx_name" {
unique = true
columns = [table.users.column.name, ]
}
index "manager_fk" {
unique = false
columns = [table.users.column.manager_id, ]
}
}
schema "example" {
}
For applying a schema to a database.
atlas schema apply -d "mysql://root:pass@tcp(localhost:3306)/example" -f atlas.hcl
Supported Databases:
- MySQL.
- PostgresSQL