Full Code of ariga/atlas for AI

master 9138a9fe419e cached
530 files
4.0 MB
1.1M tokens
8271 symbols
1 requests
Download .txt
Showing preview only (4,337K chars total). Download the full file or copy to clipboard to get everything.
Repository: ariga/atlas
Branch: master
Commit: 9138a9fe419e
Files: 530
Total size: 4.0 MB

Directory structure:
gitextract_z_8o4h8f/

├── .github/
│   ├── ops/
│   │   └── mysql/
│   │       └── Dockerfile
│   └── workflows/
│       ├── cd-docker-push-cockroach_oss.yaml
│       ├── cd-docker-push-mysql_oss.yaml
│       ├── ci-dialect_oss.yaml
│       ├── ci-go_oss.yaml
│       ├── ci-revisions_oss.yaml
│       └── ci-sdk.yml
├── .golangci.yml
├── LICENSE
├── README.md
├── atlasexec/
│   ├── README.md
│   ├── atlas.go
│   ├── atlas_internal_test.go
│   ├── atlas_migrate.go
│   ├── atlas_migrate_example_test.go
│   ├── atlas_migrate_test.go
│   ├── atlas_models.go
│   ├── atlas_schema.go
│   ├── atlas_schema_test.go
│   ├── atlas_test.go
│   ├── copilot.go
│   ├── copilot_test.go
│   ├── internal/
│   │   └── e2e/
│   │       ├── sqlite_test.go
│   │       ├── testdata/
│   │       │   ├── multi-tenants/
│   │       │   │   ├── atlas.hcl
│   │       │   │   └── migrations/
│   │       │   │       ├── 20240112070806.sql
│   │       │   │       ├── 20240116003831.sql
│   │       │   │       └── atlas.sum
│   │       │   ├── schema-plan/
│   │       │   │   ├── schema-1.lt.hcl
│   │       │   │   └── schema-2.lt.hcl
│   │       │   └── versioned-basic/
│   │       │       ├── atlas.hcl
│   │       │       └── migrations/
│   │       │           ├── 20240112070806.sql
│   │       │           └── atlas.sum
│   │       └── util_e2e.go
│   ├── mock-atlas.sh
│   ├── testdata/
│   │   ├── broken/
│   │   │   ├── 20231029112426.sql
│   │   │   └── atlas.sum
│   │   └── migrations/
│   │       ├── 20230727105553_init.sql
│   │       ├── 20230727105615_t2.sql
│   │       ├── 20230926085734_destructive-change.sql
│   │       └── atlas.sum
│   ├── working_dir.go
│   └── working_dir_test.go
├── cmd/
│   └── atlas/
│       ├── go.mod
│       ├── go.sum
│       ├── internal/
│       │   ├── cloudapi/
│       │   │   ├── client.go
│       │   │   ├── client_oss.go
│       │   │   └── client_test.go
│       │   ├── cmdapi/
│       │   │   ├── cmdapi.go
│       │   │   ├── cmdapi_oss.go
│       │   │   ├── cmdapi_test.go
│       │   │   ├── migrate.go
│       │   │   ├── migrate_oss.go
│       │   │   ├── migrate_test.go
│       │   │   ├── project.go
│       │   │   ├── project_test.go
│       │   │   ├── schema.go
│       │   │   ├── schema_test.go
│       │   │   ├── testdata/
│       │   │   │   ├── baseline1/
│       │   │   │   │   ├── 1_baseline.sql
│       │   │   │   │   └── atlas.sum
│       │   │   │   ├── baseline2/
│       │   │   │   │   ├── 1_baseline.sql
│       │   │   │   │   ├── 20220318104614_initial.sql
│       │   │   │   │   ├── 20220318104615_second.sql
│       │   │   │   │   └── atlas.sum
│       │   │   │   ├── import/
│       │   │   │   │   ├── dbmate/
│       │   │   │   │   │   ├── 1_initial.sql
│       │   │   │   │   │   └── 2_second_migration.sql
│       │   │   │   │   ├── dbmate_gold/
│       │   │   │   │   │   ├── 1_initial.sql
│       │   │   │   │   │   └── 2_second_migration.sql
│       │   │   │   │   ├── flyway/
│       │   │   │   │   │   ├── B2__baseline.sql
│       │   │   │   │   │   ├── R__views.sql
│       │   │   │   │   │   ├── U1__initial.sql
│       │   │   │   │   │   ├── V1__initial.sql
│       │   │   │   │   │   ├── V2__second_migration.sql
│       │   │   │   │   │   └── V3__third_migration.sql
│       │   │   │   │   ├── flyway_gold/
│       │   │   │   │   │   ├── 2_baseline.sql
│       │   │   │   │   │   ├── 3R_views.sql
│       │   │   │   │   │   └── 3_third_migration.sql
│       │   │   │   │   ├── golang-migrate/
│       │   │   │   │   │   ├── 1_initial.down.sql
│       │   │   │   │   │   ├── 1_initial.up.sql
│       │   │   │   │   │   ├── 2_second_migration.down.sql
│       │   │   │   │   │   └── 2_second_migration.up.sql
│       │   │   │   │   ├── golang-migrate_gold/
│       │   │   │   │   │   ├── 1_initial.sql
│       │   │   │   │   │   └── 2_second_migration.sql
│       │   │   │   │   ├── goose/
│       │   │   │   │   │   ├── 1_initial.sql
│       │   │   │   │   │   └── 2_second_migration.sql
│       │   │   │   │   ├── goose_gold/
│       │   │   │   │   │   ├── 1_initial.sql
│       │   │   │   │   │   └── 2_second_migration.sql
│       │   │   │   │   ├── liquibase/
│       │   │   │   │   │   ├── 1_initial.sql
│       │   │   │   │   │   └── 2_second_migration.sql
│       │   │   │   │   └── liquibase_gold/
│       │   │   │   │       ├── 1_initial.sql
│       │   │   │   │       └── 2_second_migration.sql
│       │   │   │   ├── mysql/
│       │   │   │   │   ├── 20220318104614_initial.sql
│       │   │   │   │   ├── 20220420213403_second.sql
│       │   │   │   │   └── atlas.sum
│       │   │   │   ├── sqlite/
│       │   │   │   │   ├── 20220318104614_initial.sql
│       │   │   │   │   ├── 20220318104615_second.sql
│       │   │   │   │   └── atlas.sum
│       │   │   │   ├── sqlite2/
│       │   │   │   │   ├── 20220318104614_initial.sql
│       │   │   │   │   ├── 20220318104615_second.sql
│       │   │   │   │   └── atlas.sum
│       │   │   │   ├── sqlitetx/
│       │   │   │   │   ├── 20220925092817_initial.sql
│       │   │   │   │   ├── 20220925094021_second.sql
│       │   │   │   │   ├── 20220925094437_third.sql
│       │   │   │   │   └── atlas.sum
│       │   │   │   ├── sqlitetx2/
│       │   │   │   │   ├── 20220925092817_initial.sql
│       │   │   │   │   ├── 20220925094021_second.sql
│       │   │   │   │   ├── 20220925094437_third.sql
│       │   │   │   │   └── atlas.sum
│       │   │   │   ├── sqlitetx3/
│       │   │   │   │   ├── 20220925092817_initial.sql
│       │   │   │   │   ├── 20220925094021_second.sql
│       │   │   │   │   └── atlas.sum
│       │   │   │   ├── sqlitetx4/
│       │   │   │   │   ├── 20220925092817_initial.sql
│       │   │   │   │   ├── 20220925094021_second.sql
│       │   │   │   │   └── atlas.sum
│       │   │   │   └── templatedir/
│       │   │   │       ├── 1.sql
│       │   │   │       ├── 2.sql
│       │   │   │       ├── atlas.sum
│       │   │   │       └── shared/
│       │   │   │           └── users.sql
│       │   │   ├── vercheck/
│       │   │   │   ├── notification.tmpl
│       │   │   │   ├── req_oss.go
│       │   │   │   ├── vercheck.go
│       │   │   │   └── vercheck_test.go
│       │   │   ├── version_oss.go
│       │   │   └── version_oss_test.go
│       │   ├── cmdext/
│       │   │   ├── cmdext.go
│       │   │   ├── cmdext_oss.go
│       │   │   ├── cmdext_test.go
│       │   │   ├── reader.go
│       │   │   └── reader_test.go
│       │   ├── cmdlog/
│       │   │   ├── cmdlog.go
│       │   │   ├── cmdlog_oss.go
│       │   │   └── cmdlog_test.go
│       │   ├── cmdstate/
│       │   │   ├── cmdstate.go
│       │   │   └── cmdstate_test.go
│       │   ├── docker/
│       │   │   ├── docker.go
│       │   │   └── docker_test.go
│       │   ├── migrate/
│       │   │   ├── ent/
│       │   │   │   ├── client.go
│       │   │   │   ├── convert.go
│       │   │   │   ├── ent.go
│       │   │   │   ├── entc.go
│       │   │   │   ├── enttest/
│       │   │   │   │   └── enttest.go
│       │   │   │   ├── generate.go
│       │   │   │   ├── hook/
│       │   │   │   │   └── hook.go
│       │   │   │   ├── internal/
│       │   │   │   │   └── schemaconfig.go
│       │   │   │   ├── migrate/
│       │   │   │   │   ├── migrate.go
│       │   │   │   │   └── schema.go
│       │   │   │   ├── mutation.go
│       │   │   │   ├── predicate/
│       │   │   │   │   └── predicate.go
│       │   │   │   ├── revision/
│       │   │   │   │   ├── revision.go
│       │   │   │   │   └── where.go
│       │   │   │   ├── revision.go
│       │   │   │   ├── revision_create.go
│       │   │   │   ├── revision_delete.go
│       │   │   │   ├── revision_query.go
│       │   │   │   ├── revision_update.go
│       │   │   │   ├── runtime/
│       │   │   │   │   └── runtime.go
│       │   │   │   ├── runtime.go
│       │   │   │   ├── schema/
│       │   │   │   │   └── revision.go
│       │   │   │   ├── template/
│       │   │   │   │   └── convert.tmpl
│       │   │   │   └── tx.go
│       │   │   ├── migrate.go
│       │   │   ├── migrate_oss.go
│       │   │   ├── migrate_test.go
│       │   │   └── testdata/
│       │   │       ├── broken/
│       │   │       │   ├── 1.sql
│       │   │       │   ├── 2.sql
│       │   │       │   ├── 3.sql
│       │   │       │   └── atlas.sum
│       │   │       └── fixed/
│       │   │           ├── 1.sql
│       │   │           ├── 2.sql
│       │   │           ├── 3.sql
│       │   │           └── atlas.sum
│       │   ├── migratelint/
│       │   │   ├── lint.go
│       │   │   ├── lint_oss.go
│       │   │   └── lint_test.go
│       │   └── sqlparse/
│       │       ├── myparse/
│       │       │   └── myparse_oss.go
│       │       ├── parseutil/
│       │       │   └── parseutil.go
│       │       ├── pgparse/
│       │       │   └── pgparse_oss.go
│       │       ├── sqliteparse/
│       │       │   ├── Lexer.g4
│       │       │   ├── Parser.g4
│       │       │   ├── README.md
│       │       │   ├── lexer.go
│       │       │   ├── parser.go
│       │       │   ├── parser_base_listener.go
│       │       │   ├── parser_base_visitor.go
│       │       │   ├── parser_listener.go
│       │       │   ├── parser_visitor.go
│       │       │   └── sqliteparse_oss.go
│       │       └── sqlparse.go
│       ├── main.go
│       └── main_oss.go
├── go.mod
├── go.sum
├── internal/
│   ├── ci/
│   │   ├── ci_dialect.tmpl
│   │   ├── ci_go.tmpl
│   │   ├── ci_revisions.tmpl
│   │   ├── cockroach/
│   │   │   ├── Dockerfile.tmpl
│   │   │   └── main.go
│   │   ├── jobs_oss.go
│   │   └── main.go
│   └── integration/
│       ├── README.md
│       ├── cockroach_test.go
│       ├── docker-compose.yaml
│       ├── go.mod
│       ├── go.sum
│       ├── hclsqlspec/
│       │   └── hclsqlspec_test.go
│       ├── integration_test.go
│       ├── mysql_test.go
│       ├── postgres_test.go
│       ├── script_test.go
│       ├── sqlite_test.go
│       ├── testdata/
│       │   ├── migrations/
│       │   │   ├── mysql/
│       │   │   │   ├── 1_initial.sql
│       │   │   │   └── atlas.sum
│       │   │   ├── mysqlock/
│       │   │   │   ├── 1.sql
│       │   │   │   ├── 2.sql
│       │   │   │   ├── 3.sql
│       │   │   │   └── atlas.sum
│       │   │   └── postgres/
│       │   │       ├── 1_initial.sql
│       │   │       └── atlas.sum
│       │   ├── mysql/
│       │   │   ├── autoincrement.txtar
│       │   │   ├── check-maria.txtar
│       │   │   ├── check.txtar
│       │   │   ├── cli-inspect-file.txtar
│       │   │   ├── cli-migrate-apply-datasrc.txtar
│       │   │   ├── cli-migrate-apply.txtar
│       │   │   ├── cli-migrate-diff-format.txtar
│       │   │   ├── cli-migrate-diff-mode-normalized.txtar
│       │   │   ├── cli-migrate-diff.txtar
│       │   │   ├── cli-project-schemas.txtar
│       │   │   ├── cli-project-url-escape.txtar
│       │   │   ├── cli-schema-apply-datasrc.txtar
│       │   │   ├── column-add-drop.txtar
│       │   │   ├── column-bit.txtar
│       │   │   ├── column-bool.txtar
│       │   │   ├── column-charset.txtar
│       │   │   ├── column-default-expr.txtar
│       │   │   ├── column-generated-inspect.txtar
│       │   │   ├── column-generated.txtar
│       │   │   ├── column-json.txtar
│       │   │   ├── column-time-precision-maria.txtar
│       │   │   ├── column-time-precision-mysql.txtar
│       │   │   ├── foreign-key-add.txtar
│       │   │   ├── foreign-key-modify-action.txtar
│       │   │   ├── foreign-key.txtar
│       │   │   ├── index-add-drop.txtar
│       │   │   ├── index-desc.txtar
│       │   │   ├── index-expr.txtar
│       │   │   ├── index-prefix.txtar
│       │   │   ├── index-type.txtar
│       │   │   ├── index-unique.txtar
│       │   │   ├── primary-key-parts.txtar
│       │   │   ├── primary-key.txtar
│       │   │   └── table-engine.txtar
│       │   ├── postgres/
│       │   │   ├── cli-inspect-file.txtar
│       │   │   ├── cli-inspect.txtar
│       │   │   ├── cli-migrate-apply-datasrc.txtar
│       │   │   ├── cli-migrate-apply.txtar
│       │   │   ├── cli-migrate-diff-unsupported.txtar
│       │   │   ├── cli-migrate-diff.txtar
│       │   │   ├── cli-migrate-status.txtar
│       │   │   ├── column-array.txtar
│       │   │   ├── column-bit.txtar
│       │   │   ├── column-comment.txtar
│       │   │   ├── column-default.txtar
│       │   │   ├── column-domain.txtar
│       │   │   ├── column-enum-array.txtar
│       │   │   ├── column-enum.txtar
│       │   │   ├── column-float.txtar
│       │   │   ├── column-generated-inspect.txtar
│       │   │   ├── column-identity.txtar
│       │   │   ├── column-interval.txtar
│       │   │   ├── column-numeric.txtar
│       │   │   ├── column-range.txtar
│       │   │   ├── column-serial.txtar
│       │   │   ├── column-textsearch.txtar
│       │   │   ├── column-time-precision.txtar
│       │   │   ├── foreign-key-action.txtar
│       │   │   ├── foreign-key.txtar
│       │   │   ├── index-desc.txtar
│       │   │   ├── index-expr.txtar
│       │   │   ├── index-include.txtar
│       │   │   ├── index-issue-557.txtar
│       │   │   ├── index-nulls-distinct.txtar
│       │   │   ├── index-operator-class.txtar
│       │   │   ├── index-partial.txtar
│       │   │   ├── index-type-brin.txtar
│       │   │   ├── index-type.txtar
│       │   │   ├── index-unique-constraint.txtar
│       │   │   ├── primary-key.txtar
│       │   │   ├── table-checks.txtar
│       │   │   └── table-partition.txtar
│       │   └── sqlite/
│       │       ├── autoincrement.txtar
│       │       ├── cli-apply-multifile.txtar
│       │       ├── cli-apply-project-multifile.txtar
│       │       ├── cli-apply-vars.txtar
│       │       ├── cli-inspect.txtar
│       │       ├── cli-migrate-apply.txtar
│       │       ├── cli-migrate-diff-datasrc-hcl-paths.txtar
│       │       ├── cli-migrate-diff-datasrc-hcl.txtar
│       │       ├── cli-migrate-diff-minimal-env.txtar
│       │       ├── cli-migrate-diff-multifile.txtar
│       │       ├── cli-migrate-diff-sql.txtar
│       │       ├── cli-migrate-diff.txtar
│       │       ├── cli-migrate-lint-add-notnull.txtar
│       │       ├── cli-migrate-lint-destructive.txtar
│       │       ├── cli-migrate-lint-ignore.txtar
│       │       ├── cli-migrate-lint-minimal-env.txtar
│       │       ├── cli-migrate-lint-project.txtar
│       │       ├── cli-migrate-project-multifile.txtar
│       │       ├── cli-migrate-project.txtar
│       │       ├── cli-migrate-set.txtar
│       │       ├── cli-project-vars.txtar
│       │       ├── cli-schema-project-file.txtar
│       │       ├── column-default.txtar
│       │       ├── column-generated.txtar
│       │       ├── column-user-defined.txtar
│       │       ├── index-desc.txtar
│       │       ├── index-expr.txtar
│       │       ├── index-partial.txtar
│       │       └── table-options.txtar
│       ├── tidb_test.go
│       └── tools.go
├── schemahcl/
│   ├── context.go
│   ├── context_test.go
│   ├── extension.go
│   ├── extension_test.go
│   ├── schemahcl.go
│   ├── schemahcl_test.go
│   ├── spec.go
│   ├── spec_test.go
│   ├── stdlib.go
│   ├── stdlib_test.go
│   ├── testdata/
│   │   ├── a.hcl
│   │   ├── b.hcl
│   │   ├── nested/
│   │   │   └── c.hcl
│   │   └── variables.hcl
│   ├── types.go
│   └── types_test.go
├── sdk/
│   ├── recordriver/
│   │   ├── driver.go
│   │   └── driver_test.go
│   └── tmplrun/
│       ├── testdata/
│       │   ├── app.tmpl
│       │   └── foo.go
│       ├── tmplrun.go
│       └── tmplrun_test.go
└── sql/
    ├── internal/
    │   ├── spectest/
    │   │   └── spectest.go
    │   ├── specutil/
    │   │   ├── convert.go
    │   │   ├── convert_test.go
    │   │   └── spec.go
    │   ├── sqltest/
    │   │   └── sqltest.go
    │   └── sqlx/
    │       ├── dev.go
    │       ├── dev_test.go
    │       ├── diff.go
    │       ├── plan.go
    │       ├── plan_test.go
    │       ├── sqlx.go
    │       ├── sqlx_oss.go
    │       └── sqlx_test.go
    ├── migrate/
    │   ├── dir.go
    │   ├── dir_test.go
    │   ├── lex.go
    │   ├── lex_test.go
    │   ├── migrate.go
    │   ├── migrate_oss.go
    │   ├── migrate_test.go
    │   └── testdata/
    │       ├── golang-migrate/
    │       │   └── 1_base.up.sql
    │       ├── lex/
    │       │   ├── 1.sql
    │       │   ├── 1.sql.golden
    │       │   ├── 10_delimiter_comment.sql
    │       │   ├── 10_delimiter_comment.sql.golden
    │       │   ├── 11_delimiter_mysql_command.sql
    │       │   ├── 11_delimiter_mysql_command.sql.golden
    │       │   ├── 12_delimiter_mysql_command.sql
    │       │   ├── 12_delimiter_mysql_command.sql.golden
    │       │   ├── 13_delimiter_mysql_command.sql
    │       │   ├── 13_delimiter_mysql_command.sql.golden
    │       │   ├── 14_delimiter_mysql_command.sql
    │       │   ├── 14_delimiter_mysql_command.sql.golden
    │       │   ├── 15_dollar_quote.sql
    │       │   ├── 15_dollar_quote.sql.golden
    │       │   ├── 16_begin_atomic.sql
    │       │   ├── 16_begin_atomic.sql.golden
    │       │   ├── 17_paren.sql
    │       │   ├── 17_paren.sql.golden
    │       │   ├── 18_pg_expr.sql
    │       │   ├── 18_pg_expr.sql.golden
    │       │   ├── 19_ms_gocmd.sql
    │       │   ├── 19_ms_gocmd.sql.golden
    │       │   ├── 20_ms_go-delim.sql
    │       │   ├── 20_ms_go-delim.sql.golden
    │       │   ├── 2_mysql.sql
    │       │   ├── 2_mysql.sql.golden
    │       │   ├── 3_delimiter.sql
    │       │   ├── 3_delimiter.sql.golden
    │       │   ├── 4_delimiter.sql
    │       │   ├── 4_delimiter.sql.golden
    │       │   ├── 5_delimiter.sql
    │       │   ├── 5_delimiter.sql.golden
    │       │   ├── 6_skip_comment.sql
    │       │   ├── 6_skip_comment.sql.golden
    │       │   ├── 7_delimiter_2n.sql
    │       │   ├── 7_delimiter_2n.sql.golden
    │       │   ├── 8_delimiter_3n.sql
    │       │   ├── 8_delimiter_3n.sql.golden
    │       │   ├── 9_delimiter_3n.sql
    │       │   └── 9_delimiter_3n.sql.golden
    │       ├── lexbegintry/
    │       │   ├── 1.sql
    │       │   └── 1.sql.golden
    │       ├── lexescaped/
    │       │   ├── 1.my.sql
    │       │   ├── 1.my.sql.golden
    │       │   ├── 2.pg.sql
    │       │   └── 2.pg.sql.golden
    │       ├── lexgroup/
    │       │   ├── 1_trigger.sql
    │       │   ├── 1_trigger.sql.golden
    │       │   ├── 2_function.sql
    │       │   ├── 2_function.sql.golden
    │       │   ├── 3_delimiter.sql
    │       │   └── 3_delimiter.sql.golden
    │       ├── migrate/
    │       │   ├── 1_initial.down.sql
    │       │   ├── 1_initial.up.sql
    │       │   ├── atlas.sum
    │       │   └── sub/
    │       │       ├── 1.a_sub.up.sql
    │       │       ├── 2.10.x-20_description.sql
    │       │       ├── 3_partly.sql
    │       │       └── atlas.sum
    │       ├── partial-checkpoint/
    │       │   ├── 1_first.sql
    │       │   ├── 2_second.sql
    │       │   ├── 3_checkpoint.sql
    │       │   ├── 4_fourth.sql
    │       │   ├── 5_checkpoint.sql
    │       │   ├── 6_sixth.sql
    │       │   └── atlas.sum
    │       └── sqlserver/
    │           ├── 1_return_table.sql
    │           ├── 1_return_table.sql.golden
    │           ├── 2_function.sql
    │           └── 2_function.sql.golden
    ├── mysql/
    │   ├── convert.go
    │   ├── diff_oss.go
    │   ├── diff_oss_test.go
    │   ├── driver_oss.go
    │   ├── driver_oss_test.go
    │   ├── inspect_oss.go
    │   ├── inspect_oss_test.go
    │   ├── internal/
    │   │   └── mysqlversion/
    │   │       ├── is/
    │   │       │   ├── .README.md
    │   │       │   ├── charset2collate
    │   │       │   ├── charset2collate.maria
    │   │       │   ├── collate2charset
    │   │       │   └── collate2charset.maria
    │   │       ├── mysqlversion.go
    │   │       └── mysqlversion_test.go
    │   ├── migrate_oss.go
    │   ├── migrate_oss_test.go
    │   ├── mysqlcheck/
    │   │   ├── mysqlcheck.go
    │   │   ├── mysqlcheck_oss.go
    │   │   └── mysqlcheck_test.go
    │   ├── sqlspec_oss.go
    │   ├── sqlspec_oss_test.go
    │   └── tidb.go
    ├── postgres/
    │   ├── convert.go
    │   ├── crdb_oss.go
    │   ├── diff_oss.go
    │   ├── diff_oss_test.go
    │   ├── driver_oss.go
    │   ├── driver_oss_test.go
    │   ├── inspect_oss.go
    │   ├── inspect_oss_test.go
    │   ├── internal/
    │   │   └── postgresop/
    │   │       └── postgresop.go
    │   ├── migrate_oss.go
    │   ├── migrate_oss_test.go
    │   ├── postgrescheck/
    │   │   ├── postgrescheck.go
    │   │   ├── postgrescheck_oss.go
    │   │   └── postgrescheck_test.go
    │   ├── sqlspec_oss.go
    │   └── sqlspec_oss_test.go
    ├── schema/
    │   ├── changekind_string.go
    │   ├── dsl.go
    │   ├── dsl_test.go
    │   ├── exclude_oss.go
    │   ├── inspect.go
    │   ├── migrate.go
    │   ├── migrate_test.go
    │   └── schema.go
    ├── sqlcheck/
    │   ├── condrop/
    │   │   ├── condrop.go
    │   │   └── condrop_test.go
    │   ├── datadepend/
    │   │   ├── datadepend.go
    │   │   └── datadepend_test.go
    │   ├── destructive/
    │   │   ├── destructive.go
    │   │   ├── destructive_oss.go
    │   │   └── destructive_test.go
    │   ├── incompatible/
    │   │   ├── incompatible.go
    │   │   └── incompatible_test.go
    │   └── sqlcheck.go
    ├── sqlclient/
    │   ├── client.go
    │   └── client_test.go
    ├── sqlite/
    │   ├── convert.go
    │   ├── diff.go
    │   ├── diff_test.go
    │   ├── driver.go
    │   ├── driver_oss.go
    │   ├── driver_test.go
    │   ├── inspect.go
    │   ├── inspect_test.go
    │   ├── migrate.go
    │   ├── migrate_test.go
    │   ├── sqlitecheck/
    │   │   ├── sqlitecheck.go
    │   │   ├── sqlitecheck_oss.go
    │   │   └── sqlitecheck_test.go
    │   ├── sqlspec.go
    │   └── sqlspec_test.go
    ├── sqlspec/
    │   ├── sqlspec.go
    │   └── sqlspec_test.go
    └── sqltool/
        ├── doc.go
        ├── hidden.go
        ├── hidden_windows.go
        ├── testdata/
        │   ├── dbmate/
        │   │   ├── 1_initial.sql
        │   │   └── 2_second_migration.sql
        │   ├── flyway/
        │   │   ├── B2__baseline.sql
        │   │   ├── R__views.sql
        │   │   ├── U1__initial.sql
        │   │   ├── V1__initial.sql
        │   │   ├── V2__second_migration.sql
        │   │   ├── V3__third_migration.sql
        │   │   └── v3/
        │   │       └── V3_1__fourth_migration.sql
        │   ├── golang-migrate/
        │   │   ├── 1_initial.down.sql
        │   │   ├── 1_initial.up.sql
        │   │   ├── 2_second_migration.down.sql
        │   │   └── 2_second_migration.up.sql
        │   ├── goose/
        │   │   ├── 1_initial.sql
        │   │   └── 2_second_migration.sql
        │   └── liquibase/
        │       ├── 1_initial.sql
        │       └── 2_second_migration.sql
        ├── tool.go
        └── tool_test.go

================================================
FILE CONTENTS
================================================

================================================
FILE: .github/ops/mysql/Dockerfile
================================================
ARG DIALECT=mysql:8.0

FROM $DIALECT as builder

ARG SERVER=mysqld
ENV MYSQL_ROOT_PASSWORD=pass

# Remove the last line of the entry point script, leaving the initialization code but omitting actually starting the db.
RUN sed -i 's/exec "$@"/echo "not running $@"/' /usr/local/bin/docker-entrypoint.sh
RUN /usr/local/bin/docker-entrypoint.sh ${SERVER}

FROM $DIALECT

COPY --from=builder /var/lib/mysql /var/lib/mysql


================================================
FILE: .github/workflows/cd-docker-push-cockroach_oss.yaml
================================================
name: CD - Build Docker - Cockroach - Community Edition
on:
  pull_request:
  push:
    branches:
      - master

env:
  CRDB_VERSIONS: v21.2.11 v22.1.0

jobs:
  build-services:
    runs-on: ubuntu-latest
    steps:
      - uses: actions/checkout@v4
      - uses: actions/setup-go@v5
        with:
          go-version-file: cmd/atlas/go.mod
      - name: Log in to registry
        run: echo "${{ secrets.GITHUB_TOKEN }}" | docker login ghcr.io -u $ --password-stdin
      - name: "build cockroach image"
        run: |
          VER="${{ env.CRDB_VERSIONS }}"
          for i in $VER
          do
            :
            if ! docker manifest inspect ghcr.io/ariga/cockroachdb-single-node:$i; then
              go run internal/ci/cockroach/main.go $i > internal/ci/cockroach/Dockerfile
              docker build -t ghcr.io/ariga/cockroachdb-single-node:$i internal/ci/cockroach/
              docker push ghcr.io/ariga/cockroachdb-single-node:$i
            else
              echo image already exists
            fi
          done

================================================
FILE: .github/workflows/cd-docker-push-mysql_oss.yaml
================================================
name: CD - Build Docker - MySQL Quick Boot - Community Edition
on:
  push:
    paths:
      - .github/ops/mysql/**
      - .github/workflows/cd-docker-push-mysql_oss.yaml
    branches:
      - master
  schedule:
    # Runs at 00:00 on Sunday
    - cron: '0 0 * * 0'
  workflow_dispatch:
jobs:
  push-docker:
    strategy:
      fail-fast: false
      matrix:
        include:
          - dialect: mysql:latest
          - dialect: mysql:5.6
            platforms: linux/amd64
          - dialect: mysql:5.6.35
            platforms: linux/amd64
          - dialect: mysql:5.7
            platforms: linux/amd64
          - dialect: mysql:5.7.26
            platforms: linux/amd64
          - dialect: mysql:8
          - dialect: mysql:8.0.40
          - dialect: mysql:8.4
          - dialect: mysql:8.4.0
          - dialect: mysql:8.3
          - dialect: mysql:8.3.0
          - dialect: mariadb:latest
            build-args: SERVER=mariadbd
          - dialect: mariadb:10.2
          - dialect: mariadb:10.2.32
          - dialect: mariadb:10.3
          - dialect: mariadb:10.3.13
            platforms: linux/amd64
          - dialect: mariadb:10.7
    runs-on: ubuntu-latest
    steps:
      - uses: actions/checkout@v4
      - name: Login to Docker Hub
        uses: docker/login-action@v1
        with:
          username: ${{ secrets.DOCKERHUB_USERNAME }}
          password: ${{ secrets.DOCKERHUB_TOKEN }}
      - name: Set up QEMU
        uses: docker/setup-qemu-action@v2
      - name: Set up Docker Buildx
        uses: docker/setup-buildx-action@v2
      - name: Build & Push ${{ matrix.dialect }} Docker Image
        uses: docker/build-push-action@v2
        with:
          context: .
          file: ./.github/ops/mysql/Dockerfile
          push: true
          tags: arigaio/${{ matrix.dialect }}
          platforms: ${{ matrix.platforms || 'linux/amd64,linux/arm64' }}
          build-args: |
            DIALECT=${{ matrix.dialect }}
            ${{ matrix.build-args }}


================================================
FILE: .github/workflows/ci-dialect_oss.yaml
================================================
# # # # # # # # # # # # # # # #
# CODE GENERATED - DO NOT EDIT
# # # # # # # # # # # # # # # #
name: CI - Dialect Tests - Community Edition
on:
  workflow_call:
concurrency:
  group: ${{ github.workflow }}-${{ github.head_ref || github.run_id }}-dialect
  cancel-in-progress: true
env:
  ATLAS_NO_UPGRADE_SUGGESTIONS: 1
jobs:
  integration-mysql56:
    runs-on: ubuntu-latest
    services:
      mysql56:
        image: mysql:5.6.35
        env:
          MYSQL_DATABASE: test
          MYSQL_ROOT_PASSWORD: pass
        ports:
          - 3306:3306
        options: >-
          --health-cmd "mysqladmin ping -ppass"
          --health-interval 10s
          --health-start-period 10s
          --health-timeout 5s
          --health-retries 10
    steps:
      - uses: actions/checkout@v4
      - uses: actions/setup-go@v5
        with:
          go-version-file: cmd/atlas/go.mod
      - name: Run integration tests for mysql56
        working-directory: internal/integration
        run: go test -race -count=2 -v -run="MySQL" -version="mysql56" -timeout 15m ./...
        env:
          MYSQL_DATABASE: test
          MYSQL_ROOT_PASSWORD: pass
  integration-mysql57:
    runs-on: ubuntu-latest
    services:
      mysql57:
        image: mysql:5.7.26
        env:
          MYSQL_DATABASE: test
          MYSQL_ROOT_PASSWORD: pass
        ports:
          - 3307:3306
        options: >-
          --health-cmd "mysqladmin ping -ppass"
          --health-interval 10s
          --health-start-period 10s
          --health-timeout 5s
          --health-retries 10
    steps:
      - uses: actions/checkout@v4
      - uses: actions/setup-go@v5
        with:
          go-version-file: cmd/atlas/go.mod
      - name: Run integration tests for mysql57
        working-directory: internal/integration
        run: go test -race -count=2 -v -run="MySQL" -version="mysql57" -timeout 15m ./...
        env:
          MYSQL_DATABASE: test
          MYSQL_ROOT_PASSWORD: pass
  integration-mysql8:
    runs-on: ubuntu-latest
    services:
      mysql8:
        image: mysql:8
        env:
          MYSQL_DATABASE: test
          MYSQL_ROOT_PASSWORD: pass
        ports:
          - 3308:3306
        options: >-
          --health-cmd "mysqladmin ping -ppass"
          --health-interval 10s
          --health-start-period 10s
          --health-timeout 5s
          --health-retries 10
    steps:
      - uses: actions/checkout@v4
      - uses: actions/setup-go@v5
        with:
          go-version-file: cmd/atlas/go.mod
      - name: Run integration tests for mysql8
        working-directory: internal/integration
        run: go test -race -count=2 -v -run="MySQL" -version="mysql8" -timeout 15m ./...
        env:
          MYSQL_DATABASE: test
          MYSQL_ROOT_PASSWORD: pass
  integration-maria107:
    runs-on: ubuntu-latest
    services:
      maria107:
        image: mariadb:10.7
        env:
          MYSQL_DATABASE: test
          MYSQL_ROOT_PASSWORD: pass
        ports:
          - 4306:3306
        options: >-
          --health-cmd "mysqladmin ping -ppass"
          --health-interval 10s
          --health-start-period 10s
          --health-timeout 5s
          --health-retries 10
    steps:
      - uses: actions/checkout@v4
      - uses: actions/setup-go@v5
        with:
          go-version-file: cmd/atlas/go.mod
      - name: Run integration tests for maria107
        working-directory: internal/integration
        run: go test -race -count=2 -v -run="MySQL" -version="maria107" -timeout 15m ./...
        env:
          MYSQL_DATABASE: test
          MYSQL_ROOT_PASSWORD: pass
  integration-maria102:
    runs-on: ubuntu-latest
    services:
      maria102:
        image: mariadb:10.2.32
        env:
          MYSQL_DATABASE: test
          MYSQL_ROOT_PASSWORD: pass
        ports:
          - 4307:3306
        options: >-
          --health-cmd "mysqladmin ping -ppass"
          --health-interval 10s
          --health-start-period 10s
          --health-timeout 5s
          --health-retries 10
    steps:
      - uses: actions/checkout@v4
      - uses: actions/setup-go@v5
        with:
          go-version-file: cmd/atlas/go.mod
      - name: Run integration tests for maria102
        working-directory: internal/integration
        run: go test -race -count=2 -v -run="MySQL" -version="maria102" -timeout 15m ./...
        env:
          MYSQL_DATABASE: test
          MYSQL_ROOT_PASSWORD: pass
  integration-maria103:
    runs-on: ubuntu-latest
    services:
      maria103:
        image: mariadb:10.3.13
        env:
          MYSQL_DATABASE: test
          MYSQL_ROOT_PASSWORD: pass
        ports:
          - 4308:3306
        options: >-
          --health-cmd "mysqladmin ping -ppass"
          --health-interval 10s
          --health-start-period 10s
          --health-timeout 5s
          --health-retries 10
    steps:
      - uses: actions/checkout@v4
      - uses: actions/setup-go@v5
        with:
          go-version-file: cmd/atlas/go.mod
      - name: Run integration tests for maria103
        working-directory: internal/integration
        run: go test -race -count=2 -v -run="MySQL" -version="maria103" -timeout 15m ./...
        env:
          MYSQL_DATABASE: test
          MYSQL_ROOT_PASSWORD: pass
  integration-postgres-ext-postgis:
    runs-on: ubuntu-latest
    services:
      postgres-ext-postgis:
        image: postgis/postgis:latest
        env:
          POSTGRES_DB: test
          POSTGRES_PASSWORD: pass
        ports:
          - 5429:5432
        options: >-
          --health-cmd pg_isready
          --health-interval 10s
          --health-timeout 5s
          --health-retries 5
    steps:
      - uses: actions/checkout@v4
      - uses: actions/setup-go@v5
        with:
          go-version-file: cmd/atlas/go.mod
      - name: Run integration tests for postgres-ext-postgis
        working-directory: internal/integration
        run: go test -race -count=2 -v -run="Postgres" -version="postgres-ext-postgis" -timeout 15m ./...
        env:
          POSTGRES_DB: test
          POSTGRES_PASSWORD: pass
  integration-postgres10:
    runs-on: ubuntu-latest
    services:
      postgres10:
        image: postgres:10
        env:
          POSTGRES_DB: test
          POSTGRES_PASSWORD: pass
        ports:
          - 5430:5432
        options: >-
          --health-cmd pg_isready
          --health-interval 10s
          --health-timeout 5s
          --health-retries 5
    steps:
      - uses: actions/checkout@v4
      - uses: actions/setup-go@v5
        with:
          go-version-file: cmd/atlas/go.mod
      - name: Run integration tests for postgres10
        working-directory: internal/integration
        run: go test -race -count=2 -v -run="Postgres" -version="postgres10" -timeout 15m ./...
        env:
          POSTGRES_DB: test
          POSTGRES_PASSWORD: pass
  integration-postgres11:
    runs-on: ubuntu-latest
    services:
      postgres11:
        image: postgres:11
        env:
          POSTGRES_DB: test
          POSTGRES_PASSWORD: pass
        ports:
          - 5431:5432
        options: >-
          --health-cmd pg_isready
          --health-interval 10s
          --health-timeout 5s
          --health-retries 5
    steps:
      - uses: actions/checkout@v4
      - uses: actions/setup-go@v5
        with:
          go-version-file: cmd/atlas/go.mod
      - name: Run integration tests for postgres11
        working-directory: internal/integration
        run: go test -race -count=2 -v -run="Postgres" -version="postgres11" -timeout 15m ./...
        env:
          POSTGRES_DB: test
          POSTGRES_PASSWORD: pass
  integration-postgres12:
    runs-on: ubuntu-latest
    services:
      postgres12:
        image: postgres:12.3
        env:
          POSTGRES_DB: test
          POSTGRES_PASSWORD: pass
        ports:
          - 5432:5432
        options: >-
          --health-cmd pg_isready
          --health-interval 10s
          --health-timeout 5s
          --health-retries 5
    steps:
      - uses: actions/checkout@v4
      - uses: actions/setup-go@v5
        with:
          go-version-file: cmd/atlas/go.mod
      - name: Run integration tests for postgres12
        working-directory: internal/integration
        run: go test -race -count=2 -v -run="Postgres" -version="postgres12" -timeout 15m ./...
        env:
          POSTGRES_DB: test
          POSTGRES_PASSWORD: pass
  integration-postgres13:
    runs-on: ubuntu-latest
    services:
      postgres13:
        image: postgres:13.1
        env:
          POSTGRES_DB: test
          POSTGRES_PASSWORD: pass
        ports:
          - 5433:5432
        options: >-
          --health-cmd pg_isready
          --health-interval 10s
          --health-timeout 5s
          --health-retries 5
    steps:
      - uses: actions/checkout@v4
      - uses: actions/setup-go@v5
        with:
          go-version-file: cmd/atlas/go.mod
      - name: Run integration tests for postgres13
        working-directory: internal/integration
        run: go test -race -count=2 -v -run="Postgres" -version="postgres13" -timeout 15m ./...
        env:
          POSTGRES_DB: test
          POSTGRES_PASSWORD: pass
  integration-postgres14:
    runs-on: ubuntu-latest
    services:
      postgres14:
        image: postgres:14
        env:
          POSTGRES_DB: test
          POSTGRES_PASSWORD: pass
        ports:
          - 5434:5432
        options: >-
          --health-cmd pg_isready
          --health-interval 10s
          --health-timeout 5s
          --health-retries 5
    steps:
      - uses: actions/checkout@v4
      - uses: actions/setup-go@v5
        with:
          go-version-file: cmd/atlas/go.mod
      - name: Run integration tests for postgres14
        working-directory: internal/integration
        run: go test -race -count=2 -v -run="Postgres" -version="postgres14" -timeout 15m ./...
        env:
          POSTGRES_DB: test
          POSTGRES_PASSWORD: pass
  integration-postgres15:
    runs-on: ubuntu-latest
    services:
      postgres15:
        image: postgres:15
        env:
          POSTGRES_DB: test
          POSTGRES_PASSWORD: pass
        ports:
          - 5435:5432
        options: >-
          --health-cmd pg_isready
          --health-interval 10s
          --health-timeout 5s
          --health-retries 5
    steps:
      - uses: actions/checkout@v4
      - uses: actions/setup-go@v5
        with:
          go-version-file: cmd/atlas/go.mod
      - name: Run integration tests for postgres15
        working-directory: internal/integration
        run: go test -race -count=2 -v -run="Postgres" -version="postgres15" -timeout 15m ./...
        env:
          POSTGRES_DB: test
          POSTGRES_PASSWORD: pass
  integration-sqlite:
    runs-on: ubuntu-latest
    steps:
      - uses: actions/checkout@v4
      - uses: actions/setup-go@v5
        with:
          go-version-file: cmd/atlas/go.mod
      - name: Run integration tests for sqlite
        working-directory: internal/integration
        run: go test -race -count=2 -v -run="SQLite.*" -version="sqlite" -timeout 15m ./...
  integration-tidb5:
    runs-on: ubuntu-latest
    services:
      tidb5:
        image: pingcap/tidb:v5.4.0
        ports:
          - 4309:4000
    steps:
      - uses: actions/checkout@v4
      - uses: actions/setup-go@v5
        with:
          go-version-file: cmd/atlas/go.mod
      - name: Run integration tests for tidb5
        working-directory: internal/integration
        run: go test -race -count=2 -v -run="TiDB" -version="tidb5" -timeout 15m ./...
  integration-tidb6:
    runs-on: ubuntu-latest
    services:
      tidb6:
        image: pingcap/tidb:v6.0.0
        ports:
          - 4310:4000
    steps:
      - uses: actions/checkout@v4
      - uses: actions/setup-go@v5
        with:
          go-version-file: cmd/atlas/go.mod
      - name: Run integration tests for tidb6
        working-directory: internal/integration
        run: go test -race -count=2 -v -run="TiDB" -version="tidb6" -timeout 15m ./...
  integration-cockroach:
    runs-on: ubuntu-latest
    services:
      cockroach:
        image: ghcr.io/ariga/cockroachdb-single-node:v21.2.11
        ports:
          - 26257:26257
    steps:
      - uses: actions/checkout@v4
      - uses: actions/setup-go@v5
        with:
          go-version-file: cmd/atlas/go.mod
      - name: Run integration tests for cockroach
        working-directory: internal/integration
        run: go test -race -count=2 -v -run="Cockroach" -version="cockroach" -timeout 15m ./...


================================================
FILE: .github/workflows/ci-go_oss.yaml
================================================
# # # # # # # # # # # # # # # #
# CODE GENERATED - DO NOT EDIT
# # # # # # # # # # # # # # # #
name: CI - General - Community Edition
on:
  pull_request:
    paths-ignore:
      - 'doc/**'
      - 'ops/**'
  push:
    branches:
      - master
    paths-ignore:
      - 'doc/**'
      - 'ops/**'
concurrency:
  group: ${{ github.workflow }}-${{ github.head_ref || github.run_id }}
  cancel-in-progress: true
env:
  ATLAS_NO_UPGRADE_SUGGESTIONS: 1
jobs:
  lint:
    runs-on: ubuntu-latest
    steps:
      - uses: actions/checkout@v4
      - uses: actions/setup-go@v5
        with:
          go-version-file: cmd/atlas/go.mod
      - name: Run linters
        uses: golangci/golangci-lint-action@v6
        with:
          args: --verbose

  generate-cmp:
    runs-on: ubuntu-latest
    steps:
      - uses: actions/checkout@v4
      - uses: actions/setup-go@v5
        with:
          go-version-file: cmd/atlas/go.mod
      - name: Install stringer
        run: go install golang.org/x/tools/cmd/stringer@latest
      - name: run "go generate ./..."
        run: go generate ./...
      - name: go generate cmd/atlas
        working-directory: cmd/atlas
        run: go generate ./...
      - name: Verify generated files are checked-in properly
        run: |
          status=$(git status --porcelain | grep -v "go.\(sum\|mod\)" | cat)
          if [ -n "$status" ]; then
            echo "you need to run 'go generate ./...' and commit the changes"
            echo "$status"
            exit 1
          fi
  unit:
    runs-on: ubuntu-latest
    strategy:
      matrix:
        go: [ "1.22" ]
    steps:
      - uses: actions/checkout@v4
      - uses: actions/setup-go@v5
        with:
          go-version: ${{ matrix.go }}
      - name: Run sql tests
        run: go test -race ./...
        working-directory: sql
      - name: Run schemahcl tests
        run: go test -race ./...
        working-directory: schemahcl

  cli:
    runs-on: ubuntu-latest
    steps:
      - uses: actions/checkout@v4
      - uses: actions/setup-go@v5
        with:
          go-version-file: cmd/atlas/go.mod
      - name: Run cli tests
        run: go test -race ./...
        working-directory: cmd/atlas

  integration:
    runs-on: ubuntu-latest
    steps:
      - uses: actions/checkout@v4
      - uses: actions/setup-go@v5
        with:
          go-version-file: cmd/atlas/go.mod
      - name: Run integration tests for HCL
        working-directory: internal/integration/hclsqlspec
        run: go test -race -count=2 -v ./...

  dialect-integration:
    needs: [lint, generate-cmp, unit, cli, integration]
    uses: ./.github/workflows/ci-dialect_oss.yaml
    secrets: inherit


================================================
FILE: .github/workflows/ci-revisions_oss.yaml
================================================
# # # # # # # # # # # # # # # #
# CODE GENERATED - DO NOT EDIT
# # # # # # # # # # # # # # # #
name: CI - Revisions - Community Edition
on:
  pull_request:
    paths:
      - 'cmd/atlas/internal/migrate/ent/**'
  push:
    branches:
      - master
    paths:
      - 'cmd/atlas/internal/migrate/ent/**'
concurrency:
  group: ${{ github.workflow }}-${{ github.head_ref || github.run_id }}
  cancel-in-progress: true
jobs:
  revisions:
    runs-on: ubuntu-latest
    steps:
      - uses: actions/checkout@v4
        with:
          fetch-depth: 0
      - uses: actions/setup-go@v5
        with:
          go-version-file: cmd/atlas/go.mod
      - name: Checkout origin/master
        run: git checkout origin/master
      - name: Create revisions from master
        run: go run . migrate apply --dir file://internal/cmdapi/testdata/sqlite --url sqlite://db?_fk=1
        working-directory: cmd/atlas
      - name: Checkout previous HEAD
        run: git checkout -
      - name: Migrate revisions table to HEAD
        run: go run . migrate apply --dir file://internal/cmdapi/testdata/sqlite --url sqlite://db?_fk=1
        working-directory: cmd/atlas

================================================
FILE: .github/workflows/ci-sdk.yml
================================================
name: Go SDK CI
on:
  push:
    branches:
      - master
  pull_request:
jobs:
  golangci-lint:
    runs-on: ubuntu-latest
    strategy:
      matrix:
        module: ["atlasexec", "sdk"]
    steps:
      - uses: actions/checkout@v4
      - uses: actions/setup-go@v5
        with:
          go-version-file: ./go.mod
      - name: Run Go linters
        uses: golangci/golangci-lint-action@v6
        with:
          working-directory: ${{ matrix.module }}
          args: --verbose --timeout 15m
  
  unit-tests:
    runs-on: ubuntu-latest
    strategy:
      matrix:
        module: ["atlasexec", "sdk"]
    steps:
      - uses: actions/checkout@v4
      - uses: actions/setup-go@v5
        with:
          go-version-file: ./go.mod
      - uses: ariga/setup-atlas@v0
        with:
          cloud-token: ${{ secrets.ATLAS_TOKEN }}
        env:
          ATLAS_DEBUG: "true"
      - name: Run tests
        run: go test -race ./...
        working-directory: ${{ matrix.module }}
  
  e2e-tests:
    runs-on: ubuntu-latest
    services:
      postgres:
        image: postgres
        env:
          POSTGRES_PASSWORD: pass
        ports:
          - 5432:5432
        options: >-
          --health-cmd pg_isready
          --health-interval 10s
          --health-timeout 5s
          --health-retries 5
    steps:
      - uses: actions/checkout@v4
      - uses: actions/setup-go@v5
        with:
          go-version-file: ./go.mod
      - uses: ariga/setup-atlas@v0
        with:
          cloud-token: ${{ secrets.ATLAS_TOKEN }}
        env:
          ATLAS_DEBUG: "true"
      - name: Run e2e tests
        run: go test ./internal/e2e
        working-directory: atlasexec
        env:
          ATLASEXEC_E2ETEST: "1"
          ATLASEXEC_E2ETEST_ATLAS_PATH: atlas
          ATLASEXEC_E2ETEST_POSTGRES_URL: "postgres://postgres:pass@localhost:5432/postgres?search_path=public&sslmode=disable"


================================================
FILE: .golangci.yml
================================================
run:
  timeout: 3m

issues:
  include:
    - EXC0012
  exclude:
    - G601
    - G404
    - redefines-builtin-id
  exclude-rules:
    - path: _test\.go
      linters:
        - gosec
    - path: sql/migrate/dir.go
      linters:
        - gosec
    - path: sql/mysql/inspect_oss.go
      linters:
        - gosec
    - path: sql/migrate/lex.go
      linters:
        - revive
    - path: sql/internal/sqlx/diff.go
      linters:
        - revive

linters-settings:
  goheader:
    template: |-
      Copyright 2021-present The Atlas Authors. All rights reserved.
      This source code is licensed under the Apache 2.0 license found
      in the LICENSE file in the root directory of this source tree.

linters:
  disable-all: true
  enable:
    - gosec
    - revive
    - goheader


================================================
FILE: LICENSE
================================================

                                 Apache License
                           Version 2.0, January 2004
                        http://www.apache.org/licenses/

   TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION

   1. Definitions.

      "License" shall mean the terms and conditions for use, reproduction,
      and distribution as defined by Sections 1 through 9 of this document.

      "Licensor" shall mean the copyright owner or entity authorized by
      the copyright owner that is granting the License.

      "Legal Entity" shall mean the union of the acting entity and all
      other entities that control, are controlled by, or are under common
      control with that entity. For the purposes of this definition,
      "control" means (i) the power, direct or indirect, to cause the
      direction or management of such entity, whether by contract or
      otherwise, or (ii) ownership of fifty percent (50%) or more of the
      outstanding shares, or (iii) beneficial ownership of such entity.

      "You" (or "Your") shall mean an individual or Legal Entity
      exercising permissions granted by this License.

      "Source" form shall mean the preferred form for making modifications,
      including but not limited to software source code, documentation
      source, and configuration files.

      "Object" form shall mean any form resulting from mechanical
      transformation or translation of a Source form, including but
      not limited to compiled object code, generated documentation,
      and conversions to other media types.

      "Work" shall mean the work of authorship, whether in Source or
      Object form, made available under the License, as indicated by a
      copyright notice that is included in or attached to the work
      (an example is provided in the Appendix below).

      "Derivative Works" shall mean any work, whether in Source or Object
      form, that is based on (or derived from) the Work and for which the
      editorial revisions, annotations, elaborations, or other modifications
      represent, as a whole, an original work of authorship. For the purposes
      of this License, Derivative Works shall not include works that remain
      separable from, or merely link (or bind by name) to the interfaces of,
      the Work and Derivative Works thereof.

      "Contribution" shall mean any work of authorship, including
      the original version of the Work and any modifications or additions
      to that Work or Derivative Works thereof, that is intentionally
      submitted to Licensor for inclusion in the Work by the copyright owner
      or by an individual or Legal Entity authorized to submit on behalf of
      the copyright owner. For the purposes of this definition, "submitted"
      means any form of electronic, verbal, or written communication sent
      to the Licensor or its representatives, including but not limited to
      communication on electronic mailing lists, source code control systems,
      and issue tracking systems that are managed by, or on behalf of, the
      Licensor for the purpose of discussing and improving the Work, but
      excluding communication that is conspicuously marked or otherwise
      designated in writing by the copyright owner as "Not a Contribution."

      "Contributor" shall mean Licensor and any individual or Legal Entity
      on behalf of whom a Contribution has been received by Licensor and
      subsequently incorporated within the Work.

   2. Grant of Copyright License. Subject to the terms and conditions of
      this License, each Contributor hereby grants to You a perpetual,
      worldwide, non-exclusive, no-charge, royalty-free, irrevocable
      copyright license to reproduce, prepare Derivative Works of,
      publicly display, publicly perform, sublicense, and distribute the
      Work and such Derivative Works in Source or Object form.

   3. Grant of Patent License. Subject to the terms and conditions of
      this License, each Contributor hereby grants to You a perpetual,
      worldwide, non-exclusive, no-charge, royalty-free, irrevocable
      (except as stated in this section) patent license to make, have made,
      use, offer to sell, sell, import, and otherwise transfer the Work,
      where such license applies only to those patent claims licensable
      by such Contributor that are necessarily infringed by their
      Contribution(s) alone or by combination of their Contribution(s)
      with the Work to which such Contribution(s) was submitted. If You
      institute patent litigation against any entity (including a
      cross-claim or counterclaim in a lawsuit) alleging that the Work
      or a Contribution incorporated within the Work constitutes direct
      or contributory patent infringement, then any patent licenses
      granted to You under this License for that Work shall terminate
      as of the date such litigation is filed.

   4. Redistribution. You may reproduce and distribute copies of the
      Work or Derivative Works thereof in any medium, with or without
      modifications, and in Source or Object form, provided that You
      meet the following conditions:

      (a) You must give any other recipients of the Work or
          Derivative Works a copy of this License; and

      (b) You must cause any modified files to carry prominent notices
          stating that You changed the files; and

      (c) You must retain, in the Source form of any Derivative Works
          that You distribute, all copyright, patent, trademark, and
          attribution notices from the Source form of the Work,
          excluding those notices that do not pertain to any part of
          the Derivative Works; and

      (d) If the Work includes a "NOTICE" text file as part of its
          distribution, then any Derivative Works that You distribute must
          include a readable copy of the attribution notices contained
          within such NOTICE file, excluding those notices that do not
          pertain to any part of the Derivative Works, in at least one
          of the following places: within a NOTICE text file distributed
          as part of the Derivative Works; within the Source form or
          documentation, if provided along with the Derivative Works; or,
          within a display generated by the Derivative Works, if and
          wherever such third-party notices normally appear. The contents
          of the NOTICE file are for informational purposes only and
          do not modify the License. You may add Your own attribution
          notices within Derivative Works that You distribute, alongside
          or as an addendum to the NOTICE text from the Work, provided
          that such additional attribution notices cannot be construed
          as modifying the License.

      You may add Your own copyright statement to Your modifications and
      may provide additional or different license terms and conditions
      for use, reproduction, or distribution of Your modifications, or
      for any such Derivative Works as a whole, provided Your use,
      reproduction, and distribution of the Work otherwise complies with
      the conditions stated in this License.

   5. Submission of Contributions. Unless You explicitly state otherwise,
      any Contribution intentionally submitted for inclusion in the Work
      by You to the Licensor shall be under the terms and conditions of
      this License, without any additional terms or conditions.
      Notwithstanding the above, nothing herein shall supersede or modify
      the terms of any separate license agreement you may have executed
      with Licensor regarding such Contributions.

   6. Trademarks. This License does not grant permission to use the trade
      names, trademarks, service marks, or product names of the Licensor,
      except as required for reasonable and customary use in describing the
      origin of the Work and reproducing the content of the NOTICE file.

   7. Disclaimer of Warranty. Unless required by applicable law or
      agreed to in writing, Licensor provides the Work (and each
      Contributor provides its Contributions) on an "AS IS" BASIS,
      WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
      implied, including, without limitation, any warranties or conditions
      of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
      PARTICULAR PURPOSE. You are solely responsible for determining the
      appropriateness of using or redistributing the Work and assume any
      risks associated with Your exercise of permissions under this License.

   8. Limitation of Liability. In no event and under no legal theory,
      whether in tort (including negligence), contract, or otherwise,
      unless required by applicable law (such as deliberate and grossly
      negligent acts) or agreed to in writing, shall any Contributor be
      liable to You for damages, including any direct, indirect, special,
      incidental, or consequential damages of any character arising as a
      result of this License or out of the use or inability to use the
      Work (including but not limited to damages for loss of goodwill,
      work stoppage, computer failure or malfunction, or any and all
      other commercial damages or losses), even if such Contributor
      has been advised of the possibility of such damages.

   9. Accepting Warranty or Additional Liability. While redistributing
      the Work or Derivative Works thereof, You may choose to offer,
      and charge a fee for, acceptance of support, warranty, indemnity,
      or other liability obligations and/or rights consistent with this
      License. However, in accepting such obligations, You may act only
      on Your own behalf and on Your sole responsibility, not on behalf
      of any other Contributor, and only if You agree to indemnify,
      defend, and hold each Contributor harmless for any liability
      incurred by, or claims asserted against, such Contributor by reason
      of your accepting any such warranty or additional liability.

   END OF TERMS AND CONDITIONS

   APPENDIX: How to apply the Apache License to your work.

      To apply the Apache License to your work, attach the following
      boilerplate notice, with the fields enclosed by brackets "[]"
      replaced with your own identifying information. (Don't include
      the brackets!)  The text should be enclosed in the appropriate
      comment syntax for the file format. We also recommend that a
      file or class name and description of purpose be included on the
      same "printed page" as the copyright notice for easier
      identification within third-party archives.

   Copyright [yyyy] [name of copyright owner]

   Licensed under the Apache License, Version 2.0 (the "License");
   you may not use this file except in compliance with the License.
   You may obtain a copy of the License at

       http://www.apache.org/licenses/LICENSE-2.0

   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.

================================================
FILE: README.md
================================================
# Atlas - Manage Your Database Schema as Code

[![Twitter](https://img.shields.io/twitter/url.svg?label=Follow%20%40atlasgo_io&style=social&url=https%3A%2F%2Ftwitter.com%2Fatlasgo_io)](https://twitter.com/atlasgo_io)
[![Discord](https://img.shields.io/discord/930720389120794674?label=discord&logo=discord&style=flat-square&logoColor=white)](https://discord.com/invite/zZ6sWVg6NT)

<p>
  <a href="https://atlasgo.io" target="_blank">
    <img alt="Atlas banner" src="https://github.com/ariga/atlas/assets/7413593/2e27cb81-bad6-491a-8d9c-20920995a186">
  </a>
</p>

Atlas is a language-agnostic tool for managing and migrating database schemas using modern DevOps principles.
It offers two workflows:

- **Declarative**: Similar to Terraform, Atlas compares the current state of the database to the desired state, as
  defined in an [HCL], [SQL], or [ORM] schema. Based on this comparison, it generates and executes a migration plan to
  transition the database to its desired state.

- **Versioned**: Unlike other tools, Atlas automatically plans schema migrations for you. Users can describe their desired
  database schema in [HCL], [SQL], or their chosen [ORM], and by utilizing Atlas, they can plan, lint, and apply the
  necessary migrations to the database.


## Supported Databases

[PostgreSQL](https://atlasgo.io/guides/postgres) ·
[MySQL](https://atlasgo.io/guides/mysql) ·
[MariaDB](https://atlasgo.io/guides/mysql) ·
[SQL Server](https://atlasgo.io/guides/mssql) ·
[SQLite](https://atlasgo.io/guides/sqlite) ·
[ClickHouse](https://atlasgo.io/guides/clickhouse) ·
[Redshift](https://atlasgo.io/guides/redshift) ·
[Oracle](https://atlasgo.io/guides/oracle) ·
[Snowflake](https://atlasgo.io/guides/snowflake) ·
[CockroachDB](https://atlasgo.io/guides/cockroachdb) ·
[TiDB](https://atlasgo.io/guides/mysql) ·
[Databricks](https://atlasgo.io/guides/databricks) ·
[Spanner](https://atlasgo.io/guides/spanner) ·
[Aurora DSQL](https://atlasgo.io/guides/dsql) ·
[Azure Fabric](https://atlasgo.io/guides/azure-fabric)

## Installation

**macOS + Linux:**

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

**Homebrew:**

```bash
brew install ariga/tap/atlas
```

**Docker:**

```bash
docker pull arigaio/atlas
```

**NPM:**

```bash
npx @ariga/atlas
```

See [installation docs](https://atlasgo.io/getting-started#installation) for all platforms.

## Key Features

- **[Declarative schema migrations](https://atlasgo.io/declarative/apply)**: The `atlas schema` command offers various options for [inspecting](https://atlasgo.io/inspect), diffing, comparing, [planning](https://atlasgo.io/declarative/plan) and applying migrations using standard Terraform-like workflows.
- **[Versioned migrations](https://atlasgo.io/versioned/intro)**: The `atlas migrate` command provides a state-of-the-art experience for [planning](https://atlasgo.io/versioned/diff), [linting](https://atlasgo.io/lint/analyzers), and [applying](https://atlasgo.io/versioned/apply) migrations.
- **[Schema as Code](https://atlasgo.io/atlas-schema)**: Define your desired database schema using [SQL], [HCL], or your chosen [ORM]. Atlas supports [16 ORM loaders](https://atlasgo.io/orms) across 6 languages.
- **[Security-as-Code](https://atlasgo.io/guides/postgres/security-declarative)**: Manage roles, permissions, and [row-level security](https://atlasgo.io/guides/postgres/row-level-security) policies as version-controlled code.
- **[Data management](https://atlasgo.io/atlas-schema/sql)**: Manage seed and lookup data declaratively alongside your schema.
- **[Cloud-native CI/CD](https://atlasgo.io/integrations)**: [Kubernetes operator](https://atlasgo.io/integrations/kubernetes), [Terraform provider](https://atlasgo.io/integrations/terraform), [GitHub Actions](https://atlasgo.io/integrations/github-actions), [GitLab CI](https://atlasgo.io/integrations/gitlab), [ArgoCD](https://atlasgo.io/integrations/kubernetes/argocd), and more.
- **[Testing framework](https://atlasgo.io/testing/schema)**: Unit test schema logic (functions, views, triggers, procedures) and [migration behavior](https://atlasgo.io/testing/migrate).
- **[50+ safety analyzers](https://atlasgo.io/lint/analyzers)**: Database-aware migration linting that detects destructive changes, data-dependent modifications, table locks, backward-incompatible changes, and more.
- **[Multi-tenancy](https://atlasgo.io/guides/multi-tenancy)**: Built-in support for multi-tenant database migrations.
- **[Drift detection](https://atlasgo.io/monitoring)**: Monitoring as Code with automatic schema drift detection and remediation.
- **[Cloud integration](https://atlasgo.io/guides/deploying/secrets)**: IAM-based authentication for [AWS RDS](https://atlasgo.io/guides/deploying/secrets#aws-rds-iam-authentication) and [GCP Cloud SQL](https://atlasgo.io/guides/deploying/secrets#gcp-cloudsql-iam-authentication), secrets management via [AWS Secrets Manager](https://atlasgo.io/guides/deploying/secrets#aws-secrets-manager), [GCP Secret Manager](https://atlasgo.io/guides/deploying/secrets#gcp-secret-manager), [HashiCorp Vault](https://atlasgo.io/guides/deploying/secrets#hashicorp-vault), and more.

## Getting Started

Get started with Atlas by following the [Getting Started](https://atlasgo.io/getting-started/) docs.

Inspect an existing database schema:
```shell
atlas schema inspect -u "postgres://localhost:5432/mydb"
```

Apply your desired schema to the database:
```shell
atlas schema apply \
  --url "postgres://localhost:5432/mydb" \
  --to file://schema.hcl \
  --dev-url "docker://postgres/16/dev"
```

📖 [Getting Started docs](https://atlasgo.io/getting-started/)

## Migration Linting

Atlas ships with 50+ built-in [analyzers](https://atlasgo.io/lint/analyzers) that review your migration files
and catch issues before they reach production. Analyzers detect [destructive changes](https://atlasgo.io/lint/analyzers#destructive-changes)
like dropped tables or columns, [data-dependent modifications](https://atlasgo.io/lint/analyzers#data-dependent-changes)
such as adding non-nullable columns without defaults, and database-specific risks like table locks
and table rewrites that can cause downtime on busy tables. You can also define
your own [custom policy rules](https://atlasgo.io/lint/rules).

```bash
atlas migrate lint --dev-url "docker://postgres/16/dev"
```

## Schema Testing

[Test](https://atlasgo.io/testing/schema) database logic (functions, views, triggers, procedures) and
[data migrations](https://atlasgo.io/testing/migrate) with `.test.hcl` files:

```hcl
test "schema" "postal" {
  # Valid postal codes pass
  exec {
    sql = "SELECT '12345'::us_postal_code"
  }
  # Invalid postal codes fail
  catch {
    sql = "SELECT 'hello'::us_postal_code"
  }
}

test "schema" "seed" {
  for_each = [
    {input: "hello", expected: "HELLO"},
    {input: "world", expected: "WORLD"},
  ]
  exec {
    sql    = "SELECT upper('${each.value.input}')"
    output = each.value.expected
  }
}
```

```bash
atlas schema test --dev-url "docker://postgres/16/dev"
```

📖 [Testing docs](https://atlasgo.io/testing/schema)

## Security-as-Code

Manage database [roles, permissions](https://atlasgo.io/guides/postgres/security-declarative), and
[row-level security](https://atlasgo.io/guides/postgres/row-level-security) as version-controlled code:

```hcl
role "app_readonly" {
  comment = "Read-only access for reporting"
}

role "app_writer" {
  comment   = "Read-write access for the application"
  member_of = [role.app_readonly]
}

user "api_user" {
  password   = var.api_password
  conn_limit = 20
  comment    = "Application API service account"
  member_of  = [role.app_writer]
}

permission {
  for_each   = [table.orders, table.products, table.users]
  for        = each.value
  to         = role.app_readonly
  privileges = [SELECT]
}

policy "tenant_isolation" {
  on    = table.orders
  for   = ALL
  to    = ["app_writer"]
  using = "(tenant_id = current_setting('app.current_tenant')::integer)"
  check = "(tenant_id = current_setting('app.current_tenant')::integer)"
}
```

📖 [Security-as-Code docs](https://atlasgo.io/guides/postgres/security-declarative)

## Data Management

Manage seed and lookup data declaratively alongside your schema:

```sql
CREATE TABLE countries (
  id INT PRIMARY KEY,
  code VARCHAR(2) NOT NULL,
  name VARCHAR(100) NOT NULL
);

INSERT INTO countries (id, code, name) VALUES
  (1, 'US', 'United States'),
  (2, 'IL', 'Israel'),
  (3, 'DE', 'Germany');
```

📖 [Data management docs](https://atlasgo.io/atlas-schema/sql)

## ORM Support

Define your schema in any of the 16 supported ORMs. Atlas reads your models and generates migrations:

| Language | ORMs |
|----------|------|
| Go | [GORM](https://atlasgo.io/guides/orms/gorm), [Ent](https://atlasgo.io/guides/orms/ent), [Bun](https://atlasgo.io/guides/orms/bun), [Beego](https://atlasgo.io/guides/orms/beego), [sqlc](https://atlasgo.io/guides/frameworks/sqlc-versioned) |
| TypeScript | [Prisma](https://atlasgo.io/guides/orms/prisma), [Drizzle](https://atlasgo.io/guides/orms/drizzle), [TypeORM](https://atlasgo.io/guides/orms/typeorm), [Sequelize](https://atlasgo.io/guides/orms/sequelize) |
| Python | [Django](https://atlasgo.io/guides/orms/django), [SQLAlchemy](https://atlasgo.io/guides/orms/sqlalchemy) |
| Java | [Hibernate](https://atlasgo.io/guides/orms/hibernate) |
| .NET | [EF Core](https://atlasgo.io/guides/orms/efcore) |
| PHP | [Doctrine](https://atlasgo.io/guides/orms/doctrine) |

📖 [ORM integration docs](https://atlasgo.io/orms)

## Integrations

Lint, test, and apply migrations automatically in your CI/CD pipeline or infrastructure-as-code workflow:

| Integration | Docs |
|-------------|------|
| GitHub Actions | [Versioned guide](https://atlasgo.io/guides/ci-platforms/github-versioned) · [Declarative guide](https://atlasgo.io/guides/ci-platforms/github-declarative) |
| GitLab CI | [Versioned guide](https://atlasgo.io/guides/ci-platforms/gitlab-versioned) · [Declarative guide](https://atlasgo.io/guides/ci-platforms/gitlab-declarative) |
| CircleCI | [Versioned guide](https://atlasgo.io/guides/ci-platforms/circleci-versioned) · [Declarative guide](https://atlasgo.io/guides/ci-platforms/circleci-declarative) |
| Bitbucket Pipes | [Versioned guide](https://atlasgo.io/guides/ci-platforms/bitbucket-versioned) · [Declarative guide](https://atlasgo.io/guides/ci-platforms/bitbucket-declarative) |
| Azure DevOps | [GitHub repos](https://atlasgo.io/guides/ci-platforms/azure-devops-github) · [Azure repos](https://atlasgo.io/guides/ci-platforms/azure-devops-repos) |
| Terraform Provider | [atlasgo.io/integrations/terraform-provider](https://atlasgo.io/integrations/terraform-provider) |
| Kubernetes Operator | [atlasgo.io/integrations/kubernetes](https://atlasgo.io/integrations/kubernetes) |
| ArgoCD | [atlasgo.io/guides/deploying/k8s-argo](https://atlasgo.io/guides/deploying/k8s-argo) |
| Flux | [atlasgo.io/guides/deploying/k8s-flux](https://atlasgo.io/guides/deploying/k8s-flux) |
| Crossplane | [atlasgo.io/guides/deploying/crossplane](https://atlasgo.io/guides/deploying/crossplane) |
| Go SDK | [pkg.go.dev/ariga.io/atlas-go-sdk/atlasexec](https://pkg.go.dev/ariga.io/atlas-go-sdk/atlasexec) |

### AI Agent Integration

Atlas provides [Agent Skills](https://atlasgo.io/guides/ai-tools/agent-skills), an open standard for packaging
migration expertise for AI coding assistants:
[Claude Code](https://atlasgo.io/guides/ai-tools/claude-code-instructions),
[GitHub Copilot](https://atlasgo.io/guides/ai-tools/github-copilot-instructions),
[Cursor](https://atlasgo.io/guides/ai-tools/cursor-rules),
[OpenAI Codex](https://atlasgo.io/guides/ai-tools/codex-instructions). Learn more at [AI tools docs](https://atlasgo.io/guides/ai-tools).

## CLI Usage

### `schema inspect`

_**Easily inspect your database schema by providing a database URL and convert it to HCL, JSON, SQL, ERD, or other formats.**_

Inspect a specific MySQL schema and get its representation in Atlas DDL syntax:
```shell
atlas schema inspect -u "mysql://root:pass@localhost:3306/example" > schema.hcl
```

<details><summary>Result</summary>

```hcl
table "users" {
  schema = schema.example
  column "id" {
    null = false
    type = int
  }
  ...
}
```
</details>

Inspect the entire MySQL database and get its JSON representation:
```shell
atlas schema inspect \
  --url "mysql://root:pass@localhost:3306/" \
  --format '{{ json . }}' | jq
```

<details><summary>Result</summary>

```json
{
  "schemas": [
    {
      "name": "example",
      "tables": [
        {
          "name": "users",
          "columns": [
            ...
          ]
        }
      ]
    }
  ]
}
```
</details>

Inspect a specific PostgreSQL schema and get its ERD representation in Mermaid syntax:
```shell
atlas schema inspect \
  --url "postgres://root:pass@:5432/test?search_path=public&sslmode=disable" \
  --format '{{ mermaid . }}'
```

```mermaid
erDiagram
    users {
      int id PK
      varchar name
    }
    blog_posts {
      int id PK
      varchar title
      text body
      int author_id FK
    }
    blog_posts }o--o| users : author_fk
```

Use the [split format](https://atlasgo.io/inspect/database-to-code) for one-file-per-object output:

```bash
atlas schema inspect -u '<url>' --format '{{ sql . | split | write }}'
```

```
├── schemas
│   └── public
│       ├── public.sql
│       ├── tables
│       │   ├── profiles.sql
│       │   └── users.sql
│       ├── functions
│       └── types
└── main.sql
```

📖 [Schema inspection docs](https://atlasgo.io/inspect)

### `schema diff`

_**Compare two schema states and get a migration plan to transform one into the other. A state can be specified using a
database URL, HCL, SQL, or ORM schema, or a migration directory.**_

```shell
atlas schema diff \
  --from "postgres://postgres:pass@:5432/test?search_path=public&sslmode=disable" \
  --to file://schema.hcl \
  --dev-url "docker://postgres/15/test"
```

📖 [Declarative workflow docs](https://atlasgo.io/declarative/apply)

### `schema apply`

_**Generate a migration plan and apply it to the database to bring it to the desired state. The desired state can be
specified using a database URL, HCL, SQL, or ORM schema, or a migration directory.**_

```shell
atlas schema apply \
  --url mysql://root:pass@:3306/db1 \
  --to file://schema.hcl \
  --dev-url docker://mysql/8/db1
```

<details><summary>Result</summary>

```shell
-- Planned Changes:
-- Modify "users" table
ALTER TABLE `db1`.`users` DROP COLUMN `d`, ADD COLUMN `c` int NOT NULL;
Use the arrow keys to navigate: ↓ ↑ → ←
? Are you sure?:
  ▸ Apply
    Abort
```
</details>

📖 [Declarative workflow docs](https://atlasgo.io/declarative/apply)

### `migrate diff`

_**Write a new migration file to the migration directory that brings it to the desired state. The desired state can be
specified using a database URL, HCL, SQL, or ORM schema, or a migration directory.**_

```shell
atlas migrate diff add_blog_posts \
  --dir file://migrations \
  --to file://schema.hcl \
  --dev-url docker://mysql/8/test
```

📖 [Versioned workflow docs](https://atlasgo.io/versioned/diff)

### `migrate apply`

_**Apply all or part of pending migration files in the migration directory on the database.**_

```shell
atlas migrate apply \
  --url mysql://root:pass@:3306/db1 \
  --dir file://migrations
```

📖 [Versioned workflow docs](https://atlasgo.io/versioned/apply)

## Supported Version Policy

To ensure the best performance, security and compatibility with the Atlas Cloud service, the Atlas team
will only support the two most recent minor versions of the CLI. For example, if the latest version is
`v0.25`, the supported versions will be `v0.24` and `v0.25` (in addition to any patch releases and the
"canary" release which is built twice a day).


## Community

[Documentation](https://atlasgo.io/getting-started) ·
[Discord](https://discord.com/invite/zZ6sWVg6NT) ·
[Twitter](https://twitter.com/atlasgo_io)

[HCL]: https://atlasgo.io/atlas-schema/hcl
[SQL]: https://atlasgo.io/atlas-schema/sql
[ORM]: https://atlasgo.io/orms


================================================
FILE: atlasexec/README.md
================================================
# Atlas SDK for Go

[![Go Reference](https://pkg.go.dev/badge/ariga.io/atlas-go-sdk/atlasexec.svg)](https://pkg.go.dev/ariga.io/atlas@master/atlasexec)

An SDK for building ariga/atlas providers in Go.

## Installation

```bash
go get -u ariga.io/atlas@master
```

## How to use

To use the SDK, you need to create a new client with your `migrations` folder and the `atlas` binary path.

```go
package main

import (
    ...
    "ariga.io/atlas/atlasexec"
)

func main() {
    // Create a new client
    client, err := atlasexec.NewClient("my-migration-folder", "my-atlas-cli-path")
    if err != nil {
        log.Fatalf("failed to create client: %v", err)
    }
}
```

## APIs

For more information, refer to the documentation available at [GoDoc](https://pkg.go.dev/ariga.io/atlas@master/atlasexec#Client)

================================================
FILE: atlasexec/atlas.go
================================================
// Copyright 2021-present The Atlas Authors. All rights reserved.
// This source code is licensed under the Apache 2.0 license found
// in the LICENSE file in the root directory of this source tree.

package atlasexec

import (
	"bufio"
	"bytes"
	"context"
	"encoding/json"
	"errors"
	"fmt"
	"io"
	"maps"
	"os"
	"os/exec"
	"reflect"
	"regexp"
	"slices"
	"strings"
	"sync"
)

type (
	// Client is a client for the Atlas CLI.
	Client struct {
		execPath   string
		workingDir string
		env        Environ
		stdout     io.Writer
		stderr     io.Writer
	}
	// LoginParams are the parameters for the `login` command.
	LoginParams struct {
		Token     string
		GrantOnly bool // If true, runs `atlas login --grant-only` for offline token flow.
	}
	// WhoAmIParams are the parameters for the `whoami` command
	WhoAmIParams struct {
		ConfigURL string
		Env       string
		Vars      VarArgs
	}
	// WhoAmI contains the result of an 'atlas whoami' run.
	WhoAmI struct {
		Org string `json:"Org,omitempty"`
	}
	// Version contains the result of an 'atlas version' run.
	Version struct {
		Version string `json:"Version"`
		SHA     string `json:"SHA,omitempty"`
		Canary  bool   `json:"Canary,omitempty"`
	}
	// VarArgs is a map of variables for the command.
	VarArgs interface {
		// AsArgs returns the variables as arguments.
		AsArgs() []string
	}
	// Vars2 is a map of variables for the command.
	// It supports multiple values for the same key (list).
	Vars2 map[string]any
	// Environ is a map of environment variables.
	Environ map[string]string
	// RunContext is an input type for describing the context of where the
	// command is triggered from. For example, a GitHub Action on the master branch.
	RunContext struct {
		Repo     string  `json:"repo,omitempty"`
		Path     string  `json:"path,omitempty"`
		Branch   string  `json:"branch,omitempty"`
		Commit   string  `json:"commit,omitempty"`
		URL      string  `json:"url,omitempty"`
		Username string  `json:"username,omitempty"` // The username that triggered the event that initiated the command.
		UserID   string  `json:"userID,omitempty"`   // The user ID that triggered the event that initiated the command.
		SCMType  SCMType `json:"scmType,omitempty"`  // Source control management system type.
	}
	// SCMType is a type for the "scm_type" enum field.
	SCMType string
	// DeployRunContext is an input type for describing the context in which
	// `migrate-apply` and `migrate down` were used. For example, a GitHub Action with version v1.2.3
	DeployRunContext struct {
		TriggerType    TriggerType `json:"triggerType,omitempty"`
		TriggerVersion string      `json:"triggerVersion,omitempty"`
	}
	// TriggerType defines the type for the "trigger_type" enum field.
	TriggerType string
	// Vars is a map of variables for the command.
	//
	// Deprecated: Use Vars2 instead.
	Vars map[string]string
)

// TriggerType values.
const (
	TriggerTypeCLI          TriggerType = "CLI"
	TriggerTypeKubernetes   TriggerType = "KUBERNETES"
	TriggerTypeTerraform    TriggerType = "TERRAFORM"
	TriggerTypeGithubAction TriggerType = "GITHUB_ACTION"
	TriggerTypeCircleCIOrb  TriggerType = "CIRCLECI_ORB"
	TriggerTypeGitlab       TriggerType = "GITLAB"
	TriggerTypeBitbucket    TriggerType = "BITBUCKET"
	TriggerTypeAzureDevOps  TriggerType = "AZURE_DEVOPS"
)

// SCMType values.
const (
	SCMTypeGithub      SCMType = "GITHUB"
	SCMTypeGitlab      SCMType = "GITLAB"
	SCMTypeBitbucket   SCMType = "BITBUCKET"
	SCMTypeAzureDevOps SCMType = "AZURE_DEVOPS"
)

// ExecutionOrder values.
const (
	ExecOrderLinear     MigrateExecOrder = "linear" // Default
	ExecOrderLinearSkip MigrateExecOrder = "linear-skip"
	ExecOrderNonLinear  MigrateExecOrder = "non-linear"
)

// NewClient returns a new Atlas client with the given atlas-cli path.
func NewClient(workingDir, execPath string) (_ *Client, err error) {
	if execPath == "" {
		return nil, fmt.Errorf("execPath cannot be empty")
	} else if execPath, err = exec.LookPath(execPath); err != nil {
		return nil, fmt.Errorf("looking up atlas-cli: %w", err)
	}
	if workingDir != "" {
		_, err := os.Stat(workingDir)
		if err != nil {
			return nil, fmt.Errorf("initializing Atlas with working dir %q: %w", workingDir, err)
		}
	}
	return &Client{
		execPath:   execPath,
		workingDir: workingDir,
	}, nil
}

// WithWorkDir creates a new client with the given working directory.
// It is useful to run multiple commands in the multiple directories.
//
// Example:
//
//	client := atlasexec.NewClient("", "atlas")
//	err := client.WithWorkDir("dir1", func(c *atlasexec.Client) error {
//	  _, err := c.MigrateApply(ctx, &atlasexec.MigrateApplyParams{
//	  })
//	  return err
//	})
func (c *Client) WithWorkDir(dir string, fn func(*Client) error) error {
	wd := c.workingDir
	defer func() { c.workingDir = wd }()
	c.workingDir = dir
	return fn(c)
}

// SetEnv allows we override the environment variables for the atlas-cli.
// To append new environment variables to environment from OS, use NewOSEnviron() then add new variables.
func (c *Client) SetEnv(env map[string]string) error {
	for k := range env {
		if _, ok := defaultEnvs[k]; ok {
			return fmt.Errorf("atlasexec: cannot override the default environment variable %q", k)
		}
	}
	c.env = env
	return nil
}

// SetStdout specifies a writer to stream stdout to for every command.
func (c *Client) SetStdout(w io.Writer) {
	c.stdout = w
}

// SetStderr specifies a writer to stream stderr to for every command.
func (c *Client) SetStderr(w io.Writer) {
	c.stderr = w
}

// Login runs the 'login' command.
func (c *Client) Login(ctx context.Context, params *LoginParams) error {
	if params.Token == "" {
		return errors.New("token cannot be empty")
	}
	args := []string{"login", "--token", params.Token}
	if params.GrantOnly {
		args = append(args, "--grant-only")
	}
	_, err := c.runCommand(ctx, args)
	return err
}

// Logout runs the 'logout' command.
func (c *Client) Logout(ctx context.Context) error {
	_, err := c.runCommand(ctx, []string{"logout"})
	return err
}

// WhoAmI runs the 'whoami' command.
func (c *Client) WhoAmI(ctx context.Context, params *WhoAmIParams) (*WhoAmI, error) {
	args := []string{"whoami", "--format", "{{ json . }}"}
	// Global flags
	if params.ConfigURL != "" {
		args = append(args, "--config", params.ConfigURL)
	}
	if params.Env != "" {
		args = append(args, "--env", params.Env)
	}
	if params.Vars != nil {
		args = append(args, params.Vars.AsArgs()...)
	}
	return firstResult(jsonDecode[WhoAmI](c.runCommand(ctx, args)))
}

var reVersion = regexp.MustCompile(`^atlas version v(\d+\.\d+.\d+)-?([a-z0-9]*)?`)

// Version runs the 'version' command.
func (c *Client) Version(ctx context.Context) (*Version, error) {
	r, err := c.runCommand(ctx, []string{"version"})
	if err != nil {
		return nil, err
	}
	out, err := io.ReadAll(r)
	if err != nil {
		return nil, err
	}
	v := reVersion.FindSubmatch(out)
	if v == nil {
		return nil, errors.New("unexpected output format")
	}
	var sha string
	if len(v) > 2 {
		sha = string(v[2])
	}
	return &Version{
		Version: string(v[1]),
		SHA:     sha,
		Canary:  strings.Contains(string(out), "canary"),
	}, nil
}

// var reVersion = regexp.MustCompile(`^atlas version v(\d+\.\d+.\d+)-?([a-z0-9]*)?`)
func (v Version) String() string {
	var b strings.Builder
	fmt.Fprintf(&b, "atlas version v%s", v.Version)
	if v.SHA != "" {
		fmt.Fprintf(&b, "-%s", v.SHA)
	}
	if v.Canary {
		b.WriteString("-canary")
	}
	return b.String()
}

// NewOSEnviron returns the current environment variables from the OS.
func NewOSEnviron() Environ {
	env := map[string]string{}
	for _, ev := range os.Environ() {
		parts := strings.SplitN(ev, "=", 2)
		if len(parts) == 0 {
			continue
		}
		k := parts[0]
		v := ""
		if len(parts) == 2 {
			v = parts[1]
		}
		env[k] = v
	}
	return env
}

// ToSlice converts the environment variables to a slice.
func (e Environ) ToSlice() []string {
	env := make([]string, 0, len(e))
	for k, v := range e {
		env = append(env, k+"="+v)
	}
	// Ensure the order of the envs.
	slices.Sort(env)
	return env
}

var defaultEnvs = map[string]string{
	// Disable the update notifier and upgrade suggestions.
	"ATLAS_NO_UPDATE_NOTIFIER":     "1",
	"ATLAS_NO_UPGRADE_SUGGESTIONS": "1",
}

// ErrRequireLogin is returned when a command requires the user to be logged in.
// It exists here to be shared between the different packages that require login.
var ErrRequireLogin = errors.New("command requires 'atlas login'")

// runCommand runs the given command and returns its output.
func (c *Client) runCommand(ctx context.Context, args []string) (io.Reader, error) {
	var stdout, stderr bytes.Buffer
	cmd := c.cmd(ctx, args)
	cmd.Stdout = mergeWriters(&stdout, c.stdout)
	cmd.Stderr = mergeWriters(&stderr, c.stderr)
	if err := c.runErr(cmd.Run(), &stdout, &stderr); err != nil {
		return nil, err
	}
	return &stdout, nil
}

// Stream is an interface for reading a stream of items.
type Stream[T any] interface {
	// Next reads the next item from the stream, making it available by calling Current.
	// It returns false if there are no more items and the stream is closed.
	Next() bool
	// Current returns the current item from the stream.
	Current() (T, error)
	// Err returns the error, if any, that occurred while reading the stream.
	Err() error
}

// runCommandStream runs the given command streams its output split by new-lines.
func (c *Client) runCommandStream(ctx context.Context, args []string) (Stream[string], error) {
	cmd := c.cmd(ctx, args)
	var stderr bytes.Buffer
	cmd.Stderr = mergeWriters(&stderr, c.stderr)
	out, err := cmd.StdoutPipe()
	if err != nil {
		return nil, fmt.Errorf("creating stdout pipe: %w", err)
	}
	if err = cmd.Start(); err != nil {
		return nil, fmt.Errorf("starting command: %w", err)
	}
	var (
		scan   = bufio.NewScanner(out)
		buf    = strings.Builder{}
		ch     = make(chan string)
		s      = &stream{ch: ch}
		stdout = mergeWriters(&buf, c.stdout)
	)
	go func() {
		defer close(ch)
		for scan.Scan() {
			stdout.Write(scan.Bytes())
			ch <- scan.Text()
		}
		s.lock.Lock()
		defer s.lock.Unlock()
		s.err = c.runErr(cmd.Wait(), &buf, &stderr)
	}()
	return s, nil
}

func (c *Client) cmd(ctx context.Context, args []string) *exec.Cmd {
	cmd := exec.CommandContext(ctx, c.execPath, args...) //nolint:gosec
	cmd.Dir = c.workingDir
	var env Environ
	if c.env == nil {
		// Initialize the environment variables from the OS.
		env = NewOSEnviron()
	} else {
		env = maps.Clone(c.env)
	}
	maps.Copy(env, defaultEnvs)
	cmd.Env = env.ToSlice()
	return cmd
}

func (c *Client) runErr(err error, stdout, stderr interface{ String() string }) error {
	if err == nil {
		return nil
	}
	e := strings.TrimSpace(stderr.String())
	// Explicit check the stderr for the login error.
	if e == "Error: command requires 'atlas login'" {
		return ErrRequireLogin
	}
	return &Error{
		err:    err,
		Stderr: strings.TrimSpace(stderr.String()),
		Stdout: strings.TrimSpace(stdout.String()),
	}
}

type stream struct {
	ch   chan string
	cur  string
	err  error
	lock sync.RWMutex
}

// Next advances the stream to the next item.
func (s *stream) Next() bool {
	s.lock.RLock()
	if s.err != nil || s.ch == nil {
		s.lock.RUnlock()
		return false
	}
	s.lock.RUnlock()
	r, ok := <-s.ch
	if !ok {
		return false
	}
	s.cur = r
	return true
}

// Current returns the current item from the stream.
func (s *stream) Current() (string, error) {
	s.lock.RLock()
	defer s.lock.RUnlock()
	if s.err != nil {
		return "", s.err
	}
	return s.cur, nil
}

// Err returns the error, if any, that occurred while reading the stream.
func (s *stream) Err() error {
	s.lock.RLock()
	defer s.lock.RUnlock()
	return s.err
}

var _ Stream[string] = (*stream)(nil)

func mergeWriters(writers ...io.Writer) io.Writer {
	var compact []io.Writer
	for _, w := range writers {
		if w != nil {
			compact = append(compact, w)
		}
	}
	switch len(compact) {
	case 1:
		return compact[0]
	case 0:
		return io.Discard
	default:
		return io.MultiWriter(compact...)
	}
}

// Error is an error returned by the atlasexec package,
// when it executes the atlas-cli command.
type Error struct {
	err    error  // The underlying error.
	Stdout string // Stdout of the command.
	Stderr string // Stderr of the command.
}

// Error implements the error interface.
func (e *Error) Error() string {
	if e.Stderr != "" {
		return e.Stderr
	}
	return e.Stdout
}

// ExitCode returns the exit code of the command.
// If the error is not an exec.ExitError, it returns 1.
func (e *Error) ExitCode() int {
	var exitErr *exec.ExitError
	if errors.As(e.err, &exitErr) {
		return exitErr.ExitCode()
	}
	// Not an exec.ExitError or nil.
	// Return the system default exit code.
	return new(exec.ExitError).ExitCode()
}

// Unwrap returns the underlying error.
func (e *Error) Unwrap() error {
	return e.err
}

// TempFile creates a temporary file with the given content and extension.
func TempFile(content, ext string) (string, func() error, error) {
	f, err := os.CreateTemp("", "atlasexec-*."+ext)
	if err != nil {
		return "", nil, err
	}
	defer f.Close()
	_, err = f.WriteString(content)
	if err != nil {
		return "", nil, err
	}
	return fmt.Sprintf("file://%s", f.Name()), func() error {
		return os.Remove(f.Name())
	}, nil
}

// AsArgs returns the variables as arguments.
func (v Vars2) AsArgs() []string {
	keys := make([]string, 0, len(v))
	for k := range v {
		keys = append(keys, k)
	}
	slices.Sort(keys)
	var args []string
	for _, k := range keys {
		switch reflect.TypeOf(v[k]).Kind() {
		case reflect.Slice, reflect.Array:
			ev := reflect.ValueOf(v[k])
			for i := range ev.Len() {
				args = append(args, "--var", fmt.Sprintf("%s=%v", k, ev.Index(i)))
			}
		default:
			args = append(args, "--var", fmt.Sprintf("%s=%v", k, v[k]))
		}
	}
	return args
}

// AsArgs returns the variables as arguments.
func (v Vars) AsArgs() []string {
	var args []string
	for k, v := range v {
		args = append(args, "--var", fmt.Sprintf("%s=%s", k, v))
	}
	return args
}

func stringVal(r io.Reader, err error) (string, error) {
	if err != nil {
		return "", err
	}
	s, err := io.ReadAll(r)
	if err != nil {
		return "", err
	}
	return string(s), nil
}

func jsonDecode[T any](r io.Reader, err error) ([]*T, error) {
	if err != nil {
		return nil, err
	}
	buf, err := io.ReadAll(r)
	if err != nil {
		return nil, err
	}
	var dst []*T
	dec := json.NewDecoder(bytes.NewReader(buf))
	for {
		var m T
		switch err := dec.Decode(&m); err {
		case io.EOF:
			return dst, nil
		case nil:
			dst = append(dst, &m)
		default:
			return nil, &Error{
				err:    fmt.Errorf("decoding JSON from stdout: %w", err),
				Stdout: string(buf),
			}
		}
	}
}

func jsonDecodeErr[T any](fn func([]*T, string) error) func(io.Reader, error) ([]*T, error) {
	return func(r io.Reader, err error) ([]*T, error) {
		if err != nil {
			if cliErr := (&Error{}); errors.As(err, &cliErr) && cliErr.Stdout != "" {
				d, err := jsonDecode[T](strings.NewReader(cliErr.Stdout), nil)
				if err == nil {
					return nil, fn(d, cliErr.Stderr)
				}
				// If the error is not a JSON, return the original error.
			}
			return nil, err
		}
		return jsonDecode[T](r, err)
	}
}

// repeatFlag repeats the flag for each value.
func repeatFlag(flag string, values []string) []string {
	if len(values) == 0 {
		return nil
	}
	out := make([]string, 0, len(values)*2)
	for _, v := range values {
		out = append(out, flag, v)
	}
	return out
}

func listString(args []string) string {
	return strings.Join(args, ",")
}

func firstResult[T ~[]E, E any](r T, err error) (e E, _ error) {
	switch {
	case err != nil:
		return e, err
	case len(r) == 1:
		return r[0], nil
	default:
		return e, errors.New("The command returned more than one result, use Slice function instead")
	}
}

func last[A ~[]E, E any](a A) (_ E) {
	if l := len(a); l > 0 {
		return a[l-1]
	}
	return
}


================================================
FILE: atlasexec/atlas_internal_test.go
================================================
// Copyright 2021-present The Atlas Authors. All rights reserved.
// This source code is licensed under the Apache 2.0 license found
// in the LICENSE file in the root directory of this source tree.

package atlasexec

import (
	"context"
	"io"
	"testing"

	"github.com/stretchr/testify/require"
)

func TestEnv(t *testing.T) {
	// printenv is a simple command that prints all environment variables
	c, err := NewClient(t.TempDir(), "printenv")
	require.NoError(t, err)

	// Should not be able to override the default environment variable
	require.ErrorContains(t, c.SetEnv(map[string]string{
		"FOO":                      "bar",
		"ATLAS_NO_UPDATE_NOTIFIER": "0",
	}), "cannot override the default environment variable")

	// Should be able to set new environment variables
	require.NoError(t, c.SetEnv(map[string]string{
		"FOO": "bar",
		"BAZ": "qux",
	}))

	// Invoke the command and check the environment variables
	v, err := c.runCommand(context.Background(), nil)
	require.NoError(t, err)
	raw, err := io.ReadAll(v)
	require.NoError(t, err)
	require.Equal(t, `ATLAS_NO_UPDATE_NOTIFIER=1
ATLAS_NO_UPGRADE_SUGGESTIONS=1
BAZ=qux
FOO=bar
`, string(raw))
}


================================================
FILE: atlasexec/atlas_migrate.go
================================================
// Copyright 2021-present The Atlas Authors. All rights reserved.
// This source code is licensed under the Apache 2.0 license found
// in the LICENSE file in the root directory of this source tree.

package atlasexec

import (
	"context"
	"encoding/json"
	"errors"
	"fmt"
	"io"
	"strconv"
	"strings"
	"time"
)

type (
	// MigrateApplyParams are the parameters for the `migrate apply` command.
	MigrateApplyParams struct {
		ConfigURL string
		Env       string
		Vars      VarArgs
		Context   *DeployRunContext
		DirURL    string

		URL             string
		RevisionsSchema string
		BaselineVersion string
		TxMode          string
		ExecOrder       MigrateExecOrder
		Amount          uint64
		ToVersion       string
		AllowDirty      bool
		DryRun          bool
		LockName        string
	}
	// MigrateApply contains a summary of a migration applying attempt on a database.
	MigrateApply struct {
		Env
		Pending []File         `json:"Pending,omitempty"` // Pending migration files
		Applied []*AppliedFile `json:"Applied,omitempty"` // Applied files
		Current string         `json:"Current,omitempty"` // Current migration version
		Target  string         `json:"Target,omitempty"`  // Target migration version
		Start   time.Time
		End     time.Time
		// Error is set even then, if it was not caused by a statement in a migration file,
		// but by Atlas, e.g. when committing or rolling back a transaction.
		Error string `json:"Error,omitempty"`
	}
	// MigrateApplyError is returned when an error occurred
	// during a migration applying attempt.
	MigrateApplyError struct {
		Result []*MigrateApply
		Stderr string
	}
	// MigrateExecOrder define how Atlas computes and executes pending migration files to the database.
	// See: https://atlasgo.io/versioned/apply#execution-order
	MigrateExecOrder string
	// MigrateDownParams are the parameters for the `migrate down` command.
	MigrateDownParams struct {
		ConfigURL string
		Env       string
		Vars      VarArgs
		Context   *DeployRunContext
		DevURL    string

		DirURL          string
		URL             string
		RevisionsSchema string
		Amount          uint64
		ToVersion       string
		ToTag           string

		// Not yet supported
		// DryRun          bool
		// TxMode          string
	}
	// MigrateDown contains a summary of a migration down attempt on a database.
	MigrateDown struct {
		Planned  []File          `json:"Planned,omitempty"`  // Planned migration files
		Reverted []*RevertedFile `json:"Reverted,omitempty"` // Reverted files
		Current  string          `json:"Current,omitempty"`  // Current migration version
		Target   string          `json:"Target,omitempty"`   // Target migration version
		Total    int             `json:"Total,omitempty"`    // Total number of migrations to revert
		Start    time.Time
		End      time.Time
		// URL and Status are set only when the migration is planned or executed in the cloud.
		URL    string `json:"URL,omitempty"`
		Status string `json:"Status,omitempty"`
		// Error is set even then, if it was not caused by a statement in a migration file,
		// but by Atlas, e.g. when committing or rolling back a transaction.
		Error string `json:"Error,omitempty"`
	}
	// MigratePushParams are the parameters for the `migrate push` command.
	MigratePushParams struct {
		ConfigURL string
		Env       string
		Vars      VarArgs
		Context   *RunContext
		DevURL    string

		Name        string
		Tag         string
		DirURL      string
		DirFormat   string
		LockTimeout string
	}
	// MigrateLintParams are the parameters for the `migrate lint` command.
	MigrateLintParams struct {
		ConfigURL string
		Env       string
		Vars      VarArgs
		Context   *RunContext
		Format    string
		DevURL    string
		GitBase   string
		GitDir    string

		DirURL string
		Latest uint64
		Writer io.Writer
		Base   string
		Web    bool
	}
	// MigrateHashParams are the parameters for the `migrate hash` command.
	MigrateHashParams struct {
		ConfigURL string
		Env       string
		Vars      VarArgs

		DirURL    string
		DirFormat string
	}
	// MigrateRebaseParams are the parameters for the `migrate rebase` command.
	MigrateRebaseParams struct {
		ConfigURL string
		Env       string
		Vars      VarArgs

		DirURL string
		Files  []string
	}
	// MigrateTestParams are the parameters for the `migrate test` command.
	MigrateTestParams struct {
		ConfigURL string
		Env       string
		Vars      VarArgs
		Context   *RunContext
		DevURL    string

		DirURL          string
		DirFormat       string
		Run             string
		RevisionsSchema string
		Paths           []string
	}
	// MigrateStatusParams are the parameters for the `migrate status` command.
	MigrateStatusParams struct {
		ConfigURL string
		Env       string
		Vars      VarArgs

		DirURL          string
		URL             string
		RevisionsSchema string
	}
	// MigrateLsParams are the parameters for the `migrate ls` command.
	MigrateLsParams struct {
		ConfigURL string
		Env       string
		Vars      VarArgs

		DirURL string
		Short  bool // -s: print only migration version (omit description and .sql suffix)
		Latest bool // -l: print only the latest migration file
	}
	// MigrateSetParams are the parameters for the `migrate set` command.
	MigrateSetParams struct {
		ConfigURL string
		Env       string
		Vars      VarArgs

		DirURL          string
		URL             string
		RevisionsSchema string
		Version         string
	}
	// MigrateDiffParams are the parameters for the `migrate diff` command.
	MigrateDiffParams struct {
		ConfigURL string
		Env       string
		Vars      VarArgs

		Name        string
		ToURL       string
		DevURL      string
		DirURL      string
		DirFormat   string
		Schema      []string
		LockTimeout string
		Format      string
		Qualifier   string
	}
	// MigrateDiff contains the result of the `migrate diff` command.
	MigrateDiff struct {
		Files []File `json:"Files,omitempty"` // Generated migration files
		Dir   string `json:"Dir,omitempty"`   // Path to migration directory
	}
	// MigrateStatus contains a summary of the migration status of a database.
	MigrateStatus struct {
		Env       Env         `json:"Env,omitempty"`       // Environment info.
		Available []File      `json:"Available,omitempty"` // Available migration files
		Pending   []File      `json:"Pending,omitempty"`   // Pending migration files
		Applied   []*Revision `json:"Applied,omitempty"`   // Applied migration files
		Current   string      `json:"Current,omitempty"`   // Current migration version
		Next      string      `json:"Next,omitempty"`      // Next migration version
		Count     int         `json:"Count,omitempty"`     // Count of applied statements of the last revision
		Total     int         `json:"Total,omitempty"`     // Total statements of the last migration
		Status    string      `json:"Status,omitempty"`    // Status of migration (OK, PENDING)
		Error     string      `json:"Error,omitempty"`     // Last Error that occurred
		SQL       string      `json:"SQL,omitempty"`       // SQL that caused the last Error
	}
)

// MigratePush runs the 'migrate push' command.
func (c *Client) MigratePush(ctx context.Context, params *MigratePushParams) (string, error) {
	args := []string{"migrate", "push"}
	if params.DevURL != "" {
		args = append(args, "--dev-url", params.DevURL)
	}
	if params.DirURL != "" {
		args = append(args, "--dir", params.DirURL)
	}
	if params.DirFormat != "" {
		args = append(args, "--dir-format", params.DirFormat)
	}
	if params.LockTimeout != "" {
		args = append(args, "--lock-timeout", params.LockTimeout)
	}
	if params.Context != nil {
		buf, err := json.Marshal(params.Context)
		if err != nil {
			return "", err
		}
		args = append(args, "--context", string(buf))
	}
	if params.ConfigURL != "" {
		args = append(args, "--config", params.ConfigURL)
	}
	if params.Env != "" {
		args = append(args, "--env", params.Env)
	}
	if params.Vars != nil {
		args = append(args, params.Vars.AsArgs()...)
	}
	if params.Name == "" {
		return "", errors.New("directory name cannot be empty")
	}
	if params.Tag != "" {
		args = append(args, fmt.Sprintf("%s:%s", params.Name, params.Tag))
	} else {
		args = append(args, params.Name)
	}
	resp, err := stringVal(c.runCommand(ctx, args))
	return strings.TrimSpace(resp), err
}

// MigrateApply runs the 'migrate apply' command.
func (c *Client) MigrateApply(ctx context.Context, params *MigrateApplyParams) (*MigrateApply, error) {
	return firstResult(c.MigrateApplySlice(ctx, params))
}

// MigrateApplySlice runs the 'migrate apply' command for multiple targets.
func (c *Client) MigrateApplySlice(ctx context.Context, params *MigrateApplyParams) ([]*MigrateApply, error) {
	args := []string{"migrate", "apply", "--format", "{{ json . }}"}
	if params.Env != "" {
		args = append(args, "--env", params.Env)
	}
	if params.ConfigURL != "" {
		args = append(args, "--config", params.ConfigURL)
	}
	if params.Context != nil {
		buf, err := json.Marshal(params.Context)
		if err != nil {
			return nil, err
		}
		args = append(args, "--context", string(buf))
	}
	if params.URL != "" {
		args = append(args, "--url", params.URL)
	}
	if params.DirURL != "" {
		args = append(args, "--dir", params.DirURL)
	}
	if params.AllowDirty {
		args = append(args, "--allow-dirty")
	}
	if params.DryRun {
		args = append(args, "--dry-run")
	}
	if params.RevisionsSchema != "" {
		args = append(args, "--revisions-schema", params.RevisionsSchema)
	}
	if params.BaselineVersion != "" {
		args = append(args, "--baseline", params.BaselineVersion)
	}
	if params.TxMode != "" {
		args = append(args, "--tx-mode", params.TxMode)
	}
	if params.ExecOrder != "" {
		args = append(args, "--exec-order", string(params.ExecOrder))
	}
	if params.ToVersion != "" {
		args = append(args, "--to-version", params.ToVersion)
	}
	if params.Amount > 0 {
		args = append(args, strconv.FormatUint(params.Amount, 10))
	}
	if params.LockName != "" {
		args = append(args, "--lock-name", params.LockName)
	}
	if params.Vars != nil {
		args = append(args, params.Vars.AsArgs()...)
	}
	return jsonDecodeErr(newMigrateApplyError)(c.runCommand(ctx, args))
}

// MigrateDown runs the 'migrate down' command.
func (c *Client) MigrateDown(ctx context.Context, params *MigrateDownParams) (*MigrateDown, error) {
	args := []string{"migrate", "down", "--format", "{{ json . }}"}
	if params.Env != "" {
		args = append(args, "--env", params.Env)
	}
	if params.ConfigURL != "" {
		args = append(args, "--config", params.ConfigURL)
	}
	if params.DevURL != "" {
		args = append(args, "--dev-url", params.DevURL)
	}
	if params.Context != nil {
		buf, err := json.Marshal(params.Context)
		if err != nil {
			return nil, err
		}
		args = append(args, "--context", string(buf))
	}
	if params.URL != "" {
		args = append(args, "--url", params.URL)
	}
	if params.DirURL != "" {
		args = append(args, "--dir", params.DirURL)
	}
	if params.RevisionsSchema != "" {
		args = append(args, "--revisions-schema", params.RevisionsSchema)
	}
	if params.ToVersion != "" {
		args = append(args, "--to-version", params.ToVersion)
	}
	if params.ToTag != "" {
		args = append(args, "--to-tag", params.ToTag)
	}
	if params.Amount > 0 {
		args = append(args, strconv.FormatUint(params.Amount, 10))
	}
	if params.Vars != nil {
		args = append(args, params.Vars.AsArgs()...)
	}
	r, err := c.runCommand(ctx, args)
	if cliErr := (&Error{}); errors.As(err, &cliErr) && cliErr.Stderr == "" {
		r = strings.NewReader(cliErr.Stdout)
		err = nil
	}
	// NOTE: This command only support one result.
	return firstResult(jsonDecode[MigrateDown](r, err))
}

// MigrateTest runs the 'migrate test' command.
func (c *Client) MigrateTest(ctx context.Context, params *MigrateTestParams) (string, error) {
	args := []string{"migrate", "test"}
	if params.Env != "" {
		args = append(args, "--env", params.Env)
	}
	if params.ConfigURL != "" {
		args = append(args, "--config", params.ConfigURL)
	}
	if params.DirURL != "" {
		args = append(args, "--dir", params.DirURL)
	}
	if params.DirFormat != "" {
		args = append(args, "--dir-format", params.DirFormat)
	}
	if params.DevURL != "" {
		args = append(args, "--dev-url", params.DevURL)
	}
	if params.Context != nil {
		buf, err := json.Marshal(params.Context)
		if err != nil {
			return "", err
		}
		args = append(args, "--context", string(buf))
	}
	if params.RevisionsSchema != "" {
		args = append(args, "--revisions-schema", params.RevisionsSchema)
	}
	if params.Run != "" {
		args = append(args, "--run", params.Run)
	}
	if params.Vars != nil {
		args = append(args, params.Vars.AsArgs()...)
	}
	if len(params.Paths) > 0 {
		args = append(args, params.Paths...)
	}
	return stringVal(c.runCommand(ctx, args))
}

// MigrateStatus runs the 'migrate status' command.
func (c *Client) MigrateStatus(ctx context.Context, params *MigrateStatusParams) (*MigrateStatus, error) {
	args := []string{"migrate", "status", "--format", "{{ json . }}"}
	if params.Env != "" {
		args = append(args, "--env", params.Env)
	}
	if params.ConfigURL != "" {
		args = append(args, "--config", params.ConfigURL)
	}
	if params.URL != "" {
		args = append(args, "--url", params.URL)
	}
	if params.DirURL != "" {
		args = append(args, "--dir", params.DirURL)
	}
	if params.RevisionsSchema != "" {
		args = append(args, "--revisions-schema", params.RevisionsSchema)
	}
	if params.Vars != nil {
		args = append(args, params.Vars.AsArgs()...)
	}
	// NOTE: This command only support one result.
	return firstResult(jsonDecode[MigrateStatus](c.runCommand(ctx, args)))
}

// MigrateLs runs the 'migrate ls' command and returns the listed migration file names (or versions when Short is true), one per line.
func (c *Client) MigrateLs(ctx context.Context, params *MigrateLsParams) (string, error) {
	args := []string{"migrate", "ls"}
	if params.ConfigURL != "" {
		args = append(args, "--config", params.ConfigURL)
	}
	if params.Env != "" {
		args = append(args, "--env", params.Env)
	}
	if params.DirURL != "" {
		args = append(args, "--dir", params.DirURL)
	}
	if params.Vars != nil {
		args = append(args, params.Vars.AsArgs()...)
	}
	if params.Short {
		args = append(args, "--short")
	}
	if params.Latest {
		args = append(args, "--latest")
	}
	return stringVal(c.runCommand(ctx, args))
}

// MigrateSet runs the 'migrate set' command.
func (c *Client) MigrateSet(ctx context.Context, params *MigrateSetParams) error {
	args := []string{"migrate", "set"}
	if params.Env != "" {
		args = append(args, "--env", params.Env)
	}
	if params.ConfigURL != "" {
		args = append(args, "--config", params.ConfigURL)
	}
	if params.URL != "" {
		args = append(args, "--url", params.URL)
	}
	if params.DirURL != "" {
		args = append(args, "--dir", params.DirURL)
	}
	if params.RevisionsSchema != "" {
		args = append(args, "--revisions-schema", params.RevisionsSchema)
	}
	if params.Vars != nil {
		args = append(args, params.Vars.AsArgs()...)
	}
	if params.Version != "" {
		args = append(args, params.Version)
	}
	_, err := c.runCommand(ctx, args)
	return err
}

// MigrateDiff runs the 'migrate diff --dry-run' command and returns the generated migration files without changing the filesystem.
// Requires atlas CLI to be logged in to the cloud.
func (c *Client) MigrateDiff(ctx context.Context, params *MigrateDiffParams) (*MigrateDiff, error) {
	args := []string{"migrate", "diff", "--dry-run"}
	if params.Env != "" {
		args = append(args, "--env", params.Env)
	}
	if params.ConfigURL != "" {
		args = append(args, "--config", params.ConfigURL)
	}
	if params.ToURL != "" {
		args = append(args, "--to", params.ToURL)
	}
	if params.DevURL != "" {
		args = append(args, "--dev-url", params.DevURL)
	}
	if params.DirURL != "" {
		args = append(args, "--dir", params.DirURL)
	}
	if params.DirFormat != "" {
		args = append(args, "--dir-format", params.DirFormat)
	}
	if params.LockTimeout != "" {
		args = append(args, "--lock-timeout", params.LockTimeout)
	}
	if params.Qualifier != "" {
		args = append(args, "--qualifier", params.Qualifier)
	}
	if len(params.Schema) > 0 {
		args = append(args, "--schema", strings.Join(params.Schema, ","))
	}
	if params.Format != "" {
		args = append(args, "--format", params.Format)
	}
	if params.Vars != nil {
		args = append(args, params.Vars.AsArgs()...)
	}
	if params.Name != "" {
		args = append(args, params.Name)
	}
	v, err := jsonDecode[MigrateDiff](c.runCommand(ctx, args))
	var e *Error
	switch {
	// if jsonDecode returns an error, and stderr is empty, it means the migration is synced with the desired state.
	case errors.As(err, &e) && e.Stderr == "":
		return &MigrateDiff{}, nil
	case err != nil:
		return nil, err
	}
	return firstResult(v, nil)
}

// MigrateLint runs the 'migrate lint' command.
func (c *Client) MigrateLint(ctx context.Context, params *MigrateLintParams) (*SummaryReport, error) {
	if params.Writer != nil || params.Web {
		return nil, errors.New("atlasexec: Writer or Web reporting are not supported with MigrateLint, use MigrateLintError")
	}
	args, err := params.AsArgs()
	if err != nil {
		return nil, err
	}
	r, err := c.runCommand(ctx, args)
	if cliErr := (&Error{}); errors.As(err, &cliErr) && cliErr.Stderr == "" {
		r = strings.NewReader(cliErr.Stdout)
		err = nil
	}
	// NOTE: This command only support one result.
	return firstResult(jsonDecode[SummaryReport](r, err))
}

// MigrateHash runs the 'migrate hash' command.
func (c *Client) MigrateHash(ctx context.Context, params *MigrateHashParams) error {
	args := []string{"migrate", "hash"}
	if params.Env != "" {
		args = append(args, "--env", params.Env)
	}
	if params.ConfigURL != "" {
		args = append(args, "--config", params.ConfigURL)
	}
	if params.Vars != nil {
		args = append(args, params.Vars.AsArgs()...)
	}
	if params.DirURL != "" {
		args = append(args, "--dir", params.DirURL)
	}
	if params.DirFormat != "" {
		args = append(args, "--dir-format", params.DirFormat)
	}
	_, err := c.runCommand(ctx, args)
	return err
}

// MigrateRebase runs the 'migrate rebase' command.
func (c *Client) MigrateRebase(ctx context.Context, params *MigrateRebaseParams) error {
	args := []string{"migrate", "rebase"}
	if params.Env != "" {
		args = append(args, "--env", params.Env)
	}
	if params.ConfigURL != "" {
		args = append(args, "--config", params.ConfigURL)
	}
	if params.Vars != nil {
		args = append(args, params.Vars.AsArgs()...)
	}
	if params.DirURL != "" {
		args = append(args, "--dir", params.DirURL)
	}
	args = append(args, params.Files...)
	_, err := c.runCommand(ctx, args)
	return err
}

// MigrateLintError runs the 'migrate lint' command, the output is written to params.Writer and reports
// if an error occurred. If the error is a setup error, a Error is returned. If the error is a lint error,
// LintErr is returned.
func (c *Client) MigrateLintError(ctx context.Context, params *MigrateLintParams) error {
	args, err := params.AsArgs()
	if err != nil {
		return err
	}
	r, err := c.runCommand(ctx, args)
	var (
		cliErr *Error
		isCLI  = errors.As(err, &cliErr)
	)
	// Setup errors.
	if isCLI && cliErr.Stderr != "" {
		return cliErr
	}
	// Lint errors.
	if isCLI && cliErr.Stdout != "" {
		err = ErrLint
		r = strings.NewReader(cliErr.Stdout)
	}
	// Unknown errors.
	if err != nil && !isCLI {
		return err
	}
	if params.Writer != nil && r != nil {
		if _, ioErr := io.Copy(params.Writer, r); ioErr != nil {
			err = errors.Join(err, ioErr)
		}
	}
	return err
}

// AsArgs returns the parameters as arguments.
func (p *MigrateLintParams) AsArgs() ([]string, error) {
	args := []string{"migrate", "lint"}
	if p.Web {
		args = append(args, "-w")
	}
	if p.Context != nil {
		buf, err := json.Marshal(p.Context)
		if err != nil {
			return nil, err
		}
		args = append(args, "--context", string(buf))
	}
	if p.Env != "" {
		args = append(args, "--env", p.Env)
	}
	if p.ConfigURL != "" {
		args = append(args, "--config", p.ConfigURL)
	}
	if p.DevURL != "" {
		args = append(args, "--dev-url", p.DevURL)
	}
	if p.DirURL != "" {
		args = append(args, "--dir", p.DirURL)
	}
	if p.Base != "" {
		args = append(args, "--base", p.Base)
	}
	if p.Latest > 0 {
		args = append(args, "--latest", strconv.FormatUint(p.Latest, 10))
	}
	if p.GitBase != "" {
		args = append(args, "--git-base", p.GitBase)
	}
	if p.GitDir != "" {
		args = append(args, "--git-dir", p.GitDir)
	}
	if p.Vars != nil {
		args = append(args, p.Vars.AsArgs()...)
	}
	format := "{{ json . }}"
	if p.Format != "" {
		format = p.Format
	}
	args = append(args, "--format", format)
	return args, nil
}

// Summary of the migration attempt.
func (a *MigrateApply) Summary(ident string) string {
	var (
		passedC, failedC int
		passedS, failedS int
		passedF, failedF int
		lines            = make([]string, 0, 3)
	)
	for _, f := range a.Applied {
		// For each check file, count the
		// number of failed assertions.
		for _, cf := range f.Checks {
			for _, s := range cf.Stmts {
				if s.Error != nil {
					failedC++
				} else {
					passedC++
				}
			}
		}
		passedS += len(f.Applied)
		if f.Error != nil {
			failedF++
			// Last statement failed (not an assertion).
			if len(f.Checks) == 0 || f.Checks[len(f.Checks)-1].Error == nil {
				passedS--
				failedS++
			}
		} else {
			passedF++
		}
	}
	// Execution time.
	lines = append(lines, a.End.Sub(a.Start).String())
	// Executed files.
	switch {
	case passedF > 0 && failedF > 0:
		lines = append(lines, fmt.Sprintf("%d migration%s ok, %d with errors", passedF, plural(passedF), failedF))
	case passedF > 0:
		lines = append(lines, fmt.Sprintf("%d migration%s", passedF, plural(passedF)))
	case failedF > 0:
		lines = append(lines, fmt.Sprintf("%d migration%s with errors", failedF, plural(failedF)))
	}
	// Executed checks.
	switch {
	case passedC > 0 && failedC > 0:
		lines = append(lines, fmt.Sprintf("%d check%s ok, %d failure%s", passedC, plural(passedC), failedC, plural(failedC)))
	case passedC > 0:
		lines = append(lines, fmt.Sprintf("%d check%s", passedC, plural(passedC)))
	case failedC > 0:
		lines = append(lines, fmt.Sprintf("%d check error%s", failedC, plural(failedC)))
	}
	// Executed statements.
	switch {
	case passedS > 0 && failedS > 0:
		lines = append(lines, fmt.Sprintf("%d sql statement%s ok, %d with errors", passedS, plural(passedS), failedS))
	case passedS > 0:
		lines = append(lines, fmt.Sprintf("%d sql statement%s", passedS, plural(passedS)))
	case failedS > 0:
		lines = append(lines, fmt.Sprintf("%d sql statement%s with errors", failedS, plural(failedS)))
	}
	var b strings.Builder
	for i, l := range lines {
		b.WriteString("-")
		b.WriteByte(' ')
		b.WriteString(fmt.Sprintf("**%s**", l))
		if i < len(lines)-1 {
			b.WriteByte('\n')
			b.WriteString(ident)
		}
	}
	return b.String()
}

var (
	// ErrLint is returned when the 'migrate lint' finds a diagnostic that is configured to
	// be reported as an error, such as destructive changes by default.
	ErrLint = errors.New("lint error")
	// Deprecated: Use ErrLint instead.
	LintErr = ErrLint
)

// LatestVersion returns the latest version of the migration directory.
func (r MigrateStatus) LatestVersion() string {
	if l := len(r.Available); l > 0 {
		return r.Available[l-1].Version
	}
	return ""
}

// Amount returns the number of migrations need to apply
// for the given version.
//
// The second return value is true if the version is found
// and the database is up-to-date.
//
// If the version is not found, it returns 0 and the second
// return value is false.
func (r MigrateStatus) Amount(version string) (amount uint64, ok bool) {
	if version == "" {
		amount := uint64(len(r.Pending))
		return amount, amount == 0
	}
	if r.Current == version {
		return amount, true
	}
	for idx, v := range r.Pending {
		if v.Version == version {
			amount = uint64(idx + 1) //nolint:gosec //G115: Safe conversion as idx is from range
			break
		}
	}
	return amount, false
}

func newMigrateApplyError(r []*MigrateApply, stderr string) error {
	return &MigrateApplyError{Result: r, Stderr: stderr}
}

// Error implements the error interface.
func (e *MigrateApplyError) Error() string {
	var errs []string
	for _, r := range e.Result {
		if r.Error != "" {
			errs = append(errs, r.Error)
		}
	}
	if e.Stderr != "" {
		errs = append(errs, e.Stderr)
	}
	return strings.Join(errs, "\n")
}

func plural(n int) (s string) {
	if n > 1 {
		s += "s"
	}
	return
}


================================================
FILE: atlasexec/atlas_migrate_example_test.go
================================================
// Copyright 2021-present The Atlas Authors. All rights reserved.
// This source code is licensed under the Apache 2.0 license found
// in the LICENSE file in the root directory of this source tree.

package atlasexec_test

import (
	"context"
	"fmt"
	"log"
	"os"

	"ariga.io/atlas/atlasexec"
)

func ExampleClient_MigrateApply() {
	// Define the execution context, supplying a migration directory
	// and potentially an `atlas.hcl` configuration file using `atlasexec.WithHCL`.
	workdir, err := atlasexec.NewWorkingDir(
		atlasexec.WithMigrations(
			os.DirFS("./migrations"),
		),
	)
	if err != nil {
		log.Fatalf("failed to load working directory: %v", err)
	}
	// atlasexec works on a temporary directory, so we need to close it
	defer workdir.Close()

	// Initialize the client.
	client, err := atlasexec.NewClient(workdir.Path(), "atlas")
	if err != nil {
		log.Fatalf("failed to initialize client: %v", err)
	}
	// Run `atlas migrate apply` on a SQLite database under /tmp.
	res, err := client.MigrateApply(context.Background(), &atlasexec.MigrateApplyParams{
		URL: "sqlite:///tmp/demo.db?_fk=1&cache=shared",
	})
	if err != nil {
		log.Fatalf("failed to apply migrations: %v", err)
	}
	fmt.Printf("Applied %d migrations\n", len(res.Applied))
}

func ExampleClient_MigrateSet() {
	// Define the execution context, supplying a migration directory
	// and potentially an `atlas.hcl` configuration file using `atlasexec.WithHCL`.
	workdir, err := atlasexec.NewWorkingDir(
		atlasexec.WithMigrations(
			os.DirFS("./migrations"),
		),
	)
	if err != nil {
		log.Fatalf("failed to load working directory: %v", err)
	}
	// atlasexec works on a temporary directory, so we need to close it
	defer workdir.Close()

	// Initialize the client.
	client, err := atlasexec.NewClient(workdir.Path(), "atlas")
	if err != nil {
		log.Fatalf("failed to initialize client: %v", err)
	}
	// Run `atlas migrate set` to mark migrations as applied up to version "3".
	err = client.MigrateSet(context.Background(), &atlasexec.MigrateSetParams{
		URL:     "sqlite:///tmp/demo.db?_fk=1&cache=shared",
		Version: "3",
	})
	if err != nil {
		log.Fatalf("failed to set migrations: %v", err)
	}
	fmt.Println("Migration version set successfully")
}


================================================
FILE: atlasexec/atlas_migrate_test.go
================================================
// Copyright 2021-present The Atlas Authors. All rights reserved.
// This source code is licensed under the Apache 2.0 license found
// in the LICENSE file in the root directory of this source tree.

package atlasexec_test

import (
	"bytes"
	"context"
	"database/sql"
	"encoding/base64"
	"encoding/json"
	"fmt"
	"io"
	"net/http"
	"net/http/httptest"
	"os"
	"os/exec"
	"path/filepath"
	"strings"
	"testing"

	"ariga.io/atlas/atlasexec"
	"ariga.io/atlas/sql/migrate"
	"ariga.io/atlas/sql/sqlcheck"
	"github.com/stretchr/testify/require"
)

func TestMigrate_Status(t *testing.T) {
	type args struct {
		ctx  context.Context
		data *atlasexec.MigrateStatusParams
	}
	tests := []struct {
		name        string
		args        args
		wantCurrent string
		wantNext    string
		wantErr     bool
	}{
		{
			args: args{
				ctx: context.Background(),
				data: &atlasexec.MigrateStatusParams{
					DirURL: "file://testdata/migrations",
				},
			},
			wantCurrent: "No migration applied yet",
			wantNext:    "20230727105553",
		},
	}
	wd, err := os.Getwd()
	require.NoError(t, err)
	c, err := atlasexec.NewClient(wd, "atlas")
	require.NoError(t, err)
	for _, tt := range tests {
		t.Run(tt.name, func(t *testing.T) {
			tt.args.data.URL = sqlitedb(t, "")
			got, err := c.MigrateStatus(tt.args.ctx, tt.args.data)
			if (err != nil) != tt.wantErr {
				t.Errorf("migrateStatus() error = %v, wantErr %v", err, tt.wantErr)
				return
			}
			require.Equal(t, tt.wantCurrent, got.Current)
			require.Equal(t, tt.wantNext, got.Next)
		})
	}
}

func TestMigrate_Apply(t *testing.T) {
	wd, err := os.Getwd()
	require.NoError(t, err)
	c, err := atlasexec.NewClient(t.TempDir(), filepath.Join(wd, "./mock-atlas.sh"))
	require.NoError(t, err)

	for _, tt := range []struct {
		name   string
		params *atlasexec.MigrateApplyParams
		args   string
		stdout string
	}{
		{
			name:   "no params",
			params: &atlasexec.MigrateApplyParams{},
			args:   "migrate apply --format {{ json . }}",
			stdout: `{"Driver":"mysql"}`,
		},
		{
			name: "with env",
			params: &atlasexec.MigrateApplyParams{
				Env: "test",
			},
			args:   "migrate apply --format {{ json . }} --env test",
			stdout: `{"Driver":"mysql"}`,
		},
		{
			name: "with url",
			params: &atlasexec.MigrateApplyParams{
				URL: "sqlite://file?_fk=1&cache=shared&mode=memory",
			},
			args:   "migrate apply --format {{ json . }} --url sqlite://file?_fk=1&cache=shared&mode=memory",
			stdout: `{"Driver":"mysql"}`,
		},
		{
			name: "with exec order",
			params: &atlasexec.MigrateApplyParams{
				ExecOrder: atlasexec.ExecOrderLinear,
			},
			args:   "migrate apply --format {{ json . }} --exec-order linear",
			stdout: `{"Driver":"mysql"}`,
		},
		{
			name: "with lock name",
			params: &atlasexec.MigrateApplyParams{
				LockName: "custom_lock",
			},
			args:   "migrate apply --format {{ json . }} --lock-name custom_lock",
			stdout: `{"Driver":"mysql"}`,
		},
	} {
		t.Run(tt.name, func(t *testing.T) {
			t.Setenv("TEST_ARGS", tt.args)
			t.Setenv("TEST_STDOUT", tt.stdout)
			result, err := c.MigrateApply(context.Background(), tt.params)
			require.NoError(t, err)
			require.NotNil(t, result)
			require.Equal(t, "mysql", result.Driver)
		})
	}
}

func TestMigrate_Ls(t *testing.T) {
	wd, err := os.Getwd()
	require.NoError(t, err)
	c, err := atlasexec.NewClient(t.TempDir(), filepath.Join(wd, "./mock-atlas.sh"))
	require.NoError(t, err)

	for _, tt := range []struct {
		name   string
		params *atlasexec.MigrateLsParams
		args   string
		stdout string
	}{
		{
			name:   "no params",
			params: &atlasexec.MigrateLsParams{},
			args:   "migrate ls",
			stdout: "\n",
		},
		{
			name: "with dir",
			params: &atlasexec.MigrateLsParams{
				DirURL: "file://migrations",
			},
			args:   "migrate ls --dir file://migrations",
			stdout: "\n",
		},
		{
			name: "with short",
			params: &atlasexec.MigrateLsParams{
				Short: true,
			},
			args:   "migrate ls --short",
			stdout: "\n",
		},
		{
			name: "with latest",
			params: &atlasexec.MigrateLsParams{
				Latest: true,
			},
			args:   "migrate ls --latest",
			stdout: "\n",
		},
		{
			name: "with short and latest",
			params: &atlasexec.MigrateLsParams{
				DirURL: "file://migrations",
				Short:  true,
				Latest: true,
			},
			args:   "migrate ls --dir file://migrations --short --latest",
			stdout: "20230727105615\n",
		},
		{
			name: "with config and env",
			params: &atlasexec.MigrateLsParams{
				ConfigURL: "file://atlas.hcl",
				Env:       "dev",
			},
			args:   "migrate ls --config file://atlas.hcl --env dev",
			stdout: "\n",
		},
	} {
		t.Run(tt.name, func(t *testing.T) {
			t.Setenv("TEST_ARGS", tt.args)
			t.Setenv("TEST_STDOUT", tt.stdout)
			got, err := c.MigrateLs(context.Background(), tt.params)
			require.NoError(t, err)
			require.Equal(t, tt.stdout, got)
		})
	}
}

func TestMigrate_Ls_Integration(t *testing.T) {
	wd, err := os.Getwd()
	require.NoError(t, err)
	c, err := atlasexec.NewClient(wd, "atlas")
	require.NoError(t, err)

	dirURL := "file://testdata/migrations"
	out, err := c.MigrateLs(context.Background(), &atlasexec.MigrateLsParams{DirURL: dirURL})
	if err != nil {
		if strings.Contains(err.Error(), "unknown") || strings.Contains(err.Error(), "unknown command") {
			t.Skip("atlas binary does not support 'migrate ls' (e.g. OSS build)")
		}
		require.NoError(t, err)
	}
	lines := strings.Split(strings.TrimSpace(out), "\n")
	require.GreaterOrEqual(t, len(lines), 2)
	require.Contains(t, out, "20230727105553_init.sql")
	require.Contains(t, out, "20230727105615_t2.sql")

	outShort, err := c.MigrateLs(context.Background(), &atlasexec.MigrateLsParams{DirURL: dirURL, Short: true})
	if err != nil && strings.Contains(err.Error(), "unknown flag") {
		t.Skip("atlas binary does not support --short/--latest (use enterprise or newer build)")
	}
	require.NoError(t, err)
	require.Contains(t, outShort, "20230727105553")
	require.Contains(t, outShort, "20230727105615")
	require.NotContains(t, outShort, ".sql")

	outLatest, err := c.MigrateLs(context.Background(), &atlasexec.MigrateLsParams{DirURL: dirURL, Latest: true})
	require.NoError(t, err)
	require.Equal(t, 1, len(strings.Split(strings.TrimSpace(outLatest), "\n")))
	require.Contains(t, outLatest, "20230926085734_destructive-change.sql")
}

func TestMigrate_Set(t *testing.T) {
	wd, err := os.Getwd()
	require.NoError(t, err)
	c, err := atlasexec.NewClient(t.TempDir(), filepath.Join(wd, "./mock-atlas.sh"))
	require.NoError(t, err)

	for _, tt := range []struct {
		name   string
		params *atlasexec.MigrateSetParams
		args   string
	}{
		{
			name:   "no params",
			params: &atlasexec.MigrateSetParams{},
			args:   "migrate set",
		},
		{
			name: "with env",
			params: &atlasexec.MigrateSetParams{
				Env: "test",
			},
			args: "migrate set --env test",
		},
		{
			name: "with url",
			params: &atlasexec.MigrateSetParams{
				URL: "sqlite://file?_fk=1&cache=shared&mode=memory",
			},
			args: "migrate set --url sqlite://file?_fk=1&cache=shared&mode=memory",
		},
		{
			name: "with dir",
			params: &atlasexec.MigrateSetParams{
				DirURL: "file://migrations",
			},
			args: "migrate set --dir file://migrations",
		},
		{
			name: "with revisions-schema",
			params: &atlasexec.MigrateSetParams{
				RevisionsSchema: "my_revisions",
			},
			args: "migrate set --revisions-schema my_revisions",
		},
		{
			name: "with version",
			params: &atlasexec.MigrateSetParams{
				Version: "3",
			},
			args: "migrate set 3",
		},
		{
			name: "with all params",
			params: &atlasexec.MigrateSetParams{
				URL:             "sqlite://file?_fk=1&cache=shared&mode=memory",
				DirURL:          "file://migrations",
				RevisionsSchema: "my_revisions",
				Version:         "1.2.4",
			},
			args: "migrate set --url sqlite://file?_fk=1&cache=shared&mode=memory --dir file://migrations --revisions-schema my_revisions 1.2.4",
		},
	} {
		t.Run(tt.name, func(t *testing.T) {
			t.Setenv("TEST_ARGS", tt.args)
			t.Setenv("TEST_STDOUT", "ok")
			err := c.MigrateSet(context.Background(), tt.params)
			require.NoError(t, err)
		})
	}
}

func TestMigrate_Down(t *testing.T) {
	wd, err := os.Getwd()
	require.NoError(t, err)
	c, err := atlasexec.NewClient(t.TempDir(), filepath.Join(wd, "./mock-atlas.sh"))
	require.NoError(t, err)

	for _, tt := range []struct {
		name   string
		params *atlasexec.MigrateDownParams
		args   string
		stdout string
	}{
		{
			name:   "no params",
			params: &atlasexec.MigrateDownParams{},
			args:   "migrate down --format {{ json . }}",
			stdout: `{"Status":"Pending"}`,
		},
		{
			name: "with env",
			params: &atlasexec.MigrateDownParams{
				Env: "test",
			},
			args:   "migrate down --format {{ json . }} --env test",
			stdout: `{"Status":"Pending"}`,
		},
		{
			name: "with url",
			params: &atlasexec.MigrateDownParams{
				URL: "sqlite://file?_fk=1&cache=shared&mode=memory",
			},
			args:   "migrate down --format {{ json . }} --url sqlite://file?_fk=1&cache=shared&mode=memory",
			stdout: `{"Status":"Pending"}`,
		},
		{
			name: "with target version",
			params: &atlasexec.MigrateDownParams{
				ToVersion: "12345",
			},
			args:   "migrate down --format {{ json . }} --to-version 12345",
			stdout: `{"Status":"Pending"}`,
		},
		{
			name: "with tag version",
			params: &atlasexec.MigrateDownParams{
				ToTag: "12345",
			},
			args:   "migrate down --format {{ json . }} --to-tag 12345",
			stdout: `{"Status":"Pending"}`,
		},
		{
			name: "with amount",
			params: &atlasexec.MigrateDownParams{
				Amount: 10,
			},
			args:   "migrate down --format {{ json . }} 10",
			stdout: `{"Status":"Pending"}`,
		},
		{
			name: "dev-url",
			params: &atlasexec.MigrateDownParams{
				DevURL: "url",
			},
			args:   "migrate down --format {{ json . }} --dev-url url",
			stdout: `{"Status":"Pending"}`,
		},
	} {
		t.Run(tt.name, func(t *testing.T) {
			t.Setenv("TEST_ARGS", tt.args)
			t.Setenv("TEST_STDOUT", tt.stdout)
			result, err := c.MigrateDown(context.Background(), tt.params)
			require.NoError(t, err)
			require.NotNil(t, result)
			require.Equal(t, "Pending", result.Status)
		})
	}
}

func TestMigrate_Test(t *testing.T) {
	wd, err := os.Getwd()
	require.NoError(t, err)
	c, err := atlasexec.NewClient(t.TempDir(), filepath.Join(wd, "./mock-atlas.sh"))
	require.NoError(t, err)

	for _, tt := range []struct {
		name   string
		params *atlasexec.MigrateTestParams
		args   string
		stdout string
	}{
		{
			name:   "no params",
			params: &atlasexec.MigrateTestParams{},
			args:   "migrate test",
			stdout: "test result",
		},
		{
			name: "with env",
			params: &atlasexec.MigrateTestParams{
				Env: "test",
			},
			args:   "migrate test --env test",
			stdout: "test result",
		},
		{
			name: "with config",
			params: &atlasexec.MigrateTestParams{
				ConfigURL: "file://config.hcl",
			},
			args:   "migrate test --config file://config.hcl",
			stdout: "test result",
		},
		{
			name: "with dev-url",
			params: &atlasexec.MigrateTestParams{
				DevURL: "sqlite://file?_fk=1&cache=shared&mode=memory",
			},
			args:   "migrate test --dev-url sqlite://file?_fk=1&cache=shared&mode=memory",
			stdout: "test result",
		},
		{
			name: "with run",
			params: &atlasexec.MigrateTestParams{
				Run: "example",
			},
			args:   "migrate test --run example",
			stdout: "test result",
		},
		{
			name: "with run and paths",
			params: &atlasexec.MigrateTestParams{
				Run:   "example",
				Paths: []string{"./foo", "./bar"},
			},
			args:   "migrate test --run example ./foo ./bar",
			stdout: "test result",
		},
		{
			name: "with revisions-schema",
			params: &atlasexec.MigrateTestParams{
				RevisionsSchema: "schema",
			},
			args:   "migrate test --revisions-schema schema",
			stdout: "test result",
		},
		{
			name: "with run context",
			params: &atlasexec.MigrateTestParams{
				Context: &atlasexec.RunContext{
					Repo: "testing-repo",
				},
			},
			args:   "migrate test --context {\"repo\":\"testing-repo\"}",
			stdout: "test result",
		},
	} {
		t.Run(tt.name, func(t *testing.T) {
			t.Setenv("TEST_ARGS", tt.args)
			t.Setenv("TEST_STDOUT", tt.stdout)
			result, err := c.MigrateTest(context.Background(), tt.params)
			require.NoError(t, err)
			require.Equal(t, tt.stdout, result)
		})
	}
}

func TestAtlasMigrate_ApplyBroken(t *testing.T) {
	c, err := atlasexec.NewClient(".", "atlas")
	require.NoError(t, err)
	got, err := c.MigrateApply(context.Background(), &atlasexec.MigrateApplyParams{
		URL:    "sqlite://?mode=memory",
		DirURL: "file://testdata/broken",
	})
	require.ErrorContains(t, err, `sql/migrate: executing statement "broken;" from version "20231029112426": near "broken": syntax error`)
	require.Nil(t, got)
	report, ok := err.(*atlasexec.MigrateApplyError)
	require.True(t, ok)
	require.Equal(t, "20231029112426", report.Result[0].Target)
	require.Equal(t, "sql/migrate: executing statement \"broken;\" from version \"20231029112426\": near \"broken\": syntax error", report.Error())
	require.Len(t, report.Result[0].Applied, 1)
	require.Equal(t, &struct {
		Stmt, Text string
	}{
		Stmt: "broken;",
		Text: "near \"broken\": syntax error",
	}, report.Result[0].Applied[0].Error)
}

func TestMigrateApplyError_Error(t *testing.T) {
	t.Run("single result error only", func(t *testing.T) {
		e := &atlasexec.MigrateApplyError{
			Result: []*atlasexec.MigrateApply{
				{Error: "sql/migrate: execution failed"},
			},
		}
		require.Equal(t, "sql/migrate: execution failed", e.Error())
	})

	t.Run("stderr only", func(t *testing.T) {
		e := &atlasexec.MigrateApplyError{
			Stderr: "Error: unable to acquire lock",
		}
		require.Equal(t, "Error: unable to acquire lock", e.Error())
	})

	t.Run("single result error and stderr", func(t *testing.T) {
		e := &atlasexec.MigrateApplyError{
			Result: []*atlasexec.MigrateApply{
				{Error: "sql/migrate: execution failed"},
			},
			Stderr: "Error: unable to acquire lock",
		}
		require.Equal(t, "sql/migrate: execution failed\nError: unable to acquire lock", e.Error())
	})

	t.Run("multiple result errors and stderr", func(t *testing.T) {
		e := &atlasexec.MigrateApplyError{
			Result: []*atlasexec.MigrateApply{
				{Error: "error on target 1"},
				{Error: "error on target 2"},
			},
			Stderr: "Error: unable to acquire lock",
		}
		require.Equal(t, "error on target 1\nerror on target 2\nError: unable to acquire lock", e.Error())
	})

	t.Run("multiple results with some having no error", func(t *testing.T) {
		e := &atlasexec.MigrateApplyError{
			Result: []*atlasexec.MigrateApply{
				{Error: ""},
				{Error: "error on target 2"},
				{Error: ""},
			},
			Stderr: "Error: unable to acquire lock",
		}
		require.Equal(t, "error on target 2\nError: unable to acquire lock", e.Error())
	})

	t.Run("no errors at all", func(t *testing.T) {
		e := &atlasexec.MigrateApplyError{
			Result: []*atlasexec.MigrateApply{
				{Error: ""},
			},
		}
		require.Equal(t, "", e.Error())
	})

	t.Run("nil result with stderr", func(t *testing.T) {
		e := &atlasexec.MigrateApplyError{
			Stderr: "Error: connection refused",
		}
		require.Equal(t, "Error: connection refused", e.Error())
	})
}

func TestAtlasMigrate_Apply(t *testing.T) {
	ec, err := atlasexec.NewWorkingDir(
		atlasexec.WithMigrations(os.DirFS(filepath.Join("testdata", "migrations"))),
		atlasexec.WithAtlasHCL(func(w io.Writer) error {
			_, err := w.Write([]byte(`
			variable "url" {
				type    = string
				default = getenv("DB_URL")
			}
			env {
				name = atlas.env
				url  = var.url
				migration {
					dir = "file://migrations"
				}
			}`))
			return err
		}),
	)
	require.NoError(t, err)
	t.Cleanup(func() {
		require.NoError(t, ec.Close())
	})
	c, err := atlasexec.NewClient(ec.Path(), "atlas")
	require.NoError(t, err)
	got, err := c.MigrateApply(context.Background(), &atlasexec.MigrateApplyParams{
		Env: "test",
	})
	require.ErrorContains(t, err, `required flag "url" not set`)
	require.Nil(t, got)
	var exerr *exec.ExitError
	require.ErrorAs(t, err, &exerr)
	// Set the env var and try again
	os.Setenv("DB_URL", "sqlite://file?_fk=1&cache=shared&mode=memory")
	got, err = c.MigrateApply(context.Background(), &atlasexec.MigrateApplyParams{
		Env: "test",
	})
	require.NoError(t, err)
	require.Equal(t, "sqlite", got.Env.Driver)
	require.Equal(t, "file://migrations", got.Env.Dir)
	require.Equal(t, "sqlite://file?_fk=1&cache=shared&mode=memory", got.Env.URL.String())
	require.Equal(t, "20230926085734", got.Target)
	// Add dirty changes and try again
	os.Setenv("DB_URL", "sqlite://test.db?_fk=1&cache=shared&mode=memory")
	drv, err := sql.Open("sqlite3", "test.db")
	require.NoError(t, err)
	defer os.Remove("test.db")
	_, err = drv.ExecContext(context.Background(), "create table atlas_schema_revisions(version varchar(255) not null primary key);")
	require.NoError(t, err)
	got, err = c.MigrateApply(context.Background(), &atlasexec.MigrateApplyParams{
		Env:        "test",
		AllowDirty: true,
	})
	require.NoError(t, err)
	require.EqualValues(t, "20230926085734", got.Target)
}

func TestAtlasMigrate_ApplyWithRemote(t *testing.T) {
	type (
		ContextInput struct {
			TriggerType    string `json:"triggerType,omitempty"`
			TriggerVersion string `json:"triggerVersion,omitempty"`
		}
		graphQLQuery struct {
			Query              string          `json:"query"`
			Variables          json.RawMessage `json:"variables"`
			MigrateApplyReport struct {
				Input struct {
					Context *ContextInput `json:"context,omitempty"`
				} `json:"input"`
			}
		}
	)
	token := "123456789"
	handler := func(payloads *[]graphQLQuery) http.HandlerFunc {
		return func(_ http.ResponseWriter, r *http.Request) {
			require.Equal(t, "Bearer "+token, r.Header.Get("Authorization"))
			var query graphQLQuery
			require.NoError(t, json.NewDecoder(r.Body).Decode(&query))
			*payloads = append(*payloads, query)
		}
	}
	var payloads []graphQLQuery
	srv := httptest.NewServer(handler(&payloads))
	t.Cleanup(srv.Close)
	ec, err := atlasexec.NewWorkingDir(
		atlasexec.WithMigrations(os.DirFS(filepath.Join("testdata", "migrations"))),
		atlasexec.WithAtlasHCL(func(w io.Writer) error {
			_, err := fmt.Fprintf(w, `
			env {
				name = atlas.env
				url  = "sqlite://file?_fk=1&cache=shared&mode=memory"
				migration {
					dir = "atlas://test_dir"
				}
			}
			atlas {
				cloud {
					token = %q
					url = %q
				}
			}`, token, srv.URL)
			return err
		}),
	)
	require.NoError(t, err)
	t.Cleanup(func() {
		require.NoError(t, ec.Close())
	})
	c, err := atlasexec.NewClient(ec.Path(), "atlas")
	require.NoError(t, err)
	got, err := c.MigrateApply(context.Background(), &atlasexec.MigrateApplyParams{
		Env: "test",
	})
	require.NoError(t, err)
	require.NotNil(t, got)
	require.Len(t, payloads, 3)
	reportPayload := payloads[2]
	require.Regexp(t, "mutation ReportMigration", reportPayload.Query)
	err = json.Unmarshal(reportPayload.Variables, &reportPayload.MigrateApplyReport)
	require.NoError(t, err)
	require.Nil(t, reportPayload.MigrateApplyReport.Input.Context)
	got, err = c.MigrateApply(context.Background(), &atlasexec.MigrateApplyParams{
		Env:     "test",
		Context: &atlasexec.DeployRunContext{TriggerVersion: "1.2.3", TriggerType: atlasexec.TriggerTypeGithubAction},
	})
	require.NoError(t, err)
	require.NotNil(t, got)
	require.Len(t, payloads, 6)
	reportPayload = payloads[5]
	require.Regexp(t, "mutation ReportMigration", reportPayload.Query)
	err = json.Unmarshal(reportPayload.Variables, &reportPayload.MigrateApplyReport)
	require.NoError(t, err)
	require.NotNil(t, reportPayload.MigrateApplyReport.Input.Context)
	require.Equal(t, "GITHUB_ACTION", reportPayload.MigrateApplyReport.Input.Context.TriggerType)
	require.Equal(t, "1.2.3", reportPayload.MigrateApplyReport.Input.Context.TriggerVersion)
}

func TestAtlasMigrate_Push(t *testing.T) {
	type (
		graphQLQuery struct {
			Query     string          `json:"query"`
			Variables json.RawMessage `json:"variables"`
			PushDir   *struct {
				Input struct {
					Slug   string `json:"slug"`
					Tag    string `json:"tag"`
					Driver string `json:"driver"`
					Dir    string `json:"dir"`
				} `json:"input"`
			}
			DiffSyncDir *struct {
				Input struct {
					Slug    string                `json:"slug"`
					Driver  string                `json:"driver"`
					Dir     string                `json:"dir"`
					Add     string                `json:"add"`
					Delete  []string              `json:"delete"`
					Context *atlasexec.RunContext `json:"context"`
				} `json:"input"`
			}
		}
		httpTest struct {
			payloads []graphQLQuery
			srv      *httptest.Server
		}
	)
	token := "123456789"
	newHTTPTest := func() (*httpTest, string) {
		tt := &httpTest{}
		handler := func() http.HandlerFunc {
			return func(w http.ResponseWriter, r *http.Request) {
				require.Equal(t, "Bearer "+token, r.Header.Get("Authorization"))
				var query graphQLQuery
				require.NoError(t, json.NewDecoder(r.Body).Decode(&query))
				if strings.Contains(query.Query, "pushDir") {
					err := json.Unmarshal(query.Variables, &query.PushDir)
					require.NoError(t, err)
					fmt.Fprint(w, `{"data":{"pushDir":{"url":"https://some-org.atlasgo.cloud/dirs/314159/tags/12345"}}}`)
				}
				if strings.Contains(query.Query, "diffSyncDir") {
					err := json.Unmarshal(query.Variables, &query.DiffSyncDir)
					require.NoError(t, err)
					fmt.Fprint(w, `{"data":{"diffSyncDir":{"url":"https://some-org.atlasgo.cloud/dirs/314159/tags/12345"}}}`)
				}
				tt.payloads = append(tt.payloads, query)
			}
		}
		tt.srv = httptest.NewServer(handler())
		t.Cleanup(tt.srv.Close)
		return tt, generateHCL(t, token, tt.srv)
	}
	c, err := atlasexec.NewClient(".", "atlas")
	require.NoError(t, err)
	inputContext := &atlasexec.RunContext{
		Repo:     "testing-repo",
		Path:     "path/to/dir",
		Branch:   "testing-branch",
		Commit:   "sha123",
		URL:      "this://is/a/url",
		UserID:   "test-user-id",
		Username: "test-user",
		SCMType:  atlasexec.SCMTypeGithub,
	}
	t.Run("sync", func(t *testing.T) {
		params := &atlasexec.MigratePushParams{
			DevURL: "sqlite://file?mode=memory",
			DirURL: "file://testdata/migrations",
			Name:   "test-dir-slug",
			Env:    "test",
		}
		t.Run("with context", func(t *testing.T) {
			tt, atlasConfigURL := newHTTPTest()
			params.ConfigURL = atlasConfigURL
			got, err := c.MigratePush(context.Background(), params)
			require.NoError(t, err)
			require.Len(t, tt.payloads, 3)
			require.Equal(t, `https://some-org.atlasgo.cloud/dirs/314159/tags/12345`, got)
			p := &tt.payloads[2]
			require.Contains(t, p.Query, "diffSyncDir")
			require.Equal(t, "test-dir-slug", p.DiffSyncDir.Input.Slug)
			require.Equal(t, "SQLITE", p.DiffSyncDir.Input.Driver)
			require.NotEmpty(t, p.DiffSyncDir.Input.Dir)
		})
		t.Run("without context", func(t *testing.T) {
			tt, atlasConfigURL := newHTTPTest()
			params.ConfigURL = atlasConfigURL
			params.Context = inputContext
			got, err := c.MigratePush(context.Background(), params)
			require.NoError(t, err)
			require.Equal(t, `https://some-org.atlasgo.cloud/dirs/314159/tags/12345`, got)
			require.Len(t, tt.payloads, 3)
			p := &tt.payloads[2]
			require.Contains(t, p.Query, "diffSyncDir")
			err = json.Unmarshal(p.Variables, &p.DiffSyncDir)
			require.NoError(t, err)
			require.Equal(t, inputContext, p.DiffSyncDir.Input.Context)
		})

	})
	t.Run("push", func(t *testing.T) {
		tt, atlasConfigURL := newHTTPTest()
		params := &atlasexec.MigratePushParams{
			ConfigURL: atlasConfigURL,
			DevURL:    "sqlite://file?mode=memory",
			DirURL:    "file://testdata/migrations",
			Name:      "test-dir-slug",
			Context:   inputContext,
			Env:       "test",
			Tag:       "this-is-my-tag",
		}
		got, err := c.MigratePush(context.Background(), params)
		require.NoError(t, err)
		require.Equal(t, `https://some-org.atlasgo.cloud/dirs/314159/tags/12345`, got)
		require.Len(t, tt.payloads, 2)
		p := &tt.payloads[1]
		require.Contains(t, p.Query, "pushDir")
		require.Equal(t, "test-dir-slug", p.PushDir.Input.Slug)
		require.Equal(t, "SQLITE", p.PushDir.Input.Driver)
		require.Equal(t, "this-is-my-tag", p.PushDir.Input.Tag)
		require.NotEmpty(t, p.PushDir.Input.Dir)
	})
}

func TestMigrateHash(t *testing.T) {
	td := t.TempDir()
	require.NoError(t, os.Mkdir(fmt.Sprintf("%s/migrations", td), 0777))
	require.NoError(t, os.WriteFile(fmt.Sprintf("%s/migrations/1.sql", td), []byte(`create table t (c int not null)`), 0666))
	c, err := atlasexec.NewClient(td, "atlas")
	require.NoError(t, err)
	inspect := func() error {
		_, err = c.SchemaInspect(context.Background(), &atlasexec.SchemaInspectParams{
			DevURL: "sqlite://file?mode=memory",
			URL:    fmt.Sprintf("file://%s/migrations", td),
		})
		return err
	}
	require.ErrorContains(t, inspect(), "checksum file not found")
	require.NoError(t, c.MigrateHash(context.Background(), &atlasexec.MigrateHashParams{}))
	require.FileExists(t, fmt.Sprintf("%s/migrations/atlas.sum", td))
	require.NoError(t, inspect())
}

func TestMigrateRebase(t *testing.T) {
	td := t.TempDir()
	require.NoError(t, os.Mkdir(fmt.Sprintf("%s/migrations", td), 0777))
	// create initial migrations dir state
	require.NoError(t, os.WriteFile(fmt.Sprintf("%s/migrations/2024030709.sql", td), []byte(`create table t (c int not null)`), 0666))
	require.NoError(t, os.WriteFile(fmt.Sprintf("%s/migrations/2024030711.sql", td), []byte("alter table `t` add column `c3` text not null;"), 0666))
	c, err := atlasexec.NewClient(td, "atlas")
	require.NoError(t, err)
	require.NoError(t, c.MigrateHash(context.Background(), &atlasexec.MigrateHashParams{}))
	require.FileExists(t, fmt.Sprintf("%s/migrations/atlas.sum", td))
	// Print atlas.sum before adding a new migration
	before, err := os.ReadFile(fmt.Sprintf("%s/migrations/atlas.sum", td))
	require.NoError(t, err)

	// add a new migration
	require.NoError(t, os.WriteFile(fmt.Sprintf("%s/migrations/2024030710.sql", td), []byte("alter table `t` add column `c2` text not null;"), 0666))
	require.NoError(t, c.MigrateHash(context.Background(), &atlasexec.MigrateHashParams{}))
	require.FileExists(t, fmt.Sprintf("%s/migrations/atlas.sum", td))
	require.NoError(t, c.MigrateRebase(context.Background(), &atlasexec.MigrateRebaseParams{
		Files: []string{
			"2024030711.sql",
		},
		DirURL: fmt.Sprintf("file://%s/migrations", td),
	}))
	inspect := func() error {
		_, err = c.SchemaInspect(context.Background(), &atlasexec.SchemaInspectParams{
			DevURL: "sqlite://file?mode=memory",
			URL:    fmt.Sprintf("file://%s/migrations", td),
		})
		return err
	}
	// ensure sum file changes after rebase
	after, err := os.ReadFile(fmt.Sprintf("%s/migrations/atlas.sum", td))
	require.NotEqual(t, before, after)
	require.NoError(t, inspect())
}

func TestAtlasMigrate_Lint(t *testing.T) {
	t.Run("with broken config", func(t *testing.T) {
		c, err := atlasexec.NewClient(".", "atlas")
		require.NoError(t, err)
		got, err := c.MigrateLint(context.Background(), &atlasexec.MigrateLintParams{
			ConfigURL: "file://config-broken.hcl",
		})
		require.ErrorContains(t, err, `file "config-broken.hcl" was not found`)
		require.Nil(t, got)
	})
	t.Run("with broken dev-url", func(t *testing.T) {
		c, err := atlasexec.NewClient(".", "atlas")
		require.NoError(t, err)
		got, err := c.MigrateLint(context.Background(), &atlasexec.MigrateLintParams{
			DirURL: "file://atlasexec/testdata/migrations",
		})
		require.ErrorContains(t, err, `required flag(s) "dev-url" not set`)
		require.Nil(t, got)
	})
	t.Run("broken dir", func(t *testing.T) {
		c, err := atlasexec.NewClient(".", "atlas")
		require.NoError(t, err)
		got, err := c.MigrateLint(context.Background(), &atlasexec.MigrateLintParams{
			DevURL: "sqlite://file?mode=memory",
			DirURL: "file://atlasexec/testdata/doesnotexist",
		})
		require.ErrorContains(t, err, `stat atlasexec/testdata/doesnotexist: no such file or directory`)
		require.Nil(t, got)
	})
	t.Run("lint error parsing", func(t *testing.T) {
		c, err := atlasexec.NewClient(".", "atlas")
		require.NoError(t, err)
		got, err := c.MigrateLint(context.Background(), &atlasexec.MigrateLintParams{
			DevURL: "sqlite://file?mode=memory",
			DirURL: "file://testdata/migrations",
			Latest: 1,
		})
		require.NoError(t, err)
		require.GreaterOrEqual(t, 4, len(got.Steps))
		require.Equal(t, "sqlite", got.Env.Driver)
		require.Equal(t, "testdata/migrations", got.Env.Dir)
		require.Equal(t, "sqlite://file?mode=memory", got.Env.URL.String())
		require.Equal(t, 1, len(got.Files))
		expectedReport := &atlasexec.FileReport{
			Name: "20230926085734_destructive-change.sql",
			Text: "DROP TABLE t2;\n",
			Reports: []sqlcheck.Report{{
				Text: "destructive changes detected",
				Diagnostics: []sqlcheck.Diagnostic{{
					Pos:  0,
					Text: `Dropping table "t2"`,
					Code: "DS102",
					SuggestedFixes: []sqlcheck.SuggestedFix{{
						Message: "Add a pre-migration check to ensure table \"t2\" is empty before dropping it",
						TextEdit: &sqlcheck.TextEdit{
							Line:    1,
							End:     1,
							NewText: "-- atlas:txtar\n\n-- checks/destructive.sql --\n-- atlas:assert DS102\nSELECT NOT EXISTS (SELECT 1 FROM `t2`) AS `is_empty`;\n\n-- migration.sql --\nDROP TABLE t2;",
						},
					}},
				}},
			}},
			Error: "destructive changes detected",
		}
		require.EqualValues(t, expectedReport, got.Files[0])
	})
	t.Run("lint with manually parsing output", func(t *testing.T) {
		c, err := atlasexec.NewClient(".", "atlas")
		require.NoError(t, err)
		var buf bytes.Buffer
		err = c.MigrateLintError(context.Background(), &atlasexec.MigrateLintParams{
			DevURL: "sqlite://file?mode=memory",
			DirURL: "file://testdata/migrations",
			Latest: 1,
			Writer: &buf,
		})
		require.Equal(t, atlasexec.ErrLint, err)
		var raw json.RawMessage
		require.NoError(t, json.NewDecoder(&buf).Decode(&raw))
		require.Contains(t, string(raw), "destructive changes detected")
	})
	t.Run("lint uses --base and --latest", func(t *testing.T) {
		c, err := atlasexec.NewClient(".", "atlas")
		require.NoError(t, err)
		summary, err := c.MigrateLint(context.Background(), &atlasexec.MigrateLintParams{
			DevURL: "sqlite://file?mode=memory",
			DirURL: "file://testdata/migrations",
			Latest: 1,
			Base:   "atlas://test-dir",
		})
		require.ErrorContains(t, err, "--latest, --git-base, and --base are mutually exclusive")
		require.Nil(t, summary)
	})
}

func TestAtlasMigrate_LintWithLogin(t *testing.T) {
	type (
		migrateLintReport struct {
			Context *atlasexec.RunContext `json:"context"`
		}
		graphQLQuery struct {
			Query             string          `json:"query"`
			Variables         json.RawMessage `json:"variables"`
			MigrateLintReport struct {
				migrateLintReport `json:"input"`
			}
		}
		Dir struct {
			Name    string `json:"name"`
			Content string `json:"content"`
			Slug    string `json:"slug"`
		}
		dirsQueryResponse struct {
			Data struct {
				Dirs []Dir `json:"dirs"`
			} `json:"data"`
		}
	)
	token := "123456789"
	handler := func(payloads *[]graphQLQuery) http.HandlerFunc {
		return func(w http.ResponseWriter, r *http.Request) {
			require.Equal(t, "Bearer "+token, r.Header.Get("Authorization"))
			var query graphQLQuery
			require.NoError(t, json.NewDecoder(r.Body).Decode(&query))
			*payloads = append(*payloads, query)
			switch {
			case strings.Contains(query.Query, "mutation reportMigrationLint"):
				_, err := fmt.Fprintf(w, `{ "data": { "reportMigrationLint": { "url": "https://migration-lint-report-url" } } }`)
				require.NoError(t, err)
			case strings.Contains(query.Query, "query dirs"):
				dir, err := migrate.NewLocalDir("./testdata/migrations")
				require.NoError(t, err)
				ad, err := migrate.ArchiveDir(dir)
				require.NoError(t, err)
				var resp dirsQueryResponse
				resp.Data.Dirs = []Dir{{
					Name:    "test-dir-name",
					Slug:    "test-dir-slug",
					Content: base64.StdEncoding.EncodeToString(ad),
				}}
				st2bytes, err := json.Marshal(resp)
				require.NoError(t, err)
				_, err = fmt.Fprint(w, string(st2bytes))
				require.NoError(t, err)
			}
		}
	}
	t.Run("Web and Writer params produces an error", func(t *testing.T) {
		var payloads []graphQLQuery
		srv := httptest.NewServer(handler(&payloads))
		t.Cleanup(srv.Close)
		atlasConfigURL := generateHCL(t, token, srv)
		c, err := atlasexec.NewClient(".", "atlas")
		require.NoError(t, err)
		params := &atlasexec.MigrateLintParams{
			ConfigURL: atlasConfigURL,
			DevURL:    "sqlite://file?mode=memory",
			DirURL:    "file://testdata/migrations",
			Latest:    1,
			Web:       true,
		}
		got, err := c.MigrateLint(context.Background(), params)
		require.ErrorContains(t, err, "Writer or Web reporting are not supported")
		require.Nil(t, got)
		params.Web = false
		params.Writer = &bytes.Buffer{}
		got, err = c.MigrateLint(context.Background(), params)
		require.ErrorContains(t, err, "Writer or Web reporting are not supported")
		require.Nil(t, got)
	})
	t.Run("lint parse web output - no error - custom format", func(t *testing.T) {
		var payloads []graphQLQuery
		srv := httptest.NewServer(handler(&payloads))
		t.Cleanup(srv.Close)
		atlasConfigURL := generateHCL(t, token, srv)
		c, err := atlasexec.NewClient(".", "atlas")
		require.NoError(t, err)
		var buf bytes.Buffer
		err = c.MigrateLintError(context.Background(), &atlasexec.MigrateLintParams{
			DevURL:    "sqlite://file?mode=memory",
			DirURL:    "file://testdata/migrations",
			ConfigURL: atlasConfigURL,
			Latest:    1,
			Writer:    &buf,
			Format:    "{{ .URL }}",
			Web:       true,
		})
		require.Equal(t, err, atlasexec.ErrLint)
		require.Equal(t, strings.TrimSpace(buf.String()), "https://migration-lint-report-url")
	})
	t.Run("lint parse web output - no error - default format", func(t *testing.T) {
		var payloads []graphQLQuery
		srv := httptest.NewServer(handler(&payloads))
		t.Cleanup(srv.Close)
		atlasConfigURL := generateHCL(t, token, srv)
		c, err := atlasexec.NewClient(".", "atlas")
		require.NoError(t, err)
		var buf bytes.Buffer
		err = c.MigrateLintError(context.Background(), &atlasexec.MigrateLintParams{
			DevURL:    "sqlite://file?mode=memory",
			DirURL:    "file://testdata/migrations",
			ConfigURL: atlasConfigURL,
			Latest:    1,
			Writer:    &buf,
			Web:       true,
		})
		require.Equal(t, atlasexec.ErrLint, err)
		var sr atlasexec.SummaryReport
		require.NoError(t, json.NewDecoder(&buf).Decode(&sr))
		require.Equal(t, "https://migration-lint-report-url", sr.URL)
	})
	t.Run("lint uses --base", func(t *testing.T) {
		var payloads []graphQLQuery
		srv := httptest.NewServer(handler(&payloads))
		t.Cleanup(srv.Close)
		atlasConfigURL := generateHCL(t, token, srv)
		c, err := atlasexec.NewClient(".", "atlas")
		require.NoError(t, err)
		summary, err := c.MigrateLint(context.Background(), &atlasexec.MigrateLintParams{
			DevURL:    "sqlite://file?mode=memory",
			DirURL:    "file://testdata/migrations",
			ConfigURL: atlasConfigURL,
			Base:      "atlas://test-dir-slug",
		})
		require.NoError(t, err)
		require.NotNil(t, summary)
	})
	t.Run("lint uses --context has error", func(t *testing.T) {
		var payloads []graphQLQuery
		srv := httptest.NewServer(handler(&payloads))
		t.Cleanup(srv.Close)
		c, err := atlasexec.NewClient(".", "atlas")
		require.NoError(t, err)
		var (
			buf            bytes.Buffer
			atlasConfigURL = generateHCL(t, token, srv)
			runContext     = &atlasexec.RunContext{
				Repo:     "testing-repo",
				Path:     "path/to/dir",
				Branch:   "testing-branch",
				Commit:   "sha123",
				URL:      "this://is/a/url",
				Username: "test-user",
				UserID:   "test-user-id",
				SCMType:  atlasexec.SCMTypeGithub,
			}
		)
		err = c.MigrateLintError(context.Background(), &atlasexec.MigrateLintParams{
			DevURL:    "sqlite://file?mode=memory",
			DirURL:    "file://testdata/migrations",
			ConfigURL: atlasConfigURL,
			Base:      "atlas://test-dir-slug",
			Context:   runContext,
			Writer:    &buf,
			Web:       true,
		})
		require.Equal(t, atlasexec.ErrLint, err)
		var sr atlasexec.SummaryReport
		require.NoError(t, json.NewDecoder(&buf).Decode(&sr))
		require.Equal(t, "https://migration-lint-report-url", sr.URL)
		found := false
		for _, query := range payloads {
			if !strings.Contains(query.Query, "mutation reportMigrationLint") {
				continue
			}
			found = true
			require.NoError(t, json.Unmarshal(query.Variables, &query.MigrateLintReport))
			require.Equal(t, runContext, query.MigrateLintReport.Context)
		}
		require.True(t, found)
	})
}

func TestMigrate_Diff(t *testing.T) {
	c, err := atlasexec.NewClient(".", "atlas")
	require.NoError(t, err)
	td := t.TempDir()
	require.NoError(t, os.WriteFile(fmt.Sprintf("%s/schema.sql", td), []byte(`create table t (c int not null)`), 0666))
	params := &atlasexec.MigrateDiffParams{
		ToURL:  fmt.Sprintf("file://%s/schema.sql", td),
		DevURL: "sqlite://file?mode=memory",
		DirURL: "file://testdata/migrations",
		Name:   "test-diff",
	}
	output, err := c.MigrateDiff(context.Background(), params)
	require.NoError(t, err)
	require.Len(t, output.Files, 1)
	require.Contains(t, output.Files[0].Name, "test-diff.sql")
	require.Equal(t, output.Files[0].Content, "-- Disable the enforcement of foreign-keys constraints\nPRAGMA foreign_keys = off;\n-- Drop \"t1\" table\nDROP TABLE `t1`;\n-- Create \"t\" table\nCREATE TABLE `t` (\n  `c` int NOT NULL\n);\n-- Enable back the enforcement of foreign-keys constraints\nPRAGMA foreign_keys = on;\n")
	require.Equal(t, output.Dir, "file://testdata/migrations?format=atlas")

	// No diff
	params = &atlasexec.MigrateDiffParams{
		ToURL:  "file://testdata/migrations",
		DevURL: "sqlite://file?mode=memory",
		DirURL: "file://testdata/migrations",
		Name:   "test-diff",
	}
	output, err = c.MigrateDiff(context.Background(), params)
	require.NoError(t, err)
	require.Len(t, output.Files, 0)
}


================================================
FILE: atlasexec/atlas_models.go
================================================
// Copyright 2021-present The Atlas Authors. All rights reserved.
// This source code is licensed under the Apache 2.0 license found
// in the LICENSE file in the root directory of this source tree.

package atlasexec

import (
	"errors"
	"time"

	"ariga.io/atlas/sql/schema"
	"ariga.io/atlas/sql/sqlcheck"
	"ariga.io/atlas/sql/sqlclient"
)

type (
	// File wraps migrate.File to implement json.Marshaler.
	File struct {
		Name        string `json:"Name,omitempty"`
		Version     string `json:"Version,omitempty"`
		Description string `json:"Description,omitempty"`
		Content     string `json:"Content,omitempty"`
	}
	// AppliedFile is part of a MigrateApply containing information about an applied file in a migration attempt.
	AppliedFile struct {
		File
		Start   time.Time
		End     time.Time
		Skipped int           // Amount of skipped SQL statements in a partially applied file.
		Applied []string      // SQL statements applied with success
		Checks  []*FileChecks // Assertion checks
		Error   *struct {
			Stmt string // SQL statement that failed.
			Text string // Error returned by the database.
		}
	}
	// RevertedFile is part of a MigrateDown containing information about a reverted file in a downgrade attempt.
	RevertedFile struct {
		File
		Start   time.Time
		End     time.Time
		Skipped int      // Amount of skipped SQL statements in a partially applied file.
		Applied []string // SQL statements applied with success
		Scope   string   // Scope of the revert. e.g., statement, versions, etc.
		Error   *struct {
			Stmt string // SQL statement that failed.
			Text string // Error returned by the database.
		}
	}
	// A SummaryReport contains a summary of the analysis of all files.
	// It is used as an input to templates to report the CI results.
	SummaryReport struct {
		URL string `json:"URL,omitempty"` // URL of the report, if exists.
		// Env holds the environment information.
		Env struct {
			Driver string         `json:"Driver,omitempty"` // Driver name.
			URL    *sqlclient.URL `json:"URL,omitempty"`    // URL to dev database.
			Dir    string         `json:"Dir,omitempty"`    // Path to migration directory.
		}
		// Schema versions found by the runner.
		Schema struct {
			Current string `json:"Current,omitempty"` // Current schema.
			Desired string `json:"Desired,omitempty"` // Desired schema.
		}
		// Steps of the analysis. Added in verbose mode.
		Steps []*StepReport `json:"Steps,omitempty"`
		// Files reports. Non-empty in case there are findings.
		Files []*FileReport `json:"Files,omitempty"`
	}
	// StepReport contains a summary of the analysis of a single step.
	StepReport struct {
		Name   string      `json:"Name,omitempty"`   // Step name.
		Text   string      `json:"Text,omitempty"`   // Step description.
		Error  string      `json:"Error,omitempty"`  // Error that cause the execution to halt.
		Result *FileReport `json:"Result,omitempty"` // Result of the step. For example, a diagnostic.
	}
	// FileReport contains a summary of the analysis of a single file.
	FileReport struct {
		Name    string            `json:"Name,omitempty"`    // Name of the file.
		Text    string            `json:"Text,omitempty"`    // Contents of the file.
		Reports []sqlcheck.Report `json:"Reports,omitempty"` // List of reports.
		Error   string            `json:"Error,omitempty"`   // File specific error.
	}
	// FileChecks represents a set of checks to run before applying a file.
	FileChecks struct {
		Name  string     `json:"Name,omitempty"`  // File/group name.
		Stmts []*Check   `json:"Stmts,omitempty"` // Checks statements executed.
		Error *StmtError `json:"Error,omitempty"` // Assertion error.
		Start time.Time  `json:"Start,omitempty"` // Start assertion time.
		End   time.Time  `json:"End,omitempty"`   // End assertion time.
	}
	// Check represents an assertion and its status.
	Check struct {
		Stmt  string  `json:"Stmt,omitempty"`  // Assertion statement.
		Error *string `json:"Error,omitempty"` // Assertion error, if any.
	}
	// StmtError groups a statement with its execution error.
	StmtError struct {
		Stmt string `json:"Stmt,omitempty"` // SQL statement that failed.
		Text string `json:"Text,omitempty"` // Error message as returned by the database.
	}
	// Env holds the environment information.
	Env struct {
		Driver string         `json:"Driver,omitempty"` // Driver name.
		URL    *sqlclient.URL `json:"URL,omitempty"`    // URL to dev database.
		Dir    string         `json:"Dir,omitempty"`    // Path to migration directory.
	}
	// Changes represents a list of changes that are pending or applied.
	Changes struct {
		Applied []string   `json:"Applied,omitempty"` // SQL changes applied with success
		Pending []string   `json:"Pending,omitempty"` // SQL changes that were not applied
		Error   *StmtError `json:"Error,omitempty"`   // Error that occurred during applying
	}
	// A Revision denotes an applied migration in a deployment. Used to track migration executions state of a database.
	Revision struct {
		Version         string        `json:"Version"`             // Version of the migration.
		Description     string        `json:"Description"`         // Description of this migration.
		Type            string        `json:"Type"`                // Type of the migration.
		Applied         int           `json:"Applied"`             // Applied amount of statements in the migration.
		Total           int           `json:"Total"`               // Total amount of statements in the migration.
		ExecutedAt      time.Time     `json:"ExecutedAt"`          // ExecutedAt is the starting point of execution.
		ExecutionTime   time.Duration `json:"ExecutionTime"`       // ExecutionTime of the migration.
		Error           string        `json:"Error,omitempty"`     // Error of the migration, if any occurred.
		ErrorStmt       string        `json:"ErrorStmt,omitempty"` // ErrorStmt is the statement that raised Error.
		OperatorVersion string        `json:"OperatorVersion"`     // OperatorVersion that executed this migration.
	}
	// A Report describes a schema analysis report with an optional specific diagnostic.
	Report struct {
		Text        string       `json:"Text"`                  // Report text.
		Desc        string       `json:"Desc,omitempty"`        // Optional description (secondary text).
		Error       bool         `json:"Error,omitempty"`       // Report is an error report.
		Diagnostics []Diagnostic `json:"Diagnostics,omitempty"` // Report diagnostics.
	}
	// A Diagnostic is a text associated with a specific position of a definition/element in a file.
	Diagnostic struct {
		Pos  *schema.Pos `json:"Pos,omitempty"`  // Element position.
		Text string      `json:"Text"`           // Diagnostic text.
		Code string      `json:"Code,omitempty"` // Code describes the check (optional).
	}
	// TableSizeMetric represents a table size metric from schema stats
	TableSizeMetric struct {
		Schema string  `json:"schema"`
		Table  string  `json:"table"`
		Value  float64 `json:"value"`
	}
)

// MetricTableSizeBytes is the name of the table size metric in bytes.
const MetricTableSizeBytes = "atlas_table_size_bytes"

// DiagnosticsCount returns the total number of diagnostics in the report.
func (r *SummaryReport) DiagnosticsCount() int {
	var n int
	for _, f := range r.Files {
		for _, r := range f.Reports {
			n += len(r.Diagnostics)
		}
	}
	return n
}

// Errors returns the errors in the summary report, if exists.
func (r *SummaryReport) Errors() []error {
	var errs []error
	for _, f := range r.Files {
		if f.Error != "" {
			errs = append(errs, errors.New(f.Error))
		}
	}
	return errs
}


================================================
FILE: atlasexec/atlas_schema.go
================================================
// Copyright 2021-present The Atlas Authors. All rights reserved.
// This source code is licensed under the Apache 2.0 license found
// in the LICENSE file in the root directory of this source tree.

package atlasexec

import (
	"context"
	"encoding/json"
	"fmt"
	"strconv"
	"strings"
	"time"

	"ariga.io/atlas/sql/migrate"
)

type (
	// SchemaPushParams are the parameters for the `schema push` command.
	SchemaPushParams struct {
		ConfigURL string
		Env       string
		Vars      VarArgs
		Context   *RunContext
		DevURL    string

		URL         []string // Desired schema URL(s) to push
		Schema      []string // If set, only the specified schemas are pushed.
		Name        string   // Name of the schema (repo) to push to.
		Tag         string   // Tag to push the schema with
		Version     string   // Version of the schema to push. Defaults to the current timestamp.
		Description string   // Description of the schema changes.
	}
	// SchemaPush represents the result of a 'schema push' command.
	SchemaPush struct {
		Link string
		Slug string
		URL  string
	}
	// SchemaApplyParams are the parameters for the `schema apply` command.
	SchemaApplyParams struct {
		ConfigURL string
		Env       string
		Vars      VarArgs
		DevURL    string

		URL         string
		To          string // TODO: change to []string
		TxMode      string
		Exclude     []string
		Include     []string
		Schema      []string
		DryRun      bool   // If true, --dry-run is set.
		AutoApprove bool   // If true, --auto-approve is set.
		PlanURL     string // URL of the plan in Atlas format (atlas://<repo>/plans/<id>). (optional)
		LockName    string
	}
	// SchemaApply represents the result of a 'schema apply' command.
	SchemaApply struct {
		Env
		// Changes holds the changes applied to the database.
		// Exists for backward compatibility with the old schema
		// apply structure as old SDK versions rely on it.
		Changes Changes      `json:"Changes,omitempty"`
		Error   string       `json:"Error,omitempty"`   // Any error that occurred during execution.
		Start   time.Time    `json:"Start,omitempty"`   // When apply (including plan) started.
		End     time.Time    `json:"End,omitempty"`     // When apply ended.
		Applied *AppliedFile `json:"Applied,omitempty"` // Applied migration file (pre-planned or computed).
		// Plan information might be partially filled. For example, if lint is done
		// during plan-stage, the linting report is available in the Plan field. If
		// the migration is pre-planned migration, the File.URL is set, etc.
		Plan *SchemaPlan `json:"Plan,omitempty"`
	}
	// SchemaApplyError is returned when an error occurred
	// during a schema applying attempt.
	SchemaApplyError struct {
		Result []*SchemaApply
		Stderr string
	}
	// SchemaInspectParams are the parameters for the `schema inspect` command.
	SchemaInspectParams struct {
		ConfigURL string
		Env       string
		Vars      VarArgs
		Format    string
		DevURL    string

		URL     string
		Exclude []string
		Include []string
		Schema  []string
	}
	// SchemaTestParams are the parameters for the `schema test` command.
	SchemaTestParams struct {
		ConfigURL string
		Env       string
		Vars      VarArgs
		DevURL    string

		URL   string
		Run   string
		Paths []string
	}
	// SchemaPlanParams are the parameters for the `schema plan` command.
	SchemaPlanParams struct {
		ConfigURL string
		Env       string
		Vars      VarArgs
		Context   *RunContext
		DevURL    string
		Exclude   []string
		Include   []string
		Schema    []string

		From, To   []string
		Repo       string
		Name       string
		Directives []string
		// The below are mutually exclusive and can be replaced
		// with the 'schema plan' sub-commands instead.
		DryRun     bool // If false, --auto-approve is set.
		Pending    bool
		Push, Save bool
	}
	// SchemaPlanListParams are the parameters for the `schema plan list` command.
	SchemaPlanListParams struct {
		ConfigURL string
		Env       string
		Vars      VarArgs
		Context   *RunContext
		DevURL    string
		Schema    []string
		Exclude   []string
		Include   []string

		From, To []string
		Repo     string
		Pending  bool // If true, only pending plans are listed.
	}
	// SchemaPlanPushParams are the parameters for the `schema plan push` command.
	SchemaPlanPushParams struct {
		ConfigURL string
		Env       string
		Vars      VarArgs
		Context   *RunContext
		DevURL    string
		Schema    []string
		Exclude   []string
		Include   []string

		From, To []string
		Repo     string
		Pending  bool   // Push plan in pending state.
		File     string // File to push. (optional)
	}
	// SchemaPlanPullParams are the parameters for the `schema plan pull` command.
	SchemaPlanPullParams struct {
		ConfigURL string
		Env       string
		Vars      VarArgs
		URL       string // URL to the plan in Atlas format. (required)
	}
	// SchemaPlanLintParams are the parameters for the `schema plan lint` command.
	SchemaPlanLintParams struct {
		ConfigURL string
		Env       string
		Vars      VarArgs
		Context   *RunContext
		DevURL    string
		Schema    []string
		Exclude   []string
		Include   []string

		From, To []string
		Repo     string
		File     string
	}
	// SchemaPlanValidateParams are the parameters for the `schema plan validate` command.
	SchemaPlanValidateParams struct {
		ConfigURL string
		Env       string
		Vars      VarArgs
		Context   *RunContext
		DevURL    string
		Schema    []string
		Exclude   []string
		Include   []string

		From, To []string
		Repo     string
		Name     string
		File     string
	}
	// SchemaPlanApproveParams are the parameters for the `schema plan approve` command.
	SchemaPlanApproveParams struct {
		ConfigURL string
		Env       string
		Vars      VarArgs

		URL string
	}
	// SchemaPlan is the result of a 'schema plan' command.
	SchemaPlan struct {
		Env   Env             `json:"Env,omitempty"`   // Environment info.
		Repo  string          `json:"Repo,omitempty"`  // Repository name.
		Lint  *SummaryReport  `json:"Lint,omitempty"`  // Lint report.
		File  *SchemaPlanFile `json:"File,omitempty"`  // Plan file.
		Error string          `json:"Error,omitempty"` // Any error occurred during planning.
	}
	// SchemaPlanApprove is the result of a 'schema plan approve' command.
	SchemaPlanApprove struct {
		URL    string `json:"URL,omitempty"`    // URL of the plan in Atlas format.
		Link   string `json:"Link,omitempty"`   // Link to the plan in the registry.
		Status string `json:"Status,omitempty"` // Status of the plan in the registry.
	}
	// SchemaPlanFile is a JSON representation of a schema plan file.
	SchemaPlanFile struct {
		Name      string          `json:"Name,omitempty"`      // Name of the plan.
		FromHash  string          `json:"FromHash,omitempty"`  // Hash of the 'from' realm.
		FromDesc  string          `json:"FromDesc,omitempty"`  // Optional description of the 'from' state.
		ToHash    string          `json:"ToHash,omitempty"`    // Hash of the 'to' realm.
		ToDesc    string          `json:"ToDesc,omitempty"`    // Optional description of the 'to' state.
		Migration string          `json:"Migration,omitempty"` // Migration SQL.
		Stmts     []*migrate.Stmt `json:"Stmts,omitempty"`     // Statements in the migration (available only in the JSON output).
		// registry only fields.
		URL    string `json:"URL,omitempty"`    // URL of the plan in Atlas format.
		Link   string `json:"Link,omitempty"`   // Link to the plan in the registry.
		Status string `json:"Status,omitempty"` // Status of the plan in the registry.
	}
	// SchemaCleanParams are the parameters for the `schema clean` command.
	SchemaCleanParams struct {
		ConfigURL string
		Env       string
		Vars      VarArgs

		URL         string // URL of the schema to clean. (required)
		DryRun      bool   // If true, --dry-run is set.
		AutoApprove bool   // If true, --auto-approve is set.
	}
	// SchemaClean represents the result of a 'schema clean' command.
	SchemaClean struct {
		Env
		Start   time.Time    `json:"Start,omitempty"`   // When clean started.
		End     time.Time    `json:"End,omitempty"`     // When clean ended.
		Applied *AppliedFile `json:"Applied,omitempty"` // Applied migration file.
		Error   string       `json:"Error,omitempty"`   // Any error that occurred during execution.
	}
	// SchemaLintParams are the parameters for the `schema lint` command.
	SchemaLintParams struct {
		ConfigURL string
		Env       string
		Vars      VarArgs

		URL    []string // Schema URL(s) to lint
		Schema []string // If set, only the specified schemas are linted.
		Format string
		DevURL string
	}
	// SchemaLintReport holds the results of a schema lint operation
	SchemaLintReport struct {
		Steps []Report `json:"Steps,omitempty"`
	}

	// SchemaStatsInspectParams are the parameters for the `schema stat inspect` command.
	SchemaStatsInspectParams struct {
		ConfigURL string
		Env       string
		Vars      VarArgs

		URL     string
		Exclude []string
		Include []string
		Schema  []string
	}
)

// SchemaPush runs the 'schema push' command.
func (c *Client) SchemaPush(ctx context.Context, params *SchemaPushParams) (*SchemaPush, error) {
	args := []string{"schema", "push", "--format", "{{ json . }}"}
	// Global flags
	if params.ConfigURL != "" {
		args = append(args, "--config", params.ConfigURL)
	}
	if params.Env != "" {
		args = append(args, "--env", params.Env)
	}
	if params.Vars != nil {
		args = append(args, params.Vars.AsArgs()...)
	}
	// Hidden flags
	if params.Context != nil {
		buf, err := json.Marshal(params.Context)
		if err != nil {
			return nil, err
		}
		args = append(args, "--context", string(buf))
	}
	// Flags of the 'schema push' sub-commands
	args = append(args, repeatFlag("--url", params.URL)...)
	if params.DevURL != "" {
		args = append(args, "--dev-url", params.DevURL)
	}
	if len(params.Schema) > 0 {
		args = append(args, "--schema", listString(params.Schema))
	}
	if params.Tag != "" {
		args = append(args, "--tag", params.Tag)
	}
	if params.Version != "" {
		args = append(args, "--version", params.Version)
	}
	if params.Description != "" {
		args = append(args, "--desc", params.Description)
	}
	if params.Name != "" {
		args = append(args, params.Name)
	}
	return firstResult(jsonDecode[SchemaPush](c.runCommand(ctx, args)))
}

// SchemaApply runs the 'schema apply' command.
func (c *Client) SchemaApply(ctx context.Context, params *SchemaApplyParams) (*SchemaApply, error) {
	return firstResult(c.SchemaApplySlice(ctx, params))
}

// SchemaApplySlice runs the 'schema apply' command for multiple targets.
func (c *Client) SchemaApplySlice(ctx context.Context, params *SchemaApplyParams) ([]*SchemaApply, error) {
	args := []string{"schema", "apply", "--format", "{{ json . }}"}
	// Global flags
	if params.ConfigURL != "" {
		args = append(args, "--config", params.ConfigURL)
	}
	if params.Env != "" {
		args = append(args, "--env", params.Env)
	}
	if params.Vars != nil {
		args = append(args, params.Vars.AsArgs()...)
	}
	// Flags of the 'schema apply' sub-commands
	if params.URL != "" {
		args = append(args, "--url", params.URL)
	}
	if params.To != "" {
		args = append(args, "--to", params.To)
	}
	if params.TxMode != "" {
		args = append(args, "--tx-mode", params.TxMode)
	}
	if params.DevURL != "" {
		args = append(args, "--dev-url", params.DevURL)
	}
	if len(params.Schema) > 0 {
		args = append(args, "--schema", listString(params.Schema))
	}
	if len(params.Exclude) > 0 {
		args = append(args, "--exclude", listString(params.Exclude))
	}
	if len(params.Include) > 0 {
		args = append(args, "--include", listString(params.Include))
	}
	if params.PlanURL != "" {
		args = append(args, "--plan", params.PlanURL)
	}
	if params.LockName != "" {
		args = append(args, "--lock-name", params.LockName)
	}
	switch {
	case params.DryRun:
		args = append(args, "--dry-run")
	case params.AutoApprove:
		args = append(args, "--auto-approve")
	}
	return jsonDecodeErr(newSchemaApplyError)(c.runCommand(ctx, args))
}

// SchemaInspect runs the 'schema inspect' command.
func (c *Client) SchemaInspect(ctx context.Context, params *SchemaInspectParams) (string, error) {
	args := []string{"schema", "inspect"}
	if params.Env != "" {
		args = append(args, "--env", params.Env)
	}
	if params.ConfigURL != "" {
		args = append(args, "--config", params.ConfigURL)
	}
	if params.URL != "" {
		args = append(args, "--url", params.URL)
	}
	if params.DevURL != "" {
		args = append(args, "--dev-url", params.DevURL)
	}
	switch {
	case params.Format == "sql":
		args = append(args, "--format", "{{ sql . }}")
	case params.Format != "":
		args = append(args, "--format", params.Format)
	}
	if len(params.Schema) > 0 {
		args = append(args, "--schema", listString(params.Schema))
	}
	if len(params.Exclude) > 0 {
		args = append(args, "--exclude", listString(params.Exclude))
	}
	if len(params.Include) > 0 {
		args = append(args, "--include", listString(params.Include))
	}
	if params.Vars != nil {
		args = append(args, params.Vars.AsArgs()...)
	}
	return stringVal(c.runCommand(ctx, args))
}

// SchemaTest runs the 'schema test' command.
func (c *Client) SchemaTest(ctx context.Context, params *SchemaTestParams) (string, error) {
	args := []string{"schema", "test"}
	if params.Env != "" {
		args = append(args, "--env", params.Env)
	}
	if params.ConfigURL != "" {
		args = append(args, "--config", params.ConfigURL)
	}
	if params.URL != "" {
		args = append(args, "--url", params.URL)
	}
	if params.DevURL != "" {
		args = append(args, "--dev-url", params.DevURL)
	}
	if params.Run != "" {
		args = append(args, "--run", params.Run)
	}
	if params.Vars != nil {
		args = append(args, params.Vars.AsArgs()...)
	}
	if len(params.Paths) > 0 {
		args = append(args, params.Paths...)
	}
	return stringVal(c.runCommand(ctx, args))
}

// SchemaPlan runs the `schema plan` command.
func (c *Client) SchemaPlan(ctx context.Context, params *SchemaPlanParams) (*SchemaPlan, error) {
	args := []string{"schema", "plan", "--format", "{{ json . }}"}
	// Global flags
	if params.ConfigURL != "" {
		args = append(args, "--config", params.ConfigURL)
	}
	if params.Env != "" {
		args = append(args, "--env", params.Env)
	}
	if params.Vars != nil {
		args = append(args, params.Vars.AsArgs()...)
	}
	// Hidden flags
	if params.Context != nil {
		buf, err := json.Marshal(params.Context)
		if err != nil {
			return nil, err
		}
		args = append(args, "--context", string(buf))
	}
	// Flags of the 'schema plan' sub-commands
	if params.DevURL != "" {
		args = append(args, "--dev-url", params.DevURL)
	}
	if len(params.Schema) > 0 {
		args = append(args, "--schema", listString(params.Schema))
	}
	if len(params.Exclude) > 0 {
		args = append(args, "--exclude", listString(params.Exclude))
	}
	if len(params.Include) > 0 {
		args = append(args, "--include", listString(params.Include))
	}
	if len(params.From) > 0 {
		args = append(args, "--from", listString(params.From))
	}
	if len(params.To) > 0 {
		args = append(args, "--to", listString(params.To))
	}
	if params.Name != "" {
		args = append(args, "--name", params.Name)
	}
	if params.Repo != "" {
		args = append(args, "--repo", params.Repo)
	}
	if params.Save {
		args = append(args, "--save")
	}
	if params.Push {
		args = append(args, "--push")
	}
	if params.Pending {
		args = append(args, "--pending")
	}
	if params.DryRun {
		args = append(args, "--dry-run")
	} else {
		args = append(args, "--auto-approve")
	}
	for _, d := range params.Directives {
		args = append(args, "--directive", strconv.Quote(d))
	}
	// NOTE: This command only support one result.
	return firstResult(jsonDecode[SchemaPlan](c.runCommand(ctx, args)))
}

// SchemaPlanList runs the `schema plan list` command.
func (c *Client) SchemaPlanList(ctx context.Context, params *SchemaPlanListParams) ([]SchemaPlanFile, error) {
	args := []string{"schema", "plan", "list", "--format", "{{ json . }}"}
	// Global flags
	if params.ConfigURL != "" {
		args = append(args, "--config", params.ConfigURL)
	}
	if params.Env != "" {
		args = append(args, "--env", params.Env)
	}
	if params.Vars != nil {
		args = append(args, params.Vars.AsArgs()...)
	}
	// Hidden flags
	if params.Context != nil {
		buf, err := json.Marshal(params.Context)
		if err != nil {
			return nil, err
		}
		args = append(args, "--context", string(buf))
	}
	// Flags of the 'schema plan lint' sub-commands
	if params.DevURL != "" {
		args = append(args, "--dev-url", params.DevURL)
	}
	if len(params.Schema) > 0 {
		args = append(args, "--schema", listString(params.Schema))
	}
	if len(params.Exclude) > 0 {
		args = append(args, "--exclude", listString(params.Exclude))
	}
	if len(params.Include) > 0 {
		args = append(args, "--include", listString(params.Include))
	}
	if len(params.From) > 0 {
		args = append(args, "--from", listString(params.From))
	}
	if len(params.To) > 0 {
		args = append(args, "--to", listString(params.To))
	}
	if params.Repo != "" {
		args = append(args, "--repo", params.Repo)
	}
	if params.Pending {
		args = append(args, "--pending")
	}
	args = append(args, "--auto-approve")
	// NOTE: This command only support one result.
	v, err := firstResult(jsonDecode[[]SchemaPlanFile](c.runCommand(ctx, args)))
	if err != nil {
		return nil, err
	}
	return *v, nil
}

// SchemaPlanPush runs the `schema plan push` command.
func (c *Client) SchemaPlanPush(ctx context.Context, params *SchemaPlanPushParams) (string, error) {
	args := []string{"schema", "plan", "push", "--format", "{{ json . }}"}
	// Global flags
	if params.ConfigURL != "" {
		args = append(args, "--config", params.ConfigURL)
	}
	if params.Env != "" {
		args = append(args, "--env", params.Env)
	}
	if params.Vars != nil {
		args = append(args, params.Vars.AsArgs()...)
	}
	// Hidden flags
	if params.Context != nil {
		buf, err := json.Marshal(params.Context)
		if err != nil {
			return "", err
		}
		args = append(args, "--context", string(buf))
	}
	// Flags of the 'schema plan push' sub-commands
	if params.DevURL != "" {
		args = append(args, "--dev-url", params.DevURL)
	}
	if len(params.Schema) > 0 {
		args = append(args, "--schema", listString(params.Schema))
	}
	if len(params.Exclude) > 0 {
		args = append(args, "--exclude", listString(params.Exclude))
	}
	if len(params.Include) > 0 {
		args = append(args, "--include", listString(params.Include))
	}
	if len(params.From) > 0 {
		args = append(args, "--from", listString(params.From))
	}
	if len(params.To) > 0 {
		args = append(args, "--to", listString(params.To))
	}
	if params.File != "" {
		args = append(args, "--file", params.File)
	} else {
		return "", &InvalidParamsError{"schema plan push", "missing required flag --file"}
	}
	if params.Repo != "" {
		args = append(args, "--repo", params.Repo)
	}
	if params.Pending {
		args = append(args, "--pending")
	} else {
		args = append(args, "--auto-approve")
	}
	return stringVal(c.runCommand(ctx, args))
}

// SchemaPlanPush runs the `schema plan pull` command.
func (c *Client) SchemaPlanPull(ctx context.Context, params *SchemaPlanPullParams) (string, error) {
	args := []string{"schema", "plan", "pull"}
	// Global flags
	if params.ConfigURL != "" {
		args = append(args, "--config", params.ConfigURL)
	}
	if params.Env != "" {
		args = append(args, "--env", params.Env)
	}
	if params.Vars != nil {
		args = append(args, params.Vars.AsArgs()...)
	}
	// Flags of the 'schema plan pull' sub-commands
	if params.URL != "" {
		args = append(args, "--url", params.URL)
	} else {
		return "", &InvalidParamsError{"schema plan pull", "missing required flag --url"}
	}
	return stringVal(c.runCommand(ctx, args))
}

// SchemaPlanLint runs the `schema plan lint` command.
func (c *Client) SchemaPlanLint(ctx context.Context, params *SchemaPlanLintParams) (*SchemaPlan, error) {
	args := []string{"schema", "plan", "lint", "--format", "{{ json . }}"}
	// Global flags
	if params.ConfigURL != "" {
		args = append(args, "--config", params.ConfigURL)
	}
	if params.Env != "" {
		args = append(args, "--env", params.Env)
	}
	if params.Vars != nil {
		args = append(args, params.Vars.AsArgs()...)
	}
	// Hidden flags
	if params.Context != nil {
		buf, err := json.Marshal(params.Context)
		if err != nil {
			return nil, err
		}
		args = append(args, "--context", string(buf))
	}
	// Flags of the 'schema plan lint' sub-commands
	if params.DevURL != "" {
		args = append(args, "--dev-url", params.DevURL)
	}
	if len(params.Schema) > 0 {
		args = append(args, "--schema", listString(params.Schema))
	}
	if len(params.Exclude) > 0 {
		args = append(args, "--exclude", listString(params.Exclude))
	}
	if len(params.Include) > 0 {
		args = append(args, "--include", listString(params.Include))
	}
	if len(params.From) > 0 {
		args = append(args, "--from", listString(params.From))
	}
	if len(params.To) > 0 {
		args = append(args, "--to", listString(params.To))
	}
	if params.File != "" {
		args = append(args, "--file", params.File)
	} else {
		return nil, &InvalidParamsError{"schema plan lint", "missing required flag --file"}
	}
	if params.Repo != "" {
		args = append(args, "--repo", params.Repo)
	}
	args = append(args, "--auto-approve")
	// NOTE: This command only support one result.
	return firstResult(jsonDecode[SchemaPlan](c.runCommand(ctx, args)))
}

// SchemaPlanValidate runs the `schema plan validate` command.
func (c *Client) SchemaPlanValidate(ctx context.Context, params *SchemaPlanValidateParams) error {
	args := []string{"schema", "plan", "validate"}
	// Global flags
	if params.ConfigURL != "" {
		args = append(args, "--config", params.ConfigURL)
	}
	if params.Env != "" {
		args = append(args, "--env", params.Env)
	}
	if params.Vars != nil {
		args = append(args, params.Vars.AsArgs()...)
	}
	// Hidden flags
	if params.Context != nil {
		buf, err := json.Marshal(params.Context)
		if err != nil {
			return err
		}
		args = append(args, "--context", string(buf))
	}
	// Flags of the 'schema plan validate' sub-commands
	if params.DevURL != "" {
		args = append(args, "--dev-url", params.DevURL)
	}
	if len(params.Schema) > 0 {
		args = append(args, "--schema", listString(params.Schema))
	}
	if len(params.Exclude) > 0 {
		args = append(args, "--exclude", listString(params.Exclude))
	}
	if len(params.Include) > 0 {
		args = append(args, "--include", listString(params.Include))
	}
	if len(params.From) > 0 {
		args = append(args, "--from", listString(params.From))
	}
	if len(params.To) > 0 {
		args = append(args, "--to", listString(params.To))
	}
	if params.File != "" {
		args = append(args, "--file", params.File)
	} else {
		return &InvalidParamsError{"schema plan validate", "missing required flag --file"}
	}
	if params.Name != "" {
		args = append(args, "--name", params.Name)
	}
	if params.Repo != "" {
		args = append(args, "--repo", params.Repo)
	}
	args = append(args, "--auto-approve")
	_, err := stringVal(c.runCommand(ctx, args))
	return err
}

// SchemaPlanApprove runs the `schema plan approve` command.
func (c *Client) SchemaPlanApprove(ctx context.Context, params *SchemaPlanApproveParams) (*SchemaPlanApprove, error) {
	args := []string{"schema", "plan", "approve", "--format", "{{ json . }}"}
	// Global flags
	if params.ConfigURL != "" {
		args = append(args, "--config", params.ConfigURL)
	}
	if params.Env != "" {
		args = append(args, "--env", params.Env)
	}
	if params.Vars != nil {
		args = append(args, params.Vars.AsArgs()...)
	}
	// Flags of the 'schema plan approve' sub-commands
	if params.URL != "" {
		args = append(args, "--url", params.URL)
	} else {
		return nil, &InvalidParamsError{"schema plan approve", "missing required flag --url"}
	}
	// NOTE: This command only support one result.
	return firstResult(jsonDecode[SchemaPlanApprove](c.runCommand(ctx, args)))
}

// SchemaClean runs the `schema clean` command.
func (c *Client) SchemaClean(ctx context.Context, params *SchemaCleanParams) (*SchemaClean, error) {
	args := []string{"schema", "clean", "--format", "{{ json . }}"}
	// Global flags
	if params.ConfigURL != "" {
		args = append(args, "--config", params.ConfigURL)
	}
	if params.Env != "" {
		args = append(args, "--env", params.Env)
	}
	if params.Vars != nil {
		args = append(args, params.Vars.AsArgs()...)
	}
	// Flags of the 'schema clean' sub-commands
	if params.URL != "" {
		args = append(args, "--url", params.URL)
	}
	switch {
	case params.DryRun:
		args = append(args, "--dry-run")
	case params.AutoApprove:
		args = append(args, "--auto-approve")
	}
	return firstResult(jsonDecode[SchemaClean](c.runCommand(ctx, args)))
}

// SchemaLint runs the 'schema lint' command.
func (c *Client) SchemaLint(ctx context.Context, params *SchemaLintParams) (*SchemaLintReport, error) {
	args, err := params.AsArgs()
	if err != nil {
		return nil, err
	}
	return firstResult(jsonDecode[SchemaLintReport](c.runCommand(ctx, args)))
}

// SchemaStatsInspect runs the 'schema stats inspect' command.
func (c *Client) SchemaStatsInspect(ctx context.Context, params *SchemaStatsInspectParams) (string, error) {
	args := []string{"schema", "stats", "inspect", "--format", "{{ json .Realm }}"}
	if params.Env != "" {
		args = append(args, "--env", params.Env)
	}
	if params.ConfigURL != "" {
		args = append(args, "--config", params.ConfigURL)
	}
	if params.URL != "" {
		args = append(args, "--url", params.URL)
	}
	if len(params.Schema) > 0 {
		args = append(args, "--schema", listString(params.Schema))
	}
	if len(params.Exclude) > 0 {
		args = append(args, "--exclude", listString(params.Exclude))
	}
	if len(params.Include) > 0 {
		args = append(args, "--include", listString(params.Include))
	}
	if params.Vars != nil {
		args = append(args, params.Vars.AsArgs()...)
	}
	return stringVal(c.runCommand(ctx, args))
}

// AsArgs returns the parameters as arguments.
func (p *SchemaLintParams) AsArgs() ([]string, error) {
	args := []string{"schema", "lint", "--format", "{{ json . }}"}
	if p.Env != "" {
		args = append(args, "--env", p.Env)
	}
	if p.ConfigURL != "" {
		args = append(args, "--config", p.ConfigURL)
	}
	if p.DevURL != "" {
		args = append(args, "--dev-url", p.DevURL)
	}
	args = append(args, repeatFlag("--url", p.URL)...)
	if len(p.Schema) > 0 {
		args = append(args, "--schema", listString(p.Schema))
	}
	if p.Vars != nil {
		args = append(args, p.Vars.AsArgs()...)
	}
	return args, nil
}

// InvalidParamsError is an error type for invalid parameters.
type InvalidParamsError struct {
	cmd string
	msg string
}

// Error returns the error message.
func (e *InvalidParamsError) Error() string {
	return fmt.Sprintf("atlasexec: command %q has invalid parameters: %v", e.cmd, e.msg)
}
func newSchemaApplyError(r []*SchemaApply, stderr string) error {
	return &SchemaApplyError{Result: r, Stderr: stderr}
}

// Error implements the error interface.
func (e *SchemaApplyError) Error() string {
	var errs []string
	for _, r := range e.Result {
		if r.Error != "" {
			errs = append(errs, r.Error)
		}
	}
	if e.Stderr != "" {
		errs = append(errs, e.Stderr)
	}
	return strings.Join(errs, "\n")
}


================================================
FILE: atlasexec/atlas_schema_test.go
================================================
// Copyright 2021-present The Atlas Authors. All rights reserved.
// This source code is licensed under the Apache 2.0 license found
// in the LICENSE file in the root directory of this source tree.

package atlasexec_test

import (
	"context"
	"fmt"
	"net/http"
	"net/http/httptest"
	"os"
	"path/filepath"
	"testing"

	"ariga.io/atlas/atlasexec"
	"github.com/stretchr/testify/require"
)

func TestSchema_Test(t *testing.T) {
	wd, err := os.Getwd()
	require.NoError(t, err)
	c, err := atlasexec.NewClient(t.TempDir(), filepath.Join(wd, "./mock-atlas.sh"))
	require.NoError(t, err)

	for _, tt := range []struct {
		name   string
		params *atlasexec.SchemaTestParams
		args   string
		stdout string
	}{
		{
			name:   "no params",
			params: &atlasexec.SchemaTestParams{},
			args:   "schema test",
			stdout: "test result",
		},
		{
			name: "with env",
			params: &atlasexec.SchemaTestParams{
				Env: "test",
			},
			args:   "schema test --env test",
			stdout: "test result",
		},
		{
			name: "with config",
			params: &atlasexec.SchemaTestParams{
				ConfigURL: "file://config.hcl",
			},
			args:   "schema test --config file://config.hcl",
			stdout: "test result",
		},
		{
			name: "with dev-url",
			params: &atlasexec.SchemaTestParams{
				DevURL: "sqlite://file?_fk=1&cache=shared&mode=memory",
			},
			args:   "schema test --dev-url sqlite://file?_fk=1&cache=shared&mode=memory",
			stdout: "test result",
		},
		{
			name: "with run",
			params: &atlasexec.SchemaTestParams{
				Run: "example",
			},
			args:   "schema test --run example",
			stdout: "test result",
		},
		{
			name: "with run and paths",
			params: &atlasexec.SchemaTestParams{
				Run:   "example",
				Paths: []string{"./foo", "./bar"},
			},
			args:   "schema test --run example ./foo ./bar",
			stdout: "test result",
		},
	} {
		t.Run(tt.name, func(t *testing.T) {
			t.Setenv("TEST_ARGS", tt.args)
			t.Setenv("TEST_STDOUT", tt.stdout)
			result, err := c.SchemaTest(context.Background(), tt.params)
			require.NoError(t, err)
			require.Equal(t, tt.stdout, result)
		})
	}
}

func TestSchema_Inspect(t *testing.T) {
	wd, err := os.Getwd()
	require.NoError(t, err)
	c, err := atlasexec.NewClient(t.TempDir(), filepath.Join(wd, "./mock-atlas.sh"))
	require.NoError(t, err)

	for _, tt := range []struct {
		name   string
		params *atlasexec.SchemaInspectParams
		args   string
		stdout string
	}{
		{
			name:   "no params",
			params: &atlasexec.SchemaInspectParams{},
			args:   "schema inspect",
			stdout: `schema "public" {}`,
		},
		{
			name: "with env",
			params: &atlasexec.SchemaInspectParams{
				Env: "test",
			},
			args:   "schema inspect --env test",
			stdout: `schema "public" {}`,
		},
		{
			name: "with config",
			params: &atlasexec.SchemaInspectParams{
				ConfigURL: "file://config.hcl",
				Env:       "test",
			},
			args:   "schema inspect --env test --config file://config.hcl",
			stdout: `schema "public" {}`,
		},
	} {
		t.Run(tt.name, func(t *testing.T) {
			t.Setenv("TEST_ARGS", tt.args)
			t.Setenv("TEST_STDOUT", tt.stdout)
			result, err := c.SchemaInspect(context.Background(), tt.params)
			require.NoError(t, err)
			require.Equal(t, tt.stdout, result)
		})
	}
}

func TestAtlasSchema_Apply(t *testing.T) {
	ce, err := atlasexec.NewWorkingDir()
	require.NoError(t, err)
	t.Cleanup(func() {
		require.NoError(t, ce.Close())
	})
	f, err := os.CreateTemp("", "sqlite-test")
	require.NoError(t, err)
	defer os.Remove(f.Name())
	u := fmt.Sprintf("sqlite://%s?_fk=1", f.Name())
	c, err := atlasexec.NewClient(ce.Path(), "atlas")
	require.NoError(t, err)

	s1 := `
	-- create table "users
	CREATE TABLE users(
		id int NOT NULL,
		name varchar(100) NULL,
		PRIMARY KEY(id)
	);`
	path, err := ce.WriteFile("schema.sql", []byte(s1))
	to := fmt.Sprintf("file://%s", path)
	require.NoError(t, err)
	_, err = c.SchemaApply(context.Background(), &atlasexec.SchemaApplyParams{
		URL:         u,
		To:          to,
		DevURL:      "sqlite://file?_fk=1&cache=shared&mode=memory",
		AutoApprove: true,
	})
	require.NoError(t, err)
	_, err = ce.WriteFile("schema.sql", []byte(s1+`
	-- create table "blog_posts"
	CREATE TABLE blog_posts(
		id int NOT NULL,
		title varchar(100) NULL,
		body text NULL,
		author_id int NULL,
		PRIMARY KEY(id),
		CONSTRAINT author_fk FOREIGN KEY(author_id) REFERENCES users(id)
	);`))
	require.NoError(t, err)
	_, err = c.SchemaApply(context.Background(), &atlasexec.SchemaApplyParams{
		URL:         u,
		To:          to,
		DevURL:      "sqlite://file?_fk=1&cache=shared&mode=memory",
		AutoApprove: true,
	})
	require.NoError(t, err)

	s, err := c.SchemaInspect(context.Background(), &atlasexec.SchemaInspectParams{
		URL: u,
	})
	require.NoError(t, err)
	require.Equal(t, `table "users" {
  schema = schema.main
  column "id" {
    null = false
    type = int
  }
  column "name" {
    null = true
    type = varchar
  }
  primary_key {
    columns = [column.id]
  }
}
table "blog_posts" {
  schema = schema.main
  column "id" {
    null = false
    type = int
  }
  column "title" {
    null = true
    type = varchar
  }
  column "body" {
    null = true
    type = text
  }
  column "author_id" {
    null = true
    type = int
  }
  primary_key {
    columns = [column.id]
  }
  foreign_key "author_fk" {
    columns     = [column.author_id]
    ref_columns = [table.users.column.id]
    on_update   = NO_ACTION
    on_delete   = NO_ACTION
  }
}
schema "main" {
}
`, s)
}

func TestSchema_Plan(t *testing.T) {
	wd, err := os.Getwd()
	require.NoError(t, err)
	c, err := atlasexec.NewClient(t.TempDir(), filepath.Join(wd, "./mock-atlas.sh"))
	require.NoError(t, err)

	testCases := []struct {
		name   string
		params *atlasexec.SchemaPlanParams
		args   string
	}{
		{
			name:   "no params",
			params: &atlasexec.SchemaPlanParams{},
			args:   "schema plan --format {{ json . }} --auto-approve",
		},
		{
			name: "with env",
			params: &atlasexec.SchemaPlanParams{
				Env: "test",
			},
			args: "schema plan --format {{ json . }} --env test --auto-approve",
		},
		{
			name: "with from to",
			params: &atlasexec.SchemaPlanParams{
				From: []string{"1", "2"},
				To:   []string{"2", "3"},
			},
			args: `schema plan --format {{ json . }} --from 1,2 --to 2,3 --auto-approve`,
		},
		{
			name: "with from to and schema",
			params: &atlasexec.SchemaPlanParams{
				From:   []string{"1", "2"},
				To:     []string{"2", "3"},
				Schema: []string{"public", "bupisu"},
			},
			args: `schema plan --format {{ json . }} --schema public,bupisu --from 1,2 --to 2,3 --auto-approve`,
		},
		{
			name: "with from to and directives",
			params: &atlasexec.SchemaPlanParams{
				From:       []string{"1", "2"},
				To:         []string{"2", "3"},
				Directives: []string{"atlas:nolint", "atlas:txmode none"},
			},
			args: `schema plan --format {{ json . }} --from 1,2 --to 2,3 --auto-approve --directive "atlas:nolint" --directive "atlas:txmode none"`,
		},
		{
			name: "with config",
			params: &atlasexec.SchemaPlanParams{
				ConfigURL: "file://config.hcl",
			},
			args: "schema plan --format {{ json . }} --config file://config.hcl --auto-approve",
		},
		{
			name: "with dev-url",
			params: &atlasexec.SchemaPlanParams{
				DevURL: "sqlite://file?_fk=1&cache=shared&mode=memory",
			},
			args: "schema plan --format {{ json . }} --dev-url sqlite://file?_fk=1&cache=shared&mode=memory --auto-approve",
		},
		{
			name: "with name",
			params: &atlasexec.SchemaPlanParams{
				Name: "example",
			},
			args: "schema plan --format {{ json . }} --name example --auto-approve",
		},
		{
			name: "with dry-run",
			params: &atlasexec.SchemaPlanParams{
				DryRun: true,
			},
			args: "schema plan --format {{ json . }} --dry-run",
		},
		{
			name: "with save",
			params: &atlasexec.SchemaPlanParams{
				Save: true,
			},
			args: "schema plan --format {{ json . }} --save --auto-approve",
		},
		{
			name: "with push",
			params: &atlasexec.SchemaPlanParams{
				Repo: "testing-repo",
				Push: true,
			},
			args: "schema plan --format {{ json . }} --repo testing-repo --push --auto-approve",
		},
		{
			name: "with include",
			params: &atlasexec.SchemaPlanParams{
				Include: []string{"public", "bupisu"},
			},
			args: "schema plan --format {{ json . }} --include public,bupisu --auto-approve",
		},
	}
	for _, tt := range testCases {
		t.Run(tt.name, func(t *testing.T) {
			t.Setenv("TEST_ARGS", tt.args)
			t.Setenv("TEST_STDOUT", `{"Repo":"foo"}`)
			result, err := c.SchemaPlan(context.Background(), tt.params)
			require.NoError(t, err)
			require.Equal(t, "foo", result.Repo)
		})
	}
}

func TestSchema_PlanPush(t *testing.T) {
	wd, err := os.Getwd()
	require.NoError(t, err)
	c, err := atlasexec.NewClient(t.TempDir(), filepath.Join(wd, "./mock-atlas.sh"))
	require.NoError(t, err)

	testCases := []struct {
		name   string
		params *atlasexec.SchemaPlanPushParams
		args   string
	}{
		{
			name: "with auto-approve",
			params: &atlasexec.SchemaPlanPushParams{
				Repo: "testing-repo",
				File: "file://plan.hcl",
			},
			args: "schema plan push --format {{ json . }} --file file://plan.hcl --repo testing-repo --auto-approve",
		},
		{
			name: "with auto-approve and schema",
			params: &atlasexec.SchemaPlanPushParams{
				Repo:   "testing-repo",
				File:   "file://plan.hcl",
				Schema: []string{"public", "bupisu"},
			},
			args: "schema plan push --format {{ json . }} --schema public,bupisu --file file://plan.hcl --repo testing-repo --auto-approve",
		},
		{
			name: "with pending status",
			params: &atlasexec.SchemaPlanPushParams{
				Pending: true,
				File:    "file://plan.hcl",
			},
			args: "schema plan push --format {{ json . }} --file file://plan.hcl --pending",
		},
	}
	for _, tt := range testCases {
		t.Run(tt.name, func(t *testing.T) {
			t.Setenv("TEST_ARGS", tt.args)
			t.Setenv("TEST_STDOUT", `{"Repo":"foo"}`)
			result, err := c.SchemaPlanPush(context.Background(), tt.params)
			require.NoError(t, err)
			require.Equal(t, `{"Repo":"foo"}`, result)
		})
	}
}

func TestSchema_PlanLint(t *testing.T) {
	wd, err := os.Getwd()
	require.NoError(t, err)
	c, err := atlasexec.NewClient(t.TempDir(), filepath.Join(wd, "./mock-atlas.sh"))
	require.NoError(t, err)

	testCases := []struct {
		name   string
		params *atlasexec.SchemaPlanLintParams
		args   string
	}{
		{
			name: "with repo",
			params: &atlasexec.SchemaPlanLintParams{
				Repo: "testing-repo",
				File: "file://plan.hcl",
			},
			args: "schema plan lint --format {{ json . }} --file file://plan.hcl --repo testing-repo --auto-approve",
		},
		{
			name: "with file only",
			params: &atlasexec.SchemaPlanLintParams{
				File: "file://plan.hcl",
			},
			args: "schema plan lint --format {{ json . }} --file file://plan.hcl --auto-approve",
		},
		{
			name: "with file and schema",
			params: &atlasexec.SchemaPlanLintParams{
				File:   "file://plan.hcl",
				Schema: []string{"public", "bupisu"},
			},
			args: "schema plan lint --format {{ json . }} --schema public,bupisu --file file://plan.hcl --auto-approve",
		},
	}
	for _, tt := range testCases {
		t.Run(tt.name, func(t *testing.T) {
			t.Setenv("TEST_ARGS", tt.args)
			t.Setenv("TEST_STDOUT", `{"Repo":"foo"}`)
			result, err := c.SchemaPlanLint(context.Background(), tt.params)
			require.NoError(t, err)
			require.Equal(t, "foo", result.Repo)
		})
	}
}

func TestSchema_PlanValidate(t *testing.T) {
	wd, err := os.Getwd()
	require.NoError(t, err)
	c, err := atlasexec.NewClient(t.TempDir(), filepath.Join(wd, "./mock-atlas.sh"))
	require.NoError(t, err)

	testCases := []struct {
		name   string
		params *atlasexec.SchemaPlanValidateParams
		args   string
	}{
		{
			name: "with repo",
			params: &atlasexec.SchemaPlanValidateParams{
				Repo: "testing-repo",
				File: "file://plan.hcl",
			},
			args: "schema plan validate --file file://plan.hcl --repo testing-repo --auto-approve",
		},
		{
			name: "with file only",
			params: &atlasexec.SchemaPlanValidateParams{
				File: "file://plan.hcl",
			},
			args: "schema plan validate --file file://plan.hcl --auto-approve",
		},
		{
			name: "with file and schema",
			params: &atlasexec.SchemaPlanValidateParams{
				File:   "file://plan.hcl",
				Schema: []string{"public", "bupisu"},
			},
			args: "schema plan validate --schema public,bupisu --file file://plan.hcl --auto-approve",
		},
	}
	for _, tt := range testCases {
		t.Run(tt.name, func(t *testing.T) {
			t.Setenv("TEST_ARGS", tt.args)
			t.Setenv("TEST_STDOUT", `{"Repo":"foo"}`)
			err := c.SchemaPlanValidate(context.Background(), tt.params)
			require.NoError(t, err)
		})
	}
}

func TestSchema_PlanApprove(t *testing.T) {
	wd, err := os.Getwd()
	require.NoError(t, err)
	c, err := atlasexec.NewClient(t.TempDir(), filepath.Join(wd, "./mock-atlas.sh"))
	require.NoError(t, err)

	testCases := []struct {
		name   string
		params *atlasexec.SchemaPlanApproveParams
		args   string
	}{
		{
			name: "with url",
			params: &atlasexec.SchemaPlanApproveParams{
				URL: "atlas://app1/plans/foo-plan",
			},
			args: "schema plan approve --format {{ json . }} --url atlas://app1/plans/foo-plan",
		},
	}
	for _, tt := range testCases {
		t.Run(tt.name, func(t *testing.T) {
			t.Setenv("TEST_ARGS", tt.args)
			t.Setenv("TEST_STDOUT", `{"URL":"atlas://app1/plans/foo-plan", "Link":"some-link", "Status":"APPROVED"}`)
			result, err := c.SchemaPlanApprove(context.Background(), tt.params)
			require.NoError(t, err)
			require.Equal(t, "atlas://app1/plans/foo-plan", result.URL)
		})
	}
}

func TestSchema_PlanPull(t *testing.T) {
	wd, err := os.Getwd()
	require.NoError(t, err)
	c, err := atlasexec.NewClient(t.TempDir(), filepath.Join(wd, "./mock-atlas.sh"))
	require.NoError(t, err)

	testCases := []struct {
		name   string
		params *atlasexec.SchemaPlanPullParams
		args   string
	}{
		{
			name: "with url",
			params: &atlasexec.SchemaPlanPullParams{
				URL: "atlas://app1/plans/foo-plan",
			},
			args: "schema plan pull --url atlas://app1/plans/foo-plan",
		},
	}
	for _, tt := range testCases {
		t.Run(tt.name, func(t *testing.T) {
			t.Setenv("TEST_ARGS", tt.args)
			t.Setenv("TEST_STDOUT", "excited-plan")
			result, err := c.SchemaPlanPull(context.Background(), tt.params)
			require.NoError(t, err)
			require.Equal(t, "excited-plan", result)
		})
	}
}

func TestSchema_PlanList(t *testing.T) {
	wd, err := os.Getwd()
	require.NoError(t, err)
	c, err := atlasexec.NewClient(t.TempDir(), filepath.Join(wd, "./mock-atlas.sh"))
	require.NoError(t, err)

	testCases := []struct {
		name   string
		params *atlasexec.SchemaPlanListParams
		args   string
	}{
		{
			name:   "no params",
			params: &atlasexec.SchemaPlanListParams{},
			args:   "schema plan list --format {{ json . }} --auto-approve",
		},
		{
			name: "with repo",
			params: &atlasexec.SchemaPlanListParams{
				Repo: "atlas://testing-repo",
				From: []string{"env://url"},
			},
			args: "schema plan list --format {{ json . }} --from env://url --repo atlas://testing-repo --auto-approve",
		},
		{
			name: "with repo and schema",
			params: &atlasexec.SchemaPlanListParams{
				Repo:   "atlas://testing-repo",
				From:   []string{"env://url"},
				Schema: []string{"public", "bupisu"},
			},
			args: "schema plan list --format {{ json . }} --schema public,bupisu --from env://url --repo atlas://testing-repo --auto-approve",
		},
		{
			name: "with repo and pending",
			params: &atlasexec.SchemaPlanListParams{
				Repo:    "atlas://testing-repo",
				Pending: true,
			},
			args: "schema plan list --format {{ json . }} --repo atlas://testing-repo --pending --auto-approve",
		},
	}
	for _, tt := range testCases {
		t.Run(tt.name, func(t *testing.T) {
			t.Setenv("TEST_ARGS", tt.args)
			t.Setenv("TEST_STDOUT", `[{"Name":"pr-2-ufnTS7Nr"}]`)
			result, err := c.SchemaPlanList(context.Background(), tt.params)
			require.NoError(t, err)
			require.Equal(t, "pr-2-ufnTS7Nr", result[0].Name)
		})
	}
}

func TestSchema_Push(t *testing.T) {
	wd, err := os.Getwd()
	require.NoError(t, err)
	c, err := atlasexec.NewClient(t.TempDir(), filepath.Join(wd, "./mock-atlas.sh"))
	require.NoError(t, err)

	testCases := []struct {
		name   string
		params *atlasexec.SchemaPushParams
		args   string
	}{
		{
			name:   "no params",
			params: &atlasexec.SchemaPushParams{},
			args:   "schema push --format {{ json . }}",
		},
		{
			name: "push with 1 URL",
			params: &atlasexec.SchemaPushParams{
				URL: []string{"file://foo.hcl"},
			},
			args: "schema push --format {{ json . }} --url file://foo.hcl",
		},
		{
			name: "push with 2 URLs",
			params: &atlasexec.SchemaPushParams{
				URL: []string{"file://foo.hcl", "file://bupisu.hcl"},
			},
			args: "schema push --format {{ json . }} --url file://foo.hcl --url file://bupisu.hcl",
		},
		{
			name: "with repo",
			params: &atlasexec.SchemaPushParams{
				Name: "atlas-action",
			},
			args: "schema push --format {{ json . }} atlas-action",
		},
		{
			name: "with repo and schemas",
			params: &atlasexec.SchemaPushParams{
				Name:   "atlas-action",
				Schema: []string{"public", "bupisu"},
			},
			args: "schema push --format {{ json . }} --schema public,bupisu atlas-action",
		},
		{
			name: "with repo and tag",
			params: &atlasexec.SchemaPushParams{
				Name: "atlas-action",
				Tag:  "v1.0.0",
			},
			args: "schema push --format {{ json . }} --tag v1.0.0 atlas-action",
		},
		{
			name: "with repo and tag and description",
			params: &atlasexec.SchemaPushParams{
				Name:        "atlas-action",
				Tag:         "v1.0.0",
				Description: "release-v1",
			},
			args: "schema push --format {{ json . }} --tag v1.0.0 --desc release-v1 atlas-action",
		},
		{
			name: "with repo and tag, version and description",
			params: &atlasexec.SchemaPushParams{
				Name:        "atlas-action",
				Tag:         "v1.0.0",
				Version:     "20240829100417",
				Description: "release-v1",
			},
			args: "schema push --format {{ json . }} --tag v1.0.0 --version 20240829100417 --desc release-v1 atlas-action",
		},
	}
	for _, tt := range testCases {
		t.Run(tt.name, func(t *testing.T) {
			t.Setenv("TEST_ARGS", tt.args)
			t.Setenv("TEST_STDOUT", `{"Link":"https://gh.atlasgo.cloud/schemas/141733920810","Slug":"awesome-app","URL":"atlas://awesome-app?tag=latest"}`)
			result, err := c.SchemaPush(context.Background(), tt.params)
			require.NoError(t, err)
			require.Equal(t, "https://gh.atlasgo.cloud/schemas/141733920810", result.Link)
			require.Equal(t, "atlas://awesome-app?tag=latest", result.URL)
			require.Equal(t, "awesome-app", result.Slug)
		})
	}
}

func TestSchema_Apply(t *testing.T) {
	wd, err := os.Getwd()
	require.NoError(t, err)
	c, err := atlasexec.NewClient(t.TempDir(), filepath.Join(wd, "./mock-atlas.sh"))
	require.NoError(t, err)

	testCases := []struct {
		name   string
		params *atlasexec.SchemaApplyParams
		args   string
	}{
		{
			name:   "no params",
			params: &atlasexec.SchemaApplyParams{},
			args:   "schema apply --format {{ json . }}",
		},
		{
			name: "with plan",
			params: &atlasexec.SchemaApplyParams{
				PlanURL: "atlas://app1/plans/foo-plan",
			},
			args: "schema apply --format {{ json . }} --plan atlas://app1/plans/foo-plan",
		},
		{
			name: "with auto-approve",
			params: &atlasexec.SchemaApplyParams{
				AutoApprove: true,
			},
			args: "schema apply --format {{ json . }} --auto-approve",
		},
		{
			name: "with lock name",
			params: &atlasexec.SchemaApplyParams{
				LockName: "custom_schema_lock",
			},
			args: "schema apply --format {{ json . }} --lock-name custom_schema_lock",
		},
	}
	for _, tt := range testCases {
		t.Run(tt.name, func(t *testing.T) {
			t.Setenv("TEST_ARGS", tt.args)
			t.Setenv("TEST_STDOUT", `{"Driver":"sqlite"}`)
			result, err := c.SchemaApply(context.Background(), tt.params)
			require.NoError(t, err)
			require.Equal(t, "sqlite", result.Driver)
		})
	}
}

func TestSchema_Clean(t *testing.T) {
	wd, err := os.Getwd()
	require.NoError(t, err)
	c, err := atlasexec.NewClient(t.TempDir(), filepath.Join(wd, "./mock-atlas.sh"))
	require.NoError(t, err)

	testCases := []struct {
		name   string
		params *atlasexec.SchemaCleanParams
		args   string
	}{
		{
			name: "with env and dry-run",
			params: &atlasexec.SchemaCleanParams{
				Env:    "test",
				URL:    "sqlite://app1.db",
				DryRun: true,
			},
			args: "schema clean --format {{ json . }} --env test --url sqlite://app1.db --dry-run",
		},
		{
			name: "with auto-approve",
			params: &atlasexec.SchemaCleanParams{
				URL:         "sqlite://app1.db",
				AutoApprove: true,
			},
			args: "schema clean --format {{ json . }} --url sqlite://app1.db --auto-approve",
		},
	}
	for _, tt := range testCases {
		t.Run(tt.name, func(t *testing.T) {
			t.Setenv("TEST_ARGS", tt.args)
			t.Setenv("TEST_STDOUT", "{\"Start\":\"2024-09-20T14:51:40.439499+07:00\",\"End\":\"2024-09-20T14:51:40.439533+07:00\",\"Applied\":{\"Name\":\"20240920075140.sql\",\"Version\":\"20240920075140\",\"Start\":\"2024-09-20T14:51:40.43952+07:00\",\"End\":\"2024-09-20T14:51:40.439533+07:00\",\"Applied\":[\"PRAGMA foreign_keys = off;\",\"DROP TABLE `t1`;\", \"PRAGMA foreign_keys = on;\"]}}")
			result, err := c.SchemaClean(context.Background(), tt.params)
			require.NoError(t, err)
			require.Equal(t, "20240920075140.sql", result.Applied.Name)
		})
	}
}

func TestSchema_ApplyEnvs(t *testing.T) {
	wd, err := os.Getwd()
	require.NoError(t, err)
	c, err := atlasexec.NewClient(t.TempDir(), filepath.Join(wd, "./mock-atlas.sh"))
	require.NoError(t, err)
	require.NoError(t, c.SetEnv(map[string]string{
		"TEST_ARGS": "schema apply --format {{ json . }} --env test",
		"TEST_STDOUT": `{"Driver":"sqlite","URL":{"Scheme":"sqlite","Host":"local-su.db"}}
{"Driver":"sqlite","URL":{"Scheme":"sqlite","Host":"local-pi.db"}}
{"Driver":"sqlite","URL":{"Scheme":"sqlite","Host":"local-bu.db"}}`,
		"TEST_STDERR": `Abort: The plan "From" hash does not match the current state hash (passed with --from):

  - iHZMQ1EoarAXt/KU0KQbBljbbGs8gVqX2ZBXefePSGE= (plan value)
  + Cp8xCVYilZuwULkggsfJLqIQHaxYcg/IpU+kgjVUBA4= (current hash)

`,
	}))
	result, err := c.SchemaApply(context.Background(), &atlasexec.SchemaApplyParams{
		Env: "test",
	})
	require.ErrorContains(t, err, `The plan "From" hash does not match the current state hash`)
	require.Nil(t, result)

	err2, ok := err.(*atlasexec.SchemaApplyError)
	require.True(t, ok, "should be a SchemaApplyError, got %T", err)
	require.Contains(t, err2.Stderr, `Abort: The plan "From" hash does not match the current state hash (passed with --from)`)
	require.Len(t, err2.Result, 3, "should returns succeed results")
	require.Equal(t, "sqlite://local-su.db", err2.Result[0].URL.String())
	require.Equal(t, "sqlite://local-pi.db", err2.Result[1].URL.String())
	require.Equal(t, "sqlite://local-bu.db", err2.Result[2].URL.String())
}

func TestSchemaApplyError_Error(t *testing.T) {
	t.Run("single result error only", func(t *testing.T) {
		e := &atlasexec.SchemaApplyError{
			Result: []*atlasexec.SchemaApply{
				{Error: "schema apply failed"},
			},
		}
		require.Equal(t, "schema apply failed", e.Error())
	})

	t.Run("stderr only", func(t *testing.T) {
		e := &atlasexec.SchemaApplyError{
			Stderr: "Error: unable to acquire lock",
		}
		require.Equal(t, "Error: unable to acquire lock", e.Error())
	})

	t.Run("single result error and stderr", func(t *testing.T) {
		e := &atlasexec.SchemaApplyError{
			Result: []*atlasexec.SchemaApply{
				{Error: "schema apply failed"},
			},
			Stderr: "Error: unable to acquire lock",
		}
		require.Equal(t, "schema apply failed\nError: unable to acquire lock", e.Error())
	})

	t.Run("multiple result errors and stderr", func(t *testing.T) {
		e := &atlasexec.SchemaApplyError{
			Result: []*atlasexec.SchemaApply{
				{Error: "error on target 1"},
				{Error: "error on target 2"},
			},
			Stderr: "Error: unable to acquire lock",
		}
		require.Equal(t, "error on target 1\nerror on target 2\nError: unable to acquire lock", e.Error())
	})

	t.Run("multiple results with some having no error", func(t *testing.T) {
		e := &atlasexec.SchemaApplyError{
			Result: []*atlasexec.SchemaApply{
				{Error: ""},
				{Error: "error on target 2"},
				{Error: ""},
			},
			Stderr: "Error: unable to acquire lock",
		}
		require.Equal(t, "error on target 2\nError: unable to acquire lock", e.Error())
	})

	t.Run("no errors at all", func(t *testing.T) {
		e := &atlasexec.SchemaApplyError{
			Result: []*atlasexec.SchemaApply{
				{Error: ""},
			},
		}
		require.Equal(t, "", e.Error())
	})

	t.Run("nil result with stderr", func(t *testing.T) {
		e := &atlasexec.SchemaApplyError{
			Stderr: "Error: connection refused",
		}
		require.Equal(t, "Error: connection refused", e.Error())
	})
}

func TestAtlasSchema_Lint(t *testing.T) {
	t.Run("with broken config", func(t *testing.T) {
		c, err := atlasexec.NewClient(".", "atlas")
		require.NoError(t, err)
		_, err = c.SchemaLint(context.Background(), &atlasexec.SchemaLintParams{
			ConfigURL: "file://config-broken.hcl",
		})
		require.ErrorContains(t, err, `file "config-broken.hcl" was not found`)
	})

	t.Run("with missing dev-url", func(t *testing.T) {
		c, err := atlasexec.NewClient(".", "atlas")
		require.NoError(t, err)
		_, err = c.SchemaLint(context.Background(), &atlasexec.SchemaLintParams{
			URL: []string{"file://testdata/schema.hcl"},
		})
		require.ErrorContains(t, err, `required flag(s) "dev-url" not set`)
	})
	var (
		atlashcl = filepath.Join(t.TempDir(), "atlas.hcl")
		srv      = httptest.NewServer(http.HandlerFunc(func(w http.ResponseWriter, _ *http.Request) {
			fmt.Fprintln(w, `{"data": {"me":{ "name": "p", "org": "life"}}}`)
		}))
	)
	t.Cleanup(srv.Close)
	require.NoError(t, os.WriteFile(atlashcl, []byte(fmt.Sprintf(`
		atlas { 
			cloud {	
				token = "aci_token"
				url = %q
				org = "life"
			}
		}
		lint {
		  naming {
			  table {
			    match = "^[a-z_]+$"
			  }
		  }
		}`, srv.URL)), 0600))
	t.Run("with non-existent schema file", func(t *testing.T) {
		c, err := atlasexec.NewClient(".", "atlas")
		require.NoError(t, err)
		_, err = c.SchemaLint(context.Background(), &atlasexec.SchemaLintParams{
			ConfigURL: "file://" + atlashcl,
			DevURL:    "sqlite://file?mode=memory",
			URL:       []string{"file://testdata/doesnotexist.hcl"},
		})
		require.ErrorContains(t, err, "Error: stat testdata/doesnotexist.hcl: no such file or directory")
	})
	t.Run("with schema containing problems", func(t *testing.T) {
		c, err := atlasexec.NewClient(".", "atlas")
		require.NoError(t, err)
		report, err := c.SchemaLint(context.Background(), &atlasexec.SchemaLintParams{
			ConfigURL: "file://" + atlashcl,
			DevURL:    "sqlite://file?mode=memory",
			URL:       []string{sqlitedb(t, "create table T1(id int);")},
		})
		require.NoError(t, err)
		require.NotNil(t, report)
		require.NotEmpty(t, report.Steps)
		require.Len(t, report.Steps, 1)
		require.Len(t, report.Steps[0].Diagnostics, 1)
		require.Equal(t, "Table \"main.T1\" violates the naming policy", report.Steps[0].Diagnostics[0].Text)
		require.Equal(t, "NM102", report.Steps[0].Diagnostics[0].Code)
	})
}

func TestSchema_Lint(t *testing.T) {
	wd, err := os.Getwd()
	require.NoError(t, err)
	c, err := atlasexec.NewClient(t.TempDir(), filepath.Join(wd, "./mock-atlas.sh"))
	require.NoError(t, err)

	testCases := []struct {
		name   string
		params *atlasexec.SchemaLintParams
		args   string
	}{
		{
			name: "with dev-url and url",
			params: &atlasexec.SchemaLintParams{
				URL:    []string{"file://testdata/schema.hcl"},
				DevURL: "sqlite://file?mode=memory",
			},
			args: "schema lint --format {{ json . }} --dev-url sqlite://file?mode=memory --url file://testdata/schema.hcl",
		},
		{
			name: "with dev-url and url and schema",
			params: &atlasexec.SchemaLintParams{
				URL:    []string{"file://testdata/schema.hcl"},
				DevURL: "sqlite://file?mode=memory",
				Schema: []string{"main", "bupisu"},
			},
			args: "schema lint --format {{ json . }} --dev-url sqlite://file?mode=memory --url file://testdata/schema.hcl --schema main,bupisu",
		},
	}
	for _, tt := range testCases {
		t.Run(tt.name, func(t *testing.T) {
			t.Setenv("TEST_ARGS", tt.args)
			t.Setenv("TEST_STDOUT", `{"Steps":[{"Diagnostics":[{"Text":"Table \"main.T1\" violates the naming policy","Code":"NM102"}]}]}`)
			result, err := c.SchemaLint(context.Background(), tt.params)
			require.NoError(t, err)
			require.NotNil(t, result)
			require.NotEmpty(t, result.Steps)
			require.Len(t, result.Steps, 1)
			require.Len(t, result.Steps[0].Diagnostics, 1)
			require.Equal(t, "Table \"main.T1\" violates the naming policy", result.Steps[0].Diagnostics[0].Text)
		})
	}
}


================================================
FILE: atlasexec/atlas_test.go
================================================
// Copyright 2021-present The Atlas Authors. All rights reserved.
// This source code is licensed under the Apache 2.0 license found
// in the LICENSE file in the root directory of this source tree.

package atlasexec_test

import (
	"context"
	"database/sql"
	"fmt"
	"net/http/httptest"
	"os"
	"os/exec"
	"path/filepath"
	"testing"

	"ariga.io/atlas/atlasexec"

	_ "github.com/mattn/go-sqlite3"
	"github.com/stretchr/testify/require"
)

func TestError(t *testing.T) {
	err := atlasexec.Error{}
	require.NotPanics(t, func() {
		err.ExitCode()
	})
}

func TestNewClient(t *testing.T) {
	execPath, err := exec.LookPath("atlas")
	require.NoError(t, err)

	// Test that we can create a client with a custom exec path.
	_, err = atlasexec.NewClient(t.TempDir(), execPath)
	require.NoError(t, err)

	// Atlas-CLI is installed in the PATH.
	_, err = atlasexec.NewClient(t.TempDir(), "atlas")
	require.NoError(t, err)

	// Atlas-CLI is not found for the given exec path.
	_, err = atlasexec.NewClient(t.TempDir(), "/foo/atlas")
	require.ErrorContains(t, err, `no such file or directory`)
}

func TestVersion(t *testing.T) {
	wd, err := os.Getwd()
	require.NoError(t, err)
	c, err := atlasexec.NewClient(t.TempDir(), filepath.Join(wd, "./mock-atlas.sh"))
	require.NoError(t, err)

	for _, tt := range []struct {
		env    string
		expect *atlasexec.Version
	}{
		{
			env:    "v1.2.3",
			expect: &atlasexec.Version{Version: "1.2.3"},
		},
		{
			env: "v0.14.1-abcdef-canary",
			expect: &atlasexec.Version{
				Version: "0.14.1",
				SHA:     "abcdef",
				Canary:  true,
			},
		},
		{
			env: "v11.22.33-sha",
			expect: &atlasexec.Version{
				Version: "11.22.33",
				SHA:     "sha",
			},
		},
	} {
		t.Run(tt.env, func(t *testing.T) {
			t.Setenv("TEST_ARGS", "version")
			t.Setenv("TEST_STDOUT", fmt.Sprintf("atlas version %s", tt.env))
			v, err := c.Version(context.Background())
			require.NoError(t, err)
			require.Equal(t, tt.expect, v)
			if tt.env != "" {
				require.Equal(t, "atlas version "+tt.env, v.String())
			}
		})
	}
}

func TestLogin(t *testing.T) {
	wd, err := os.Getwd()
	require.NoError(t, err)
	c, err := atlasexec.NewClient(t.TempDir(), filepath.Join(wd, "./mock-atlas.sh"))
	require.NoError(t, err)

	// Empty token returns error without invoking the binary.
	err = c.Login(context.Background(), &atlasexec.LoginParams{Token: ""})
	require.Error(t, err)
	require.Contains(t, err.Error(), "token cannot be empty")

	// Login with token only: must pass "login --token <token>".
	
Download .txt
gitextract_z_8o4h8f/

├── .github/
│   ├── ops/
│   │   └── mysql/
│   │       └── Dockerfile
│   └── workflows/
│       ├── cd-docker-push-cockroach_oss.yaml
│       ├── cd-docker-push-mysql_oss.yaml
│       ├── ci-dialect_oss.yaml
│       ├── ci-go_oss.yaml
│       ├── ci-revisions_oss.yaml
│       └── ci-sdk.yml
├── .golangci.yml
├── LICENSE
├── README.md
├── atlasexec/
│   ├── README.md
│   ├── atlas.go
│   ├── atlas_internal_test.go
│   ├── atlas_migrate.go
│   ├── atlas_migrate_example_test.go
│   ├── atlas_migrate_test.go
│   ├── atlas_models.go
│   ├── atlas_schema.go
│   ├── atlas_schema_test.go
│   ├── atlas_test.go
│   ├── copilot.go
│   ├── copilot_test.go
│   ├── internal/
│   │   └── e2e/
│   │       ├── sqlite_test.go
│   │       ├── testdata/
│   │       │   ├── multi-tenants/
│   │       │   │   ├── atlas.hcl
│   │       │   │   └── migrations/
│   │       │   │       ├── 20240112070806.sql
│   │       │   │       ├── 20240116003831.sql
│   │       │   │       └── atlas.sum
│   │       │   ├── schema-plan/
│   │       │   │   ├── schema-1.lt.hcl
│   │       │   │   └── schema-2.lt.hcl
│   │       │   └── versioned-basic/
│   │       │       ├── atlas.hcl
│   │       │       └── migrations/
│   │       │           ├── 20240112070806.sql
│   │       │           └── atlas.sum
│   │       └── util_e2e.go
│   ├── mock-atlas.sh
│   ├── testdata/
│   │   ├── broken/
│   │   │   ├── 20231029112426.sql
│   │   │   └── atlas.sum
│   │   └── migrations/
│   │       ├── 20230727105553_init.sql
│   │       ├── 20230727105615_t2.sql
│   │       ├── 20230926085734_destructive-change.sql
│   │       └── atlas.sum
│   ├── working_dir.go
│   └── working_dir_test.go
├── cmd/
│   └── atlas/
│       ├── go.mod
│       ├── go.sum
│       ├── internal/
│       │   ├── cloudapi/
│       │   │   ├── client.go
│       │   │   ├── client_oss.go
│       │   │   └── client_test.go
│       │   ├── cmdapi/
│       │   │   ├── cmdapi.go
│       │   │   ├── cmdapi_oss.go
│       │   │   ├── cmdapi_test.go
│       │   │   ├── migrate.go
│       │   │   ├── migrate_oss.go
│       │   │   ├── migrate_test.go
│       │   │   ├── project.go
│       │   │   ├── project_test.go
│       │   │   ├── schema.go
│       │   │   ├── schema_test.go
│       │   │   ├── testdata/
│       │   │   │   ├── baseline1/
│       │   │   │   │   ├── 1_baseline.sql
│       │   │   │   │   └── atlas.sum
│       │   │   │   ├── baseline2/
│       │   │   │   │   ├── 1_baseline.sql
│       │   │   │   │   ├── 20220318104614_initial.sql
│       │   │   │   │   ├── 20220318104615_second.sql
│       │   │   │   │   └── atlas.sum
│       │   │   │   ├── import/
│       │   │   │   │   ├── dbmate/
│       │   │   │   │   │   ├── 1_initial.sql
│       │   │   │   │   │   └── 2_second_migration.sql
│       │   │   │   │   ├── dbmate_gold/
│       │   │   │   │   │   ├── 1_initial.sql
│       │   │   │   │   │   └── 2_second_migration.sql
│       │   │   │   │   ├── flyway/
│       │   │   │   │   │   ├── B2__baseline.sql
│       │   │   │   │   │   ├── R__views.sql
│       │   │   │   │   │   ├── U1__initial.sql
│       │   │   │   │   │   ├── V1__initial.sql
│       │   │   │   │   │   ├── V2__second_migration.sql
│       │   │   │   │   │   └── V3__third_migration.sql
│       │   │   │   │   ├── flyway_gold/
│       │   │   │   │   │   ├── 2_baseline.sql
│       │   │   │   │   │   ├── 3R_views.sql
│       │   │   │   │   │   └── 3_third_migration.sql
│       │   │   │   │   ├── golang-migrate/
│       │   │   │   │   │   ├── 1_initial.down.sql
│       │   │   │   │   │   ├── 1_initial.up.sql
│       │   │   │   │   │   ├── 2_second_migration.down.sql
│       │   │   │   │   │   └── 2_second_migration.up.sql
│       │   │   │   │   ├── golang-migrate_gold/
│       │   │   │   │   │   ├── 1_initial.sql
│       │   │   │   │   │   └── 2_second_migration.sql
│       │   │   │   │   ├── goose/
│       │   │   │   │   │   ├── 1_initial.sql
│       │   │   │   │   │   └── 2_second_migration.sql
│       │   │   │   │   ├── goose_gold/
│       │   │   │   │   │   ├── 1_initial.sql
│       │   │   │   │   │   └── 2_second_migration.sql
│       │   │   │   │   ├── liquibase/
│       │   │   │   │   │   ├── 1_initial.sql
│       │   │   │   │   │   └── 2_second_migration.sql
│       │   │   │   │   └── liquibase_gold/
│       │   │   │   │       ├── 1_initial.sql
│       │   │   │   │       └── 2_second_migration.sql
│       │   │   │   ├── mysql/
│       │   │   │   │   ├── 20220318104614_initial.sql
│       │   │   │   │   ├── 20220420213403_second.sql
│       │   │   │   │   └── atlas.sum
│       │   │   │   ├── sqlite/
│       │   │   │   │   ├── 20220318104614_initial.sql
│       │   │   │   │   ├── 20220318104615_second.sql
│       │   │   │   │   └── atlas.sum
│       │   │   │   ├── sqlite2/
│       │   │   │   │   ├── 20220318104614_initial.sql
│       │   │   │   │   ├── 20220318104615_second.sql
│       │   │   │   │   └── atlas.sum
│       │   │   │   ├── sqlitetx/
│       │   │   │   │   ├── 20220925092817_initial.sql
│       │   │   │   │   ├── 20220925094021_second.sql
│       │   │   │   │   ├── 20220925094437_third.sql
│       │   │   │   │   └── atlas.sum
│       │   │   │   ├── sqlitetx2/
│       │   │   │   │   ├── 20220925092817_initial.sql
│       │   │   │   │   ├── 20220925094021_second.sql
│       │   │   │   │   ├── 20220925094437_third.sql
│       │   │   │   │   └── atlas.sum
│       │   │   │   ├── sqlitetx3/
│       │   │   │   │   ├── 20220925092817_initial.sql
│       │   │   │   │   ├── 20220925094021_second.sql
│       │   │   │   │   └── atlas.sum
│       │   │   │   ├── sqlitetx4/
│       │   │   │   │   ├── 20220925092817_initial.sql
│       │   │   │   │   ├── 20220925094021_second.sql
│       │   │   │   │   └── atlas.sum
│       │   │   │   └── templatedir/
│       │   │   │       ├── 1.sql
│       │   │   │       ├── 2.sql
│       │   │   │       ├── atlas.sum
│       │   │   │       └── shared/
│       │   │   │           └── users.sql
│       │   │   ├── vercheck/
│       │   │   │   ├── notification.tmpl
│       │   │   │   ├── req_oss.go
│       │   │   │   ├── vercheck.go
│       │   │   │   └── vercheck_test.go
│       │   │   ├── version_oss.go
│       │   │   └── version_oss_test.go
│       │   ├── cmdext/
│       │   │   ├── cmdext.go
│       │   │   ├── cmdext_oss.go
│       │   │   ├── cmdext_test.go
│       │   │   ├── reader.go
│       │   │   └── reader_test.go
│       │   ├── cmdlog/
│       │   │   ├── cmdlog.go
│       │   │   ├── cmdlog_oss.go
│       │   │   └── cmdlog_test.go
│       │   ├── cmdstate/
│       │   │   ├── cmdstate.go
│       │   │   └── cmdstate_test.go
│       │   ├── docker/
│       │   │   ├── docker.go
│       │   │   └── docker_test.go
│       │   ├── migrate/
│       │   │   ├── ent/
│       │   │   │   ├── client.go
│       │   │   │   ├── convert.go
│       │   │   │   ├── ent.go
│       │   │   │   ├── entc.go
│       │   │   │   ├── enttest/
│       │   │   │   │   └── enttest.go
│       │   │   │   ├── generate.go
│       │   │   │   ├── hook/
│       │   │   │   │   └── hook.go
│       │   │   │   ├── internal/
│       │   │   │   │   └── schemaconfig.go
│       │   │   │   ├── migrate/
│       │   │   │   │   ├── migrate.go
│       │   │   │   │   └── schema.go
│       │   │   │   ├── mutation.go
│       │   │   │   ├── predicate/
│       │   │   │   │   └── predicate.go
│       │   │   │   ├── revision/
│       │   │   │   │   ├── revision.go
│       │   │   │   │   └── where.go
│       │   │   │   ├── revision.go
│       │   │   │   ├── revision_create.go
│       │   │   │   ├── revision_delete.go
│       │   │   │   ├── revision_query.go
│       │   │   │   ├── revision_update.go
│       │   │   │   ├── runtime/
│       │   │   │   │   └── runtime.go
│       │   │   │   ├── runtime.go
│       │   │   │   ├── schema/
│       │   │   │   │   └── revision.go
│       │   │   │   ├── template/
│       │   │   │   │   └── convert.tmpl
│       │   │   │   └── tx.go
│       │   │   ├── migrate.go
│       │   │   ├── migrate_oss.go
│       │   │   ├── migrate_test.go
│       │   │   └── testdata/
│       │   │       ├── broken/
│       │   │       │   ├── 1.sql
│       │   │       │   ├── 2.sql
│       │   │       │   ├── 3.sql
│       │   │       │   └── atlas.sum
│       │   │       └── fixed/
│       │   │           ├── 1.sql
│       │   │           ├── 2.sql
│       │   │           ├── 3.sql
│       │   │           └── atlas.sum
│       │   ├── migratelint/
│       │   │   ├── lint.go
│       │   │   ├── lint_oss.go
│       │   │   └── lint_test.go
│       │   └── sqlparse/
│       │       ├── myparse/
│       │       │   └── myparse_oss.go
│       │       ├── parseutil/
│       │       │   └── parseutil.go
│       │       ├── pgparse/
│       │       │   └── pgparse_oss.go
│       │       ├── sqliteparse/
│       │       │   ├── Lexer.g4
│       │       │   ├── Parser.g4
│       │       │   ├── README.md
│       │       │   ├── lexer.go
│       │       │   ├── parser.go
│       │       │   ├── parser_base_listener.go
│       │       │   ├── parser_base_visitor.go
│       │       │   ├── parser_listener.go
│       │       │   ├── parser_visitor.go
│       │       │   └── sqliteparse_oss.go
│       │       └── sqlparse.go
│       ├── main.go
│       └── main_oss.go
├── go.mod
├── go.sum
├── internal/
│   ├── ci/
│   │   ├── ci_dialect.tmpl
│   │   ├── ci_go.tmpl
│   │   ├── ci_revisions.tmpl
│   │   ├── cockroach/
│   │   │   ├── Dockerfile.tmpl
│   │   │   └── main.go
│   │   ├── jobs_oss.go
│   │   └── main.go
│   └── integration/
│       ├── README.md
│       ├── cockroach_test.go
│       ├── docker-compose.yaml
│       ├── go.mod
│       ├── go.sum
│       ├── hclsqlspec/
│       │   └── hclsqlspec_test.go
│       ├── integration_test.go
│       ├── mysql_test.go
│       ├── postgres_test.go
│       ├── script_test.go
│       ├── sqlite_test.go
│       ├── testdata/
│       │   ├── migrations/
│       │   │   ├── mysql/
│       │   │   │   ├── 1_initial.sql
│       │   │   │   └── atlas.sum
│       │   │   ├── mysqlock/
│       │   │   │   ├── 1.sql
│       │   │   │   ├── 2.sql
│       │   │   │   ├── 3.sql
│       │   │   │   └── atlas.sum
│       │   │   └── postgres/
│       │   │       ├── 1_initial.sql
│       │   │       └── atlas.sum
│       │   ├── mysql/
│       │   │   ├── autoincrement.txtar
│       │   │   ├── check-maria.txtar
│       │   │   ├── check.txtar
│       │   │   ├── cli-inspect-file.txtar
│       │   │   ├── cli-migrate-apply-datasrc.txtar
│       │   │   ├── cli-migrate-apply.txtar
│       │   │   ├── cli-migrate-diff-format.txtar
│       │   │   ├── cli-migrate-diff-mode-normalized.txtar
│       │   │   ├── cli-migrate-diff.txtar
│       │   │   ├── cli-project-schemas.txtar
│       │   │   ├── cli-project-url-escape.txtar
│       │   │   ├── cli-schema-apply-datasrc.txtar
│       │   │   ├── column-add-drop.txtar
│       │   │   ├── column-bit.txtar
│       │   │   ├── column-bool.txtar
│       │   │   ├── column-charset.txtar
│       │   │   ├── column-default-expr.txtar
│       │   │   ├── column-generated-inspect.txtar
│       │   │   ├── column-generated.txtar
│       │   │   ├── column-json.txtar
│       │   │   ├── column-time-precision-maria.txtar
│       │   │   ├── column-time-precision-mysql.txtar
│       │   │   ├── foreign-key-add.txtar
│       │   │   ├── foreign-key-modify-action.txtar
│       │   │   ├── foreign-key.txtar
│       │   │   ├── index-add-drop.txtar
│       │   │   ├── index-desc.txtar
│       │   │   ├── index-expr.txtar
│       │   │   ├── index-prefix.txtar
│       │   │   ├── index-type.txtar
│       │   │   ├── index-unique.txtar
│       │   │   ├── primary-key-parts.txtar
│       │   │   ├── primary-key.txtar
│       │   │   └── table-engine.txtar
│       │   ├── postgres/
│       │   │   ├── cli-inspect-file.txtar
│       │   │   ├── cli-inspect.txtar
│       │   │   ├── cli-migrate-apply-datasrc.txtar
│       │   │   ├── cli-migrate-apply.txtar
│       │   │   ├── cli-migrate-diff-unsupported.txtar
│       │   │   ├── cli-migrate-diff.txtar
│       │   │   ├── cli-migrate-status.txtar
│       │   │   ├── column-array.txtar
│       │   │   ├── column-bit.txtar
│       │   │   ├── column-comment.txtar
│       │   │   ├── column-default.txtar
│       │   │   ├── column-domain.txtar
│       │   │   ├── column-enum-array.txtar
│       │   │   ├── column-enum.txtar
│       │   │   ├── column-float.txtar
│       │   │   ├── column-generated-inspect.txtar
│       │   │   ├── column-identity.txtar
│       │   │   ├── column-interval.txtar
│       │   │   ├── column-numeric.txtar
│       │   │   ├── column-range.txtar
│       │   │   ├── column-serial.txtar
│       │   │   ├── column-textsearch.txtar
│       │   │   ├── column-time-precision.txtar
│       │   │   ├── foreign-key-action.txtar
│       │   │   ├── foreign-key.txtar
│       │   │   ├── index-desc.txtar
│       │   │   ├── index-expr.txtar
│       │   │   ├── index-include.txtar
│       │   │   ├── index-issue-557.txtar
│       │   │   ├── index-nulls-distinct.txtar
│       │   │   ├── index-operator-class.txtar
│       │   │   ├── index-partial.txtar
│       │   │   ├── index-type-brin.txtar
│       │   │   ├── index-type.txtar
│       │   │   ├── index-unique-constraint.txtar
│       │   │   ├── primary-key.txtar
│       │   │   ├── table-checks.txtar
│       │   │   └── table-partition.txtar
│       │   └── sqlite/
│       │       ├── autoincrement.txtar
│       │       ├── cli-apply-multifile.txtar
│       │       ├── cli-apply-project-multifile.txtar
│       │       ├── cli-apply-vars.txtar
│       │       ├── cli-inspect.txtar
│       │       ├── cli-migrate-apply.txtar
│       │       ├── cli-migrate-diff-datasrc-hcl-paths.txtar
│       │       ├── cli-migrate-diff-datasrc-hcl.txtar
│       │       ├── cli-migrate-diff-minimal-env.txtar
│       │       ├── cli-migrate-diff-multifile.txtar
│       │       ├── cli-migrate-diff-sql.txtar
│       │       ├── cli-migrate-diff.txtar
│       │       ├── cli-migrate-lint-add-notnull.txtar
│       │       ├── cli-migrate-lint-destructive.txtar
│       │       ├── cli-migrate-lint-ignore.txtar
│       │       ├── cli-migrate-lint-minimal-env.txtar
│       │       ├── cli-migrate-lint-project.txtar
│       │       ├── cli-migrate-project-multifile.txtar
│       │       ├── cli-migrate-project.txtar
│       │       ├── cli-migrate-set.txtar
│       │       ├── cli-project-vars.txtar
│       │       ├── cli-schema-project-file.txtar
│       │       ├── column-default.txtar
│       │       ├── column-generated.txtar
│       │       ├── column-user-defined.txtar
│       │       ├── index-desc.txtar
│       │       ├── index-expr.txtar
│       │       ├── index-partial.txtar
│       │       └── table-options.txtar
│       ├── tidb_test.go
│       └── tools.go
├── schemahcl/
│   ├── context.go
│   ├── context_test.go
│   ├── extension.go
│   ├── extension_test.go
│   ├── schemahcl.go
│   ├── schemahcl_test.go
│   ├── spec.go
│   ├── spec_test.go
│   ├── stdlib.go
│   ├── stdlib_test.go
│   ├── testdata/
│   │   ├── a.hcl
│   │   ├── b.hcl
│   │   ├── nested/
│   │   │   └── c.hcl
│   │   └── variables.hcl
│   ├── types.go
│   └── types_test.go
├── sdk/
│   ├── recordriver/
│   │   ├── driver.go
│   │   └── driver_test.go
│   └── tmplrun/
│       ├── testdata/
│       │   ├── app.tmpl
│       │   └── foo.go
│       ├── tmplrun.go
│       └── tmplrun_test.go
└── sql/
    ├── internal/
    │   ├── spectest/
    │   │   └── spectest.go
    │   ├── specutil/
    │   │   ├── convert.go
    │   │   ├── convert_test.go
    │   │   └── spec.go
    │   ├── sqltest/
    │   │   └── sqltest.go
    │   └── sqlx/
    │       ├── dev.go
    │       ├── dev_test.go
    │       ├── diff.go
    │       ├── plan.go
    │       ├── plan_test.go
    │       ├── sqlx.go
    │       ├── sqlx_oss.go
    │       └── sqlx_test.go
    ├── migrate/
    │   ├── dir.go
    │   ├── dir_test.go
    │   ├── lex.go
    │   ├── lex_test.go
    │   ├── migrate.go
    │   ├── migrate_oss.go
    │   ├── migrate_test.go
    │   └── testdata/
    │       ├── golang-migrate/
    │       │   └── 1_base.up.sql
    │       ├── lex/
    │       │   ├── 1.sql
    │       │   ├── 1.sql.golden
    │       │   ├── 10_delimiter_comment.sql
    │       │   ├── 10_delimiter_comment.sql.golden
    │       │   ├── 11_delimiter_mysql_command.sql
    │       │   ├── 11_delimiter_mysql_command.sql.golden
    │       │   ├── 12_delimiter_mysql_command.sql
    │       │   ├── 12_delimiter_mysql_command.sql.golden
    │       │   ├── 13_delimiter_mysql_command.sql
    │       │   ├── 13_delimiter_mysql_command.sql.golden
    │       │   ├── 14_delimiter_mysql_command.sql
    │       │   ├── 14_delimiter_mysql_command.sql.golden
    │       │   ├── 15_dollar_quote.sql
    │       │   ├── 15_dollar_quote.sql.golden
    │       │   ├── 16_begin_atomic.sql
    │       │   ├── 16_begin_atomic.sql.golden
    │       │   ├── 17_paren.sql
    │       │   ├── 17_paren.sql.golden
    │       │   ├── 18_pg_expr.sql
    │       │   ├── 18_pg_expr.sql.golden
    │       │   ├── 19_ms_gocmd.sql
    │       │   ├── 19_ms_gocmd.sql.golden
    │       │   ├── 20_ms_go-delim.sql
    │       │   ├── 20_ms_go-delim.sql.golden
    │       │   ├── 2_mysql.sql
    │       │   ├── 2_mysql.sql.golden
    │       │   ├── 3_delimiter.sql
    │       │   ├── 3_delimiter.sql.golden
    │       │   ├── 4_delimiter.sql
    │       │   ├── 4_delimiter.sql.golden
    │       │   ├── 5_delimiter.sql
    │       │   ├── 5_delimiter.sql.golden
    │       │   ├── 6_skip_comment.sql
    │       │   ├── 6_skip_comment.sql.golden
    │       │   ├── 7_delimiter_2n.sql
    │       │   ├── 7_delimiter_2n.sql.golden
    │       │   ├── 8_delimiter_3n.sql
    │       │   ├── 8_delimiter_3n.sql.golden
    │       │   ├── 9_delimiter_3n.sql
    │       │   └── 9_delimiter_3n.sql.golden
    │       ├── lexbegintry/
    │       │   ├── 1.sql
    │       │   └── 1.sql.golden
    │       ├── lexescaped/
    │       │   ├── 1.my.sql
    │       │   ├── 1.my.sql.golden
    │       │   ├── 2.pg.sql
    │       │   └── 2.pg.sql.golden
    │       ├── lexgroup/
    │       │   ├── 1_trigger.sql
    │       │   ├── 1_trigger.sql.golden
    │       │   ├── 2_function.sql
    │       │   ├── 2_function.sql.golden
    │       │   ├── 3_delimiter.sql
    │       │   └── 3_delimiter.sql.golden
    │       ├── migrate/
    │       │   ├── 1_initial.down.sql
    │       │   ├── 1_initial.up.sql
    │       │   ├── atlas.sum
    │       │   └── sub/
    │       │       ├── 1.a_sub.up.sql
    │       │       ├── 2.10.x-20_description.sql
    │       │       ├── 3_partly.sql
    │       │       └── atlas.sum
    │       ├── partial-checkpoint/
    │       │   ├── 1_first.sql
    │       │   ├── 2_second.sql
    │       │   ├── 3_checkpoint.sql
    │       │   ├── 4_fourth.sql
    │       │   ├── 5_checkpoint.sql
    │       │   ├── 6_sixth.sql
    │       │   └── atlas.sum
    │       └── sqlserver/
    │           ├── 1_return_table.sql
    │           ├── 1_return_table.sql.golden
    │           ├── 2_function.sql
    │           └── 2_function.sql.golden
    ├── mysql/
    │   ├── convert.go
    │   ├── diff_oss.go
    │   ├── diff_oss_test.go
    │   ├── driver_oss.go
    │   ├── driver_oss_test.go
    │   ├── inspect_oss.go
    │   ├── inspect_oss_test.go
    │   ├── internal/
    │   │   └── mysqlversion/
    │   │       ├── is/
    │   │       │   ├── .README.md
    │   │       │   ├── charset2collate
    │   │       │   ├── charset2collate.maria
    │   │       │   ├── collate2charset
    │   │       │   └── collate2charset.maria
    │   │       ├── mysqlversion.go
    │   │       └── mysqlversion_test.go
    │   ├── migrate_oss.go
    │   ├── migrate_oss_test.go
    │   ├── mysqlcheck/
    │   │   ├── mysqlcheck.go
    │   │   ├── mysqlcheck_oss.go
    │   │   └── mysqlcheck_test.go
    │   ├── sqlspec_oss.go
    │   ├── sqlspec_oss_test.go
    │   └── tidb.go
    ├── postgres/
    │   ├── convert.go
    │   ├── crdb_oss.go
    │   ├── diff_oss.go
    │   ├── diff_oss_test.go
    │   ├── driver_oss.go
    │   ├── driver_oss_test.go
    │   ├── inspect_oss.go
    │   ├── inspect_oss_test.go
    │   ├── internal/
    │   │   └── postgresop/
    │   │       └── postgresop.go
    │   ├── migrate_oss.go
    │   ├── migrate_oss_test.go
    │   ├── postgrescheck/
    │   │   ├── postgrescheck.go
    │   │   ├── postgrescheck_oss.go
    │   │   └── postgrescheck_test.go
    │   ├── sqlspec_oss.go
    │   └── sqlspec_oss_test.go
    ├── schema/
    │   ├── changekind_string.go
    │   ├── dsl.go
    │   ├── dsl_test.go
    │   ├── exclude_oss.go
    │   ├── inspect.go
    │   ├── migrate.go
    │   ├── migrate_test.go
    │   └── schema.go
    ├── sqlcheck/
    │   ├── condrop/
    │   │   ├── condrop.go
    │   │   └── condrop_test.go
    │   ├── datadepend/
    │   │   ├── datadepend.go
    │   │   └── datadepend_test.go
    │   ├── destructive/
    │   │   ├── destructive.go
    │   │   ├── destructive_oss.go
    │   │   └── destructive_test.go
    │   ├── incompatible/
    │   │   ├── incompatible.go
    │   │   └── incompatible_test.go
    │   └── sqlcheck.go
    ├── sqlclient/
    │   ├── client.go
    │   └── client_test.go
    ├── sqlite/
    │   ├── convert.go
    │   ├── diff.go
    │   ├── diff_test.go
    │   ├── driver.go
    │   ├── driver_oss.go
    │   ├── driver_test.go
    │   ├── inspect.go
    │   ├── inspect_test.go
    │   ├── migrate.go
    │   ├── migrate_test.go
    │   ├── sqlitecheck/
    │   │   ├── sqlitecheck.go
    │   │   ├── sqlitecheck_oss.go
    │   │   └── sqlitecheck_test.go
    │   ├── sqlspec.go
    │   └── sqlspec_test.go
    ├── sqlspec/
    │   ├── sqlspec.go
    │   └── sqlspec_test.go
    └── sqltool/
        ├── doc.go
        ├── hidden.go
        ├── hidden_windows.go
        ├── testdata/
        │   ├── dbmate/
        │   │   ├── 1_initial.sql
        │   │   └── 2_second_migration.sql
        │   ├── flyway/
        │   │   ├── B2__baseline.sql
        │   │   ├── R__views.sql
        │   │   ├── U1__initial.sql
        │   │   ├── V1__initial.sql
        │   │   ├── V2__second_migration.sql
        │   │   ├── V3__third_migration.sql
        │   │   └── v3/
        │   │       └── V3_1__fourth_migration.sql
        │   ├── golang-migrate/
        │   │   ├── 1_initial.down.sql
        │   │   ├── 1_initial.up.sql
        │   │   ├── 2_second_migration.down.sql
        │   │   └── 2_second_migration.up.sql
        │   ├── goose/
        │   │   ├── 1_initial.sql
        │   │   └── 2_second_migration.sql
        │   └── liquibase/
        │       ├── 1_initial.sql
        │       └── 2_second_migration.sql
        ├── tool.go
        └── tool_test.go
Download .txt
Showing preview only (754K chars total). Download the full file or copy to clipboard to get everything.
SYMBOL INDEX (8271 symbols across 301 files)

FILE: atlasexec/atlas.go
  type Client (line 27) | type Client struct
    method WithWorkDir (line 150) | func (c *Client) WithWorkDir(dir string, fn func(*Client) error) error {
    method SetEnv (line 159) | func (c *Client) SetEnv(env map[string]string) error {
    method SetStdout (line 170) | func (c *Client) SetStdout(w io.Writer) {
    method SetStderr (line 175) | func (c *Client) SetStderr(w io.Writer) {
    method Login (line 180) | func (c *Client) Login(ctx context.Context, params *LoginParams) error {
    method Logout (line 193) | func (c *Client) Logout(ctx context.Context) error {
    method WhoAmI (line 199) | func (c *Client) WhoAmI(ctx context.Context, params *WhoAmIParams) (*W...
    method Version (line 217) | func (c *Client) Version(ctx context.Context) (*Version, error) {
    method runCommand (line 294) | func (c *Client) runCommand(ctx context.Context, args []string) (io.Re...
    method runCommandStream (line 317) | func (c *Client) runCommandStream(ctx context.Context, args []string) ...
    method cmd (line 348) | func (c *Client) cmd(ctx context.Context, args []string) *exec.Cmd {
    method runErr (line 363) | func (c *Client) runErr(err error, stdout, stderr interface{ String() ...
  type LoginParams (line 35) | type LoginParams struct
  type WhoAmIParams (line 40) | type WhoAmIParams struct
  type WhoAmI (line 46) | type WhoAmI struct
  type Version (line 50) | type Version struct
    method String (line 242) | func (v Version) String() string {
  type VarArgs (line 56) | type VarArgs interface
  type Vars2 (line 62) | type Vars2
    method AsArgs (line 488) | func (v Vars2) AsArgs() []string {
  type Environ (line 64) | type Environ
    method ToSlice (line 273) | func (e Environ) ToSlice() []string {
  type RunContext (line 67) | type RunContext struct
  type SCMType (line 78) | type SCMType
  type DeployRunContext (line 81) | type DeployRunContext struct
  type TriggerType (line 86) | type TriggerType
  type Vars (line 90) | type Vars
    method AsArgs (line 510) | func (v Vars) AsArgs() []string {
  constant TriggerTypeCLI (line 95) | TriggerTypeCLI          TriggerType = "CLI"
  constant TriggerTypeKubernetes (line 96) | TriggerTypeKubernetes   TriggerType = "KUBERNETES"
  constant TriggerTypeTerraform (line 97) | TriggerTypeTerraform    TriggerType = "TERRAFORM"
  constant TriggerTypeGithubAction (line 98) | TriggerTypeGithubAction TriggerType = "GITHUB_ACTION"
  constant TriggerTypeCircleCIOrb (line 99) | TriggerTypeCircleCIOrb  TriggerType = "CIRCLECI_ORB"
  constant TriggerTypeGitlab (line 100) | TriggerTypeGitlab       TriggerType = "GITLAB"
  constant TriggerTypeBitbucket (line 101) | TriggerTypeBitbucket    TriggerType = "BITBUCKET"
  constant TriggerTypeAzureDevOps (line 102) | TriggerTypeAzureDevOps  TriggerType = "AZURE_DEVOPS"
  constant SCMTypeGithub (line 107) | SCMTypeGithub      SCMType = "GITHUB"
  constant SCMTypeGitlab (line 108) | SCMTypeGitlab      SCMType = "GITLAB"
  constant SCMTypeBitbucket (line 109) | SCMTypeBitbucket   SCMType = "BITBUCKET"
  constant SCMTypeAzureDevOps (line 110) | SCMTypeAzureDevOps SCMType = "AZURE_DEVOPS"
  constant ExecOrderLinear (line 115) | ExecOrderLinear     MigrateExecOrder = "linear"
  constant ExecOrderLinearSkip (line 116) | ExecOrderLinearSkip MigrateExecOrder = "linear-skip"
  constant ExecOrderNonLinear (line 117) | ExecOrderNonLinear  MigrateExecOrder = "non-linear"
  function NewClient (line 121) | func NewClient(workingDir, execPath string) (_ *Client, err error) {
  function NewOSEnviron (line 255) | func NewOSEnviron() Environ {
  type Stream (line 306) | type Stream interface
  type stream (line 379) | type stream struct
    method Next (line 387) | func (s *stream) Next() bool {
    method Current (line 403) | func (s *stream) Current() (string, error) {
    method Err (line 413) | func (s *stream) Err() error {
  function mergeWriters (line 421) | func mergeWriters(writers ...io.Writer) io.Writer {
  type Error (line 440) | type Error struct
    method Error (line 447) | func (e *Error) Error() string {
    method ExitCode (line 456) | func (e *Error) ExitCode() int {
    method Unwrap (line 467) | func (e *Error) Unwrap() error {
  function TempFile (line 472) | func TempFile(content, ext string) (string, func() error, error) {
  function stringVal (line 518) | func stringVal(r io.Reader, err error) (string, error) {
  function jsonDecode (line 529) | func jsonDecode[T any](r io.Reader, err error) ([]*T, error) {
  function jsonDecodeErr (line 555) | func jsonDecodeErr[T any](fn func([]*T, string) error) func(io.Reader, e...
  function repeatFlag (line 572) | func repeatFlag(flag string, values []string) []string {
  function listString (line 583) | func listString(args []string) string {
  function firstResult (line 587) | func firstResult[T ~[]E, E any](r T, err error) (e E, _ error) {
  function last (line 598) | func last[A ~[]E, E any](a A) (_ E) {

FILE: atlasexec/atlas_internal_test.go
  function TestEnv (line 15) | func TestEnv(t *testing.T) {

FILE: atlasexec/atlas_migrate.go
  type MigrateApplyParams (line 20) | type MigrateApplyParams struct
  type MigrateApply (line 39) | type MigrateApply struct
    method Summary (line 690) | func (a *MigrateApply) Summary(ident string) string {
  type MigrateApplyError (line 53) | type MigrateApplyError struct
    method Error (line 809) | func (e *MigrateApplyError) Error() string {
  type MigrateExecOrder (line 59) | type MigrateExecOrder
  type MigrateDownParams (line 61) | type MigrateDownParams struct
  type MigrateDown (line 80) | type MigrateDown struct
  type MigratePushParams (line 96) | type MigratePushParams struct
  type MigrateLintParams (line 110) | type MigrateLintParams struct
    method AsArgs (line 642) | func (p *MigrateLintParams) AsArgs() ([]string, error) {
  type MigrateHashParams (line 127) | type MigrateHashParams struct
  type MigrateRebaseParams (line 136) | type MigrateRebaseParams struct
  type MigrateTestParams (line 145) | type MigrateTestParams struct
  type MigrateStatusParams (line 159) | type MigrateStatusParams struct
  type MigrateLsParams (line 169) | type MigrateLsParams struct
  type MigrateSetParams (line 179) | type MigrateSetParams struct
  type MigrateDiffParams (line 190) | type MigrateDiffParams struct
  type MigrateDiff (line 206) | type MigrateDiff struct
  type MigrateStatus (line 211) | type MigrateStatus struct
    method LatestVersion (line 772) | func (r MigrateStatus) LatestVersion() string {
    method Amount (line 787) | func (r MigrateStatus) Amount(version string) (amount uint64, ok bool) {
  method MigratePush (line 227) | func (c *Client) MigratePush(ctx context.Context, params *MigratePushPar...
  method MigrateApply (line 270) | func (c *Client) MigrateApply(ctx context.Context, params *MigrateApplyP...
  method MigrateApplySlice (line 275) | func (c *Client) MigrateApplySlice(ctx context.Context, params *MigrateA...
  method MigrateDown (line 330) | func (c *Client) MigrateDown(ctx context.Context, params *MigrateDownPar...
  method MigrateTest (line 379) | func (c *Client) MigrateTest(ctx context.Context, params *MigrateTestPar...
  method MigrateStatus (line 419) | func (c *Client) MigrateStatus(ctx context.Context, params *MigrateStatu...
  method MigrateLs (line 444) | func (c *Client) MigrateLs(ctx context.Context, params *MigrateLsParams)...
  method MigrateSet (line 468) | func (c *Client) MigrateSet(ctx context.Context, params *MigrateSetParam...
  method MigrateDiff (line 497) | func (c *Client) MigrateDiff(ctx context.Context, params *MigrateDiffPar...
  method MigrateLint (line 548) | func (c *Client) MigrateLint(ctx context.Context, params *MigrateLintPar...
  method MigrateHash (line 566) | func (c *Client) MigrateHash(ctx context.Context, params *MigrateHashPar...
  method MigrateRebase (line 588) | func (c *Client) MigrateRebase(ctx context.Context, params *MigrateRebas...
  method MigrateLintError (line 610) | func (c *Client) MigrateLintError(ctx context.Context, params *MigrateLi...
  function newMigrateApplyError (line 804) | func newMigrateApplyError(r []*MigrateApply, stderr string) error {
  function plural (line 822) | func plural(n int) (s string) {

FILE: atlasexec/atlas_migrate_example_test.go
  function ExampleClient_MigrateApply (line 16) | func ExampleClient_MigrateApply() {
  function ExampleClient_MigrateSet (line 45) | func ExampleClient_MigrateSet() {

FILE: atlasexec/atlas_migrate_test.go
  function TestMigrate_Status (line 29) | func TestMigrate_Status(t *testing.T) {
  function TestMigrate_Apply (line 70) | func TestMigrate_Apply(t *testing.T) {
  function TestMigrate_Ls (line 132) | func TestMigrate_Ls(t *testing.T) {
  function TestMigrate_Ls_Integration (line 204) | func TestMigrate_Ls_Integration(t *testing.T) {
  function TestMigrate_Set (line 238) | func TestMigrate_Set(t *testing.T) {
  function TestMigrate_Down (line 309) | func TestMigrate_Down(t *testing.T) {
  function TestMigrate_Test (line 387) | func TestMigrate_Test(t *testing.T) {
  function TestAtlasMigrate_ApplyBroken (line 475) | func TestAtlasMigrate_ApplyBroken(t *testing.T) {
  function TestMigrateApplyError_Error (line 497) | func TestMigrateApplyError_Error(t *testing.T) {
  function TestAtlasMigrate_Apply (line 564) | func TestAtlasMigrate_Apply(t *testing.T) {
  function TestAtlasMigrate_ApplyWithRemote (line 621) | func TestAtlasMigrate_ApplyWithRemote(t *testing.T) {
  function TestAtlasMigrate_Push (line 702) | func TestAtlasMigrate_Push(t *testing.T) {
  function TestMigrateHash (line 828) | func TestMigrateHash(t *testing.T) {
  function TestMigrateRebase (line 847) | func TestMigrateRebase(t *testing.T) {
  function TestAtlasMigrate_Lint (line 884) | func TestAtlasMigrate_Lint(t *testing.T) {
  function TestAtlasMigrate_LintWithLogin (line 979) | func TestAtlasMigrate_LintWithLogin(t *testing.T) {
  function TestMigrate_Diff (line 1157) | func TestMigrate_Diff(t *testing.T) {

FILE: atlasexec/atlas_models.go
  type File (line 18) | type File struct
  type AppliedFile (line 25) | type AppliedFile struct
  type RevertedFile (line 38) | type RevertedFile struct
  type SummaryReport (line 52) | type SummaryReport struct
    method DiagnosticsCount (line 152) | func (r *SummaryReport) DiagnosticsCount() int {
    method Errors (line 163) | func (r *SummaryReport) Errors() []error {
  type StepReport (line 71) | type StepReport struct
  type FileReport (line 78) | type FileReport struct
  type FileChecks (line 85) | type FileChecks struct
  type Check (line 93) | type Check struct
  type StmtError (line 98) | type StmtError struct
  type Env (line 103) | type Env struct
  type Changes (line 109) | type Changes struct
  type Revision (line 115) | type Revision struct
  type Report (line 128) | type Report struct
  type Diagnostic (line 135) | type Diagnostic struct
  type TableSizeMetric (line 141) | type TableSizeMetric struct
  constant MetricTableSizeBytes (line 149) | MetricTableSizeBytes = "atlas_table_size_bytes"

FILE: atlasexec/atlas_schema.go
  type SchemaPushParams (line 20) | type SchemaPushParams struct
  type SchemaPush (line 35) | type SchemaPush struct
  type SchemaApplyParams (line 41) | type SchemaApplyParams struct
  type SchemaApply (line 59) | type SchemaApply struct
  type SchemaApplyError (line 76) | type SchemaApplyError struct
    method Error (line 870) | func (e *SchemaApplyError) Error() string {
  type SchemaInspectParams (line 81) | type SchemaInspectParams struct
  type SchemaTestParams (line 94) | type SchemaTestParams struct
  type SchemaPlanParams (line 105) | type SchemaPlanParams struct
  type SchemaPlanListParams (line 126) | type SchemaPlanListParams struct
  type SchemaPlanPushParams (line 141) | type SchemaPlanPushParams struct
  type SchemaPlanPullParams (line 157) | type SchemaPlanPullParams struct
  type SchemaPlanLintParams (line 164) | type SchemaPlanLintParams struct
  type SchemaPlanValidateParams (line 179) | type SchemaPlanValidateParams struct
  type SchemaPlanApproveParams (line 195) | type SchemaPlanApproveParams struct
  type SchemaPlan (line 203) | type SchemaPlan struct
  type SchemaPlanApprove (line 211) | type SchemaPlanApprove struct
  type SchemaPlanFile (line 217) | type SchemaPlanFile struct
  type SchemaCleanParams (line 231) | type SchemaCleanParams struct
  type SchemaClean (line 241) | type SchemaClean struct
  type SchemaLintParams (line 249) | type SchemaLintParams struct
    method AsArgs (line 834) | func (p *SchemaLintParams) AsArgs() ([]string, error) {
  type SchemaLintReport (line 260) | type SchemaLintReport struct
  type SchemaStatsInspectParams (line 265) | type SchemaStatsInspectParams struct
  method SchemaPush (line 278) | func (c *Client) SchemaPush(ctx context.Context, params *SchemaPushParam...
  method SchemaApply (line 322) | func (c *Client) SchemaApply(ctx context.Context, params *SchemaApplyPar...
  method SchemaApplySlice (line 327) | func (c *Client) SchemaApplySlice(ctx context.Context, params *SchemaApp...
  method SchemaInspect (line 377) | func (c *Client) SchemaInspect(ctx context.Context, params *SchemaInspec...
  method SchemaTest (line 413) | func (c *Client) SchemaTest(ctx context.Context, params *SchemaTestParam...
  method SchemaPlan (line 440) | func (c *Client) SchemaPlan(ctx context.Context, params *SchemaPlanParam...
  method SchemaPlanList (line 507) | func (c *Client) SchemaPlanList(ctx context.Context, params *SchemaPlanL...
  method SchemaPlanPush (line 562) | func (c *Client) SchemaPlanPush(ctx context.Context, params *SchemaPlanP...
  method SchemaPlanPull (line 618) | func (c *Client) SchemaPlanPull(ctx context.Context, params *SchemaPlanP...
  method SchemaPlanLint (line 640) | func (c *Client) SchemaPlanLint(ctx context.Context, params *SchemaPlanL...
  method SchemaPlanValidate (line 693) | func (c *Client) SchemaPlanValidate(ctx context.Context, params *SchemaP...
  method SchemaPlanApprove (line 749) | func (c *Client) SchemaPlanApprove(ctx context.Context, params *SchemaPl...
  method SchemaClean (line 772) | func (c *Client) SchemaClean(ctx context.Context, params *SchemaCleanPar...
  method SchemaLint (line 798) | func (c *Client) SchemaLint(ctx context.Context, params *SchemaLintParam...
  method SchemaStatsInspect (line 807) | func (c *Client) SchemaStatsInspect(ctx context.Context, params *SchemaS...
  type InvalidParamsError (line 856) | type InvalidParamsError struct
    method Error (line 862) | func (e *InvalidParamsError) Error() string {
  function newSchemaApplyError (line 865) | func newSchemaApplyError(r []*SchemaApply, stderr string) error {

FILE: atlasexec/atlas_schema_test.go
  function TestSchema_Test (line 20) | func TestSchema_Test(t *testing.T) {
  function TestSchema_Inspect (line 90) | func TestSchema_Inspect(t *testing.T) {
  function TestAtlasSchema_Apply (line 136) | func TestAtlasSchema_Apply(t *testing.T) {
  function TestSchema_Plan (line 236) | func TestSchema_Plan(t *testing.T) {
  function TestSchema_PlanPush (line 347) | func TestSchema_PlanPush(t *testing.T) {
  function TestSchema_PlanLint (line 395) | func TestSchema_PlanLint(t *testing.T) {
  function TestSchema_PlanValidate (line 441) | func TestSchema_PlanValidate(t *testing.T) {
  function TestSchema_PlanApprove (line 486) | func TestSchema_PlanApprove(t *testing.T) {
  function TestSchema_PlanPull (line 516) | func TestSchema_PlanPull(t *testing.T) {
  function TestSchema_PlanList (line 546) | func TestSchema_PlanList(t *testing.T) {
  function TestSchema_Push (line 599) | func TestSchema_Push(t *testing.T) {
  function TestSchema_Apply (line 685) | func TestSchema_Apply(t *testing.T) {
  function TestSchema_Clean (line 734) | func TestSchema_Clean(t *testing.T) {
  function TestSchema_ApplyEnvs (line 774) | func TestSchema_ApplyEnvs(t *testing.T) {
  function TestSchemaApplyError_Error (line 806) | func TestSchemaApplyError_Error(t *testing.T) {
  function TestAtlasSchema_Lint (line 873) | func TestAtlasSchema_Lint(t *testing.T) {
  function TestSchema_Lint (line 941) | func TestSchema_Lint(t *testing.T) {

FILE: atlasexec/atlas_test.go
  function TestError (line 23) | func TestError(t *testing.T) {
  function TestNewClient (line 30) | func TestNewClient(t *testing.T) {
  function TestVersion (line 47) | func TestVersion(t *testing.T) {
  function TestLogin (line 90) | func TestLogin(t *testing.T) {
  function TestWhoAmI (line 120) | func TestWhoAmI(t *testing.T) {
  function TestVars2 (line 152) | func TestVars2(t *testing.T) {
  function generateHCL (line 175) | func generateHCL(t *testing.T, token string, srv *httptest.Server) string {
  function sqlitedb (line 193) | func sqlitedb(t *testing.T, seed string) string {
  type stringer (line 205) | type stringer struct
    method String (line 207) | func (s stringer) String() string {

FILE: atlasexec/copilot.go
  constant CopilotTypeMessage (line 16) | CopilotTypeMessage    = "message"
  constant CopilotTypeToolCall (line 17) | CopilotTypeToolCall   = "tool_call"
  constant CopilotTypeToolOutput (line 18) | CopilotTypeToolOutput = "tool_output"
  type CopilotParams (line 23) | type CopilotParams struct
  type Copilot (line 29) | type Copilot
    method String (line 133) | func (c Copilot) String() string {
  type CopilotMessage (line 31) | type CopilotMessage struct
  type ToolCallMessage (line 44) | type ToolCallMessage struct
  type ToolOutputMessage (line 50) | type ToolOutputMessage struct
  method Copilot (line 57) | func (c *Client) Copilot(ctx context.Context, params *CopilotParams) (Co...
  type copilotStream (line 71) | type copilotStream struct
    method Next (line 78) | func (s *copilotStream) Next() bool {
    method Current (line 85) | func (s *copilotStream) Current() (*CopilotMessage, error) {
    method Err (line 105) | func (s *copilotStream) Err() error {
  method CopilotStream (line 115) | func (c *Client) CopilotStream(ctx context.Context, params *CopilotParam...

FILE: atlasexec/copilot_test.go
  function TestCopilot (line 18) | func TestCopilot(t *testing.T) {

FILE: atlasexec/internal/e2e/sqlite_test.go
  function Test_SQLite (line 21) | func Test_SQLite(t *testing.T) {
  function Test_PostgreSQL (line 51) | func Test_PostgreSQL(t *testing.T) {
  function Test_MultiTenants (line 85) | func Test_MultiTenants(t *testing.T) {
  function Test_SchemaPlan (line 135) | func Test_SchemaPlan(t *testing.T) {

FILE: atlasexec/internal/e2e/testdata/multi-tenants/migrations/20240112070806.sql
  type t1 (line 1) | CREATE TABLE t1(c1 int)

FILE: atlasexec/internal/e2e/testdata/multi-tenants/migrations/20240116003831.sql
  type c1_unique (line 1) | CREATE UNIQUE INDEX c1_unique ON t1(c1)

FILE: atlasexec/internal/e2e/testdata/versioned-basic/migrations/20240112070806.sql
  type t1 (line 1) | CREATE TABLE t1(c1 int)

FILE: atlasexec/internal/e2e/util_e2e.go
  constant testFixtureDir (line 20) | testFixtureDir = "testdata"
  function runTestWithVersions (line 22) | func runTestWithVersions(t *testing.T, versions []string, fixtureName st...
  function downloadAtlas (line 83) | func downloadAtlas(t *testing.T, version string) string {

FILE: atlasexec/testdata/migrations/20230727105553_init.sql
  type t1 (line 1) | CREATE TABLE t1 ( c1 int )

FILE: atlasexec/testdata/migrations/20230727105615_t2.sql
  type t2 (line 1) | CREATE TABLE t2 ( c1 int, c2 text )

FILE: atlasexec/working_dir.go
  type WorkingDir (line 22) | type WorkingDir struct
    method Close (line 90) | func (ce *WorkingDir) Close() error {
    method DirFS (line 95) | func (ce *WorkingDir) DirFS() fs.FS {
    method Path (line 100) | func (ce *WorkingDir) Path(elem ...string) string {
    method RunCommand (line 108) | func (ce *WorkingDir) RunCommand(cmd *exec.Cmd) error {
    method WriteFile (line 116) | func (ce *WorkingDir) WriteFile(name string, data []byte) (string, err...
    method CreateFile (line 128) | func (ce *WorkingDir) CreateFile(name string, fn func(w io.Writer) err...
    method CopyFS (line 145) | func (ce *WorkingDir) CopyFS(name string, src fs.FS) error {
  type Option (line 26) | type Option
  function WithAtlasHCLString (line 30) | func WithAtlasHCLString(s string) Option {
  function WithAtlasHCLPath (line 38) | func WithAtlasHCLPath(path string) Option {
  function WithAtlasHCL (line 51) | func WithAtlasHCL(fn func(w io.Writer) error) Option {
  function WithMigrations (line 59) | func WithMigrations(dir fs.FS) Option {
  function NewWorkingDir (line 72) | func NewWorkingDir(opts ...Option) (*WorkingDir, error) {

FILE: atlasexec/working_dir_test.go
  function TestContextExecer (line 21) | func TestContextExecer(t *testing.T) {
  function TestMaintainOriginalWorkingDir (line 87) | func TestMaintainOriginalWorkingDir(t *testing.T) {

FILE: cmd/atlas/internal/cloudapi/client.go
  constant defaultURL (line 30) | defaultURL = "https://api.atlasgo.cloud/query"
  constant DefaultProjectName (line 32) | DefaultProjectName = "default"
  constant DefaultDirName (line 35) | DefaultDirName = ".atlas"
  type Client (line 39) | type Client struct
    method Dir (line 96) | func (c *Client) Dir(ctx context.Context, input DirInput) (migrate.Dir...
    method ReportMigrationSet (line 216) | func (c *Client) ReportMigrationSet(ctx context.Context, input ReportM...
    method ReportMigration (line 242) | func (c *Client) ReportMigration(ctx context.Context, input ReportMigr...
    method post (line 270) | func (c *Client) post(ctx context.Context, query string, vars, data an...
    method AddHeader (line 324) | func (c *Client) AddHeader(key, value string) {
  function New (line 45) | func New(endpoint, token string) *Client {
  type clientCtxKey (line 75) | type clientCtxKey struct
  function NewContext (line 78) | func NewContext(parent context.Context, c *Client) context.Context {
  function FromContext (line 83) | func FromContext(ctx context.Context) *Client {
  type DirInput (line 89) | type DirInput struct
  type DeployContextInput (line 124) | type DeployContextInput struct
  type ReportMigrationSetInput (line 130) | type ReportMigrationSetInput struct
  type ReportMigrationInput (line 142) | type ReportMigrationInput struct
  type DeployedTargetInput (line 161) | type DeployedTargetInput struct
  type DeployedFileInput (line 168) | type DeployedFileInput struct
  type FileChecksInput (line 180) | type FileChecksInput struct
  type CheckStmtInput (line 189) | type CheckStmtInput struct
  type StmtErrorInput (line 195) | type StmtErrorInput struct
  type ReportStep (line 201) | type ReportStep struct
  type ReportStepLog (line 209) | type ReportStepLog struct
  type errlist (line 335) | type errlist
    method Error (line 344) | func (e errlist) Error() string {
  type roundTripper (line 337) | type roundTripper struct
    method RoundTrip (line 350) | func (r *roundTripper) RoundTrip(req *http.Request) (*http.Response, e...
  type HTTPError (line 359) | type HTTPError struct
    method Error (line 364) | func (e *HTTPError) Error() string {
  function RedactedURL (line 369) | func RedactedURL(s string) (string, error) {
  function SetVersion (line 382) | func SetVersion(v, flavor string) {
  function SetHeader (line 390) | func SetHeader(req *http.Request, token string) {
  function header (line 396) | func header(token string) http.Header {
  function UserAgent (line 405) | func UserAgent(systems ...string) string {

FILE: cmd/atlas/internal/cloudapi/client_oss.go
  function testingURL (line 13) | func testingURL(endpoint string) bool {

FILE: cmd/atlas/internal/cloudapi/client_test.go
  function TestClient_Dir (line 22) | func TestClient_Dir(t *testing.T) {
  function TestClient_GraphQLError (line 57) | func TestClient_GraphQLError(t *testing.T) {
  function TestClient_HTTPError (line 73) | func TestClient_HTTPError(t *testing.T) {
  function TestClient_ReportMigration (line 125) | func TestClient_ReportMigration(t *testing.T) {
  function TestClient_ReportMigrationSet (line 149) | func TestClient_ReportMigrationSet(t *testing.T) {
  function TestRedactedURL (line 196) | func TestRedactedURL(t *testing.T) {
  function TestUserAgent (line 205) | func TestUserAgent(t *testing.T) {
  function TestClient_AddHeader (line 212) | func TestClient_AddHeader(t *testing.T) {
  function TestClient_Retry (line 226) | func TestClient_Retry(t *testing.T) {

FILE: cmd/atlas/internal/cmdapi/cmdapi.go
  type ErrorFormatter (line 94) | type ErrorFormatter interface
  type FormattedError (line 98) | type FormattedError struct
    method Error (line 115) | func (e *FormattedError) Error() string { return e.Err.Error() }
    method FormatError (line 117) | func (e *FormattedError) FormatError(cmd *cobra.Command) {
  type AbortError (line 105) | type AbortError struct
    method Error (line 129) | func (e *AbortError) Error() string { return e.Err.Error() }
    method FormatError (line 131) | func (e *AbortError) FormatError(cmd *cobra.Command) {
    method Unwrap (line 135) | func (e *AbortError) Unwrap() error {
  type Aborter (line 109) | type Aborter interface
  function AbortErrorf (line 125) | func AbortErrorf(format string, a ...any) error {
  function RunE (line 140) | func RunE(f func(*cobra.Command, []string) error) func(*cobra.Command, [...
  function init (line 154) | func init() {
  function parseV (line 167) | func parseV(version string) (string, string) {
  function Version (line 180) | func Version() string {
  type Vars (line 185) | type Vars
    method String (line 188) | func (v Vars) String() string {
    method Copy (line 220) | func (v Vars) Copy() Vars {
    method Replace (line 229) | func (v *Vars) Replace(vc Vars) {
    method Set (line 234) | func (v *Vars) Set(s string) error {
    method Type (line 261) | func (v *Vars) Type() string {
  constant flagAllowDirty (line 266) | flagAllowDirty     = "allow-dirty"
  constant flagEdit (line 267) | flagEdit           = "edit"
  constant flagAutoApprove (line 268) | flagAutoApprove    = "auto-approve"
  constant flagBaseline (line 269) | flagBaseline       = "baseline"
  constant flagConfig (line 270) | flagConfig         = "config"
  constant flagContext (line 271) | flagContext        = "context"
  constant flagDevURL (line 272) | flagDevURL         = "dev-url"
  constant flagDirURL (line 273) | flagDirURL         = "dir"
  constant flagDirFormat (line 274) | flagDirFormat      = "dir-format"
  constant flagDryRun (line 275) | flagDryRun         = "dry-run"
  constant flagEnv (line 276) | flagEnv            = "env"
  constant flagExclude (line 277) | flagExclude        = "exclude"
  constant flagInclude (line 278) | flagInclude        = "include"
  constant flagFile (line 279) | flagFile           = "file"
  constant flagFrom (line 280) | flagFrom           = "from"
  constant flagFromShort (line 281) | flagFromShort      = "f"
  constant flagFormat (line 282) | flagFormat         = "format"
  constant flagGitBase (line 283) | flagGitBase        = "git-base"
  constant flagGitDir (line 284) | flagGitDir         = "git-dir"
  constant flagLatest (line 285) | flagLatest         = "latest"
  constant flagLockTimeout (line 286) | flagLockTimeout    = "lock-timeout"
  constant flagLog (line 287) | flagLog            = "log"
  constant flagPlan (line 288) | flagPlan           = "plan"
  constant flagRevisionSchema (line 289) | flagRevisionSchema = "revisions-schema"
  constant flagSchema (line 290) | flagSchema         = "schema"
  constant flagSchemaShort (line 291) | flagSchemaShort    = "s"
  constant flagTo (line 292) | flagTo             = "to"
  constant flagTxMode (line 293) | flagTxMode         = "tx-mode"
  constant flagExecOrder (line 294) | flagExecOrder      = "exec-order"
  constant flagURL (line 295) | flagURL            = "url"
  constant flagURLShort (line 296) | flagURLShort       = "u"
  constant flagVar (line 297) | flagVar            = "var"
  constant flagQualifier (line 298) | flagQualifier      = "qualifier"
  function addGlobalFlags (line 301) | func addGlobalFlags(set *pflag.FlagSet) {
  function addFlagAutoApprove (line 307) | func addFlagAutoApprove(set *pflag.FlagSet, target *bool) {
  function addFlagDirFormat (line 311) | func addFlagDirFormat(set *pflag.FlagSet, target *string) {
  function addFlagLockTimeout (line 315) | func addFlagLockTimeout(set *pflag.FlagSet, target *time.Duration) {
  function addFlagDirURL (line 320) | func addFlagDirURL(set *pflag.FlagSet, target *string, args ...string) {
  function addFlagDevURL (line 335) | func addFlagDevURL(set *pflag.FlagSet, target *string) {
  function addFlagDryRun (line 344) | func addFlagDryRun(set *pflag.FlagSet, target *bool) {
  function addFlagExclude (line 348) | func addFlagExclude(set *pflag.FlagSet, target *[]string) {
  function addFlagInclude (line 357) | func addFlagInclude(set *pflag.FlagSet, target *[]string) {
  function addFlagLog (line 366) | func addFlagLog(set *pflag.FlagSet, target *string) {
  function addFlagFormat (line 373) | func addFlagFormat(set *pflag.FlagSet, target *string) {
  function addFlagRevisionSchema (line 377) | func addFlagRevisionSchema(set *pflag.FlagSet, target *string) {
  function addFlagSchemas (line 381) | func addFlagSchemas(set *pflag.FlagSet, target *[]string) {
  function addFlagURL (line 391) | func addFlagURL(set *pflag.FlagSet, target *string, args ...string) {
  function addFlagURLs (line 408) | func addFlagURLs(set *pflag.FlagSet, target *[]string, args ...string) {
  function addFlagToURLs (line 425) | func addFlagToURLs(set *pflag.FlagSet, target *[]string) {
  function maySetFlag (line 432) | func maySetFlag(cmd *cobra.Command, name, envVal string) error {
  function resetFromEnv (line 442) | func resetFromEnv(cmd *cobra.Command) func() {
  type stateReaderConfig (line 476) | type stateReaderConfig struct
    method Exported (line 487) | func (c *stateReaderConfig) Exported() (*cmdext.StateReaderConfig, err...
  function readerUseDev (line 510) | func readerUseDev(env *Env, urls ...string) (bool, error) {
  function stateReader (line 531) | func stateReader(ctx context.Context, env *Env, config *stateReaderConfi...
  constant localStateFile (line 609) | localStateFile = "local-community.json"
  type LocalState (line 612) | type LocalState struct

FILE: cmd/atlas/internal/cmdapi/cmdapi_oss.go
  function init (line 33) | func init() {
  function unsupportedCommand (line 70) | func unsupportedCommand(cmd, sub string) *cobra.Command {
  function unsupportedMessage (line 90) | func unsupportedMessage(cmd, sub string) string {
  type Project (line 108) | type Project struct
  constant envSkipUpgradeSuggestions (line 118) | envSkipUpgradeSuggestions = "ATLAS_NO_UPGRADE_SUGGESTIONS"
  constant oneWeek (line 119) | oneWeek                   = 7 * 24 * time.Hour
  function maySuggestUpgrade (line 125) | func maySuggestUpgrade(cmd *cobra.Command) {
  function migrateLintSetFlags (line 156) | func migrateLintSetFlags(*cobra.Command, *migrateLintFlags) {}
  function migrateLintRun (line 159) | func migrateLintRun(cmd *cobra.Command, _ []string, flags migrateLintFla...
  function migrateDiffRun (line 216) | func migrateDiffRun(cmd *cobra.Command, args []string, flags migrateDiff...
  function schemaApplyRunE (line 315) | func schemaApplyRunE(cmd *cobra.Command, _ []string, flags *schemaApplyF...
  function schemaApplyRun (line 344) | func schemaApplyRun(cmd *cobra.Command, flags schemaApplyFlags, env *Env...
  function applySchemaClean (line 438) | func applySchemaClean(cmd *cobra.Command, client *sqlclient.Client, drop...
  function schemaDiffRun (line 460) | func schemaDiffRun(cmd *cobra.Command, _ []string, flags schemaDiffFlags...
  function summary (line 520) | func summary(cmd *cobra.Command, c *sqlclient.Client, changes []schema.C...
  function promptApply (line 531) | func promptApply(cmd *cobra.Command, flags schemaApplyFlags, diff *diff,...
  function maySetLoginContext (line 538) | func maySetLoginContext(*cobra.Command, *Project) error {
  function setEnvs (line 542) | func setEnvs(context.Context, []*Env) {}
  function diffOptions (line 548) | func diffOptions(_ *cobra.Command, env *Env) []schema.DiffOption {
  method openClient (line 553) | func (*Env) openClient(ctx context.Context, u string) (*sqlclient.Client...
  type schemaInspectFlags (line 557) | type schemaInspectFlags struct
  function schemaInspectCmd (line 566) | func schemaInspectCmd() *cobra.Command {
  function schemaInspectCmdWithFlags (line 571) | func schemaInspectCmdWithFlags() (*cobra.Command, *schemaInspectFlags) {
  function schemaInspectRun (line 618) | func schemaInspectRun(cmd *cobra.Command, _ []string, flags schemaInspec...

FILE: cmd/atlas/internal/cmdapi/cmdapi_test.go
  function TestVars_String (line 20) | func TestVars_String(t *testing.T) {
  function runCmd (line 31) | func runCmd(cmd *cobra.Command, args ...string) (string, error) {
  function runCmdContext (line 35) | func runCmdContext(ctx context.Context, cmd *cobra.Command, args ...stri...
  function openSQLite (line 50) | func openSQLite(t *testing.T, seed string) string {

FILE: cmd/atlas/internal/cmdapi/migrate.go
  function migrateCmd (line 41) | func migrateCmd() *cobra.Command {
  type migrateApplyFlags (line 51) | type migrateApplyFlags struct
    method migrateOptions (line 65) | func (f *migrateApplyFlags) migrateOptions() ([]migrate.ExecutorOption...
  function migrateApplyCmd (line 86) | func migrateApplyCmd() *cobra.Command {
  type MigrateReport (line 164) | type MigrateReport struct
    method Init (line 322) | func (r *MigrateReport) Init(c *sqlclient.Client, l *cmdlog.MigrateApp...
    method RecordTargetID (line 328) | func (r *MigrateReport) RecordTargetID(ctx context.Context) error {
    method RecordPlanError (line 340) | func (r *MigrateReport) RecordPlanError(cmd *cobra.Command, flags migr...
    method Done (line 369) | func (r *MigrateReport) Done(cmd *cobra.Command, flags migrateApplyFla...
    method DirName (line 445) | func (r *MigrateReport) DirName(flags migrateApplyFlags) string {
    method CloudEnabled (line 461) | func (r *MigrateReport) CloudEnabled(ctx context.Context) bool {
  type MigrateReportSet (line 173) | type MigrateReportSet struct
    method RedactedURL (line 207) | func (*MigrateReportSet) RedactedURL(u string) string {
    method Step (line 216) | func (s *MigrateReportSet) Step(format string, args ...interface{}) {
    method StepLog (line 227) | func (s *MigrateReportSet) StepLog(text string) {
    method StepLogf (line 237) | func (s *MigrateReportSet) StepLogf(format string, args ...interface{}) {
    method StepLogError (line 242) | func (s *MigrateReportSet) StepLogError(text string) {
    method ReportFor (line 252) | func (s *MigrateReportSet) ReportFor(flags migrateApplyFlags, e *Env) ...
    method Flush (line 275) | func (s *MigrateReportSet) Flush(cmd *cobra.Command, cmdErr error) {
  function NewReportProvider (line 181) | func NewReportProvider(ctx context.Context, p *Project, envs []*Env, fla...
  function logApply (line 470) | func logApply(cmd *cobra.Command, w io.Writer, flags migrateApplyFlags, ...
  type migrateDiffFlags (line 490) | type migrateDiffFlags struct
  function migrateDiffCmd (line 503) | func migrateDiffCmd() *cobra.Command {
  function mayIndent (line 554) | func mayIndent(dir *url.URL, f migrate.Formatter, format string) (migrat...
  function maskNoPlan (line 603) | func maskNoPlan(cmd *cobra.Command, err error) error {
  type migrateHashFlags (line 611) | type migrateHashFlags struct
  function migrateHashCmd (line 614) | func migrateHashCmd() *cobra.Command {
  type migrateImportFlags (line 649) | type migrateImportFlags struct
  function migrateImportCmd (line 652) | func migrateImportCmd() *cobra.Command {
  function migrateImportRun (line 690) | func migrateImportRun(cmd *cobra.Command, _ []string, flags migrateImpor...
  type migrateLintFlags (line 768) | type migrateLintFlags struct
  function migrateLintCmd (line 781) | func migrateLintCmd() *cobra.Command {
  type migrateNewFlags (line 821) | type migrateNewFlags struct
  function migrateNewCmd (line 828) | func migrateNewCmd() *cobra.Command {
  function migrateNewRun (line 858) | func migrateNewRun(cmd *cobra.Command, args []string, flags migrateNewFl...
  type migrateSetFlags (line 885) | type migrateSetFlags struct
  function migrateSetCmd (line 892) | func migrateSetCmd() *cobra.Command {
  function migrateSetRun (line 925) | func migrateSetRun(cmd *cobra.Command, args []string, flags migrateSetFl...
  type migrateStatusFlags (line 1079) | type migrateStatusFlags struct
  function migrateStatusCmd (line 1087) | func migrateStatusCmd() *cobra.Command {
  function migrateStatusRun (line 1121) | func migrateStatusRun(cmd *cobra.Command, _ []string, flags migrateStatu...
  type migrateValidateFlags (line 1157) | type migrateValidateFlags struct
  function migrateValidateCmd (line 1163) | func migrateValidateCmd() *cobra.Command {
  function migrateValidateRun (line 1198) | func migrateValidateRun(cmd *cobra.Command, _ []string, flags migrateVal...
  constant applyLockValue (line 1230) | applyLockValue = "atlas_migrate_execute"
  function checkRevisionSchemaClarity (line 1232) | func checkRevisionSchemaClarity(cmd *cobra.Command, c *sqlclient.Client,...
  function entRevisions (line 1282) | func entRevisions(ctx context.Context, c *sqlclient.Client, flag string)...
  constant defaultRevisionSchema (line 1287) | defaultRevisionSchema = "atlas_schema_revisions"
  function revisionSchemaName (line 1289) | func revisionSchemaName(c *sqlclient.Client, flag string) string {
  constant txModeNone (line 1301) | txModeNone      = "none"
  constant txModeAll (line 1302) | txModeAll       = "all"
  constant txModeFile (line 1303) | txModeFile      = "file"
  constant txModeDirective (line 1304) | txModeDirective = "txmode"
  constant execOrderLinear (line 1306) | execOrderLinear     = "linear"
  constant execOrderLinearSkip (line 1307) | execOrderLinearSkip = "linear-skip"
  constant execOrderNonLinear (line 1308) | execOrderNonLinear  = "non-linear"
  type tx (line 1312) | type tx struct
    method driverFor (line 1323) | func (tx *tx) driverFor(ctx context.Context, f migrate.File) (migrate....
    method mayRollback (line 1369) | func (tx *tx) mayRollback(err error) error {
    method mayCommit (line 1379) | func (tx *tx) mayCommit() error {
    method commit (line 1388) | func (tx *tx) commit() error {
    method modeFor (line 1396) | func (tx *tx) modeFor(f migrate.File) (string, error) {
  function txmodeFor (line 1415) | func txmodeFor(f *migrate.LocalFile) (string, error) {
  function operatorVersion (line 1430) | func operatorVersion() string {
  function dirFormatBC (line 1436) | func dirFormatBC(flag string, urls ...*string) error {
  function checkDir (line 1452) | func checkDir(cmd *cobra.Command, url string, create bool) error {
  function printChecksumError (line 1464) | func printChecksumError(cmd *cobra.Command, err error) {
  function selectScheme (line 1481) | func selectScheme(urls []string) (string, error) {
  function migrateFlagsFromConfig (line 1508) | func migrateFlagsFromConfig(cmd *cobra.Command) error {
  function setMigrateEnvFlags (line 1516) | func setMigrateEnvFlags(cmd *cobra.Command, env *Env) error {
  function isURL (line 1606) | func isURL(s string) bool {
  function cmdEnvsRun (line 1612) | func cmdEnvsRun(
  type editDir (line 1644) | type editDir struct
    method WriteFile (line 1647) | func (d *editDir) WriteFile(name string, b []byte) (err error) {
  function edit (line 1657) | func edit(name string, src []byte) ([]byte, error) {
  type dryRunDriver (line 1683) | type dryRunDriver struct
    method ExecContext (line 1690) | func (dryRunDriver) ExecContext(context.Context, string, ...any) (sql....
    method Lock (line 1695) | func (dryRunDriver) Lock(context.Context, string, time.Duration) (sche...
    method CheckClean (line 1701) | func (dryRunDriver) CheckClean(context.Context, *migrate.TableIdent) e...
    method Snapshot (line 1706) | func (dryRunDriver) Snapshot(context.Context) (migrate.RestoreFunc, er...
  type dryRunRevisions (line 1686) | type dryRunRevisions struct
    method WriteRevision (line 1712) | func (dryRunRevisions) WriteRevision(context.Context, *migrate.Revisio...

FILE: cmd/atlas/internal/cmdapi/migrate_oss.go
  function migrateApplyRun (line 22) | func migrateApplyRun(cmd *cobra.Command, args []string, flags migrateApp...

FILE: cmd/atlas/internal/cmdapi/migrate_test.go
  function TestMigrate (line 38) | func TestMigrate(t *testing.T) {
  function TestMigrate_Import (line 43) | func TestMigrate_Import(t *testing.T) {
  function TestMigrate_Apply (line 101) | func TestMigrate_Apply(t *testing.T) {
  function TestMigrate_ApplyMultiEnv (line 397) | func TestMigrate_ApplyMultiEnv(t *testing.T) {
  function TestMigrate_ApplyTxMode (line 603) | func TestMigrate_ApplyTxMode(t *testing.T) {
  function TestMigrate_ApplyTxModeDirective (line 674) | func TestMigrate_ApplyTxModeDirective(t *testing.T) {
  function TestMigrate_ApplyExecOrder (line 712) | func TestMigrate_ApplyExecOrder(t *testing.T) {
  function TestMigrate_ApplyBaseline (line 801) | func TestMigrate_ApplyBaseline(t *testing.T) {
  function TestMigrate_Diff (line 879) | func TestMigrate_Diff(t *testing.T) {
  function TestMigrate_StatusJSON (line 1255) | func TestMigrate_StatusJSON(t *testing.T) {
  function TestMigrate_Set (line 1267) | func TestMigrate_Set(t *testing.T) {
  function TestMigrate_New (line 1350) | func TestMigrate_New(t *testing.T) {
  function TestMigrate_Validate (line 1429) | func TestMigrate_Validate(t *testing.T) {
  function TestMigrate_Hash (line 1480) | func TestMigrate_Hash(t *testing.T) {
  function TestMigrate_Lint (line 1518) | func TestMigrate_Lint(t *testing.T) {
  constant testSchema (line 1676) | testSchema = `
  function hclURL (line 1753) | func hclURL(t *testing.T) string {
  function copyFile (line 1759) | func copyFile(src, dst string) error {
  type sqliteLockerDriver (line 1774) | type sqliteLockerDriver struct
    method Lock (line 1778) | func (d *sqliteLockerDriver) Lock(context.Context, string, time.Durati...
  function countFiles (line 1782) | func countFiles(t *testing.T, p string) int {
  function sed (line 1788) | func sed(t *testing.T, r, p string) {
  function lines (line 1797) | func lines(f migrate.File) []string {

FILE: cmd/atlas/internal/cmdapi/project.go
  type Env (line 33) | type Env struct
    method MigrationRepo (line 214) | func (e *Env) MigrationRepo() (s string) {
    method MigrationExclude (line 222) | func (e *Env) MigrationExclude() []string {
    method SchemaRepo (line 230) | func (e *Env) SchemaRepo() (s string) {
    method LintReview (line 238) | func (e *Env) LintReview() string {
    method VarFromURL (line 246) | func (e *Env) VarFromURL(s string) (string, error) {
    method remainedLog (line 314) | func (e *Env) remainedLog() error {
    method DiffOptions (line 467) | func (e *Env) DiffOptions() []schema.DiffOption {
    method Sources (line 477) | func (e *Env) Sources() ([]string, error) {
    method Vars (line 503) | func (e *Env) Vars() map[string]cty.Value {
  type Migration (line 79) | type Migration struct
  type Schema (line 91) | type Schema struct
  type Repo (line 100) | type Repo struct
  type Lint (line 105) | type Lint struct
    method Extend (line 347) | func (l *Lint) Extend(global *Lint) *Lint {
    method remainedLog (line 379) | func (l *Lint) remainedLog() error {
  type Diff (line 122) | type Diff struct
    method Extend (line 413) | func (d *Diff) Extend(global *Diff) *Diff {
    method Options (line 424) | func (d *Diff) Options() (opts []schema.DiffOption) {
  type Test (line 129) | type Test struct
    method Extend (line 537) | func (t *Test) Extend(global *Test) *Test {
  type SkipChanges (line 143) | type SkipChanges struct
  type Format (line 181) | type Format struct
  constant envAttrScheme (line 211) | envAttrScheme = "env"
  function EnvByName (line 545) | func EnvByName(cmd *cobra.Command, name string, vars map[string]cty.Valu...
  type envCacheK (line 617) | type envCacheK struct
  type envCacheV (line 620) | type envCacheV struct
  type envCache (line 624) | type envCache struct
    method load (line 632) | func (c *envCache) load(path, env string, vars Vars) (*Project, []*Env...
    method store (line 639) | func (c *envCache) store(path, env string, vars Vars, p *Project, e []...
  constant blockEnv (line 646) | blockEnv          = "env"
  constant refAtlas (line 647) | refAtlas          = "atlas"
  constant defaultConfigPath (line 648) | defaultConfigPath = "file://atlas.hcl"
  function parseConfig (line 651) | func parseConfig(ctx context.Context, path, env string, vars map[string]...
  function init (line 695) | func init() {
  function partialParse (line 700) | func partialParse(path, env string) (*hclparse.Parser, error) {
  constant ReviewAlways (line 747) | ReviewAlways  = "ALWAYS"
  constant ReviewWarning (line 748) | ReviewWarning = "WARNING"
  constant ReviewError (line 749) | ReviewError   = "ERROR"

FILE: cmd/atlas/internal/cmdapi/project_test.go
  function TestEnvByName (line 26) | func TestEnvByName(t *testing.T) {
  function TestUnnamedEnv (line 280) | func TestUnnamedEnv(t *testing.T) {
  function TestEnvCache (line 301) | func TestEnvCache(t *testing.T) {
  function TestNoEnv (line 341) | func TestNoEnv(t *testing.T) {
  function TestPartialParse (line 392) | func TestPartialParse(t *testing.T) {
  function TestDiff_Options (line 483) | func TestDiff_Options(t *testing.T) {

FILE: cmd/atlas/internal/cmdapi/schema.go
  function schemaCmd (line 31) | func schemaCmd() *cobra.Command {
  type schemaApplyFlags (line 41) | type schemaApplyFlags struct
    method check (line 59) | func (f *schemaApplyFlags) check(env *Env) error {
  function schemaApplyCmd (line 84) | func schemaApplyCmd() *cobra.Command {
  function applyChanges (line 139) | func applyChanges(ctx context.Context, client *sqlclient.Client, changes...
  function planOptions (line 158) | func planOptions(c *sqlclient.Client) []migrate.PlanOption {
  type schemaCleanFlags (line 174) | type schemaCleanFlags struct
  function schemaCleanCmd (line 182) | func schemaCleanCmd() *cobra.Command {
  function schemaCleanRun (line 209) | func schemaCleanRun(cmd *cobra.Command, _ []string, flags schemaCleanFla...
  type schemaDiffFlags (line 240) | type schemaDiffFlags struct
  function schemaDiffCmd (line 251) | func schemaDiffCmd() *cobra.Command {
  function schemaDiffCmdWithFlags (line 256) | func schemaDiffCmdWithFlags() (*cobra.Command, *schemaDiffFlags) {
  function schemaFmtCmd (line 295) | func schemaFmtCmd() *cobra.Command {
  function schemaFmtRun (line 313) | func schemaFmtRun(cmd *cobra.Command, args []string) error {
  function selectEnv (line 338) | func selectEnv(cmd *cobra.Command) (*Env, error) {
  function schemaFlagsFromConfig (line 366) | func schemaFlagsFromConfig(cmd *cobra.Command) error {
  function setSchemaEnvFlags (line 374) | func setSchemaEnvFlags(cmd *cobra.Command, env *Env) error {
  type diff (line 442) | type diff struct
  function computeDiff (line 447) | func computeDiff(ctx context.Context, differ *sqlclient.Client, from, to...
  constant answerApply (line 488) | answerApply = "Apply"
  constant answerAbort (line 489) | answerAbort = "Abort"
  function cmdPrompt (line 493) | func cmdPrompt(cmd *cobra.Command) *promptui.Select {
  function promptUser (line 502) | func promptUser(cmd *cobra.Command) bool {
  type nopBellCloser (line 513) | type nopBellCloser struct
    method Write (line 515) | func (n nopBellCloser) Write(p []byte) (int, error) {
    method Close (line 522) | func (nopBellCloser) Close() error { return nil }
  function tasks (line 524) | func tasks(path string) ([]fmttask, error) {
  type fmttask (line 561) | type fmttask struct
  function fmtFile (line 567) | func fmtFile(task fmttask) (bool, error) {
  function fixFileURLs (line 581) | func fixFileURLs(src []string) []string {

FILE: cmd/atlas/internal/cmdapi/schema_test.go
  constant unformatted (line 27) | unformatted = `block  "x"  {
  constant formatted (line 32) | formatted = `block "x" {
  function TestSchema_Diff (line 39) | func TestSchema_Diff(t *testing.T) {
  function TestSchema_Apply (line 462) | func TestSchema_Apply(t *testing.T) {
  function TestSchema_ApplyLog (line 487) | func TestSchema_ApplyLog(t *testing.T) {
  function TestSchema_ApplySchemaMismatch (line 593) | func TestSchema_ApplySchemaMismatch(t *testing.T) {
  function TestSchema_ApplySkip (line 613) | func TestSchema_ApplySkip(t *testing.T) {
  function TestSchema_ApplySources (line 710) | func TestSchema_ApplySources(t *testing.T) {
  function TestSchema_ToFlagPrecedence (line 759) | func TestSchema_ToFlagPrecedence(t *testing.T) {
  function TestSchema_ApplySQL (line 803) | func TestSchema_ApplySQL(t *testing.T) {
  function TestSchema_ApplyReview (line 935) | func TestSchema_ApplyReview(t *testing.T) {
  function TestSchema_InspectLog (line 962) | func TestSchema_InspectLog(t *testing.T) {
  function TestSchema_InspectFile (line 975) | func TestSchema_InspectFile(t *testing.T) {
  function TestFmt (line 1026) | func TestFmt(t *testing.T) {
  function TestSchema_Clean (line 1102) | func TestSchema_Clean(t *testing.T) {
  function assertDir (line 1122) | func assertDir(t *testing.T, dir string, expected map[string]string) {
  function setupFmtTest (line 1137) | func setupFmtTest(t *testing.T, inputDir map[string]string) string {
  type assertNormalizerDriver (line 1156) | type assertNormalizerDriver struct
    method NormalizeSchema (line 1162) | func (d *assertNormalizerDriver) NormalizeSchema(context.Context, *sch...
    method NormalizeRealm (line 1168) | func (d *assertNormalizerDriver) NormalizeRealm(context.Context, *sche...

FILE: cmd/atlas/internal/cmdapi/testdata/baseline1/1_baseline.sql
  type baseline (line 2) | CREATE TABLE baseline (`c` int NOT NULL)

FILE: cmd/atlas/internal/cmdapi/testdata/baseline2/1_baseline.sql
  type baseline (line 2) | CREATE TABLE baseline (`c` int NOT NULL)

FILE: cmd/atlas/internal/cmdapi/testdata/baseline2/20220318104614_initial.sql
  type tbl (line 2) | CREATE TABLE tbl (`col` int NOT NULL)

FILE: cmd/atlas/internal/cmdapi/testdata/import/dbmate/1_initial.sql
  type post (line 2) | CREATE TABLE post

FILE: cmd/atlas/internal/cmdapi/testdata/import/dbmate/2_second_migration.sql
  type tbl_2 (line 9) | CREATE TABLE tbl_2 (col INT)

FILE: cmd/atlas/internal/cmdapi/testdata/import/dbmate_gold/1_initial.sql
  type post (line 1) | CREATE TABLE post

FILE: cmd/atlas/internal/cmdapi/testdata/import/dbmate_gold/2_second_migration.sql
  type tbl_2 (line 1) | CREATE TABLE tbl_2 (col INT)

FILE: cmd/atlas/internal/cmdapi/testdata/import/flyway/B2__baseline.sql
  type post (line 1) | CREATE TABLE post

FILE: cmd/atlas/internal/cmdapi/testdata/import/flyway/R__views.sql
  type `my_view` (line 1) | CREATE VIEW `my_view` AS SELECT * FROM `post`

FILE: cmd/atlas/internal/cmdapi/testdata/import/flyway/V1__initial.sql
  type post (line 2) | CREATE TABLE post

FILE: cmd/atlas/internal/cmdapi/testdata/import/flyway/V2__second_migration.sql
  type tbl_2 (line 9) | CREATE TABLE tbl_2 (col INT)

FILE: cmd/atlas/internal/cmdapi/testdata/import/flyway_gold/2_baseline.sql
  type post (line 1) | CREATE TABLE post

FILE: cmd/atlas/internal/cmdapi/testdata/import/flyway_gold/3R_views.sql
  type `my_view` (line 1) | CREATE VIEW `my_view` AS SELECT * FROM `post`

FILE: cmd/atlas/internal/cmdapi/testdata/import/golang-migrate/1_initial.up.sql
  type tbl (line 1) | CREATE TABLE tbl

FILE: cmd/atlas/internal/cmdapi/testdata/import/golang-migrate/2_second_migration.up.sql
  type tbl_2 (line 1) | CREATE TABLE tbl_2 (col INT)

FILE: cmd/atlas/internal/cmdapi/testdata/import/golang-migrate_gold/1_initial.sql
  type tbl (line 1) | CREATE TABLE tbl

FILE: cmd/atlas/internal/cmdapi/testdata/import/golang-migrate_gold/2_second_migration.sql
  type tbl_2 (line 1) | CREATE TABLE tbl_2 (col INT)

FILE: cmd/atlas/internal/cmdapi/testdata/import/goose/1_initial.sql
  type post (line 2) | CREATE TABLE post

FILE: cmd/atlas/internal/cmdapi/testdata/import/goose/2_second_migration.sql
  function histories_partition_creation (line 11) | CREATE

FILE: cmd/atlas/internal/cmdapi/testdata/import/goose_gold/1_initial.sql
  type post (line 1) | CREATE TABLE post

FILE: cmd/atlas/internal/cmdapi/testdata/import/goose_gold/2_second_migration.sql
  function histories_partition_creation (line 3) | CREATE

FILE: cmd/atlas/internal/cmdapi/testdata/import/liquibase/1_initial.sql
  type post (line 4) | CREATE TABLE post

FILE: cmd/atlas/internal/cmdapi/testdata/import/liquibase/2_second_migration.sql
  type tbl_2 (line 4) | CREATE TABLE tbl_2 (col INT)

FILE: cmd/atlas/internal/cmdapi/testdata/import/liquibase_gold/1_initial.sql
  type post (line 2) | CREATE TABLE post

FILE: cmd/atlas/internal/cmdapi/testdata/import/liquibase_gold/2_second_migration.sql
  type tbl_2 (line 2) | CREATE TABLE tbl_2 (col INT)

FILE: cmd/atlas/internal/cmdapi/testdata/mysql/20220318104614_initial.sql
  type `atlantis` (line 4) | CREATE TABLE `atlantis`.`tbl` (`col` int NOT NULL) CHARSET utf8mb4 COLLA...

FILE: cmd/atlas/internal/cmdapi/testdata/sqlite/20220318104614_initial.sql
  type tbl (line 2) | CREATE TABLE tbl (`col` int NOT NULL)

FILE: cmd/atlas/internal/cmdapi/testdata/sqlite2/20220318104614_initial.sql
  type tbl (line 2) | CREATE TABLE tbl (`col` int NOT NULL)

FILE: cmd/atlas/internal/cmdapi/testdata/sqlitetx/20220925092817_initial.sql
  type `users` (line 2) | CREATE TABLE `users` (`id` integer NOT NULL, `name` text NULL, PRIMARY K...

FILE: cmd/atlas/internal/cmdapi/testdata/sqlitetx/20220925094021_second.sql
  type `friendships` (line 2) | CREATE TABLE `friendships` (`user_id` integer NOT NULL, `friend_id` inte...

FILE: cmd/atlas/internal/cmdapi/testdata/sqlitetx/20220925094437_third.sql
  type `new_users` (line 4) | CREATE TABLE `new_users` (`id` integer NOT NULL, PRIMARY KEY (`id`))

FILE: cmd/atlas/internal/cmdapi/testdata/sqlitetx2/20220925092817_initial.sql
  type `users` (line 2) | CREATE TABLE `users` (`id` integer NOT NULL, `name` text NULL, PRIMARY K...

FILE: cmd/atlas/internal/cmdapi/testdata/sqlitetx2/20220925094021_second.sql
  type `friendships` (line 2) | CREATE TABLE `friendships` (`user_id` integer NOT NULL, `friend_id` inte...

FILE: cmd/atlas/internal/cmdapi/testdata/sqlitetx2/20220925094437_third.sql
  type `new_users` (line 4) | CREATE TABLE `new_users` (`id` integer NOT NULL, PRIMARY KEY (`id`))

FILE: cmd/atlas/internal/cmdapi/testdata/sqlitetx3/20220925092817_initial.sql
  type `users` (line 2) | CREATE TABLE `users` (`id` integer NOT NULL, `name` text NULL, PRIMARY K...

FILE: cmd/atlas/internal/cmdapi/testdata/sqlitetx3/20220925094021_second.sql
  type t1 (line 4) | CREATE TABLE t1 (a INTEGER PRIMARY KEY)

FILE: cmd/atlas/internal/cmdapi/testdata/sqlitetx4/20220925092817_initial.sql
  type `users` (line 2) | CREATE TABLE `users` (`id` integer NOT NULL, `name` text NULL, PRIMARY K...

FILE: cmd/atlas/internal/cmdapi/testdata/sqlitetx4/20220925094021_second.sql
  type t1 (line 4) | CREATE TABLE t1 (a INTEGER PRIMARY KEY)

FILE: cmd/atlas/internal/cmdapi/testdata/templatedir/1.sql
  type dev1 (line 2) | create table dev1 (c text)
  type prod1 (line 4) | create table prod1 (c text)

FILE: cmd/atlas/internal/cmdapi/testdata/templatedir/2.sql
  type dev2 (line 2) | create table dev2 (c text)
  type prod2 (line 5) | create table prod2 (c text)

FILE: cmd/atlas/internal/cmdapi/testdata/templatedir/shared/users.sql
  type users_ (line 2) | create table users_{{ $ }} (c text)

FILE: cmd/atlas/internal/cmdapi/vercheck/req_oss.go
  function addHeaders (line 16) | func addHeaders(_ context.Context, req *http.Request) {

FILE: cmd/atlas/internal/cmdapi/vercheck/vercheck.go
  constant StateFileName (line 22) | StateFileName = "release.json"
  function New (line 25) | func New(endpoint string) *VerChecker {
  type Latest (line 34) | type Latest struct
  type Advisory (line 43) | type Advisory struct
  type Payload (line 47) | type Payload struct
  type VerChecker (line 54) | type VerChecker struct
    method Check (line 76) | func (v *VerChecker) Check(ctx context.Context, ver string) (*Payload,...
    method verifyTime (line 106) | func (v *VerChecker) verifyTime() error {
  type State (line 60) | type State struct
  function init (line 117) | func init() {

FILE: cmd/atlas/internal/cmdapi/vercheck/vercheck_test.go
  function TestVerCheck (line 26) | func TestVerCheck(t *testing.T) {
  function TestState (line 59) | func TestState(t *testing.T) {
  function TestStatePersist (line 118) | func TestStatePersist(t *testing.T) {
  function TestTemplate (line 134) | func TestTemplate(t *testing.T) {

FILE: cmd/atlas/internal/cmdapi/version_oss.go
  constant versionFmt (line 10) | versionFmt  = "atlas unofficial "
  constant versionInfo (line 11) | versionInfo = "To download an official version, visit: https://atlasgo.i...

FILE: cmd/atlas/internal/cmdapi/version_oss_test.go
  function TestCLI_Version (line 18) | func TestCLI_Version(t *testing.T) {

FILE: cmd/atlas/internal/cmdext/cmdext.go
  type AtlasConfig (line 68) | type AtlasConfig struct
  function RuntimeVar (line 84) | func RuntimeVar(ctx context.Context, ectx *hcl.EvalContext, block *hclsy...
  function AWSRDSToken (line 138) | func AWSRDSToken(ctx context.Context, ectx *hcl.EvalContext, block *hcls...
  function GCPCloudSQLToken (line 171) | func GCPCloudSQLToken(ctx context.Context, _ *hcl.EvalContext, block *hc...
  function Query (line 196) | func Query(ctx context.Context, ectx *hcl.EvalContext, block *hclsyntax....
  function External (line 298) | func External(_ context.Context, ectx *hcl.EvalContext, block *hclsyntax...
  function TemplateDir (line 351) | func TemplateDir(_ context.Context, ectx *hcl.EvalContext, block *hclsyn...
  function SchemaHCL (line 487) | func SchemaHCL(_ context.Context, ectx *hcl.EvalContext, block *hclsynta...
  function blockError (line 532) | func blockError(name string, b *hclsyntax.Block) func(string, ...any) er...
  type StateLoader (line 540) | type StateLoader interface
  type StateLoaderFunc (line 545) | type StateLoaderFunc
    method LoadState (line 564) | func (f StateLoaderFunc) LoadState(ctx context.Context, opts *StateRea...
  type MigrateDiffOptions (line 548) | type MigrateDiffOptions struct
  type MigrateDiffer (line 557) | type MigrateDiffer interface
  type registry (line 578) | type registry
    method HasLoader (line 581) | func (r registry) HasLoader(scheme string) bool {
    method Loader (line 587) | func (r registry) Loader(scheme string) (StateLoader, bool) {
    method Differ (line 593) | func (r registry) Differ(to []string) (MigrateDiffer, bool) {
  type MemLoader (line 604) | type MemLoader struct
    method LoadState (line 609) | func (l MemLoader) LoadState(ctx context.Context, config *StateReaderC...

FILE: cmd/atlas/internal/cmdext/cmdext_oss.go
  function RemoteSchema (line 29) | func RemoteSchema(context.Context, *hcl.EvalContext, *hclsyntax.Block) (...
  function RemoteDir (line 34) | func RemoteDir(context.Context, *hcl.EvalContext, *hclsyntax.Block) (cty...
  function StateReaderAtlas (line 39) | func StateReaderAtlas(context.Context, *StateReaderConfig) (*StateReadCl...
  function SchemaExternal (line 44) | func SchemaExternal(context.Context, *hcl.EvalContext, *hclsyntax.Block)...
  type EntLoader (line 49) | type EntLoader struct
    method LoadState (line 52) | func (l EntLoader) LoadState(context.Context, *StateReaderConfig) (*St...
    method MigrateDiff (line 57) | func (l EntLoader) MigrateDiff(context.Context, *MigrateDiffOptions) e...
  method InitBlock (line 62) | func (c *AtlasConfig) InitBlock() schemahcl.Option {
  function StateReaderSQL (line 69) | func StateReaderSQL(ctx context.Context, config *StateReaderConfig) (*St...
  type UnsupportedError (line 129) | type UnsupportedError struct
    method IsAbort (line 134) | func (*UnsupportedError) IsAbort() {}
  function UnsupportedErr (line 136) | func UnsupportedErr(feature string) error {

FILE: cmd/atlas/internal/cmdext/cmdext_test.go
  function TestRuntimeVarSrc (line 29) | func TestRuntimeVarSrc(t *testing.T) {
  function TestRDSToken (line 66) | func TestRDSToken(t *testing.T) {
  function TestRDSTokenProfile (line 96) | func TestRDSTokenProfile(t *testing.T) {
  function TestGCPToken (line 117) | func TestGCPToken(t *testing.T) {
  function TestQuerySrc (line 164) | func TestQuerySrc(t *testing.T) {
  function TestTemplateDir (line 198) | func TestTemplateDir(t *testing.T) {
  function TestSchemaHCL (line 261) | func TestSchemaHCL(t *testing.T) {
  function TestExternal (line 352) | func TestExternal(t *testing.T) {
  function backupEnv (line 411) | func backupEnv(keys ...string) (restoreFunc func()) {

FILE: cmd/atlas/internal/cmdext/reader.go
  type StateReadCloser (line 31) | type StateReadCloser struct
    method Close (line 50) | func (r *StateReadCloser) Close() error {
  type StateReaderConfig (line 38) | type StateReaderConfig struct
  function isSchemaDir (line 58) | func isSchemaDir(u *url.URL, path string) bool {
  function stateSchemaSQL (line 71) | func stateSchemaSQL(ctx context.Context, cfg *StateReaderConfig, dir mig...
  type errorRecorder (line 83) | type errorRecorder struct
    method Log (line 89) | func (r *errorRecorder) Log(e migrate.LogEntry) {
  function stateReaderSQL (line 100) | func stateReaderSQL(ctx context.Context, cfg *StateReaderConfig, dir mig...
  function StateReaderHCL (line 131) | func StateReaderHCL(ctx context.Context, c *StateReaderConfig) (*StateRe...
  function stateReaderHCL (line 140) | func stateReaderHCL(_ context.Context, config *StateReaderConfig, paths ...
  function FilesExt (line 255) | func FilesExt(urls []*url.URL) (string, error) {
  function parseHCLPaths (line 309) | func parseHCLPaths(paths ...string) (*hclparse.Parser, error) {
  constant SchemaTypeFile (line 343) | SchemaTypeFile  = "file"
  constant SchemaTypeAtlas (line 344) | SchemaTypeAtlas = "atlas"
  constant FileTypeHCL (line 349) | FileTypeHCL  = ".hcl"
  constant FileTypeSQL (line 350) | FileTypeSQL  = ".sql"
  constant FileTypeTest (line 351) | FileTypeTest = ".test.hcl"
  function mayParse (line 356) | func mayParse(p *hclparse.Parser, path string) error {
  function isProjectFile (line 370) | func isProjectFile(f *hcl.File) bool {
  function FilesAsDir (line 380) | func FilesAsDir(files ...migrate.File) (migrate.Dir, error) {

FILE: cmd/atlas/internal/cmdext/reader_test.go
  function TestSchemaDirState (line 24) | func TestSchemaDirState(t *testing.T) {
  function TestStateReaderHCL (line 89) | func TestStateReaderHCL(t *testing.T) {

FILE: cmd/atlas/internal/cmdlog/cmdlog.go
  function WithColorFuncs (line 52) | func WithColorFuncs(f template.FuncMap) template.FuncMap {
  type Env (line 61) | type Env struct
  type Files (line 68) | type Files
    method MarshalJSON (line 106) | func (f Files) MarshalJSON() ([]byte, error) {
  type File (line 71) | type File struct
    method MarshalJSON (line 96) | func (f File) MarshalJSON() ([]byte, error) {
  type FileChecks (line 74) | type FileChecks struct
  type Check (line 83) | type Check struct
  type StmtError (line 89) | type StmtError struct
  function NewEnv (line 115) | func NewEnv(c *sqlclient.Client, dirURL *url.URL) Env {
  type MigrateStatus (line 170) | type MigrateStatus struct
    method Left (line 186) | func (r *MigrateStatus) Left() int { return r.Total - r.Count }
    method FromCheckpoint (line 190) | func (r *MigrateStatus) FromCheckpoint() bool {
  type StatusReporter (line 199) | type StatusReporter struct
    method Report (line 211) | func (r *StatusReporter) Report(ctx context.Context) (*MigrateStatus, ...
  constant statusOK (line 299) | statusOK      = "OK"
  constant statusPending (line 300) | statusPending = "PENDING"
  type MigrateSet (line 321) | type MigrateSet struct
    method ByVersion (line 341) | func (r *MigrateSet) ByVersion() []RevisionOp {
    method Set (line 349) | func (r *MigrateSet) Set(rev *migrate.Revision) {
    method Removed (line 354) | func (r *MigrateSet) Removed(rev *migrate.Revision) {
    method Summary (line 359) | func (r *MigrateSet) Summary() string {
  type RevisionOp (line 329) | type RevisionOp struct
    method ColoredVersion (line 380) | func (r *RevisionOp) ColoredVersion() string {
  function NewMigrateSet (line 336) | func NewMigrateSet(ctx context.Context) *MigrateSet {
  type MigrateApply (line 452) | type MigrateApply struct
    method Log (line 488) | func (a *MigrateApply) Log(e migrate.LogEntry) {
    method Header (line 574) | func (a *MigrateApply) Header() string {
    method Summary (line 592) | func (a *MigrateApply) Summary(ident string) string {
    method MarshalJSON (line 673) | func (a *MigrateApply) MarshalJSON() ([]byte, error) {
  type AppliedFile (line 467) | type AppliedFile struct
    method MarshalJSON (line 691) | func (f *AppliedFile) MarshalJSON() ([]byte, error) {
  function NewMigrateApply (line 479) | func NewMigrateApply(ctx context.Context, client *sqlclient.Client, dirU...
  function plural (line 665) | func plural(n int) (s string) {
  type Changes (line 732) | type Changes struct
    method MarshalJSON (line 739) | func (c Changes) MarshalJSON() ([]byte, error) {
  type SchemaInspect (line 756) | type SchemaInspect struct
    method Client (line 793) | func (s *SchemaInspect) Client() *sqlclient.Client {
    method MarshalHCL (line 799) | func (s *SchemaInspect) MarshalHCL() (string, error) {
    method RedactedURL (line 808) | func (s *SchemaInspect) RedactedURL() (string, error) {
    method MarshalJSON (line 817) | func (s *SchemaInspect) MarshalJSON() ([]byte, error) {
    method MarshalSQL (line 941) | func (s *SchemaInspect) MarshalSQL(indent ...string) (string, error) {
  function NewSchemaInspect (line 788) | func NewSchemaInspect(ctx context.Context, client *sqlclient.Client, rea...
  function sqlInspect (line 945) | func sqlInspect(report *SchemaInspect, indent ...string) (string, error) {
  function base64url (line 951) | func base64url(s string) string {
  type SchemaDiff (line 956) | type SchemaDiff struct
    method Client (line 992) | func (s *SchemaDiff) Client() *sqlclient.Client { return s.client }
    method MarshalSQL (line 995) | func (s *SchemaDiff) MarshalSQL(indent ...string) (string, error) {
  function NewSchemaDiff (line 981) | func NewSchemaDiff(ctx context.Context, client *sqlclient.Client, from, ...
  function sqlDiff (line 999) | func sqlDiff(diff *SchemaDiff, indent ...string) (string, error) {
  function fmtPlan (line 1003) | func fmtPlan(ctx context.Context, client *sqlclient.Client, changes sche...
  function mermaid (line 1031) | func mermaid(i *SchemaInspect, _ ...string) (string, error) {
  function jsonEncode (line 1114) | func jsonEncode(v any, args ...string) (string, error) {
  function jsonMerge (line 1130) | func jsonMerge(objects ...string) (string, error) {
  function add (line 1144) | func add(a, b int) int {
  function indentLn (line 1148) | func indentLn(input string, indent int) string {
  function noDirectives (line 1154) | func noDirectives(comments []string) (cs []string) {
  function WarnOnce (line 1165) | func WarnOnce(w io.Writer, text string) error {

FILE: cmd/atlas/internal/cmdlog/cmdlog_oss.go
  type SchemaApply (line 16) | type SchemaApply struct
  function NewSchemaApply (line 26) | func NewSchemaApply(ctx context.Context, env Env, applied, pending []*mi...
  function NewSchemaPlan (line 39) | func NewSchemaPlan(ctx context.Context, env Env, pending []*migrate.Chan...
  method MaskedText (line 43) | func (*MigrateApply) MaskedText(s *migrate.Stmt) string {
  method MaskedErrorText (line 48) | func (*MigrateApply) MaskedErrorText(e migrate.LogError) string {

FILE: cmd/atlas/internal/cmdlog/cmdlog_test.go
  function TestSchemaInspect_MarshalJSON (line 32) | func TestSchemaInspect_MarshalJSON(t *testing.T) {
  function TestSchemaInspect_MarshalSQL (line 115) | func TestSchemaInspect_MarshalSQL(t *testing.T) {
  function TestSchemaInspect_EncodeSQL (line 137) | func TestSchemaInspect_EncodeSQL(t *testing.T) {
  function TestSchemaInspect_Mermaid (line 163) | func TestSchemaInspect_Mermaid(t *testing.T) {
  function TestSchemaInspect_RedactedURL (line 294) | func TestSchemaInspect_RedactedURL(t *testing.T) {
  function TestSchemaDiff_MarshalSQL (line 303) | func TestSchemaDiff_MarshalSQL(t *testing.T) {
  function TestMigrateSet (line 320) | func TestMigrateSet(t *testing.T) {
  function TestMigrateApply (line 368) | func TestMigrateApply(t *testing.T) {
  function TestReporter_Status (line 650) | func TestReporter_Status(t *testing.T) {
  function TestReporter_OutOfOrder (line 745) | func TestReporter_OutOfOrder(t *testing.T) {
  function TestWarnOnce (line 834) | func TestWarnOnce(t *testing.T) {
  type unassignable (line 862) | type unassignable struct
    method Write (line 867) | func (a unassignable) Write(p []byte) (n int, err error) { return a.Wr...

FILE: cmd/atlas/internal/cmdstate/cmdstate.go
  constant DefaultDir (line 19) | DefaultDir = "~/.atlas"
  type File (line 22) | type File struct
  method Read (line 30) | func (f File[T]) Read() (v T, err error) {
  method Write (line 47) | func (f File[T]) Write(t T) error {
  method Path (line 63) | func (f File[T]) Path() (string, error) {
  function newT (line 79) | func newT[T any](t T) T {
  function TestingHome (line 91) | func TestingHome(t *testing.T) string {

FILE: cmd/atlas/internal/cmdstate/cmdstate_test.go
  function TestFile (line 18) | func TestFile(t *testing.T) {

FILE: cmd/atlas/internal/docker/docker.go
  constant pass (line 29) | pass          = "pass"
  constant passSQLServer (line 30) | passSQLServer = "P@ssw0rd0995"
  type Config (line 35) | type Config struct
    method Run (line 390) | func (c *Config) Run(ctx context.Context) (*Container, error) {
    method validate (line 533) | func (c *Config) validate() error {
  type Container (line 54) | type Container struct
    method Close (line 423) | func (c *Container) Close() error {
    method Wait (line 428) | func (c *Container) Wait(ctx context.Context, timeout time.Duration) e...
    method URL (line 477) | func (c *Container) URL() (*url.URL, error) {
    method PingURL (line 519) | func (c *Container) PingURL(u url.URL) string {
  type ConnOptions (line 62) | type ConnOptions struct
  type ConfigOption (line 69) | type ConfigOption
  function NewConfig (line 73) | func NewConfig(opts ...ConfigOption) (*Config, error) {
  constant DriverMySQL (line 85) | DriverMySQL      = "mysql"
  constant DriverMariaDB (line 86) | DriverMariaDB    = "mariadb"
  constant DriverPostgres (line 87) | DriverPostgres   = "postgres"
  constant DriverSQLServer (line 88) | DriverSQLServer  = "sqlserver"
  constant DriverClickHouse (line 89) | DriverClickHouse = "clickhouse"
  constant PostgresPostGIS (line 93) | PostgresPostGIS  = "postgis"
  constant PostgresPGVector (line 94) | PostgresPGVector = "pgvector"
  function FromURL (line 99) | func FromURL(u *url.URL, opts ...ConfigOption) (*Config, error) {
  function ImageURL (line 210) | func ImageURL(driver string, image string) (*url.URL, error) {
  constant hubUser (line 229) | hubUser = "arigaio"
  function MySQL (line 232) | func MySQL(version string, opts ...ConfigOption) (*Config, error) {
  function MariaDB (line 247) | func MariaDB(version string, opts ...ConfigOption) (*Config, error) {
  function PostgreSQL (line 252) | func PostgreSQL(version string, opts ...ConfigOption) (*Config, error) {
  function SQLServer (line 268) | func SQLServer(version string, opts ...ConfigOption) (*Config, error) {
  function ClickHouse (line 288) | func ClickHouse(version string, opts ...ConfigOption) (*Config, error) {
  function Image (line 307) | func Image(parts ...string) ConfigOption {
  function Port (line 321) | func Port(p string) ConfigOption {
  function Env (line 332) | func Env(env ...string) ConfigOption {
  function Database (line 342) | func Database(name string) ConfigOption {
  function Userinfo (line 352) | func Userinfo(u *url.Userinfo) ConfigOption {
  function Out (line 363) | func Out(w io.Writer) ConfigOption {
  function Setup (line 374) | func Setup(s ...string) ConfigOption {
  function Conn (line 382) | func Conn(s *ConnOptions) ConfigOption {
  function freePort (line 540) | func freePort() (string, error) {
  function init (line 555) | func init() {
  function Open (line 568) | func Open(ctx context.Context, u *url.URL) (client *sqlclient.Client, er...
  function OpenWithOpts (line 573) | func OpenWithOpts(ctx context.Context, u *url.URL, opts ...ConfigOption)...

FILE: cmd/atlas/internal/docker/docker_test.go
  function TestDockerConfig (line 16) | func TestDockerConfig(t *testing.T) {
  function TestFromURL (line 87) | func TestFromURL(t *testing.T) {
  function TestFromURL_CustomImage (line 307) | func TestFromURL_CustomImage(t *testing.T) {
  function TestImageURL (line 444) | func TestImageURL(t *testing.T) {
  function TestContainerURL (line 465) | func TestContainerURL(t *testing.T) {

FILE: cmd/atlas/internal/migrate/ent/client.go
  type Client (line 29) | type Client struct
    method init (line 44) | func (c *Client) init() {
    method Tx (line 128) | func (c *Client) Tx(ctx context.Context) (*Tx, error) {
    method BeginTx (line 146) | func (c *Client) BeginTx(ctx context.Context, opts *sql.TxOptions) (*T...
    method Debug (line 171) | func (c *Client) Debug() *Client {
    method Close (line 183) | func (c *Client) Close() error {
    method Use (line 189) | func (c *Client) Use(hooks ...Hook) {
    method Intercept (line 195) | func (c *Client) Intercept(interceptors ...Interceptor) {
    method Mutate (line 200) | func (c *Client) Mutate(ctx context.Context, m Mutation) (Value, error) {
  function NewClient (line 38) | func NewClient(opts ...Option) *Client {
  type config (line 51) | type config struct
    method options (line 77) | func (c *config) options(opts ...Option) {
    method ExecContext (line 366) | func (c *config) ExecContext(ctx context.Context, query string, args ....
    method QueryContext (line 378) | func (c *config) QueryContext(ctx context.Context, query string, args ...
  type Option (line 66) | type Option
  function newConfig (line 70) | func newConfig(opts ...Option) config {
  function Debug (line 87) | func Debug() Option {
  function Log (line 94) | func Log(fn func(...any)) Option {
  function Driver (line 101) | func Driver(driver dialect.Driver) Option {
  function Open (line 110) | func Open(driverName, dataSourceName string, options ...Option) (*Client...
  type RevisionClient (line 210) | type RevisionClient struct
    method Use (line 221) | func (c *RevisionClient) Use(hooks ...Hook) {
    method Intercept (line 227) | func (c *RevisionClient) Intercept(interceptors ...Interceptor) {
    method Create (line 232) | func (c *RevisionClient) Create() *RevisionCreate {
    method CreateBulk (line 238) | func (c *RevisionClient) CreateBulk(builders ...*RevisionCreate) *Revi...
    method MapCreateBulk (line 244) | func (c *RevisionClient) MapCreateBulk(slice any, setFunc func(*Revisi...
    method Update (line 258) | func (c *RevisionClient) Update() *RevisionUpdate {
    method UpdateOne (line 264) | func (c *RevisionClient) UpdateOne(_m *Revision) *RevisionUpdateOne {
    method UpdateOneID (line 270) | func (c *RevisionClient) UpdateOneID(id string) *RevisionUpdateOne {
    method Delete (line 276) | func (c *RevisionClient) Delete() *RevisionDelete {
    method DeleteOne (line 282) | func (c *RevisionClient) DeleteOne(_m *Revision) *RevisionDeleteOne {
    method DeleteOneID (line 287) | func (c *RevisionClient) DeleteOneID(id string) *RevisionDeleteOne {
    method Query (line 295) | func (c *RevisionClient) Query() *RevisionQuery {
    method Get (line 304) | func (c *RevisionClient) Get(ctx context.Context, id string) (*Revisio...
    method GetX (line 309) | func (c *RevisionClient) GetX(ctx context.Context, id string) *Revision {
    method Hooks (line 318) | func (c *RevisionClient) Hooks() []Hook {
    method Interceptors (line 323) | func (c *RevisionClient) Interceptors() []Interceptor {
    method mutate (line 327) | func (c *RevisionClient) mutate(ctx context.Context, m *RevisionMutati...
  function NewRevisionClient (line 215) | func NewRevisionClient(c config) *RevisionClient {
  type hooks (line 344) | type hooks struct
  type inters (line 347) | type inters struct
  function AlternateSchema (line 358) | func AlternateSchema(schemaConfig SchemaConfig) Option {

FILE: cmd/atlas/internal/migrate/ent/convert.go
  method SetRevision (line 12) | func (rc *RevisionCreate) SetRevision(rev *migrate.Revision) *RevisionCr...
  method AtlasRevision (line 29) | func (_m *Revision) AtlasRevision() *migrate.Revision {

FILE: cmd/atlas/internal/migrate/ent/ent.go
  type clientCtxKey (line 41) | type clientCtxKey struct
  function FromContext (line 44) | func FromContext(ctx context.Context) *Client {
  function NewContext (line 50) | func NewContext(parent context.Context, c *Client) context.Context {
  type txCtxKey (line 54) | type txCtxKey struct
  function TxFromContext (line 57) | func TxFromContext(ctx context.Context) *Tx {
  function NewTxContext (line 63) | func NewTxContext(parent context.Context, tx *Tx) context.Context {
  type OrderFunc (line 69) | type OrderFunc
  function checkColumn (line 77) | func checkColumn(t, c string) error {
  function Asc (line 87) | func Asc(fields ...string) func(*sql.Selector) {
  function Desc (line 99) | func Desc(fields ...string) func(*sql.Selector) {
  type AggregateFunc (line 111) | type AggregateFunc
  function As (line 118) | func As(fn AggregateFunc, end string) AggregateFunc {
  function Count (line 125) | func Count() AggregateFunc {
  function Max (line 132) | func Max(field string) AggregateFunc {
  function Mean (line 143) | func Mean(field string) AggregateFunc {
  function Min (line 154) | func Min(field string) AggregateFunc {
  function Sum (line 165) | func Sum(field string) AggregateFunc {
  type ValidationError (line 176) | type ValidationError struct
    method Error (line 182) | func (e *ValidationError) Error() string {
    method Unwrap (line 187) | func (e *ValidationError) Unwrap() error {
  function IsValidationError (line 192) | func IsValidationError(err error) bool {
  type NotFoundError (line 201) | type NotFoundError struct
    method Error (line 206) | func (e *NotFoundError) Error() string {
  function IsNotFound (line 211) | func IsNotFound(err error) bool {
  function MaskNotFound (line 220) | func MaskNotFound(err error) error {
  type NotSingularError (line 228) | type NotSingularError struct
    method Error (line 233) | func (e *NotSingularError) Error() string {
  function IsNotSingular (line 238) | func IsNotSingular(err error) bool {
  type NotLoadedError (line 247) | type NotLoadedError struct
    method Error (line 252) | func (e *NotLoadedError) Error() string {
  function IsNotLoaded (line 257) | func IsNotLoaded(err error) bool {
  type ConstraintError (line 268) | type ConstraintError struct
    method Error (line 274) | func (e ConstraintError) Error() string {
    method Unwrap (line 279) | func (e *ConstraintError) Unwrap() error {
  function IsConstraintError (line 284) | func IsConstraintError(err error) bool {
  type selector (line 293) | type selector struct
    method ScanX (line 301) | func (s *selector) ScanX(ctx context.Context, v any) {
    method Strings (line 308) | func (s *selector) Strings(ctx context.Context) ([]string, error) {
    method StringsX (line 320) | func (s *selector) StringsX(ctx context.Context) []string {
    method String (line 329) | func (s *selector) String(ctx context.Context) (_ string, err error) {
    method StringX (line 346) | func (s *selector) StringX(ctx context.Context) string {
    method Ints (line 355) | func (s *selector) Ints(ctx context.Context) ([]int, error) {
    method IntsX (line 367) | func (s *selector) IntsX(ctx context.Context) []int {
    method Int (line 376) | func (s *selector) Int(ctx context.Context) (_ int, err error) {
    method IntX (line 393) | func (s *selector) IntX(ctx context.Context) int {
    method Float64s (line 402) | func (s *selector) Float64s(ctx context.Context) ([]float64, error) {
    method Float64sX (line 414) | func (s *selector) Float64sX(ctx context.Context) []float64 {
    method Float64 (line 423) | func (s *selector) Float64(ctx context.Context) (_ float64, err error) {
    method Float64X (line 440) | func (s *selector) Float64X(ctx context.Context) float64 {
    method Bools (line 449) | func (s *selector) Bools(ctx context.Context) ([]bool, error) {
    method BoolsX (line 461) | func (s *selector) BoolsX(ctx context.Context) []bool {
    method Bool (line 470) | func (s *selector) Bool(ctx context.Context) (_ bool, err error) {
    method BoolX (line 487) | func (s *selector) BoolX(ctx context.Context) bool {
  function withHooks (line 496) | func withHooks[V Value, M any, PM interface {
  function setContextOp (line 530) | func setContextOp(ctx context.Context, qc *QueryContext, op string) cont...
  function querierAll (line 538) | func querierAll[V Value, Q interface {
  function querierCount (line 550) | func querierCount[Q interface {
  function withInterceptors (line 562) | func withInterceptors[V Value](ctx context.Context, q Query, qr Querier,...
  function scanWithInterceptors (line 577) | func scanWithInterceptors[Q1 ent.Query, Q2 interface {
  type queryHook (line 612) | type queryHook

FILE: cmd/atlas/internal/migrate/ent/entc.go
  function main (line 16) | func main() {

FILE: cmd/atlas/internal/migrate/ent/enttest/enttest.go
  type TestingT (line 23) | type TestingT interface
  type Option (line 29) | type Option
  type options (line 31) | type options struct
  function WithOptions (line 38) | func WithOptions(opts ...ent.Option) Option {
  function WithMigrateOptions (line 45) | func WithMigrateOptions(opts ...schema.MigrateOption) Option {
  function newOptions (line 51) | func newOptions(opts []Option) *options {
  function Open (line 60) | func Open(t TestingT, driverName, dataSourceName string, opts ...Option)...
  function NewClient (line 72) | func NewClient(t TestingT, opts ...Option) *ent.Client {
  function migrateSchema (line 78) | func migrateSchema(t TestingT, c *ent.Client, o *options) {

FILE: cmd/atlas/internal/migrate/ent/hook/hook.go
  type RevisionFunc (line 18) | type RevisionFunc
    method Mutate (line 21) | func (f RevisionFunc) Mutate(ctx context.Context, m ent.Mutation) (ent...
  type Condition (line 29) | type Condition
  function And (line 32) | func And(first, second Condition, rest ...Condition) Condition {
  function Or (line 47) | func Or(first, second Condition, rest ...Condition) Condition {
  function Not (line 62) | func Not(cond Condition) Condition {
  function HasOp (line 69) | func HasOp(op ent.Op) Condition {
  function HasAddedFields (line 76) | func HasAddedFields(field string, fields ...string) Condition {
  function HasClearedFields (line 91) | func HasClearedFields(field string, fields ...string) Condition {
  function HasFields (line 106) | func HasFields(field string, fields ...string) Condition {
  function If (line 123) | func If(hk ent.Hook, cond Condition) ent.Hook {
  function On (line 137) | func On(hk ent.Hook, op ent.Op) ent.Hook {
  function Unless (line 144) | func Unless(hk ent.Hook, op ent.Op) ent.Hook {
  function FixedError (line 149) | func FixedError(err error) ent.Hook {
  function Reject (line 164) | func Reject(op ent.Op) ent.Hook {
  type Chain (line 171) | type Chain struct
    method Hook (line 181) | func (c Chain) Hook() ent.Hook {
    method Append (line 192) | func (c Chain) Append(hooks ...ent.Hook) Chain {
    method Extend (line 201) | func (c Chain) Extend(chain Chain) Chain {
  function NewChain (line 176) | func NewChain(hooks ...ent.Hook) Chain {

FILE: cmd/atlas/internal/migrate/ent/internal/schemaconfig.go
  type SchemaConfig (line 13) | type SchemaConfig struct
  type schemaCtxKey (line 17) | type schemaCtxKey struct
  function SchemaConfigFromContext (line 20) | func SchemaConfigFromContext(ctx context.Context) SchemaConfig {
  function NewSchemaConfigContext (line 26) | func NewSchemaConfigContext(parent context.Context, config SchemaConfig)...

FILE: cmd/atlas/internal/migrate/ent/migrate/migrate.go
  type Schema (line 40) | type Schema struct
    method Create (line 48) | func (s *Schema) Create(ctx context.Context, opts ...schema.MigrateOpt...
    method WriteTo (line 66) | func (s *Schema) WriteTo(ctx context.Context, w io.Writer, opts ...sch...
  function NewSchema (line 45) | func NewSchema(drv dialect.Driver) *Schema { return &Schema{drv: drv} }
  function Create (line 53) | func Create(ctx context.Context, s *Schema, tables []*schema.Table, opts...

FILE: cmd/atlas/internal/migrate/ent/migrate/schema.go
  function init (line 43) | func init() {

FILE: cmd/atlas/internal/migrate/ent/mutation.go
  constant OpCreate (line 25) | OpCreate    = ent.OpCreate
  constant OpDelete (line 26) | OpDelete    = ent.OpDelete
  constant OpDeleteOne (line 27) | OpDeleteOne = ent.OpDeleteOne
  constant OpUpdate (line 28) | OpUpdate    = ent.OpUpdate
  constant OpUpdateOne (line 29) | OpUpdateOne = ent.OpUpdateOne
  constant TypeRevision (line 32) | TypeRevision = "Revision"
  type RevisionMutation (line 36) | type RevisionMutation struct
    method Client (line 116) | func (m RevisionMutation) Client() *Client {
    method Tx (line 124) | func (m RevisionMutation) Tx() (*Tx, error) {
    method SetID (line 135) | func (m *RevisionMutation) SetID(id string) {
    method ID (line 141) | func (m *RevisionMutation) ID() (id string, exists bool) {
    method IDs (line 152) | func (m *RevisionMutation) IDs(ctx context.Context) ([]string, error) {
    method SetDescription (line 168) | func (m *RevisionMutation) SetDescription(s string) {
    method Description (line 173) | func (m *RevisionMutation) Description() (r string, exists bool) {
    method OldDescription (line 184) | func (m *RevisionMutation) OldDescription(ctx context.Context) (v stri...
    method ResetDescription (line 199) | func (m *RevisionMutation) ResetDescription() {
    method SetType (line 204) | func (m *RevisionMutation) SetType(mt migrate.RevisionType) {
    method GetType (line 210) | func (m *RevisionMutation) GetType() (r migrate.RevisionType, exists b...
    method OldType (line 221) | func (m *RevisionMutation) OldType(ctx context.Context) (v migrate.Rev...
    method AddType (line 236) | func (m *RevisionMutation) AddType(mt migrate.RevisionType) {
    method AddedType (line 245) | func (m *RevisionMutation) AddedType() (r migrate.RevisionType, exists...
    method ResetType (line 254) | func (m *RevisionMutation) ResetType() {
    method SetApplied (line 260) | func (m *RevisionMutation) SetApplied(i int) {
    method Applied (line 266) | func (m *RevisionMutation) Applied() (r int, exists bool) {
    method OldApplied (line 277) | func (m *RevisionMutation) OldApplied(ctx context.Context) (v int, err...
    method AddApplied (line 292) | func (m *RevisionMutation) AddApplied(i int) {
    method AddedApplied (line 301) | func (m *RevisionMutation) AddedApplied() (r int, exists bool) {
    method ResetApplied (line 310) | func (m *RevisionMutation) ResetApplied() {
    method SetTotal (line 316) | func (m *RevisionMutation) SetTotal(i int) {
    method Total (line 322) | func (m *RevisionMutation) Total() (r int, exists bool) {
    method OldTotal (line 333) | func (m *RevisionMutation) OldTotal(ctx context.Context) (v int, err e...
    method AddTotal (line 348) | func (m *RevisionMutation) AddTotal(i int) {
    method AddedTotal (line 357) | func (m *RevisionMutation) AddedTotal() (r int, exists bool) {
    method ResetTotal (line 366) | func (m *RevisionMutation) ResetTotal() {
    method SetExecutedAt (line 372) | func (m *RevisionMutation) SetExecutedAt(t time.Time) {
    method ExecutedAt (line 377) | func (m *RevisionMutation) ExecutedAt() (r time.Time, exists bool) {
    method OldExecutedAt (line 388) | func (m *RevisionMutation) OldExecutedAt(ctx context.Context) (v time....
    method ResetExecutedAt (line 403) | func (m *RevisionMutation) ResetExecutedAt() {
    method SetExecutionTime (line 408) | func (m *RevisionMutation) SetExecutionTime(t time.Duration) {
    method ExecutionTime (line 414) | func (m *RevisionMutation) ExecutionTime() (r time.Duration, exists bo...
    method OldExecutionTime (line 425) | func (m *RevisionMutation) OldExecutionTime(ctx context.Context) (v ti...
    method AddExecutionTime (line 440) | func (m *RevisionMutation) AddExecutionTime(t time.Duration) {
    method AddedExecutionTime (line 449) | func (m *RevisionMutation) AddedExecutionTime() (r time.Duration, exis...
    method ResetExecutionTime (line 458) | func (m *RevisionMutation) ResetExecutionTime() {
    method SetError (line 464) | func (m *RevisionMutation) SetError(s string) {
    method Error (line 469) | func (m *RevisionMutation) Error() (r string, exists bool) {
    method OldError (line 480) | func (m *RevisionMutation) OldError(ctx context.Context) (v string, er...
    method ClearError (line 495) | func (m *RevisionMutation) ClearError() {
    method ErrorCleared (line 501) | func (m *RevisionMutation) ErrorCleared() bool {
    method ResetError (line 507) | func (m *RevisionMutation) ResetError() {
    method SetErrorStmt (line 513) | func (m *RevisionMutation) SetErrorStmt(s string) {
    method ErrorStmt (line 518) | func (m *RevisionMutation) ErrorStmt() (r string, exists bool) {
    method OldErrorStmt (line 529) | func (m *RevisionMutation) OldErrorStmt(ctx context.Context) (v string...
    method ClearErrorStmt (line 544) | func (m *RevisionMutation) ClearErrorStmt() {
    method ErrorStmtCleared (line 550) | func (m *RevisionMutation) ErrorStmtCleared() bool {
    method ResetErrorStmt (line 556) | func (m *RevisionMutation) ResetErrorStmt() {
    method SetHash (line 562) | func (m *RevisionMutation) SetHash(s string) {
    method Hash (line 567) | func (m *RevisionMutation) Hash() (r string, exists bool) {
    method OldHash (line 578) | func (m *RevisionMutation) OldHash(ctx context.Context) (v string, err...
    method ResetHash (line 593) | func (m *RevisionMutation) ResetHash() {
    method SetPartialHashes (line 598) | func (m *RevisionMutation) SetPartialHashes(s []string) {
    method PartialHashes (line 604) | func (m *RevisionMutation) PartialHashes() (r []string, exists bool) {
    method OldPartialHashes (line 615) | func (m *RevisionMutation) OldPartialHashes(ctx context.Context) (v []...
    method AppendPartialHashes (line 630) | func (m *RevisionMutation) AppendPartialHashes(s []string) {
    method AppendedPartialHashes (line 635) | func (m *RevisionMutation) AppendedPartialHashes() ([]string, bool) {
    method ClearPartialHashes (line 643) | func (m *RevisionMutation) ClearPartialHashes() {
    method PartialHashesCleared (line 650) | func (m *RevisionMutation) PartialHashesCleared() bool {
    method ResetPartialHashes (line 656) | func (m *RevisionMutation) ResetPartialHashes() {
    method SetOperatorVersion (line 663) | func (m *RevisionMutation) SetOperatorVersion(s string) {
    method OperatorVersion (line 668) | func (m *RevisionMutation) OperatorVersion() (r string, exists bool) {
    method OldOperatorVersion (line 679) | func (m *RevisionMutation) OldOperatorVersion(ctx context.Context) (v ...
    method ResetOperatorVersion (line 694) | func (m *RevisionMutation) ResetOperatorVersion() {
    method Where (line 699) | func (m *RevisionMutation) Where(ps ...predicate.Revision) {
    method WhereP (line 705) | func (m *RevisionMutation) WhereP(ps ...func(*sql.Selector)) {
    method Op (line 714) | func (m *RevisionMutation) Op() Op {
    method SetOp (line 719) | func (m *RevisionMutation) SetOp(op Op) {
    method Type (line 724) | func (m *RevisionMutation) Type() string {
    method Fields (line 731) | func (m *RevisionMutation) Fields() []string {
    method Field (line 772) | func (m *RevisionMutation) Field(name string) (ent.Value, bool) {
    method OldField (line 803) | func (m *RevisionMutation) OldField(ctx context.Context, name string) ...
    method SetField (line 834) | func (m *RevisionMutation) SetField(name string, value ent.Value) error {
    method AddedFields (line 919) | func (m *RevisionMutation) AddedFields() []string {
    method AddedField (line 939) | func (m *RevisionMutation) AddedField(name string) (ent.Value, bool) {
    method AddField (line 956) | func (m *RevisionMutation) AddField(name string, value ent.Value) error {
    method ClearedFields (line 992) | func (m *RevisionMutation) ClearedFields() []string {
    method FieldCleared (line 1008) | func (m *RevisionMutation) FieldCleared(name string) bool {
    method ClearField (line 1015) | func (m *RevisionMutation) ClearField(name string) error {
    method ResetField (line 1032) | func (m *RevisionMutation) ResetField(name string) error {
    method AddedEdges (line 1072) | func (m *RevisionMutation) AddedEdges() []string {
    method AddedIDs (line 1079) | func (m *RevisionMutation) AddedIDs(name string) []ent.Value {
    method RemovedEdges (line 1084) | func (m *RevisionMutation) RemovedEdges() []string {
    method RemovedIDs (line 1091) | func (m *RevisionMutation) RemovedIDs(name string) []ent.Value {
    method ClearedEdges (line 1096) | func (m *RevisionMutation) ClearedEdges() []string {
    method EdgeCleared (line 1103) | func (m *RevisionMutation) EdgeCleared(name string) bool {
    method ClearEdge (line 1109) | func (m *RevisionMutation) ClearEdge(name string) error {
    method ResetEdge (line 1115) | func (m *RevisionMutation) ResetEdge(name string) error {
  type revisionOption (line 66) | type revisionOption
  function newRevisionMutation (line 69) | func newRevisionMutation(c config, op Op, opts ...revisionOption) *Revis...
  function withRevisionID (line 83) | func withRevisionID(id string) revisionOption {
  function withRevision (line 105) | func withRevision(node *Revision) revisionOption {

FILE: cmd/atlas/internal/migrate/ent/predicate/predicate.go
  type Revision (line 14) | type Revision

FILE: cmd/atlas/internal/migrate/ent/revision.go
  type Revision (line 22) | type Revision struct
    method scanValues (line 52) | func (*Revision) scanValues(columns []string) ([]any, error) {
    method assignValues (line 73) | func (_m *Revision) assignValues(columns []string, values []any) error {
    method Value (line 162) | func (_m *Revision) Value(name string) (ent.Value, error) {
    method Update (line 169) | func (_m *Revision) Update() *RevisionUpdateOne {
    method Unwrap (line 175) | func (_m *Revision) Unwrap() *Revision {
    method String (line 185) | func (_m *Revision) String() string {
  type Revisions (line 226) | type Revisions

FILE: cmd/atlas/internal/migrate/ent/revision/revision.go
  constant Label (line 16) | Label = "revision"
  constant FieldID (line 18) | FieldID = "version"
  constant FieldDescription (line 20) | FieldDescription = "description"
  constant FieldType (line 22) | FieldType = "type"
  constant FieldApplied (line 24) | FieldApplied = "applied"
  constant FieldTotal (line 26) | FieldTotal = "total"
  constant FieldExecutedAt (line 28) | FieldExecutedAt = "executed_at"
  constant FieldExecutionTime (line 30) | FieldExecutionTime = "execution_time"
  constant FieldError (line 32) | FieldError = "error"
  constant FieldErrorStmt (line 34) | FieldErrorStmt = "error_stmt"
  constant FieldHash (line 36) | FieldHash = "hash"
  constant FieldPartialHashes (line 38) | FieldPartialHashes = "partial_hashes"
  constant FieldOperatorVersion (line 40) | FieldOperatorVersion = "operator_version"
  constant Table (line 42) | Table = "atlas_schema_revisions"
  function ValidColumn (line 62) | func ValidColumn(column string) bool {
  type OrderOption (line 85) | type OrderOption
  function ByID (line 88) | func ByID(opts ...sql.OrderTermOption) OrderOption {
  function ByDescription (line 93) | func ByDescription(opts ...sql.OrderTermOption) OrderOption {
  function ByType (line 98) | func ByType(opts ...sql.OrderTermOption) OrderOption {
  function ByApplied (line 103) | func ByApplied(opts ...sql.OrderTermOption) OrderOption {
  function ByTotal (line 108) | func ByTotal(opts ...sql.OrderTermOption) OrderOption {
  function ByExecutedAt (line 113) | func ByExecutedAt(opts ...sql.OrderTermOption) OrderOption {
  function ByExecutionTime (line 118) | func ByExecutionTime(opts ...sql.OrderTermOption) OrderOption {
  function ByError (line 123) | func ByError(opts ...sql.OrderTermOption) OrderOption {
  function ByErrorStmt (line 128) | func ByErrorStmt(opts ...sql.OrderTermOption) OrderOption {
  function ByHash (line 133) | func ByHash(opts ...sql.OrderTermOption) OrderOption {
  function ByOperatorVersion (line 138) | func ByOperatorVersion(opts ...sql.OrderTermOption) OrderOption {

FILE: cmd/atlas/internal/migrate/ent/revision/where.go
  function ID (line 18) | func ID(id string) predicate.Revision {
  function IDEQ (line 23) | func IDEQ(id string) predicate.Revision {
  function IDNEQ (line 28) | func IDNEQ(id string) predicate.Revision {
  function IDIn (line 33) | func IDIn(ids ...string) predicate.Revision {
  function IDNotIn (line 38) | func IDNotIn(ids ...string) predicate.Revision {
  function IDGT (line 43) | func IDGT(id string) predicate.Revision {
  function IDGTE (line 48) | func IDGTE(id string) predicate.Revision {
  function IDLT (line 53) | func IDLT(id string) predicate.Revision {
  function IDLTE (line 58) | func IDLTE(id string) predicate.Revision {
  function IDEqualFold (line 63) | func IDEqualFold(id string) predicate.Revision {
  function IDContainsFold (line 68) | func IDContainsFold(id string) predicate.Revision {
  function Description (line 73) | func Description(v string) predicate.Revision {
  function Type (line 78) | func Type(v migrate.RevisionType) predicate.Revision {
  function Applied (line 84) | func Applied(v int) predicate.Revision {
  function Total (line 89) | func Total(v int) predicate.Revision {
  function ExecutedAt (line 94) | func ExecutedAt(v time.Time) predicate.Revision {
  function ExecutionTime (line 99) | func ExecutionTime(v time.Duration) predicate.Revision {
  function Error (line 105) | func Error(v string) predicate.Revision {
  function ErrorStmt (line 110) | func ErrorStmt(v string) predicate.Revision {
  function Hash (line 115) | func Hash(v string) predicate.Revision {
  function OperatorVersion (line 120) | func OperatorVersion(v string) predicate.Revision {
  function DescriptionEQ (line 125) | func DescriptionEQ(v string) predicate.Revision {
  function DescriptionNEQ (line 130) | func DescriptionNEQ(v string) predicate.Revision {
  function DescriptionIn (line 135) | func DescriptionIn(vs ...string) predicate.Revision {
  function DescriptionNotIn (line 140) | func DescriptionNotIn(vs ...string) predicate.Revision {
  function DescriptionGT (line 145) | func DescriptionGT(v string) predicate.Revision {
  function DescriptionGTE (line 150) | func DescriptionGTE(v string) predicate.Revision {
  function DescriptionLT (line 155) | func DescriptionLT(v string) predicate.Revision {
  function DescriptionLTE (line 160) | func DescriptionLTE(v string) predicate.Revision {
  function DescriptionContains (line 165) | func DescriptionContains(v string) predicate.Revision {
  function DescriptionHasPrefix (line 170) | func DescriptionHasPrefix(v string) predicate.Revision {
  function DescriptionHasSuffix (line 175) | func DescriptionHasSuffix(v string) predicate.Revision {
  function DescriptionEqualFold (line 180) | func DescriptionEqualFold(v string) predicate.Revision {
  function DescriptionContainsFold (line 185) | func DescriptionContainsFold(v string) predicate.Revision {
  function TypeEQ (line 190) | func TypeEQ(v migrate.RevisionType) predicate.Revision {
  function TypeNEQ (line 196) | func TypeNEQ(v migrate.RevisionType) predicate.Revision {
  function TypeIn (line 202) | func TypeIn(vs ...migrate.RevisionType) predicate.Revision {
  function TypeNotIn (line 211) | func TypeNotIn(vs ...migrate.RevisionType) predicate.Revision {
  function TypeGT (line 220) | func TypeGT(v migrate.RevisionType) predicate.Revision {
  function TypeGTE (line 226) | func TypeGTE(v migrate.RevisionType) predicate.Revision {
  function TypeLT (line 232) | func TypeLT(v migrate.RevisionType) predicate.Revision {
  function TypeLTE (line 238) | func TypeLTE(v migrate.RevisionType) predicate.Revision {
  function AppliedEQ (line 244) | func AppliedEQ(v int) predicate.Revision {
  function AppliedNEQ (line 249) | func AppliedNEQ(v int) predicate.Revision {
  function AppliedIn (line 254) | func AppliedIn(vs ...int) predicate.Revision {
  function AppliedNotIn (line 259) | func AppliedNotIn(vs ...int) predicate.Revision {
  function AppliedGT (line 264) | func AppliedGT(v int) predicate.Revision {
  function AppliedGTE (line 269) | func AppliedGTE(v int) predicate.Revision {
  function AppliedLT (line 274) | func AppliedLT(v int) predicate.Revision {
  function AppliedLTE (line 279) | func AppliedLTE(v int) predicate.Revision {
  function TotalEQ (line 284) | func TotalEQ(v int) predicate.Revision {
  function TotalNEQ (line 289) | func TotalNEQ(v int) predicate.Revision {
  function TotalIn (line 294) | func TotalIn(vs ...int) predicate.Revision {
  function TotalNotIn (line 299) | func TotalNotIn(vs ...int) predicate.Revision {
  function TotalGT (line 304) | func TotalGT(v int) predicate.Revision {
  function TotalGTE (line 309) | func TotalGTE(v int) predicate.Revision {
  function TotalLT (line 314) | func TotalLT(v int) predicate.Revision {
  function TotalLTE (line 319) | func TotalLTE(v int) predicate.Revision {
  function ExecutedAtEQ (line 324) | func ExecutedAtEQ(v time.Time) predicate.Revision {
  function ExecutedAtNEQ (line 329) | func ExecutedAtNEQ(v time.Time) predicate.Revision {
  function ExecutedAtIn (line 334) | func ExecutedAtIn(vs ...time.Time) predicate.Revision {
  function ExecutedAtNotIn (line 339) | func ExecutedAtNotIn(vs ...time.Time) predicate.Revision {
  function ExecutedAtGT (line 344) | func ExecutedAtGT(v time.Time) predicate.Revision {
  function ExecutedAtGTE (line 349) | func ExecutedAtGTE(v time.Time) predicate.Revision {
  function ExecutedAtLT (line 354) | func ExecutedAtLT(v time.Time) predicate.Revision {
  function ExecutedAtLTE (line 359) | func ExecutedAtLTE(v time.Time) predicate.Revision {
  function ExecutionTimeEQ (line 364) | func ExecutionTimeEQ(v time.Duration) predicate.Revision {
  function ExecutionTimeNEQ (line 370) | func ExecutionTimeNEQ(v time.Duration) predicate.Revision {
  function ExecutionTimeIn (line 376) | func ExecutionTimeIn(vs ...time.Duration) predicate.Revision {
  function ExecutionTimeNotIn (line 385) | func ExecutionTimeNotIn(vs ...time.Duration) predicate.Revision {
  function ExecutionTimeGT (line 394) | func ExecutionTimeGT(v time.Duration) predicate.Revision {
  function ExecutionTimeGTE (line 400) | func ExecutionTimeGTE(v time.Duration) predicate.Revision {
  function ExecutionTimeLT (line 406) | func ExecutionTimeLT(v time.Duration) predicate.Revision {
  function ExecutionTimeLTE (line 412) | func ExecutionTimeLTE(v time.Duration) predicate.Revision {
  function ErrorEQ (line 418) | func ErrorEQ(v string) predicate.Revision {
  function ErrorNEQ (line 423) | func ErrorNEQ(v string) predicate.Revision {
  function ErrorIn (line 428) | func ErrorIn(vs ...string) predicate.Revision {
  function ErrorNotIn (line 433) | func ErrorNotIn(vs ...string) predicate.Revision {
  function ErrorGT (line 438) | func ErrorGT(v string) predicate.Revision {
  function ErrorGTE (line 443) | func ErrorGTE(v string) predicate.Revision {
  function ErrorLT (line 448) | func ErrorLT(v string) predicate.Revision {
  function ErrorLTE (line 453) | func ErrorLTE(v string) predicate.Revision {
  function ErrorContains (line 458) | func ErrorContains(v string) predicate.Revision {
  function ErrorHasPrefix (line 463) | func ErrorHasPrefix(v string) predicate.Revision {
  function ErrorHasSuffix (line 468) | func ErrorHasSuffix(v string) predicate.Revision {
  function ErrorIsNil (line 473) | func ErrorIsNil() predicate.Revision {
  function ErrorNotNil (line 478) | func ErrorNotNil() predicate.Revision {
  function ErrorEqualFold (line 483) | func ErrorEqualFold(v string) predicate.Revision {
  function ErrorContainsFold (line 488) | func ErrorContainsFold(v string) predicate.Revision {
  function ErrorStmtEQ (line 493) | func ErrorStmtEQ(v string) predicate.Revision {
  function ErrorStmtNEQ (line 498) | func ErrorStmtNEQ(v string) predicate.Revision {
  function ErrorStmtIn (line 503) | func ErrorStmtIn(vs ...string) predicate.Revision {
  function ErrorStmtNotIn (line 508) | func ErrorStmtNotIn(vs ...string) predicate.Revision {
  function ErrorStmtGT (line 513) | func ErrorStmtGT(v string) predicate.Revision {
  function ErrorStmtGTE (line 518) | func ErrorStmtGTE(v string) predicate.Revision {
  function ErrorStmtLT (line 523) | func ErrorStmtLT(v string) predicate.Revision {
  function ErrorStmtLTE (line 528) | func ErrorStmtLTE(v string) predicate.Revision {
  function ErrorStmtContains (line 533) | func ErrorStmtContains(v string) predicate.Revision {
  function ErrorStmtHasPrefix (line 538) | func ErrorStmtHasPrefix(v string) predicate.Revision {
  function ErrorStmtHasSuffix (line 543) | func ErrorStmtHasSuffix(v string) predicate.Revision {
  function ErrorStmtIsNil (line 548) | func ErrorStmtIsNil() predicate.Revision {
  function ErrorStmtNotNil (line 553) | func ErrorStmtNotNil() predicate.Revision {
  function ErrorStmtEqualFold (line 558) | func ErrorStmtEqualFold(v string) predicate.Revision {
  function ErrorStmtContainsFold (line 563) | func ErrorStmtContainsFold(v string) predicate.Revision {
  function HashEQ (line 568) | func HashEQ(v string) predicate.Revision {
  function HashNEQ (line 573) | func HashNEQ(v string) predicate.Revision {
  function HashIn (line 578) | func HashIn(vs ...string) predicate.Revision {
  function HashNotIn (line 583) | func HashNotIn(vs ...string) predicate.Revision {
  function HashGT (line 588) | func HashGT(v string) predicate.Revision {
  function HashGTE (line 593) | func HashGTE(v string) predicate.Revision {
  function HashLT (line 598) | func HashLT(v string) predicate.Revision {
  function HashLTE (line 603) | func HashLTE(v string) predicate.Revision {
  function HashContains (line 608) | func HashContains(v string) predicate.Revision {
  function HashHasPrefix (line 613) | func HashHasPrefix(v string) predicate.Revision {
  function HashHasSuffix (line 618) | func HashHasSuffix(v string) predicate.Revision {
  function HashEqualFold (line 623) | func HashEqualFold(v string) predicate.Revision {
  function HashContainsFold (line 628) | func HashContainsFold(v string) predicate.Revision {
  function PartialHashesIsNil (line 633) | func PartialHashesIsNil() predicate.Revision {
  function PartialHashesNotNil (line 638) | func PartialHashesNotNil() predicate.Revision {
  function OperatorVersionEQ (line 643) | func OperatorVersionEQ(v string) predicate.Revision {
  function OperatorVersionNEQ (line 648) | func OperatorVersionNEQ(v string) predicate.Revision {
  function OperatorVersionIn (line 653) | func OperatorVersionIn(vs ...string) predicate.Revision {
  function OperatorVersionNotIn (line 658) | func OperatorVersionNotIn(vs ...string) predicate.Revision {
  function OperatorVersionGT (line 663) | func OperatorVersionGT(v string) predicate.Revision {
  function OperatorVersionGTE (line 668) | func OperatorVersionGTE(v string) predicate.Revision {
  function OperatorVersionLT (line 673) | func OperatorVersionLT(v string) predicate.Revision {
  function OperatorVersionLTE (line 678) | func OperatorVersionLTE(v string) predicate.Revision {
  function OperatorVersionContains (line 683) | func OperatorVersionContains(v string) predicate.Revision {
  function OperatorVersionHasPrefix (line 688) | func OperatorVersionHasPrefix(v string) predicate.Revision {
  function OperatorVersionHasSuffix (line 693) | func OperatorVersionHasSuffix(v string) predicate.Revision {
  function OperatorVersionEqualFold (line 698) | func OperatorVersionEqualFold(v string) predicate.Revision {
  function OperatorVersionContainsFold (line 703) | func OperatorVersionContainsFold(v string) predicate.Revision {
  function And (line 708) | func And(predicates ...predicate.Revision) predicate.Revision {
  function Or (line 713) | func Or(predicates ...predicate.Revision) predicate.Revision {
  function Not (line 718) | func Not(p predicate.Revision) predicate.Revision {

FILE: cmd/atlas/internal/migrate/ent/revision_create.go
  type RevisionCreate (line 24) | type RevisionCreate struct
    method SetDescription (line 32) | func (_c *RevisionCreate) SetDescription(v string) *RevisionCreate {
    method SetType (line 38) | func (_c *RevisionCreate) SetType(v migrate.RevisionType) *RevisionCre...
    method SetNillableType (line 44) | func (_c *RevisionCreate) SetNillableType(v *migrate.RevisionType) *Re...
    method SetApplied (line 52) | func (_c *RevisionCreate) SetApplied(v int) *RevisionCreate {
    method SetNillableApplied (line 58) | func (_c *RevisionCreate) SetNillableApplied(v *int) *RevisionCreate {
    method SetTotal (line 66) | func (_c *RevisionCreate) SetTotal(v int) *RevisionCreate {
    method SetNillableTotal (line 72) | func (_c *RevisionCreate) SetNillableTotal(v *int) *RevisionCreate {
    method SetExecutedAt (line 80) | func (_c *RevisionCreate) SetExecutedAt(v time.Time) *RevisionCreate {
    method SetExecutionTime (line 86) | func (_c *RevisionCreate) SetExecutionTime(v time.Duration) *RevisionC...
    method SetError (line 92) | func (_c *RevisionCreate) SetError(v string) *RevisionCreate {
    method SetNillableError (line 98) | func (_c *RevisionCreate) SetNillableError(v *string) *RevisionCreate {
    method SetErrorStmt (line 106) | func (_c *RevisionCreate) SetErrorStmt(v string) *RevisionCreate {
    method SetNillableErrorStmt (line 112) | func (_c *RevisionCreate) SetNillableErrorStmt(v *string) *RevisionCre...
    method SetHash (line 120) | func (_c *RevisionCreate) SetHash(v string) *RevisionCreate {
    method SetPartialHashes (line 126) | func (_c *RevisionCreate) SetPartialHashes(v []string) *RevisionCreate {
    method SetOperatorVersion (line 132) | func (_c *RevisionCreate) SetOperatorVersion(v string) *RevisionCreate {
    method SetID (line 138) | func (_c *RevisionCreate) SetID(v string) *RevisionCreate {
    method Mutation (line 144) | func (_c *RevisionCreate) Mutation() *RevisionMutation {
    method Save (line 149) | func (_c *RevisionCreate) Save(ctx context.Context) (*Revision, error) {
    method SaveX (line 155) | func (_c *RevisionCreate) SaveX(ctx context.Context) *Revision {
    method Exec (line 164) | func (_c *RevisionCreate) Exec(ctx context.Context) error {
    method ExecX (line 170) | func (_c *RevisionCreate) ExecX(ctx context.Context) {
    method defaults (line 177) | func (_c *RevisionCreate) defaults() {
    method check (line 193) | func (_c *RevisionCreate) check() error {
    method sqlSave (line 231) | func (_c *RevisionCreate) sqlSave(ctx context.Context) (*Revision, err...
    method createSpec (line 254) | func (_c *RevisionCreate) createSpec() (*Revision, *sqlgraph.CreateSpe...
    method OnConflict (line 328) | func (_c *RevisionCreate) OnConflict(opts ...sql.ConflictOption) *Revi...
    method OnConflictColumns (line 341) | func (_c *RevisionCreate) OnConflictColumns(columns ...string) *Revisi...
  type RevisionUpsertOne (line 351) | type RevisionUpsertOne struct
    method UpdateNewValues (line 522) | func (u *RevisionUpsertOne) UpdateNewValues() *RevisionUpsertOne {
    method Ignore (line 544) | func (u *RevisionUpsertOne) Ignore() *RevisionUpsertOne {
    method DoNothing (line 551) | func (u *RevisionUpsertOne) DoNothing() *RevisionUpsertOne {
    method Update (line 558) | func (u *RevisionUpsertOne) Update(set func(*RevisionUpsert)) *Revisio...
    method SetType (line 566) | func (u *RevisionUpsertOne) SetType(v migrate.RevisionType) *RevisionU...
    method AddType (line 573) | func (u *RevisionUpsertOne) AddType(v migrate.RevisionType) *RevisionU...
    method UpdateType (line 580) | func (u *RevisionUpsertOne) UpdateType() *RevisionUpsertOne {
    method SetApplied (line 587) | func (u *RevisionUpsertOne) SetApplied(v int) *RevisionUpsertOne {
    method AddApplied (line 594) | func (u *RevisionUpsertOne) AddApplied(v int) *RevisionUpsertOne {
    method UpdateApplied (line 601) | func (u *RevisionUpsertOne) UpdateApplied() *RevisionUpsertOne {
    method SetTotal (line 608) | func (u *RevisionUpsertOne) SetTotal(v int) *RevisionUpsertOne {
    method AddTotal (line 615) | func (u *RevisionUpsertOne) AddTotal(v int) *RevisionUpsertOne {
    method UpdateTotal (line 622) | func (u *RevisionUpsertOne) UpdateTotal() *RevisionUpsertOne {
    method SetExecutionTime (line 629) | func (u *RevisionUpsertOne) SetExecutionTime(v time.Duration) *Revisio...
    method AddExecutionTime (line 636) | func (u *RevisionUpsertOne) AddExecutionTime(v time.Duration) *Revisio...
    method UpdateExecutionTime (line 643) | func (u *RevisionUpsertOne) UpdateExecutionTime() *RevisionUpsertOne {
    method SetError (line 650) | func (u *RevisionUpsertOne) SetError(v string) *RevisionUpsertOne {
    method UpdateError (line 657) | func (u *RevisionUpsertOne) UpdateError() *RevisionUpsertOne {
    method ClearError (line 664) | func (u *RevisionUpsertOne) ClearError() *RevisionUpsertOne {
    method SetErrorStmt (line 671) | func (u *RevisionUpsertOne) SetErrorStmt(v string) *RevisionUpsertOne {
    method UpdateErrorStmt (line 678) | func (u *RevisionUpsertOne) UpdateErrorStmt() *RevisionUpsertOne {
    method ClearErrorStmt (line 685) | func (u *RevisionUpsertOne) ClearErrorStmt() *RevisionUpsertOne {
    method SetHash (line 692) | func (u *RevisionUpsertOne) SetHash(v string) *RevisionUpsertOne {
    method UpdateHash (line 699) | func (u *RevisionUpsertOne) UpdateHash() *RevisionUpsertOne {
    method SetPartialHashes (line 706) | func (u *RevisionUpsertOne) SetPartialHashes(v []string) *RevisionUpse...
    method UpdatePartialHashes (line 713) | func (u *RevisionUpsertOne) UpdatePartialHashes() *RevisionUpsertOne {
    method ClearPartialHashes (line 720) | func (u *RevisionUpsertOne) ClearPartialHashes() *RevisionUpsertOne {
    method SetOperatorVersion (line 727) | func (u *RevisionUpsertOne) SetOperatorVersion(v string) *RevisionUpse...
    method UpdateOperatorVersion (line 734) | func (u *RevisionUpsertOne) UpdateOperatorVersion() *RevisionUpsertOne {
    method Exec (line 741) | func (u *RevisionUpsertOne) Exec(ctx context.Context) error {
    method ExecX (line 749) | func (u *RevisionUpsertOne) ExecX(ctx context.Context) {
    method ID (line 756) | func (u *RevisionUpsertOne) ID(ctx context.Context) (id string, err er...
    method IDX (line 770) | func (u *RevisionUpsertOne) IDX(ctx context.Context) string {
  type RevisionUpsert (line 356) | type RevisionUpsert struct
    method SetType (line 362) | func (u *RevisionUpsert) SetType(v migrate.RevisionType) *RevisionUpse...
    method UpdateType (line 368) | func (u *RevisionUpsert) UpdateType() *RevisionUpsert {
    method AddType (line 374) | func (u *RevisionUpsert) AddType(v migrate.RevisionType) *RevisionUpse...
    method SetApplied (line 380) | func (u *RevisionUpsert) SetApplied(v int) *RevisionUpsert {
    method UpdateApplied (line 386) | func (u *RevisionUpsert) UpdateApplied() *RevisionUpsert {
    method AddApplied (line 392) | func (u *RevisionUpsert) AddApplied(v int) *RevisionUpsert {
    method SetTotal (line 398) | func (u *RevisionUpsert) SetTotal(v int) *RevisionUpsert {
    method UpdateTotal (line 404) | func (u *RevisionUpsert) UpdateTotal() *RevisionUpsert {
    method AddTotal (line 410) | func (u *RevisionUpsert) AddTotal(v int) *RevisionUpsert {
    method SetExecutionTime (line 416) | func (u *RevisionUpsert) SetExecutionTime(v time.Duration) *RevisionUp...
    method UpdateExecutionTime (line 422) | func (u *RevisionUpsert) UpdateExecutionTime() *RevisionUpsert {
    method AddExecutionTime (line 428) | func (u *RevisionUpsert) AddExecutionTime(v time.Duration) *RevisionUp...
    method SetError (line 434) | func (u *RevisionUpsert) SetError(v string) *RevisionUpsert {
    method UpdateError (line 440) | func (u *RevisionUpsert) UpdateError() *RevisionUpsert {
    method ClearError (line 446) | func (u *RevisionUpsert) ClearError() *RevisionUpsert {
    method SetErrorStmt (line 452) | func (u *RevisionUpsert) SetErrorStmt(v string) *RevisionUpsert {
    method UpdateErrorStmt (line 458) | func (u *RevisionUpsert) UpdateErrorStmt() *RevisionUpsert {
    method ClearErrorStmt (line 464) | func (u *RevisionUpsert) ClearErrorStmt() *RevisionUpsert {
    method SetHash (line 470) | func (u *RevisionUpsert) SetHash(v string) *RevisionUpsert {
    method UpdateHash (line 476) | func (u *RevisionUpsert) UpdateHash() *RevisionUpsert {
    method SetPartialHashes (line 482) | func (u *RevisionUpsert) SetPartialHashes(v []string) *RevisionUpsert {
    method UpdatePartialHashes (line 488) | func (u *RevisionUpsert) UpdatePartialHashes() *RevisionUpsert {
    method ClearPartialHashes (line 494) | func (u *RevisionUpsert) ClearPartialHashes() *RevisionUpsert {
    method SetOperatorVersion (line 500) | func (u *RevisionUpsert) SetOperatorVersion(v string) *RevisionUpsert {
    method UpdateOperatorVersion (line 506) | func (u *RevisionUpsert) UpdateOperatorVersion() *RevisionUpsert {
  type RevisionCreateBulk (line 779) | type RevisionCreateBulk struct
    method Save (line 787) | func (_c *RevisionCreateBulk) Save(ctx context.Context) ([]*Revision, ...
    method SaveX (line 843) | func (_c *RevisionCreateBulk) SaveX(ctx context.Context) []*Revision {
    method Exec (line 852) | func (_c *RevisionCreateBulk) Exec(ctx context.Context) error {
    method ExecX (line 858) | func (_c *RevisionCreateBulk) ExecX(ctx context.Context) {
    method OnConflict (line 879) | func (_c *RevisionCreateBulk) OnConflict(opts ...sql.ConflictOption) *...
    method OnConflictColumns (line 892) | func (_c *RevisionCreateBulk) OnConflictColumns(columns ...string) *Re...
  type RevisionUpsertBulk (line 901) | type RevisionUpsertBulk struct
    method UpdateNewValues (line 916) | func (u *RevisionUpsertBulk) UpdateNewValues() *RevisionUpsertBulk {
    method Ignore (line 940) | func (u *RevisionUpsertBulk) Ignore() *RevisionUpsertBulk {
    method DoNothing (line 947) | func (u *RevisionUpsertBulk) DoNothing() *RevisionUpsertBulk {
    method Update (line 954) | func (u *RevisionUpsertBulk) Update(set func(*RevisionUpsert)) *Revisi...
    method SetType (line 962) | func (u *RevisionUpsertBulk) SetType(v migrate.RevisionType) *Revision...
    method AddType (line 969) | func (u *RevisionUpsertBulk) AddType(v migrate.RevisionType) *Revision...
    method UpdateType (line 976) | func (u *RevisionUpsertBulk) UpdateType() *RevisionUpsertBulk {
    method SetApplied (line 983) | func (u *RevisionUpsertBulk) SetApplied(v int) *RevisionUpsertBulk {
    method AddApplied (line 990) | func (u *RevisionUpsertBulk) AddApplied(v int) *RevisionUpsertBulk {
    method UpdateApplied (line 997) | func (u *RevisionUpsertBulk) UpdateApplied() *RevisionUpsertBulk {
    method SetTotal (line 1004) | func (u *RevisionUpsertBulk) SetTotal(v int) *RevisionUpsertBulk {
    method AddTotal (line 1011) | func (u *RevisionUpsertBulk) AddTotal(v int) *RevisionUpsertBulk {
    method UpdateTotal (line 1018) | func (u *RevisionUpsertBulk) UpdateTotal() *RevisionUpsertBulk {
    method SetExecutionTime (line 1025) | func (u *RevisionUpsertBulk) SetExecutionTime(v time.Duration) *Revisi...
    method AddExecutionTime (line 1032) | func (u *RevisionUpsertBulk) AddExecutionTime(v time.Duration) *Revisi...
    method UpdateExecutionTime (line 1039) | func (u *RevisionUpsertBulk) UpdateExecutionTime() *RevisionUpsertBulk {
    method SetError (line 1046) | func (u *RevisionUpsertBulk) SetError(v string) *RevisionUpsertBulk {
    method UpdateError (line 1053) | func (u *RevisionUpsertBulk) UpdateError() *RevisionUpsertBulk {
    method ClearError (line 1060) | func (u *RevisionUpsertBulk) ClearError() *RevisionUpsertBulk {
    method SetErrorStmt (line 1067) | func (u *RevisionUpsertBulk) SetErrorStmt(v string) *RevisionUpsertBulk {
    method UpdateErrorStmt (line 1074) | func (u *RevisionUpsertBulk) UpdateErrorStmt() *RevisionUpsertBulk {
    method ClearErrorStmt (line 1081) | func (u *RevisionUpsertBulk) ClearErrorStmt() *RevisionUpsertBulk {
    method SetHash (line 1088) | func (u *RevisionUpsertBulk) SetHash(v string) *RevisionUpsertBulk {
    method UpdateHash (line 1095) | func (u *RevisionUpsertBulk) UpdateHash() *RevisionUpsertBulk {
    method SetPartialHashes (line 1102) | func (u *RevisionUpsertBulk) SetPartialHashes(v []string) *RevisionUps...
    method UpdatePartialHashes (line 1109) | func (u *RevisionUpsertBulk) UpdatePartialHashes() *RevisionUpsertBulk {
    method ClearPartialHashes (line 1116) | func (u *RevisionUpsertBulk) ClearPartialHashes() *RevisionUpsertBulk {
    method SetOperatorVersion (line 1123) | func (u *RevisionUpsertBulk) SetOperatorVersion(v string) *RevisionUps...
    method UpdateOperatorVersion (line 1130) | func (u *RevisionUpsertBulk) UpdateOperatorVersion() *RevisionUpsertBu...
    method Exec (line 1137) | func (u *RevisionUpsertBulk) Exec(ctx context.Context) error {
    method ExecX (line 1153) | func (u *RevisionUpsertBulk) ExecX(ctx context.Context) {

FILE: cmd/atlas/internal/migrate/ent/revision_delete.go
  type RevisionDelete (line 21) | type RevisionDelete struct
    method Where (line 28) | func (_d *RevisionDelete) Where(ps ...predicate.Revision) *RevisionDel...
    method Exec (line 34) | func (_d *RevisionDelete) Exec(ctx context.Context) (int, error) {
    method ExecX (line 39) | func (_d *RevisionDelete) ExecX(ctx context.Context) int {
    method sqlExec (line 47) | func (_d *RevisionDelete) sqlExec(ctx context.Context) (int, error) {
  type RevisionDeleteOne (line 67) | type RevisionDeleteOne struct
    method Where (line 72) | func (_d *RevisionDeleteOne) Where(ps ...predicate.Revision) *Revision...
    method Exec (line 78) | func (_d *RevisionDeleteOne) Exec(ctx context.Context) error {
    method ExecX (line 91) | func (_d *RevisionDeleteOne) ExecX(ctx context.Context) {

FILE: cmd/atlas/internal/migrate/ent/revision_query.go
  type RevisionQuery (line 24) | type RevisionQuery struct
    method Where (line 36) | func (_q *RevisionQuery) Where(ps ...predicate.Revision) *RevisionQuery {
    method Limit (line 42) | func (_q *RevisionQuery) Limit(limit int) *RevisionQuery {
    method Offset (line 48) | func (_q *RevisionQuery) Offset(offset int) *RevisionQuery {
    method Unique (line 55) | func (_q *RevisionQuery) Unique(unique bool) *RevisionQuery {
    method Order (line 61) | func (_q *RevisionQuery) Order(o ...revision.OrderOption) *RevisionQue...
    method First (line 68) | func (_q *RevisionQuery) First(ctx context.Context) (*Revision, error) {
    method FirstX (line 80) | func (_q *RevisionQuery) FirstX(ctx context.Context) *Revision {
    method FirstID (line 90) | func (_q *RevisionQuery) FirstID(ctx context.Context) (id string, err ...
    method FirstIDX (line 103) | func (_q *RevisionQuery) FirstIDX(ctx context.Context) string {
    method Only (line 114) | func (_q *RevisionQuery) Only(ctx context.Context) (*Revision, error) {
    method OnlyX (line 130) | func (_q *RevisionQuery) OnlyX(ctx context.Context) *Revision {
    method OnlyID (line 141) | func (_q *RevisionQuery) OnlyID(ctx context.Context) (id string, err e...
    method OnlyIDX (line 158) | func (_q *RevisionQuery) OnlyIDX(ctx context.Context) string {
    method All (line 167) | func (_q *RevisionQuery) All(ctx context.Context) ([]*Revision, error) {
    method AllX (line 177) | func (_q *RevisionQuery) AllX(ctx context.Context) []*Revision {
    method IDs (line 186) | func (_q *RevisionQuery) IDs(ctx context.Context) (ids []string, err e...
    method IDsX (line 198) | func (_q *RevisionQuery) IDsX(ctx context.Context) []string {
    method Count (line 207) | func (_q *RevisionQuery) Count(ctx context.Context) (int, error) {
    method CountX (line 216) | func (_q *RevisionQuery) CountX(ctx context.Context) int {
    method Exist (line 225) | func (_q *RevisionQuery) Exist(ctx context.Context) (bool, error) {
    method ExistX (line 238) | func (_q *RevisionQuery) ExistX(ctx context.Context) bool {
    method Clone (line 248) | func (_q *RevisionQuery) Clone() *RevisionQuery {
    method GroupBy (line 278) | func (_q *RevisionQuery) GroupBy(field string, fields ...string) *Revi...
    method Select (line 299) | func (_q *RevisionQuery) Select(fields ...string) *RevisionSelect {
    method Aggregate (line 308) | func (_q *RevisionQuery) Aggregate(fns ...AggregateFunc) *RevisionSele...
    method prepareQuery (line 312) | func (_q *RevisionQuery) prepareQuery(ctx context.Context) error {
    method sqlAll (line 338) | func (_q *RevisionQuery) sqlAll(ctx context.Context, hooks ...queryHoo...
    method sqlCount (line 365) | func (_q *RevisionQuery) sqlCount(ctx context.Context) (int, error) {
    method querySpec (line 376) | func (_q *RevisionQuery) querySpec() *sqlgraph.QuerySpec {
    method sqlQuery (line 416) | func (_q *RevisionQuery) sqlQuery(ctx context.Context) *sql.Selector {
  type RevisionGroupBy (line 452) | type RevisionGroupBy struct
    method Aggregate (line 458) | func (_g *RevisionGroupBy) Aggregate(fns ...AggregateFunc) *RevisionGr...
    method Scan (line 464) | func (_g *RevisionGroupBy) Scan(ctx context.Context, v any) error {
    method sqlScan (line 472) | func (_g *RevisionGroupBy) sqlScan(ctx context.Context, root *Revision...
  type RevisionSelect (line 500) | type RevisionSelect struct
    method Aggregate (line 506) | func (_s *RevisionSelect) Aggregate(fns ...AggregateFunc) *RevisionSel...
    method Scan (line 512) | func (_s *RevisionSelect) Scan(ctx context.Context, v any) error {
    method sqlScan (line 520) | func (_s *RevisionSelect) sqlScan(ctx context.Context, root *RevisionQ...

FILE: cmd/atlas/internal/migrate/ent/revision_update.go
  type RevisionUpdate (line 26) | type RevisionUpdate struct
    method Where (line 33) | func (_u *RevisionUpdate) Where(ps ...predicate.Revision) *RevisionUpd...
    method SetType (line 39) | func (_u *RevisionUpdate) SetType(v migrate.RevisionType) *RevisionUpd...
    method SetNillableType (line 46) | func (_u *RevisionUpdate) SetNillableType(v *migrate.RevisionType) *Re...
    method AddType (line 54) | func (_u *RevisionUpdate) AddType(v migrate.RevisionType) *RevisionUpd...
    method SetApplied (line 60) | func (_u *RevisionUpdate) SetApplied(v int) *RevisionUpdate {
    method SetNillableApplied (line 67) | func (_u *RevisionUpdate) SetNillableApplied(v *int) *RevisionUpdate {
    method AddApplied (line 75) | func (_u *RevisionUpdate) AddApplied(v int) *RevisionUpdate {
    method SetTotal (line 81) | func (_u *RevisionUpdate) SetTotal(v int) *RevisionUpdate {
    method SetNillableTotal (line 88) | func (_u *RevisionUpdate) SetNillableTotal(v *int) *RevisionUpdate {
    method AddTotal (line 96) | func (_u *RevisionUpdate) AddTotal(v int) *RevisionUpdate {
    method SetExecutionTime (line 102) | func (_u *RevisionUpdate) SetExecutionTime(v time.Duration) *RevisionU...
    method SetNillableExecutionTime (line 109) | func (_u *RevisionUpdate) SetNillableExecutionTime(v *time.Duration) *...
    method AddExecutionTime (line 117) | func (_u *RevisionUpdate) AddExecutionTime(v time.Duration) *RevisionU...
    method SetError (line 123) | func (_u *RevisionUpdate) SetError(v string) *RevisionUpdate {
    method SetNillableError (line 129) | func (_u *RevisionUpdate) SetNillableError(v *string) *RevisionUpdate {
    method ClearError (line 137) | func (_u *RevisionUpdate) ClearError() *RevisionUpdate {
    method SetErrorStmt (line 143) | func (_u *RevisionUpdate) SetErrorStmt(v string) *RevisionUpdate {
    method SetNillableErrorStmt (line 149) | func (_u *RevisionUpdate) SetNillableErrorStmt(v *string) *RevisionUpd...
    method ClearErrorStmt (line 157) | func (_u *RevisionUpdate) ClearErrorStmt() *RevisionUpdate {
    method SetHash (line 163) | func (_u *RevisionUpdate) SetHash(v string) *RevisionUpdate {
    method SetNillableHash (line 169) | func (_u *RevisionUpdate) SetNillableHash(v *string) *RevisionUpdate {
    method SetPartialHashes (line 177) | func (_u *RevisionUpdate) SetPartialHashes(v []string) *RevisionUpdate {
    method AppendPartialHashes (line 183) | func (_u *RevisionUpdate) AppendPartialHashes(v []string) *RevisionUpd...
    method ClearPartialHashes (line 189) | func (_u *RevisionUpdate) ClearPartialHashes() *RevisionUpdate {
    method SetOperatorVersion (line 195) | func (_u *RevisionUpdate) SetOperatorVersion(v string) *RevisionUpdate {
    method SetNillableOperatorVersion (line 201) | func (_u *RevisionUpdate) SetNillableOperatorVersion(v *string) *Revis...
    method Mutation (line 209) | func (_u *RevisionUpdate) Mutation() *RevisionMutation {
    method Save (line 214) | func (_u *RevisionUpdate) Save(ctx context.Context) (int, error) {
    method SaveX (line 219) | func (_u *RevisionUpdate) SaveX(ctx context.Context) int {
    method Exec (line 228) | func (_u *RevisionUpdate) Exec(ctx context.Context) error {
    method ExecX (line 234) | func (_u *RevisionUpdate) ExecX(ctx context.Context) {
    method check (line 241) | func (_u *RevisionUpdate) check() error {
    method sqlSave (line 255) | func (_u *RevisionUpdate) sqlSave(ctx context.Context) (_node int, err...
  type RevisionUpdateOne (line 335) | type RevisionUpdateOne struct
    method SetType (line 343) | func (_u *RevisionUpdateOne) SetType(v migrate.RevisionType) *Revision...
    method SetNillableType (line 350) | func (_u *RevisionUpdateOne) SetNillableType(v *migrate.RevisionType) ...
    method AddType (line 358) | func (_u *RevisionUpdateOne) AddType(v migrate.RevisionType) *Revision...
    method SetApplied (line 364) | func (_u *RevisionUpdateOne) SetApplied(v int) *RevisionUpdateOne {
    method SetNillableApplied (line 371) | func (_u *RevisionUpdateOne) SetNillableApplied(v *int) *RevisionUpdat...
    method AddApplied (line 379) | func (_u *RevisionUpdateOne) AddApplied(v int) *RevisionUpdateOne {
    method SetTotal (line 385) | func (_u *RevisionUpdateOne) SetTotal(v int) *RevisionUpdateOne {
    method SetNillableTotal (line 392) | func (_u *RevisionUpdateOne) SetNillableTotal(v *int) *RevisionUpdateO...
    method AddTotal (line 400) | func (_u *RevisionUpdateOne) AddTotal(v int) *RevisionUpdateOne {
    method SetExecutionTime (line 406) | func (_u *RevisionUpdateOne) SetExecutionTime(v time.Duration) *Revisi...
    method SetNillableExecutionTime (line 413) | func (_u *RevisionUpdateOne) SetNillableExecutionTime(v *time.Duration...
    method AddExecutionTime (line 421) | func (_u *RevisionUpdateOne) AddExecutionTime(v time.Duration) *Revisi...
    method SetError (line 427) | func (_u *RevisionUpdateOne) SetError(v string) *RevisionUpdateOne {
    method SetNillableError (line 433) | func (_u *RevisionUpdateOne) SetNillableError(v *string) *RevisionUpda...
    method ClearError (line 441) | func (_u *RevisionUpdateOne) ClearError() *RevisionUpdateOne {
    method SetErrorStmt (line 447) | func (_u *RevisionUpdateOne) SetErrorStmt(v string) *RevisionUpdateOne {
    method SetNillableErrorStmt (line 453) | func (_u *RevisionUpdateOne) SetNillableErrorStmt(v *string) *Revision...
    method ClearErrorStmt (line 461) | func (_u *RevisionUpdateOne) ClearErrorStmt() *RevisionUpdateOne {
    method SetHash (line 467) | func (_u *RevisionUpdateOne) SetHash(v string) *RevisionUpdateOne {
    method SetNillableHash (line 473) | func (_u *RevisionUpdateOne) SetNillableHash(v *string) *RevisionUpdat...
    method SetPartialHashes (line 481) | func (_u *RevisionUpdateOne) SetPartialHashes(v []string) *RevisionUpd...
    method AppendPartialHashes (line 487) | func (_u *RevisionUpdateOne) AppendPartialHashes(v []string) *Revision...
    method ClearPartialHashes (line 493) | func (_u *RevisionUpdateOne) ClearPartialHashes() *RevisionUpdateOne {
    method SetOperatorVersion (line 499) | func (_u *RevisionUpdateOne) SetOperatorVersion(v string) *RevisionUpd...
    method SetNillableOperatorVersion (line 505) | func (_u *RevisionUpdateOne) SetNillableOperatorVersion(v *string) *Re...
    method Mutation (line 513) | func (_u *RevisionUpdateOne) Mutation() *RevisionMutation {
    method Where (line 518) | func (_u *RevisionUpdateOne) Where(ps ...predicate.Revision) *Revision...
    method Select (line 525) | func (_u *RevisionUpdateOne) Select(field string, fields ...string) *R...
    method Save (line 531) | func (_u *RevisionUpdateOne) Save(ctx context.Context) (*Revision, err...
    method SaveX (line 536) | func (_u *RevisionUpdateOne) SaveX(ctx context.Context) *Revision {
    method Exec (line 545) | func (_u *RevisionUpdateOne) Exec(ctx context.Context) error {
    method ExecX (line 551) | func (_u *RevisionUpdateOne) ExecX(ctx context.Context) {
    method check (line 558) | func (_u *RevisionUpdateOne) check() error {
    method sqlSave (line 572) | func (_u *RevisionUpdateOne) sqlSave(ctx context.Context) (_node *Revi...

FILE: cmd/atlas/internal/migrate/ent/runtime.go
  function init (line 18) | func init() {

FILE: cmd/atlas/internal/migrate/ent/runtime/runtime.go
  constant Version (line 12) | Version = "v0.14.5-0.20250523082027-21ecfa0872d4"
  constant Sum (line 13) | Sum     = "h1:d7UZAvQCnOp1PyiHAWkPCXBEPW3tVjraiK/RZlsW0XY="

FILE: cmd/atlas/internal/migrate/ent/schema/revision.go
  constant DefaultRevisionSchema (line 19) | DefaultRevisionSchema = "atlas_schema_revisions"
  type Revision (line 22) | type Revision struct
    method Fields (line 27) | func (Revision) Fields() []ent.Field {
    method Annotations (line 59) | func (Revision) Annotations() []schema.Annotation {

FILE: cmd/atlas/internal/migrate/ent/tx.go
  type Tx (line 19) | type Tx struct
    method Commit (line 66) | func (tx *Tx) Commit() error {
    method OnCommit (line 81) | func (tx *Tx) OnCommit(f CommitHook) {
    method Rollback (line 122) | func (tx *Tx) Rollback() error {
    method OnRollback (line 137) | func (tx *Tx) OnRollback(f RollbackHook) {
    method Client (line 145) | func (tx *Tx) Client() *Client {
    method init (line 153) | func (tx *Tx) init() {
  type Committer (line 34) | type Committer interface
  type CommitFunc (line 41) | type CommitFunc
    method Commit (line 61) | func (f CommitFunc) Commit(ctx context.Context, tx *Tx) error {
  type CommitHook (line 57) | type CommitHook
  type Rollbacker (line 90) | type Rollbacker interface
  type RollbackFunc (line 97) | type RollbackFunc
    method Rollback (line 117) | func (f RollbackFunc) Rollback(ctx context.Context, tx *Tx) error {
  type RollbackHook (line 113) | type RollbackHook
  type txDriver (line 168) | type txDriver struct
    method Tx (line 190) | func (tx *txDriver) Tx(context.Context) (dialect.Tx, error) { return t...
    method Dialect (line 193) | func (tx *txDriver) Dialect() string { return tx.drv.Dialect() }
    method Close (line 196) | func (*txDriver) Close() error { return nil }
    method Commit (line 200) | func (*txDriver) Commit() error { return nil }
    method Rollback (line 204) | func (*txDriver) Rollback() error { return nil }
    method Exec (line 207) | func (tx *txDriver) Exec(ctx context.Context, query string, args, v an...
    method Query (line 212) | func (tx *txDriver) Query(ctx context.Context, query string, args, v a...
    method ExecContext (line 220) | func (tx *txDriver) ExecContext(ctx context.Context, query string, arg...
    method QueryContext (line 232) | func (tx *txDriver) QueryContext(ctx context.Context, query string, ar...
  function newTx (line 180) | func newTx(ctx context.Context, drv dialect.Driver) (*txDriver, error) {

FILE: cmd/atlas/internal/migrate/migrate.go
  type RevisionReadWriter (line 37) | type RevisionReadWriter interface
  type EntRevisions (line 47) | type EntRevisions struct
    method Dialect (line 58) | func (r *EntRevisions) Dialect() string {
    method Ident (line 140) | func (r *EntRevisions) Ident() *migrate.TableIdent {
    method ReadRevision (line 147) | func (r *EntRevisions) ReadRevision(ctx context.Context, v string) (*m...
    method ReadRevisions (line 164) | func (r *EntRevisions) ReadRevisions(ctx context.Context) ([]*migrate....
    method CurrentRevision (line 180) | func (r *EntRevisions) CurrentRevision(ctx context.Context) (*migrate....
    method WriteRevision (line 195) | func (r *EntRevisions) WriteRevision(ctx context.Context, rev *migrate...
    method DeleteRevision (line 207) | func (r *EntRevisions) DeleteRevision(ctx context.Context, v string) e...
    method Migrate (line 217) | func (r *EntRevisions) Migrate(ctx context.Context) (err error) {
    method maySetSchemaQualifier (line 293) | func (r *EntRevisions) maySetSchemaQualifier(t *schema.Table) {
    method ID (line 309) | func (r *EntRevisions) ID(ctx context.Context, operatorV string) (stri...
  type Option (line 54) | type Option
  function EntDialect (line 63) | func EntDialect(d string) string {
  function RevisionsForClient (line 77) | func RevisionsForClient(ctx context.Context, ac *sqlclient.Client, schem...
  function NewEntRevisions (line 95) | func NewEntRevisions(ctx context.Context, ac *sqlclient.Client, opts ......
  function WithSchema (line 132) | func WithSchema(s string) Option {
  constant revisionID (line 306) | revisionID = ".atlas_cloud_identifier"
  constant FormatAtlas (line 338) | FormatAtlas         = "atlas"
  constant FormatGolangMigrate (line 339) | FormatGolangMigrate = "golang-migrate"
  constant FormatGoose (line 340) | FormatGoose         = "goose"
  constant FormatFlyway (line 341) | FormatFlyway        = "flyway"
  constant FormatLiquibase (line 342) | FormatLiquibase     = "liquibase"
  constant FormatDBMate (line 343) | FormatDBMate        = "dbmate"
  function Formatter (line 350) | func Formatter(u *url.URL) (migrate.Formatter, error) {
  function Dir (line 370) | func Dir(ctx context.Context, u string, create bool) (migrate.Dir, error) {
  constant DirTypeMem (line 380) | DirTypeMem   = "mem"
  constant DirTypeFile (line 381) | DirTypeFile  = "file"
  constant DirTypeAtlas (line 382) | DirTypeAtlas = "atlas"
  constant DefaultDirName (line 386) | DefaultDirName = "migrations"
  function DirURL (line 389) | func DirURL(ctx context.Context, u *url.URL, create bool) (migrate.Dir, ...
  function ChangesToRealm (line 436) | func ChangesToRealm(c *sqlclient.Client, r *schema.Realm) schema.Changes {

FILE: cmd/atlas/internal/migrate/migrate_oss.go
  function openAtlasDir (line 17) | func openAtlasDir(context.Context, *url.URL) (migrate.Dir, error) {

FILE: cmd/atlas/internal/migrate/migrate_test.go
  function TestFormatter (line 25) | func TestFormatter(t *testing.T) {
  function TestRevisionsForClient (line 43) | func TestRevisionsForClient(t *testing.T) {
  function TestNewEntRevisions (line 67) | func TestNewEntRevisions(t *testing.T) {
  function TestDirURL (line 76) | func TestDirURL(t *testing.T) {
  function runRevisionsTests (line 132) | func runRevisionsTests(ctx context.Context, t *testing.T, drv migrate.Dr...
  type mockDriver (line 211) | type mockDriver struct
    method RevisionsReadWriter (line 220) | func (m *mockDriver) RevisionsReadWriter(context.Context, string) (mig...
  type mockrrw (line 215) | type mockrrw struct
    method CurrentRevision (line 224) | func (*mockrrw) CurrentRevision(context.Context) (*migrate.Revision, e...
    method Migrate (line 225) | func (*mockrrw) Migrate(context.Context) error                        ...
    method ID (line 226) | func (*mockrrw) ID(context.Context, string) (string, error)           ...

FILE: cmd/atlas/internal/migrate/testdata/broken/1.sql
  type `users` (line 1) | CREATE TABLE `users` (`id` int NOT NULL PRIMARY KEY)

FILE: cmd/atlas/internal/migrate/testdata/broken/3.sql
  type `pets` (line 1) | CREATE TABLE `pets` (`id` int NOT NULL PRIMARY KEY)

FILE: cmd/atlas/internal/migrate/testdata/fixed/1.sql
  type `users` (line 1) | CREATE TABLE `users` (`id` int NOT NULL PRIMARY KEY)

FILE: cmd/atlas/internal/migrate/testdata/fixed/3.sql
  type `pets` (line 1) | CREATE TABLE `pets` (`id` int NOT NULL PRIMARY KEY)

FILE: cmd/atlas/internal/migratelint/lint.go
  type ChangeDetector (line 24) | type ChangeDetector interface
  type ChangeLoader (line 30) | type ChangeLoader interface
  type Changes (line 36) | type Changes struct
  type GitChangeDetector (line 44) | type GitChangeDetector struct
    method DetectChanges (line 100) | func (d *GitChangeDetector) DetectChanges(ctx context.Context) ([]migr...
  type GitChangeDetectorOption (line 52) | type GitChangeDetectorOption
  function NewGitChangeDetector (line 56) | func NewGitChangeDetector(dir migrate.Dir, opts ...GitChangeDetectorOpti...
  function WithWorkDir (line 76) | func WithWorkDir(work string) GitChangeDetectorOption {
  function WithBase (line 84) | func WithBase(base string) GitChangeDetectorOption {
  function WithMigrationsPath (line 92) | func WithMigrationsPath(path string) GitChangeDetectorOption {
  type DirChangeDetector (line 140) | type DirChangeDetector struct
    method DetectChanges (line 147) | func (d DirChangeDetector) DetectChanges(context.Context) ([]migrate.F...
  type latestChange (line 169) | type latestChange struct
    method DetectChanges (line 182) | func (d *latestChange) DetectChanges(context.Context) ([]migrate.File,...
  function LatestChanges (line 177) | func LatestChanges(dir migrate.Dir, n int) ChangeDetector {
  type DevLoader (line 196) | type DevLoader struct
    method LoadChanges (line 202) | func (d *DevLoader) LoadChanges(ctx context.Context, base, files []mig...
    method base (line 271) | func (d *DevLoader) base(ctx context.Context, base []migrate.File) (*s...
    method first (line 295) | func (d *DevLoader) first(ctx context.Context, f *sqlcheck.File, start...
    method next (line 330) | func (d *DevLoader) next(ctx context.Context, f *sqlcheck.File, start ...
    method nextStmts (line 339) | func (d *DevLoader) nextStmts(ctx context.Context, f *sqlcheck.File, s...
    method mayFix (line 366) | func (d *DevLoader) mayFix(stmt string, changes schema.Changes) schema...
    method inspect (line 378) | func (d *DevLoader) inspect(ctx context.Context) (*schema.Realm, error) {
    method lock (line 398) | func (d *DevLoader) lock(ctx context.Context) (schema.UnlockFunc, erro...
  type FileError (line 413) | type FileError struct
    method Error (line 419) | func (e FileError) Error() string { return e.Err.Error() }
    method Unwrap (line 421) | func (e FileError) Unwrap() error { return e.Err }

FILE: cmd/atlas/internal/migratelint/lint_oss.go
  type Runner (line 29) | type Runner struct
    method Run (line 52) | func (r *Runner) Run(ctx context.Context) error {
    method summary (line 91) | func (r *Runner) summary(ctx context.Context) error {
    method analyze (line 156) | func (r *Runner) analyze(ctx context.Context, files []*sqlcheck.File) ...
  constant StepIntegrityCheck (line 85) | StepIntegrityCheck = "Migration Integrity Check"
  constant StepDetectChanges (line 86) | StepDetectChanges  = "Detect New Migration Files"
  constant StepLoadChanges (line 87) | StepLoadChanges    = "Replay Migration Files"
  constant StepAnalyzeFile (line 88) | StepAnalyzeFile    = "Analyze %s"
  type SummaryReport (line 378) | type SummaryReport struct
    method StepResult (line 487) | func (r *SummaryReport) StepResult(name, text string, result *FileRepo...
    method StepError (line 499) | func (r *SummaryReport) StepError(name, text string, err error) error {
    method WriteSchema (line 509) | func (r *SummaryReport) WriteSchema(c *sqlclient.Client, diff *Changes) {
    method DiagnosticsCount (line 519) | func (r *SummaryReport) DiagnosticsCount() int {
    method VersionStatuses (line 530) | func (r *SummaryReport) VersionStatuses() string {
    method TotalChanges (line 565) | func (r *SummaryReport) TotalChanges() int {
    method NonFileReports (line 579) | func (r *SummaryReport) NonFileReports() (rs []*StepReport) {
  type FileChange (line 414) | type FileChange
  type StepReport (line 417) | type StepReport struct
  type FileReport (line 431) | type FileReport struct
    method Line (line 594) | func (f *FileReport) Line(pos int) int {
    method SuggestedFixes (line 599) | func (f *FileReport) SuggestedFixes() []sqlcheck.SuggestedFix {
    method WriteReport (line 621) | func (f *FileReport) WriteReport(r sqlcheck.Report) {
  type ReportWriter (line 445) | type ReportWriter interface
  type TemplateWriter (line 450) | type TemplateWriter struct
    method WriteReport (line 626) | func (w *TemplateWriter) WriteReport(r *SummaryReport) error {
  type SilentError (line 457) | type SilentError struct
    method Unwrap (line 630) | func (err SilentError) Unwrap() error { return err.error }
  constant FileChangeAdded (line 461) | FileChangeAdded    FileChange = "ADDED"
  constant FileChangeDeleted (line 462) | FileChangeDeleted  FileChange = "DELETED"
  constant FileChangeModified (line 463) | FileChangeModified FileChange = "MODIFIED"
  function NewSummaryReport (line 467) | func NewSummaryReport(c *sqlclient.Client, dir migrate.Dir) *SummaryRepo...
  function NewFileReport (line 589) | func NewFileReport(f *sqlcheck.File) *FileReport {
  function nolintRules (line 632) | func nolintRules(f *sqlcheck.File) *skipRules {
  type skipRules (line 660) | type skipRules struct
    method reporterFor (line 666) | func (s *skipRules) reporterFor(rw sqlcheck.ReportWriter, az sqlcheck....
  method stmts (line 692) | func (d *DevLoader) stmts(_ context.Context, f migrate.File, _ bool) ([]...

FILE: cmd/atlas/internal/migratelint/lint_test.go
  function TestGitChangeDetector (line 24) | func TestGitChangeDetector(t *testing.T) {
  function TestDirChangeDetector (line 88) | func TestDirChangeDetector(t *testing.T) {
  function TestLatestChanges (line 107) | func TestLatestChanges(t *testing.T) {

FILE: cmd/atlas/internal/sqlparse/myparse/myparse_oss.go
  type FileParser (line 17) | type FileParser struct
    method FixChange (line 20) | func (*FileParser) FixChange(migrate.Driver, string, schema.Changes) (...
    method ColumnFilledBefore (line 25) | func (*FileParser) ColumnFilledBefore([]*migrate.Stmt, *schema.Table, ...
    method CreateViewAfter (line 30) | func (*FileParser) CreateViewAfter([]*migrate.Stmt, string, string, in...

FILE: cmd/atlas/internal/sqlparse/parseutil/parseutil.go
  type Rename (line 16) | type Rename struct
  function RenameColumn (line 21) | func RenameColumn(modify *schema.ModifyTable, r *Rename) {
  function RenameIndex (line 51) | func RenameIndex(modify *schema.ModifyTable, r *Rename) {
  function RenameTable (line 66) | func RenameTable(changes schema.Changes, r *Rename) schema.Changes {
  function MatchStmtBefore (line 80) | func MatchStmtBefore(stmts []*migrate.Stmt, pos int, p func(*migrate.Stm...
  function MatchStmtAfter (line 100) | func MatchStmtAfter(stmts []*migrate.Stmt, pos int, p func(*migrate.Stmt...

FILE: cmd/atlas/internal/sqlparse/pgparse/pgparse_oss.go
  type Parser (line 16) | type Parser struct
    method ColumnFilledBefore (line 18) | func (*Parser) ColumnFilledBefore([]*migrate.Stmt, *schema.Table, *sch...
    method CreateViewAfter (line 22) | func (*Parser) CreateViewAfter([]*migrate.Stmt, string, string, int) (...
    method FixChange (line 26) | func (*Parser) FixChange(_ migrate.Driver, _ string, changes schema.Ch...

FILE: cmd/atlas/internal/sqlparse/sqliteparse/lexer.go
  type Lexer (line 17) | type Lexer struct
  function lexerLexerInit (line 37) | func lexerLexerInit() {
  function LexerInit (line 919) | func LexerInit() {
  function NewLexer (line 925) | func NewLexer(input antlr.CharStream) *Lexer {
  constant LexerSCOL (line 944) | LexerSCOL                = 1
  constant LexerDOT (line 945) | LexerDOT                 = 2
  constant LexerOPEN_PAR (line 946) | LexerOPEN_PAR            = 3
  constant LexerCLOSE_PAR (line 947) | LexerCLOSE_PAR           = 4
  constant LexerCOMMA (line 948) | LexerCOMMA               = 5
  constant LexerASSIGN (line 949) | LexerASSIGN              = 6
  constant LexerSTAR (line 950) | LexerSTAR                = 7
  constant LexerPLUS (line 951) | LexerPLUS                = 8
  constant LexerMINUS (line 952) | LexerMINUS               = 9
  constant LexerTILDE (line 953) | LexerTILDE               = 10
  constant LexerPIPE2 (line 954) | LexerPIPE2               = 11
  constant LexerDIV (line 955) | LexerDIV                 = 12
  constant LexerMOD (line 956) | LexerMOD                 = 13
  constant LexerLT2 (line 957) | LexerLT2                 = 14
  constant LexerGT2 (line 958) | LexerGT2                 = 15
  constant LexerAMP (line 959) | LexerAMP                 = 16
  constant LexerPIPE (line 960) | LexerPIPE                = 17
  constant LexerLT (line 961) | LexerLT                  = 18
  constant LexerLT_EQ (line 962) | LexerLT_EQ               = 19
  constant LexerGT (line 963) | LexerGT                  = 20
  constant LexerGT_EQ (line 964) | LexerGT_EQ               = 21
  constant LexerEQ (line 965) | LexerEQ                  = 22
  constant LexerNOT_EQ1 (line 966) | LexerNOT_EQ1             = 23
  constant LexerNOT_EQ2 (line 967) | LexerNOT_EQ2             = 24
  constant LexerABORT_ (line 968) | LexerABORT_              = 25
  constant LexerACTION_ (line 969) | LexerACTION_             = 26
  constant LexerADD_ (line 970) | LexerADD_                = 27
  constant LexerAFTER_ (line 971) | LexerAFTER_              = 28
  constant LexerALL_ (line 972) | LexerALL_                = 29
  constant LexerALTER_ (line 973) | LexerALTER_              = 30
  constant LexerANALYZE_ (line 974) | LexerANALYZE_            = 31
  constant LexerAND_ (line 975) | LexerAND_                = 32
  constant LexerAS_ (line 976) | LexerAS_                 = 33
  constant LexerASC_ (line 977) | LexerASC_                = 34
  constant LexerATTACH_ (line 978) | LexerATTACH_             = 35
  constant LexerAUTOINCREMENT_ (line 979) | LexerAUTOINCREMENT_      = 36
  constant LexerBEFORE_ (line 980) | LexerBEFORE_             = 37
  constant LexerBEGIN_ (line 981) | LexerBEGIN_              = 38
  constant LexerBETWEEN_ (line 982) | LexerBETWEEN_            = 39
  constant LexerBY_ (line 983) | LexerBY_                 = 40
  constant LexerCASCADE_ (line 984) | LexerCASCADE_            = 41
  constant LexerCASE_ (line 985) | LexerCASE_               = 42
  constant LexerCAST_ (line 986) | LexerCAST_               = 43
  constant LexerCHECK_ (line 987) | LexerCHECK_              = 44
  constant LexerCOLLATE_ (line 988) | LexerCOLLATE_            = 45
  constant LexerCOLUMN_ (line 989) | LexerCOLUMN_             = 46
  constant LexerCOMMIT_ (line 990) | LexerCOMMIT_             = 47
  constant LexerCONFLICT_ (line 991) | LexerCONFLICT_           = 48
  constant LexerCONSTRAINT_ (line 992) | LexerCONSTRAINT_         = 49
  constant LexerCREATE_ (line 993) | LexerCREATE_             = 50
  constant LexerCROSS_ (line 994) | LexerCROSS_              = 51
  constant LexerCURRENT_DATE_ (line 995) | LexerCURRENT_DATE_       = 52
  constant LexerCURRENT_TIME_ (line 996) | LexerCURRENT_TIME_       = 53
  constant LexerCURRENT_TIMESTAMP_ (line 997) | LexerCURRENT_TIMESTAMP_  = 54
  constant LexerDATABASE_ (line 998) | LexerDATABASE_           = 55
  constant LexerDEFAULT_ (line 999) | LexerDEFAULT_            = 56
  constant LexerDEFERRABLE_ (line 1000) | LexerDEFERRABLE_         = 57
  constant LexerDEFERRED_ (line 1001) | LexerDEFERRED_           = 58
  constant LexerDELETE_ (line 1002) | LexerDELETE_             = 59
  constant LexerDESC_ (line 1003) | LexerDESC_               = 60
  constant LexerDETACH_ (line 1004) | LexerDETACH_             = 61
  constant LexerDISTINCT_ (line 1005) | LexerDISTINCT_           = 62
  constant LexerDROP_ (line 1006) | LexerDROP_               = 63
  constant LexerEACH_ (line 1007) | LexerEACH_               = 64
  constant LexerELSE_ (line 1008) | LexerELSE_               = 65
  constant LexerEND_ (line 1009) | LexerEND_                = 66
  constant LexerESCAPE_ (line 1010) | LexerESCAPE_             = 67
  constant LexerEXCEPT_ (line 1011) | LexerEXCEPT_             = 68
  constant LexerEXCLUSIVE_ (line 1012) | LexerEXCLUSIVE_          = 69
  constant LexerEXISTS_ (line 1013) | LexerEXISTS_             = 70
  constant LexerEXPLAIN_ (line 1014) | LexerEXPLAIN_            = 71
  constant LexerFAIL_ (line 1015) | LexerFAIL_               = 72
  constant LexerFOR_ (line 1016) | LexerFOR_                = 73
  constant LexerFOREIGN_ (line 1017) | LexerFOREIGN_            = 74
  constant LexerFROM_ (line 1018) | LexerFROM_               = 75
  constant LexerFULL_ (line 1019) | LexerFULL_               = 76
  constant LexerGLOB_ (line 1020) | LexerGLOB_               = 77
  constant LexerGROUP_ (line 1021) | LexerGROUP_              = 78
  constant LexerHAVING_ (line 1022) | LexerHAVING_             = 79
  constant LexerIF_ (line 1023) | LexerIF_                 = 80
  constant LexerIGNORE_ (line 1024) | LexerIGNORE_             = 81
  constant LexerIMMEDIATE_ (line 1025) | LexerIMMEDIATE_          = 82
  constant LexerIN_ (line 1026) | LexerIN_                 = 83
  constant LexerINDEX_ (line 1027) | LexerINDEX_              = 84
  constant LexerINDEXED_ (line 1028) | LexerINDEXED_            = 85
  constant LexerINITIALLY_ (line 1029) | LexerINITIALLY_          = 86
  constant LexerINNER_ (line 1030) | LexerINNER_              = 87
  constant LexerINSERT_ (line 1031) | LexerINSERT_             = 88
  constant LexerINSTEAD_ (line 1032) | LexerINSTEAD_            = 89
  constant LexerINTERSECT_ (line 1033) | LexerINTERSECT_          = 90
  constant LexerINTO_ (line 1034) | LexerINTO_               = 91
  constant LexerIS_ (line 1035) | LexerIS_                 = 92
  constant LexerISNULL_ (line 1036) | LexerISNULL_             = 93
  constant LexerJOIN_ (line 1037) | LexerJOIN_               = 94
  constant LexerKEY_ (line 1038) | LexerKEY_                = 95
  constant LexerLEFT_ (line 1039) | LexerLEFT_               = 96
  constant LexerLIKE_ (line 1040) | LexerLIKE_               = 97
  constant LexerLIMIT_ (line 1041) | LexerLIMIT_              = 98
  constant LexerMATCH_ (line 1042) | LexerMATCH_              = 99
  constant LexerNATURAL_ (line 1043) | LexerNATURAL_            = 100
  constant LexerNO_ (line 1044) | LexerNO_                 = 101
  constant LexerNOT_ (line 1045) | LexerNOT_                = 102
  constant LexerNOTNULL_ (line 1046) | LexerNOTNULL_            = 103
  constant LexerNULL_ (line 1047) | LexerNULL_               = 104
  constant LexerOF_ (line 1048) | LexerOF_                 = 105
  constant LexerOFFSET_ (line 1049) | LexerOFFSET_             = 106
  constant LexerON_ (line 1050) | LexerON_                 = 107
  constant LexerOR_ (line 1051) | LexerOR_                 = 108
  constant LexerORDER_ (line 1052) | LexerORDER_              = 109
  constant LexerOUTER_ (line 1053) | LexerOUTER_              = 110
  constant LexerPLAN_ (line 1054) | LexerPLAN_               = 111
  constant LexerPRAGMA_ (line 1055) | LexerPRAGMA_             = 112
  constant LexerPRIMARY_ (line 1056) | LexerPRIMARY_            = 113
  constant LexerQUERY_ (line 1057) | LexerQUERY_              = 114
  constant LexerRAISE_ (line 1058) | LexerRAISE_              = 115
  constant LexerRECURSIVE_ (line 1059) | LexerRECURSIVE_          = 116
  constant LexerREFERENCES_ (line 1060) | LexerREFERENCES_         = 117
  constant LexerREGEXP_ (line 1061) | LexerREGEXP_             = 118
  constant LexerREINDEX_ (line 1062) | LexerREINDEX_            = 119
  constant LexerRELEASE_ (line 1063) | LexerRELEASE_            = 120
  constant LexerRENAME_ (line 1064) | LexerRENAME_             = 121
  constant LexerREPLACE_ (line 1065) | LexerREPLACE_            = 122
  constant LexerRESTRICT_ (line 1066) | LexerRESTRICT_           = 123
  constant LexerRETURNING_ (line 1067) | LexerRETURNING_          = 124
  constant LexerRIGHT_ (line 1068) | LexerRIGHT_              = 125
  constant LexerROLLBACK_ (line 1069) | LexerROLLBACK_           = 126
  constant LexerROW_ (line 1070) | LexerROW_                = 127
  constant LexerROWS_ (line 1071) | LexerROWS_               = 128
  constant LexerSAVEPOINT_ (line 1072) | LexerSAVEPOINT_          = 129
  constant LexerSELECT_ (line 1073) | LexerSELECT_             = 130
  constant LexerSET_ (line 1074) | LexerSET_                = 131
  constant LexerTABLE_ (line 1075) | LexerTABLE_              = 132
  constant LexerTEMP_ (line 1076) | LexerTEMP_               = 133
  constant LexerTEMPORARY_ (line 1077) | LexerTEMPORARY_          = 134
  constant LexerTHEN_ (line 1078) | LexerTHEN_               = 135
  constant LexerTO_ (line 1079) | LexerTO_                 = 136
  constant LexerTRANSACTION_ (line 1080) | LexerTRANSACTION_        = 137
  constant LexerTRIGGER_ (line 1081) | LexerTRIGGER_            = 138
  constant LexerUNION_ (line 1082) | LexerUNION_              = 139
  constant LexerUNIQUE_ (line 1083) | LexerUNIQUE_             = 140
  constant LexerUPDATE_ (line 1084) | LexerUPDATE_             = 141
  constant LexerUSING_ (line 1085) | LexerUSING_              = 142
  constant LexerVACUUM_ (line 1086) | LexerVACUUM_             = 143
  constant LexerVALUES_ (line 1087) | LexerVALUES_             = 144
  constant LexerVIEW_ (line 1088) | LexerVIEW_               = 145
  constant LexerVIRTUAL_ (line 1089) | LexerVIRTUAL_            = 146
  constant LexerWHEN_ (line 1090) | LexerWHEN_               = 147
  constant LexerWHERE_ (line 1091) | LexerWHERE_              = 148
  constant LexerWITH_ (line 1092) | LexerWITH_               = 149
  constant LexerWITHOUT_ (line 1093) | LexerWITHOUT_            = 150
  constant LexerFIRST_VALUE_ (line 1094) | LexerFIRST_VALUE_        = 151
  constant LexerOVER_ (line 1095) | LexerOVER_               = 152
  constant LexerPARTITION_ (line 1096) | LexerPARTITION_          = 153
  constant LexerRANGE_ (line 1097) | LexerRANGE_              = 154
  constant LexerPRECEDING_ (line 1098) | LexerPRECEDING_          = 155
  constant LexerUNBOUNDED_ (line 1099) | LexerUNBOUNDED_          = 156
  constant LexerCURRENT_ (line 1100) | LexerCURRENT_            = 157
  constant LexerFOLLOWING_ (line 1101) | LexerFOLLOWING_          = 158
  constant LexerCUME_DIST_ (line 1102) | LexerCUME_DIST_          = 159
  constant LexerDENSE_RANK_ (line 1103) | LexerDENSE_RANK_         = 160
  constant LexerLAG_ (line 1104) | LexerLAG_                = 161
  constant LexerLAST_VALUE_ (line 1105) | LexerLAST_VALUE_         = 162
  constant LexerLEAD_ (line 1106) | LexerLEAD_               = 163
  constant LexerNTH_VALUE_ (line 1107) | LexerNTH_VALUE_          = 164
  constant LexerNTILE_ (line 1108) | LexerNTILE_              = 165
  constant LexerPERCENT_RANK_ (line 1109) | LexerPERCENT_RANK_       = 166
  constant LexerRANK_ (line 1110) | LexerRANK_               = 167
  constant LexerROW_NUMBER_ (line 1111) | LexerROW_NUMBER_         = 168
  constant LexerGENERATED_ (line 1112) | LexerGENERATED_          = 169
  constant LexerALWAYS_ (line 1113) | LexerALWAYS_             = 170
  constant LexerSTORED_ (line 1114) | LexerSTORED_             = 171
  constant LexerTRUE_ (line 1115) | LexerTRUE_               = 172
  constant LexerFALSE_ (line 1116) | LexerFALSE_              = 173
  constant LexerWINDOW_ (line 1117) | LexerWINDOW_             = 174
  constant LexerNULLS_ (line 1118) | LexerNULLS_              = 175
  constant LexerFIRST_ (line 1119) | LexerFIRST_              = 176
  constant LexerLAST_ (line 1120) | LexerLAST_               = 177
  constant LexerFILTER_ (line 1121) | LexerFILTER_             = 178
  constant LexerGROUPS_ (line 1122) | LexerGROUPS_             = 179
  constant LexerEXCLUDE_ (line 1123) | LexerEXCLUDE_            = 180
  constant LexerTIES_ (line 1124) | LexerTIES_               = 181
  constant LexerOTHERS_ (line 1125) | LexerOTHERS_             = 182
  constant LexerDO_ (line 1126) | LexerDO_                 = 183
  constant LexerNOTHING_ (line 1127) | LexerNOTHING_            = 184
  constant LexerIDENTIFIER (line 1128) | LexerIDENTIFIER          = 185
  constant LexerNUMERIC_LITERAL (line 1129) | LexerNUMERIC_LITERAL     = 186
  constant LexerBIND_PARAMETER (line 1130) | LexerBIND_PARAMETER      = 187
  constant LexerSTRING_LITERAL (line 1131) | LexerSTRING_LITERAL      = 188
  constant LexerBLOB_LITERAL (line 1132) | LexerBLOB_LITERAL        = 189
  constant LexerSINGLE_LINE_COMMENT (line 1133) | LexerSINGLE_LINE_COMMENT = 190
  constant LexerMULTILINE_COMMENT (line 1134) | LexerMULTILINE_COMMENT   = 191
  constant LexerSPACES (line 1135) | LexerSPACES              = 192
  constant LexerUNEXPECTED_CHAR (line 1136) | LexerUNEXPECTED_CHAR     = 193

FILE: cmd/atlas/internal/sqlparse/sqliteparse/parser.go
  type Parser (line 17) | type Parser struct
    method Parse (line 1640) | func (p *Parser) Parse() (localctx IParseContext) {
    method Sql_stmt_list (line 1816) | func (p *Parser) Sql_stmt_list() (localctx ISql_stmt_listContext) {
    method Sql_stmt (line 2446) | func (p *Parser) Sql_stmt() (localctx ISql_stmtContext) {
    method Alter_table_stmt (line 2932) | func (p *Parser) Alter_table_stmt() (localctx IAlter_table_stmtContext) {
    method Analyze_stmt (line 3257) | func (p *Parser) Analyze_stmt() (localctx IAnalyze_stmtContext) {
    method Attach_stmt (line 3447) | func (p *Parser) Attach_stmt() (localctx IAttach_stmtContext) {
    method Begin_stmt (line 3622) | func (p *Parser) Begin_stmt() (localctx IBegin_stmtContext) {
    method Commit_stmt (line 3791) | func (p *Parser) Commit_stmt() (localctx ICommit_stmtContext) {
    method Rollback_stmt (line 3952) | func (p *Parser) Rollback_stmt() (localctx IRollback_stmtContext) {
    method Savepoint_stmt (line 4133) | func (p *Parser) Savepoint_stmt() (localctx ISavepoint_stmtContext) {
    method Release_stmt (line 4265) | func (p *Parser) Release_stmt() (localctx IRelease_stmtContext) {
    method Create_index_stmt (line 4562) | func (p *Parser) Create_index_stmt() (localctx ICreate_index_stmtConte...
    method Indexed_column (line 4902) | func (p *Parser) Indexed_column() (localctx IIndexed_columnContext) {
    method Create_table_stmt (line 5278) | func (p *Parser) Create_table_stmt() (localctx ICreate_table_stmtConte...
    method Column_def (line 5684) | func (p *Parser) Column_def() (localctx IColumn_defContext) {
    method Type_name (line 5916) | func (p *Parser) Type_name() (localctx IType_nameContext) {
    method Column_constraint (line 6322) | func (p *Parser) Column_constraint() (localctx IColumn_constraintConte...
    method Signed_number (line 6765) | func (p *Parser) Signed_number() (localctx ISigned_numberContext) {
    method Table_constraint (line 7093) | func (p *Parser) Table_constraint() (localctx ITable_constraintContext) {
    method Foreign_key_clause (line 7687) | func (p *Parser) Foreign_key_clause() (localctx IForeign_key_clauseCon...
    method Conflict_clause (line 8082) | func (p *Parser) Conflict_clause() (localctx IConflict_clauseContext) {
    method Create_trigger_stmt (line 8622) | func (p *Parser) Create_trigger_stmt() (localctx ICreate_trigger_stmtC...
    method Create_view_stmt (line 9250) | func (p *Parser) Create_view_stmt() (localctx ICreate_view_stmtContext) {
    method Create_virtual_table_stmt (line 9662) | func (p *Parser) Create_virtual_table_stmt() (localctx ICreate_virtual...
    method With_clause (line 10043) | func (p *Parser) With_clause() (localctx IWith_clauseContext) {
    method Cte_table_name (line 10330) | func (p *Parser) Cte_table_name() (localctx ICte_table_nameContext) {
    method Recursive_cte (line 10563) | func (p *Parser) Recursive_cte() (localctx IRecursive_cteContext) {
    method Common_table_expression (line 10832) | func (p *Parser) Common_table_expression() (localctx ICommon_table_exp...
    method Delete_stmt (line 11100) | func (p *Parser) Delete_stmt() (localctx IDelete_stmtContext) {
    method Delete_stmt_limited (line 11382) | func (p *Parser) Delete_stmt_limited() (localctx IDelete_stmt_limitedC...
    method Detach_stmt (line 11602) | func (p *Parser) Detach_stmt() (localctx IDetach_stmtContext) {
    method Drop_stmt (line 11808) | func (p *Parser) Drop_stmt() (localctx IDrop_stmtContext) {
    method Expr (line 12496) | func (p *Parser) Expr() (localctx IExprContext) {
    method expr (line 12500) | func (p *Parser) expr(_p int) (localctx IExprContext) {
    method Raise_function (line 13908) | func (p *Parser) Raise_function() (localctx IRaise_functionContext) {
    method Literal_value (line 14118) | func (p *Parser) Literal_value() (localctx ILiteral_valueContext) {
    method Insert_stmt (line 14519) | func (p *Parser) Insert_stmt() (localctx IInsert_stmtContext) {
    method Returning_clause (line 15062) | func (p *Parser) Returning_clause() (localctx IReturning_clauseContext) {
    method Upsert_clause (line 15439) | func (p *Parser) Upsert_clause() (localctx IUpsert_clauseContext) {
    method Pragma_stmt (line 15868) | func (p *Parser) Pragma_stmt() (localctx IPragma_stmtContext) {
    method Pragma_value (line 16078) | func (p *Parser) Pragma_value() (localctx IPragma_valueContext) {
    method Reindex_stmt (line 16283) | func (p *Parser) Reindex_stmt() (localctx IReindex_stmtContext) {
    method Select_stmt (line 16579) | func (p *Parser) Select_stmt() (localctx ISelect_stmtContext) {
    method Join_clause (line 16882) | func (p *Parser) Join_clause() (localctx IJoin_clauseContext) {
    method Select_core (line 17339) | func (p *Parser) Select_core() (localctx ISelect_coreContext) {
    method Factored_select_stmt (line 17898) | func (p *Parser) Factored_select_stmt() (localctx IFactored_select_stm...
    method Simple_select_stmt (line 18063) | func (p *Parser) Simple_select_stmt() (localctx ISimple_select_stmtCon...
    method Compound_select_stmt (line 18338) | func (p *Parser) Compound_select_stmt() (localctx ICompound_select_stm...
    method Table_or_subquery (line 18808) | func (p *Parser) Table_or_subquery() (localctx ITable_or_subqueryConte...
    method Result_column (line 19306) | func (p *Parser) Result_column() (localctx IResult_columnContext) {
    method Join_operator (line 19518) | func (p *Parser) Join_operator() (localctx IJoin_operatorContext) {
    method Join_constraint (line 19811) | func (p *Parser) Join_constraint() (localctx IJoin_constraintContext) {
    method Compound_operator (line 20010) | func (p *Parser) Compound_operator() (localctx ICompound_operatorConte...
    method Update_stmt (line 20382) | func (p *Parser) Update_stmt() (localctx IUpdate_stmtContext) {
    method Assignment_list (line 20702) | func (p *Parser) Assignment_list() (localctx IAssignment_listContext) {
    method Assignment (line 20885) | func (p *Parser) Assignment() (localctx IAssignmentContext) {
    method Column_name_list (line 21075) | func (p *Parser) Column_name_list() (localctx IColumn_name_listContext) {
    method Update_stmt_limited (line 21497) | func (p *Parser) Update_stmt_limited() (localctx IUpdate_stmt_limitedC...
    method Qualified_table_name (line 21902) | func (p *Parser) Qualified_table_name() (localctx IQualified_table_nam...
    method Vacuum_stmt (line 22137) | func (p *Parser) Vacuum_stmt() (localctx IVacuum_stmtContext) {
    method Filter_clause (line 22311) | func (p *Parser) Filter_clause() (localctx IFilter_clauseContext) {
    method Window_defn (line 22600) | func (p *Parser) Window_defn() (localctx IWindow_defnContext) {
    method Over_clause (line 23027) | func (p *Parser) Over_clause() (localctx IOver_clauseContext) {
    method Frame_spec (line 23358) | func (p *Parser) Frame_spec() (localctx IFrame_specContext) {
    method Frame_clause (line 23606) | func (p *Parser) Frame_clause() (localctx IFrame_clauseContext) {
    method Simple_function_invocation (line 23839) | func (p *Parser) Simple_function_invocation() (localctx ISimple_functi...
    method Aggregate_function_invocation (line 24116) | func (p *Parser) Aggregate_function_invocation() (localctx IAggregate_...
    method Window_function_invocation (line 24456) | func (p *Parser) Window_function_invocation() (localctx IWindow_functi...
    method Common_table_stmt (line 24732) | func (p *Parser) Common_table_stmt() (localctx ICommon_table_stmtConte...
    method Order_by_stmt (line 24946) | func (p *Parser) Order_by_stmt() (localctx IOrder_by_stmtContext) {
    method Limit_stmt (line 25147) | func (p *Parser) Limit_stmt() (localctx ILimit_stmtContext) {
    method Ordering_term (line 25350) | func (p *Parser) Ordering_term() (localctx IOrdering_termContext) {
    method Asc_desc (line 25524) | func (p *Parser) Asc_desc() (localctx IAsc_descContext) {
    method Frame_left (line 25672) | func (p *Parser) Frame_left() (localctx IFrame_leftContext) {
    method Frame_right (line 25884) | func (p *Parser) Frame_right() (localctx IFrame_rightContext) {
    method Frame_single (line 26091) | func (p *Parser) Frame_single() (localctx IFrame_singleContext) {
    method Window_function (line 26467) | func (p *Parser) Window_function() (localctx IWindow_functionContext) {
    method Offset (line 27112) | func (p *Parser) Offset() (localctx IOffsetContext) {
    method Default_value (line 27239) | func (p *Parser) Default_value() (localctx IDefault_valueContext) {
    method Partition_by (line 27397) | func (p *Parser) Partition_by() (localctx IPartition_byContext) {
    method Order_by_expr (line 27587) | func (p *Parser) Order_by_expr() (localctx IOrder_by_exprContext) {
    method Order_by_expr_asc_desc (line 27745) | func (p *Parser) Order_by_expr_asc_desc() (localctx IOrder_by_expr_asc...
    method Expr_asc_desc (line 27954) | func (p *Parser) Expr_asc_desc() (localctx IExpr_asc_descContext) {
    method Initial_select (line 28126) | func (p *Parser) Initial_select() (localctx IInitial_selectContext) {
    method Recursive_select (line 28240) | func (p *Parser) Recursive_select() (localctx IRecursive_selectContext) {
    method Unary_operator (line 28357) | func (p *Parser) Unary_operator() (localctx IUnary_operatorContext) {
    method Error_message (line 28468) | func (p *Parser) Error_message() (localctx IError_messageContext) {
    method Module_argument (line 28603) | func (p *Parser) Module_argument() (localctx IModule_argumentContext) {
    method Column_alias (line 28729) | func (p *Parser) Column_alias() (localctx IColumn_aliasContext) {
    method Keyword (line 29610) | func (p *Parser) Keyword() (localctx IKeywordContext) {
    method Name (line 29733) | func (p *Parser) Name() (localctx INameContext) {
    method Function_name (line 29847) | func (p *Parser) Function_name() (localctx IFunction_nameContext) {
    method Schema_name (line 29961) | func (p *Parser) Schema_name() (localctx ISchema_nameContext) {
    method Table_name (line 30075) | func (p *Parser) Table_name() (localctx ITable_nameContext) {
    method Table_or_index_name (line 30189) | func (p *Parser) Table_or_index_name() (localctx ITable_or_index_nameC...
    method Column_name (line 30303) | func (p *Parser) Column_name() (localctx IColumn_nameContext) {
    method Collation_name (line 30417) | func (p *Parser) Collation_name() (localctx ICollation_nameContext) {
    method Foreign_table (line 30531) | func (p *Parser) Foreign_table() (localctx IForeign_tableContext) {
    method Index_name (line 30645) | func (p *Parser) Index_name() (localctx IIndex_nameContext) {
    method Trigger_name (line 30759) | func (p *Parser) Trigger_name() (localctx ITrigger_nameContext) {
    method View_name (line 30873) | func (p *Parser) View_name() (localctx IView_nameContext) {
    method Module_name (line 30987) | func (p *Parser) Module_name() (localctx IModule_nameContext) {
    method Pragma_name (line 31101) | func (p *Parser) Pragma_name() (localctx IPragma_nameContext) {
    method Savepoint_name (line 31215) | func (p *Parser) Savepoint_name() (localctx ISavepoint_nameContext) {
    method Table_alias (line 31329) | func (p *Parser) Table_alias() (localctx ITable_aliasContext) {
    method Transaction_name (line 31443) | func (p *Parser) Transaction_name() (localctx ITransaction_nameContext) {
    method Window_name (line 31557) | func (p *Parser) Window_name() (localctx IWindow_nameContext) {
    method Alias (line 31671) | func (p *Parser) Alias() (localctx IAliasContext) {
    method Filename (line 31785) | func (p *Parser) Filename() (localctx IFilenameContext) {
    method Base_window_name (line 31899) | func (p *Parser) Base_window_name() (localctx IBase_window_nameContext) {
    method Simple_func (line 32013) | func (p *Parser) Simple_func() (localctx ISimple_funcContext) {
    method Aggregate_func (line 32127) | func (p *Parser) Aggregate_func() (localctx IAggregate_funcContext) {
    method Table_function_name (line 32241) | func (p *Parser) Table_function_name() (localctx ITable_function_nameC...
    method Any_name (line 32392) | func (p *Parser) Any_name() (localctx IAny_nameContext) {
    method Sempred (line 32472) | func (p *Parser) Sempred(localctx antlr.RuleContext, ruleIndex, predIn...
    method Expr_Sempred (line 32486) | func (p *Parser) Expr_Sempred(localctx antlr.RuleContext, predIndex in...
  function parserParserInit (line 32) | func parserParserInit() {
  function ParserInit (line 1182) | func ParserInit() {
  function NewParser (line 1188) | func NewParser(input antlr.TokenStream) *Parser {
  constant ParserEOF (line 1204) | ParserEOF                 = antlr.TokenEOF
  constant ParserSCOL (line 1205) | ParserSCOL                = 1
  constant ParserDOT (line 1206) | ParserDOT                 = 2
  constant ParserOPEN_PAR (line 1207) | ParserOPEN_PAR            = 3
  constant ParserCLOSE_PAR (line 1208) | ParserCLOSE_PAR           = 4
  constant ParserCOMMA (line 1209) | ParserCOMMA               = 5
  constant ParserASSIGN (line 1210) | ParserASSIGN              = 6
  constant ParserSTAR (line 1211) | ParserSTAR                = 7
  constant ParserPLUS (line 1212) | ParserPLUS                = 8
  constant ParserMINUS (line 1213) | ParserMINUS               = 9
  constant ParserTILDE (line 1214) | ParserTILDE               = 10
  constant ParserPIPE2 (line 1215) | ParserPIPE2               = 11
  constant ParserDIV (line 1216) | ParserDIV                 = 12
  constant ParserMOD (line 1217) | ParserMOD                 = 13
  constant ParserLT2 (line 1218) | ParserLT2                 = 14
  constant ParserGT2 (line 1219) | ParserGT2                 = 15
  constant ParserAMP (line 1220) | ParserAMP                 = 16
  constant ParserPIPE (line 1221) | ParserPIPE                = 17
  constant ParserLT (line 1222) | ParserLT                  = 18
  constant ParserLT_EQ (line 1223) | ParserLT_EQ               = 19
  constant ParserGT (line 1224) | ParserGT                  = 20
  constant ParserGT_EQ (line 1225) | ParserGT_EQ               = 21
  constant ParserEQ (line 1226) | ParserEQ                  = 22
  constant ParserNOT_EQ1 (line 1227) | ParserNOT_EQ1             = 23
  constant ParserNOT_EQ2 (line 1228) | ParserNOT_EQ2             = 24
  constant ParserABORT_ (line 1229) | ParserABORT_              = 25
  constant ParserACTION_ (line 1230) | ParserACTION_             = 26
  constant ParserADD_ (line 1231) | ParserADD_                = 27
  constant ParserAFTER_ (line 1232) | ParserAFTER_              = 28
  constant ParserALL_ (line 1233) | ParserALL_                = 29
  constant ParserALTER_ (line 1234) | ParserALTER_              = 30
  constant ParserANALYZE_ (line 1235) | ParserANALYZE_            = 31
  constant ParserAND_ (line 1236) | ParserAND_                = 32
  constant ParserAS_ (line 1237) | ParserAS_                 = 33
  constant ParserASC_ (line 1238) | ParserASC_                = 34
  constant ParserATTACH_ (line 1239) | ParserATTACH_             = 35
  constant ParserAUTOINCREMENT_ (line 1240) | ParserAUTOINCREMENT_      = 36
  constant ParserBEFORE_ (line 1241) | ParserBEFORE_             = 37
  constant ParserBEGIN_ (line 1242) | ParserBEGIN_              = 38
  constant ParserBETWEEN_ (line 1243) | ParserBETWEEN_            = 39
  constant ParserBY_ (line 1244) | ParserBY_                 = 40
  constant ParserCASCADE_ (line 1245) | ParserCASCADE_            = 41
  constant ParserCASE_ (line 1246) | ParserCASE_               = 42
  constant ParserCAST_ (line 1247) | ParserCAST_               = 43
  constant ParserCHECK_ (line 1248) | ParserCHECK_              = 44
  constant ParserCOLLATE_ (line 1249) | ParserCOLLATE_            = 45
  constant ParserCOLUMN_ (line 1250) | ParserCOLUMN_             = 46
  constant ParserCOMMIT_ (line 1251) | ParserCOMMIT_             = 47
  constant ParserCONFLICT_ (line 1252) | ParserCONFLICT_           = 48
  constant ParserCONSTRAINT_ (line 1253) | ParserCONSTRAINT_         = 49
  constant ParserCREATE_ (line 1254) | ParserCREATE_             = 50
  constant ParserCROSS_ (line 1255) | ParserCROSS_              = 51
  constant ParserCURRENT_DATE_ (line 1256) | ParserCURRENT_DATE_       = 52
  constant ParserCURRENT_TIME_ (line 1257) | ParserCURRENT_TIME_       = 53
  constant ParserCURRENT_TIMESTAMP_ (line 1258) | ParserCURRENT_TIMESTAMP_  = 54
  constant ParserDATABASE_ (line 1259) | ParserDATABASE_           = 55
  constant ParserDEFAULT_ (line 1260) | ParserDEFAULT_            = 56
  constant ParserDEFERRABLE_ (line 1261) | ParserDEFERRABLE_         = 57
  constant ParserDEFERRED_ (line 1262) | ParserDEFERRED_           = 58
  constant ParserDELETE_ (line 1263) | ParserDELETE_             = 59
  constant ParserDESC_ (line 1264) | ParserDESC_               = 60
  constant ParserDETACH_ (line 1265) | ParserDETACH_             = 61
  constant ParserDISTINCT_ (line 1266) | ParserDISTINCT_           = 62
  constant ParserDROP_ (line 1267) | ParserDROP_               = 63
  constant ParserEACH_ (line 1268) | ParserEACH_               = 64
  constant ParserELSE_ (line 1269) | ParserELSE_               = 65
  constant ParserEND_ (line 1270) | ParserEND_                = 66
  constant ParserESCAPE_ (line 1271) | ParserESCAPE_             = 67
  constant ParserEXCEPT_ (line 1272) | ParserEXCEPT_             = 68
  constant ParserEXCLUSIVE_ (line 1273) | ParserEXCLUSIVE_          = 69
  constant ParserEXISTS_ (line 1274) | ParserEXISTS_             = 70
  constant ParserEXPLAIN_ (line 1275) | ParserEXPLAIN_            = 71
  constant ParserFAIL_ (line 1276) | ParserFAIL_               = 72
  constant ParserFOR_ (line 1277) | ParserFOR_                = 73
  constant ParserFOREIGN_ (line 1278) | ParserFOREIGN_            = 74
  constant ParserFROM_ (line 1279) | ParserFROM_               = 75
  constant ParserFULL_ (line 1280) | ParserFULL_               = 76
  constant ParserGLOB_ (line 1281) | ParserGLOB_               = 77
  constant ParserGROUP_ (line 1282) | ParserGROUP_              = 78
  constant ParserHAVING_ (line 1283) | ParserHAVING_             = 79
  constant ParserIF_ (line 1284) | ParserIF_                 = 80
  constant ParserIGNORE_ (line 1285) | ParserIGNORE_             = 81
  constant ParserIMMEDIATE_ (line 1286) | ParserIMMEDIATE_          = 82
  constant ParserIN_ (line 1287) | ParserIN_                 = 83
  constant ParserINDEX_ (line 1288) | ParserINDEX_              = 84
  constant ParserINDEXED_ (line 1289) | ParserINDEXED_            = 85
  constant ParserINITIALLY_ (line 1290) | ParserINITIALLY_          = 86
  constant ParserINNER_ (line 1291) | ParserINNER_              = 87
  constant ParserINSERT_ (line 1292) | ParserINSERT_             = 88
  constant ParserINSTEAD_ (line 1293) | ParserINSTEAD_            = 89
  constant ParserINTERSECT_ (line 1294) | ParserINTERSECT_          = 90
  constant ParserINTO_ (line 1295) | ParserINTO_               = 91
  constant ParserIS_ (line 1296) | ParserIS_                 = 92
  constant ParserISNULL_ (line 1297) | ParserISNULL_             = 93
  constant ParserJOIN_ (line 1298) | ParserJOIN_               = 94
  constant ParserKEY_ (line 1299) | ParserKEY_                = 95
  constant ParserLEFT_ (line 1300) | ParserLEFT_               = 96
  constant ParserLIKE_ (line 1301) | ParserLIKE_               = 97
  constant ParserLIMIT_ (line 1302) | ParserLIMIT_              = 98
  constant ParserMATCH_ (line 1303) | ParserMATCH_              = 99
  constant ParserNATURAL_ (line 1304) | ParserNATURAL_            = 100
  constant ParserNO_ (line 1305) | ParserNO_                 = 101
  constant ParserNOT_ (line 1306) | ParserNOT_                = 102
  constant ParserNOTNULL_ (line 1307) | ParserNOTNULL_            = 103
  constant ParserNULL_ (line 1308) | ParserNULL_               = 104
  constant ParserOF_ (line 1309) | ParserOF_                 = 105
  constant ParserOFFSET_ (line 1310) | ParserOFFSET_             = 106
  constant ParserON_ (line 1311) | ParserON_                 = 107
  constant ParserOR_ (line 1312) | ParserOR_                 = 108
  constant ParserORDER_ (line 1313) | ParserORDER_              = 109
  constant ParserOUTER_ (line 1314) | ParserOUTER_              = 110
  constant ParserPLAN_ (line 1315) | ParserPLAN_               = 111
  constant ParserPRAGMA_ (line 1316) | ParserPRAGMA_             = 112
  constant ParserPRIMARY_ (line 1317) | ParserPRIMARY_            = 113
  constant ParserQUERY_ (line 1318) | ParserQUERY_              = 114
  constant ParserRAISE_ (line 1319) | ParserRAISE_              = 115
  constant ParserRECURSIVE_ (line 1320) | ParserRECURSIVE_          = 116
  constant ParserREFERENCES_ (line 1321) | ParserREFERENCES_         = 117
  constant ParserREGEXP_ (line 1322) | ParserREGEXP_             = 118
  constant ParserREINDEX_ (line 1323) | ParserREINDEX_            = 119
  constant ParserRELEASE_ (line 1324) | ParserRELEASE_            = 120
  constant ParserRENAME_ (line 1325) | ParserRENAME_             = 121
  constant ParserREPLACE_ (line 1326) | ParserREPLACE_            = 122
  constant ParserRESTRICT_ (line 1327) | ParserRESTRICT_           = 123
  constant ParserRETURNING_ (line 1328) | ParserRETURNING_          = 124
  constant ParserRIGHT_ (line 1329) | ParserRIGHT_              = 125
  constant ParserROLLBACK_ (line 1330) | ParserROLLBACK_           = 126
  constant ParserROW_ (line 1331) | ParserROW_                = 127
  constant ParserROWS_ (line 1332) | ParserROWS_               = 128
  constant ParserSAVEPOINT_ (line 1333) | ParserSAVEPOINT_          = 129
  constant ParserSELECT_ (line 1334) | ParserSELECT_             = 130
  constant ParserSET_ (line 1335) | ParserSET_                = 131
  constant ParserTABLE_ (line 1336) | ParserTABLE_              = 132
  constant ParserTEMP_ (line 1337) | ParserTEMP_               = 133
  constant ParserTEMPORARY_ (line 1338) | ParserTEMPORARY_          = 134
  constant ParserTHEN_ (line 1339) | ParserTHEN_               = 135
  constant ParserTO_ (line 1340) | ParserTO_                 = 136
  constant ParserTRANSACTION_ (line 1341) | ParserTRANSACTION_        = 137
  constant ParserTRIGGER_ (line 1342) | ParserTRIGGER_            = 138
  constant ParserUNION_ (line 1343) | ParserUNION_              = 139
  constant ParserUNIQUE_ (line 1344) | ParserUNIQUE_             = 140
  constant ParserUPDATE_ (line 1345) | ParserUPDATE_             = 141
  constant ParserUSING_ (line 1346) | ParserUSING_              = 142
  constant ParserVACUUM_ (line 1347) | ParserVACUUM_             = 143
  constant ParserVALUES_ (line 1348) | ParserVALUES_             = 144
  constant ParserVIEW_ (line 1349) | ParserVIEW_               = 145
  constant ParserVIRTUAL_ (line 1350) | ParserVIRTUAL_            = 146
  constant ParserWHEN_ (line 1351) | ParserWHEN_               = 147
  constant ParserWHERE_ (line 1352) | ParserWHERE_              = 148
  constant ParserWITH_ (line 1353) | ParserWITH_               = 149
  constant ParserWITHOUT_ (line 1354) | ParserWITHOUT_            = 150
  constant ParserFIRST_VALUE_ (line 1355) | ParserFIRST_VALUE_        = 151
  constant ParserOVER_ (line 1356) | ParserOVER_               = 152
  constant ParserPARTITION_ (line 1357) | ParserPARTITION_          = 153
  constant ParserRANGE_ (line 1358) | ParserRANGE_              = 154
  constant ParserPRECEDING_ (line 1359) | ParserPRECEDING_          = 155
  constant ParserUNBOUNDED_ (line 1360) | ParserUNBOUNDED_          = 156
  constant ParserCURRENT_ (line 1361) | ParserCURRENT_            = 157
  constant ParserFOLLOWING_ (line 1362) | ParserFOLLOWING_          = 158
  constant ParserCUME_DIST_ (line 1363) | ParserCUME_DIST_          = 159
  constant ParserDENSE_RANK_ (line 1364) | ParserDENSE_RANK_         = 160
  constant ParserLAG_ (line 1365) | ParserLAG_                = 161
  constant ParserLAST_VALUE_ (line 1366) | ParserLAST_VALUE_         = 162
  constant ParserLEAD_ (line 1367) | ParserLEAD_               = 163
  constant ParserNTH_VALUE_ (line 1368) | ParserNTH_VALUE_          = 164
  constant ParserNTILE_ (line 1369) | ParserNTILE_              = 165
  constant ParserPERCENT_RANK_ (line 1370) | ParserPERCENT_RANK_       = 166
  constant ParserRANK_ (line 1371) | ParserRANK_               = 167
  constant ParserROW_NUMBER_ (line 1372) | ParserROW_NUMBER_         = 168
  constant ParserGENERATED_ (line 1373) | ParserGENERATED_          = 169
  constant ParserALWAYS_ (line 1374) | ParserALWAYS_             = 170
  constant ParserSTORED_ (line 1375) | ParserSTORED_             = 171
  constant ParserTRUE_ (line 1376) | ParserTRUE_               = 172
  constant ParserFALSE_ (line 1377) | ParserFALSE_              = 173
  constant ParserWINDOW_ (line 1378) | ParserWINDOW_             = 174
  constant ParserNULLS_ (line 1379) | ParserNULLS_              = 175
  constant ParserFIRST_ (line 1380) | ParserFIRST_              = 176
  constant ParserLAST_ (line 1381) | ParserLAST_               = 177
  constant ParserFILTER_ (line 1382) | ParserFILTER_             = 178
  constant ParserGROUPS_ (line 1383) | ParserGROUPS_             = 179
  constant ParserEXCLUDE_ (line 1384) | ParserEXCLUDE_            = 180
  constant ParserTIES_ (line 1385) | ParserTIES_               = 181
  constant ParserOTHERS_ (line 1386) | ParserOTHERS_             = 182
  constant ParserDO_ (line 1387) | ParserDO_                 = 183
  constant ParserNOTHING_ (line 1388) | ParserNOTHING_            = 184
  constant ParserIDENTIFIER (line 1389) | ParserIDENTIFIER          = 185
  constant ParserNUMERIC_LITERAL (line 1390) | ParserNUMERIC_LITERAL     = 186
  constant ParserBIND_PARAMETER (line 1391) | ParserBIND_PARAMETER      = 187
  constant ParserSTRING_LITERAL (line 1392) | ParserSTRING_LITERAL      = 188
  constant ParserBLOB_LITERAL (line 1393) | ParserBLOB_LITERAL        = 189
  constant ParserSINGLE_LINE_COMMENT (line 1394) | ParserSINGLE_LINE_COMMENT = 190
  constant ParserMULTILINE_COMMENT (line 1395) | ParserMULTILINE_COMMENT   = 191
  constant ParserSPACES (line 1396) | ParserSPACES              = 192
  constant ParserUNEXPECTED_CHAR (line 1397) | ParserUNEXPECTED_CHAR     = 193
  constant ParserRULE_parse (line 1402) | ParserRULE_parse                         = 0
  constant ParserRULE_sql_stmt_list (line 1403) | ParserRULE_sql_stmt_list                 = 1
  constant ParserRULE_sql_stmt (line 1404) | ParserRULE_sql_stmt                      = 2
  constant ParserRULE_alter_table_stmt (line 1405) | ParserRULE_alter_table_stmt              = 3
  constant ParserRULE_analyze_stmt (line 1406) | ParserRULE_analyze_stmt                  = 4
  constant ParserRULE_attach_stmt (line 1407) | ParserRULE_attach_stmt                   = 5
  constant ParserRULE_begin_stmt (line 1408) | ParserRULE_begin_stmt                    = 6
  constant ParserRULE_commit_stmt (line 1409) | ParserRULE_commit_stmt                   = 7
  constant ParserRULE_rollback_stmt (line 1410) | ParserRULE_rollback_stmt                 = 8
  constant ParserRULE_savepoint_stmt (line 1411) | ParserRULE_savepoint_stmt                = 9
  constant ParserRULE_release_stmt (line 1412) | ParserRULE_release_stmt                  = 10
  constant ParserRULE_create_index_stmt (line 1413) | ParserRULE_create_index_stmt             = 11
  constant ParserRULE_indexed_column (line 1414) | ParserRULE_indexed_column                = 12
  constant ParserRULE_create_table_stmt (line 1415) | ParserRULE_create_table_stmt             = 13
  constant ParserRULE_column_def (line 1416) | ParserRULE_column_def                    = 14
  constant ParserRULE_type_name (line 1417) | ParserRULE_type_name                     = 15
  constant ParserRULE_column_constraint (line 1418) | ParserRULE_column_constraint             = 16
  constant ParserRULE_signed_number (line 1419) | ParserRULE_signed_number                 = 17
  constant ParserRULE_table_constraint (line 1420) | ParserRULE_table_constraint              = 18
  constant ParserRULE_foreign_key_clause (line 1421) | ParserRULE_foreign_key_clause            = 19
  constant ParserRULE_conflict_clause (line 1422) | ParserRULE_conflict_clause               = 20
  constant ParserRULE_create_trigger_stmt (line 1423) | ParserRULE_create_trigger_stmt           = 21
  constant ParserRULE_create_view_stmt (line 1424) | ParserRULE_create_view_stmt              = 22
  constant ParserRULE_create_virtual_table_stmt (line 1425) | ParserRULE_create_virtual_table_stmt     = 23
  constant ParserRULE_with_clause (line 1426) | ParserRULE_with_clause                   = 24
  constant ParserRULE_cte_table_name (line 1427) | ParserRULE_cte_table_name                = 25
  constant ParserRULE_recursive_cte (line 1428) | ParserRULE_recursive_cte                 = 26
  constant ParserRULE_common_table_expression (line 1429) | ParserRULE_common_table_expression       = 27
  constant ParserRULE_delete_stmt (line 1430) | ParserRULE_delete_stmt                   = 28
  constant ParserRULE_delete_stmt_limited (line 1431) | ParserRULE_delete_stmt_limited           = 29
  constant ParserRULE_detach_stmt (line 1432) | ParserRULE_detach_stmt                   = 30
  constant ParserRULE_drop_stmt (line 1433) | ParserRULE_drop_stmt                     = 31
  constant ParserRULE_expr (line 1434) | ParserRULE_expr                          = 32
  constant ParserRULE_raise_function (line 1435) | ParserRULE_raise_function                = 33
  constant ParserRULE_literal_value (line 1436) | ParserRULE_literal_value                 = 34
  constant ParserRULE_insert_stmt (line 1437) | ParserRULE_insert_stmt                   = 35
  constant ParserRULE_returning_clause (line 1438) | ParserRULE_returning_clause              = 36
  constant ParserRULE_upsert_clause (line 1439) | ParserRULE_upsert_clause                 = 37
  constant ParserRULE_pragma_stmt (line 1440) | ParserRULE_pragma_stmt                   = 38
  constant ParserRULE_pragma_value (line 1441) | ParserRULE_pragma_value                  = 39
  constant ParserRULE_reindex_stmt (line 1442) | ParserRULE_reindex_stmt                  = 40
  constant ParserRULE_select_stmt (line 1443) | ParserRULE_select_stmt                   = 41
  constant ParserRULE_join_clause (line 1444) | ParserRULE_join_clause                   = 42
  constant ParserRULE_select_core (line 1445) | ParserRULE_select_core                   = 43
  constant ParserRULE_factored_select_stmt (line 1446) | ParserRULE_factored_select_stmt          = 44
  constant ParserRULE_simple_select_stmt (line 1447) | ParserRULE_simple_select_stmt            = 45
  constant ParserRULE_compound_select_stmt (line 1448) | ParserRULE_compound_select_stmt          = 46
  constant ParserRULE_table_or_subquery (line 1449) | ParserRULE_table_or_subquery             = 47
  constant ParserRULE_result_column (line 1450) | ParserRULE_result_column                 = 48
  constant ParserRULE_join_operator (line 1451) | ParserRULE_join_operator                 = 49
  constant ParserRULE_join_constraint (line 1452) | ParserRULE_join_constraint               = 50
  constant ParserRULE_compound_operator (line 1453) | ParserRULE_compound_operator             = 51
  constant ParserRULE_update_stmt (line 1454) | ParserRULE_update_stmt                   = 52
  constant ParserRULE_assignment_list (line 1455) | ParserRULE_assignment_list               = 53
  constant ParserRULE_assignment (line 1456) | ParserRULE_assignment                    = 54
  constant ParserRULE_column_name_list (line 1457) | ParserRULE_column_name_list              = 55
  constant ParserRULE_update_stmt_limited (line 1458) | ParserRULE_update_stmt_limited           = 56
  constant ParserRULE_qualified_table_name (line 1459) | ParserRULE_qualified_table_name          = 57
  constant ParserRULE_vacuum_stmt (line 1460) | ParserRULE_vacuum_stmt                   = 58
  constant ParserRULE_filter_clause (line 1461) | ParserRULE_filter_clause                 = 59
  constant ParserRULE_window_defn (line 1462) | ParserRULE_window_defn                   = 60
  constant ParserRULE_over_clause (line 1463) | ParserRULE_over_clause                   = 61
  constant ParserRULE_frame_spec (line 1464) | ParserRULE_frame_spec                    = 62
  constant ParserRULE_frame_clause (line 1465) | ParserRULE_frame_clause                  = 63
  constant ParserRULE_simple_function_invocation (line 1466) | ParserRULE_simple_function_invocation    = 64
  constant ParserRULE_aggregate_function_invocation (line 1467) | ParserRULE_aggregate_function_invocation = 65
  constant ParserRULE_window_function_invocation (line 1468) | ParserRULE_window_function_invocation    = 66
  constant ParserRULE_common_table_stmt (line 1469) | ParserRULE_common_table_stmt             = 67
  constant ParserRULE_order_by_stmt (line 1470) | ParserRULE_order_by_stmt                 = 68
  constant ParserRULE_limit_stmt (line 1471) | ParserRULE_limit_stmt                    = 69
  constant ParserRULE_ordering_term (line 1472) | ParserRULE_ordering_term                 = 70
  constant ParserRULE_asc_desc (line 1473) | ParserRULE_asc_desc                      = 71
  constant ParserRULE_frame_left (line 1474) | ParserRULE_frame_left                    = 72
  constant ParserRULE_frame_right (line 1475) | ParserRULE_frame_right                   = 73
  constant ParserRULE_frame_single (line 1476) | ParserRULE_frame_single                  = 74
  constant ParserRULE_window_function (line 1477) | ParserRULE_window_function               = 75
  constant ParserRULE_offset (line 1478) | ParserRULE_offset                        = 76
  constant ParserRULE_default_value (line 1479) | ParserRULE_default_value                 = 77
  constant ParserRULE_partition_by (line 1480) | ParserRULE_partition_by                  = 78
  constant ParserRULE_order_by_expr (line 1481) | ParserRULE_order_by_expr                 = 79
  constant ParserRULE_order_by_expr_asc_desc (line 1482) | ParserRULE_order_by_expr_asc_desc        = 80
  constant ParserRULE_expr_asc_desc (line 1483) | ParserRULE_expr_asc_desc                 = 81
  constant ParserRULE_initial_select (line 1484) | ParserRULE_initial_select                = 82
  constant ParserRULE_recursive_select (line 1485) | ParserRULE_recursive_select              = 83
  constant ParserRULE_unary_operator (line 1486) | ParserRULE_unary_operator                = 84
  constant ParserRULE_error_message (line 1487) | ParserRULE_error_message                 = 85
  constant ParserRULE_module_argument (line 1488) | ParserRULE_module_argument               = 86
  constant ParserRULE_column_alias (line 1489) | ParserRULE_column_alias                  = 87
  constant ParserRULE_keyword (line 1490) | ParserRULE_keyword                       = 88
  constant ParserRULE_name (line 1491) | ParserRULE_name                          = 89
  constant ParserRULE_function_name (line 1492) | ParserRULE_function_name                 = 90
  constant ParserRULE_schema_name (line 1493) | ParserRULE_schema_name                   = 91
  constant ParserRULE_table_name (line 1494) | ParserRULE_table_name                    = 92
  constant ParserRULE_table_or_index_name (line 1495) | ParserRULE_table_or_index_name           = 93
  constant ParserRULE_column_name (line 1496) | ParserRULE_column_name                   = 94
  constant ParserRULE_collation_name (line 1497) | ParserRULE_collation_name                = 95
  constant ParserRULE_foreign_table (line 1498) | ParserRULE_foreign_table                 = 96
  constant ParserRULE_index_name (line 1499) | ParserRULE_index_name                    = 97
  constant ParserRULE_trigger_name (line 1500) | ParserRULE_trigger_name                  = 98
  constant ParserRULE_view_name (line 1501) | ParserRULE_view_name                     = 99
  constant ParserRULE_module_name (line 1502) | ParserRULE_module_name                   = 100
  constant ParserRULE_pragma_name (line 1503) | ParserRULE_pragma_name                   = 101
  constant ParserRULE_savepoint_name (line 1504) | ParserRULE_savepoint_name                = 102
  constant ParserRULE_table_alias (line 1505) | ParserRULE_table_alias                   = 103
  constant ParserRULE_transaction_name (line 1506) | ParserRULE_transaction_name              = 104
  constant ParserRULE_window_name (line 1507) | ParserRULE_window_name                   = 105
  constant ParserRULE_alias (line 1508) | ParserRULE_alias                         = 106
  constant ParserRULE_filename (line 1509) | ParserRULE_filename                      = 107
  constant ParserRULE_base_window_name (line 1510) | ParserRULE_base_window_name              = 108
  constant ParserRULE_simple_func (line 1511) | ParserRULE_simple_func                   = 109
  constant ParserRULE_aggregate_func (line 1512) | ParserRULE_aggregate_func                = 110
  constant ParserRULE_table_function_name (line 1513) | ParserRULE_table_function_name           = 111
  constant ParserRULE_any_name (line 1514) | ParserRULE_any_name                      = 112
  type IParseContext (line 1518) | type IParseContext interface
  type ParseContext (line 1533) | type ParseContext struct
    method IsParseContext (line 1550) | func (*ParseContext) IsParseContext() {}
    method GetParser (line 1563) | func (s *ParseContext) GetParser() antlr.Parser { return s.parser }
    method EOF (line 1565) | func (s *ParseContext) EOF() antlr.TerminalNode {
    method AllSql_stmt_list (line 1569) | func (s *ParseContext) AllSql_stmt_list() []ISql_stmt_listContext {
    method Sql_stmt_list (line 1590) | func (s *ParseContext) Sql_stmt_list(i int) ISql_stmt_listContext {
    method GetRuleContext (
Condensed preview — 530 files, each showing path, character count, and a content snippet. Download the .json file or copy for the full structured content (4,683K chars).
[
  {
    "path": ".github/ops/mysql/Dockerfile",
    "chars": 418,
    "preview": "ARG DIALECT=mysql:8.0\n\nFROM $DIALECT as builder\n\nARG SERVER=mysqld\nENV MYSQL_ROOT_PASSWORD=pass\n\n# Remove the last line "
  },
  {
    "path": ".github/workflows/cd-docker-push-cockroach_oss.yaml",
    "chars": 1037,
    "preview": "name: CD - Build Docker - Cockroach - Community Edition\non:\n  pull_request:\n  push:\n    branches:\n      - master\n\nenv:\n "
  },
  {
    "path": ".github/workflows/cd-docker-push-mysql_oss.yaml",
    "chars": 1997,
    "preview": "name: CD - Build Docker - MySQL Quick Boot - Community Edition\non:\n  push:\n    paths:\n      - .github/ops/mysql/**\n     "
  },
  {
    "path": ".github/workflows/ci-dialect_oss.yaml",
    "chars": 12578,
    "preview": "# # # # # # # # # # # # # # # #\n# CODE GENERATED - DO NOT EDIT\n# # # # # # # # # # # # # # # #\nname: CI - Dialect Tests "
  },
  {
    "path": ".github/workflows/ci-go_oss.yaml",
    "chars": 2674,
    "preview": "# # # # # # # # # # # # # # # #\n# CODE GENERATED - DO NOT EDIT\n# # # # # # # # # # # # # # # #\nname: CI - General - Comm"
  },
  {
    "path": ".github/workflows/ci-revisions_oss.yaml",
    "chars": 1151,
    "preview": "# # # # # # # # # # # # # # # #\n# CODE GENERATED - DO NOT EDIT\n# # # # # # # # # # # # # # # #\nname: CI - Revisions - Co"
  },
  {
    "path": ".github/workflows/ci-sdk.yml",
    "chars": 1900,
    "preview": "name: Go SDK CI\non:\n  push:\n    branches:\n      - master\n  pull_request:\njobs:\n  golangci-lint:\n    runs-on: ubuntu-late"
  },
  {
    "path": ".golangci.yml",
    "chars": 782,
    "preview": "run:\n  timeout: 3m\n\nissues:\n  include:\n    - EXC0012\n  exclude:\n    - G601\n    - G404\n    - redefines-builtin-id\n  exclu"
  },
  {
    "path": "LICENSE",
    "chars": 11357,
    "preview": "\n                                 Apache License\n                           Version 2.0, January 2004\n                  "
  },
  {
    "path": "README.md",
    "chars": 16047,
    "preview": "# Atlas - Manage Your Database Schema as Code\n\n[![Twitter](https://img.shields.io/twitter/url.svg?label=Follow%20%40atla"
  },
  {
    "path": "atlasexec/README.md",
    "chars": 808,
    "preview": "# Atlas SDK for Go\n\n[![Go Reference](https://pkg.go.dev/badge/ariga.io/atlas-go-sdk/atlasexec.svg)](https://pkg.go.dev/a"
  },
  {
    "path": "atlasexec/atlas.go",
    "chars": 15794,
    "preview": "// Copyright 2021-present The Atlas Authors. All rights reserved.\n// This source code is licensed under the Apache 2.0 l"
  },
  {
    "path": "atlasexec/atlas_internal_test.go",
    "chars": 1159,
    "preview": "// Copyright 2021-present The Atlas Authors. All rights reserved.\n// This source code is licensed under the Apache 2.0 l"
  },
  {
    "path": "atlasexec/atlas_migrate.go",
    "chars": 24187,
    "preview": "// Copyright 2021-present The Atlas Authors. All rights reserved.\n// This source code is licensed under the Apache 2.0 l"
  },
  {
    "path": "atlasexec/atlas_migrate_example_test.go",
    "chars": 2225,
    "preview": "// Copyright 2021-present The Atlas Authors. All rights reserved.\n// This source code is licensed under the Apache 2.0 l"
  },
  {
    "path": "atlasexec/atlas_migrate_test.go",
    "chars": 37652,
    "preview": "// Copyright 2021-present The Atlas Authors. All rights reserved.\n// This source code is licensed under the Apache 2.0 l"
  },
  {
    "path": "atlasexec/atlas_models.go",
    "chars": 7612,
    "preview": "// Copyright 2021-present The Atlas Authors. All rights reserved.\n// This source code is licensed under the Apache 2.0 l"
  },
  {
    "path": "atlasexec/atlas_schema.go",
    "chars": 26850,
    "preview": "// Copyright 2021-present The Atlas Authors. All rights reserved.\n// This source code is licensed under the Apache 2.0 l"
  },
  {
    "path": "atlasexec/atlas_schema_test.go",
    "chars": 28574,
    "preview": "// Copyright 2021-present The Atlas Authors. All rights reserved.\n// This source code is licensed under the Apache 2.0 l"
  },
  {
    "path": "atlasexec/atlas_test.go",
    "chars": 5645,
    "preview": "// Copyright 2021-present The Atlas Authors. All rights reserved.\n// This source code is licensed under the Apache 2.0 l"
  },
  {
    "path": "atlasexec/copilot.go",
    "chars": 3889,
    "preview": "// Copyright 2021-present The Atlas Authors. All rights reserved.\n// This source code is licensed under the Apache 2.0 l"
  },
  {
    "path": "atlasexec/copilot_test.go",
    "chars": 2873,
    "preview": "// Copyright 2021-present The Atlas Authors. All rights reserved.\n// This source code is licensed under the Apache 2.0 l"
  },
  {
    "path": "atlasexec/internal/e2e/sqlite_test.go",
    "chars": 6450,
    "preview": "// Copyright 2021-present The Atlas Authors. All rights reserved.\n// This source code is licensed under the Apache 2.0 l"
  },
  {
    "path": "atlasexec/internal/e2e/testdata/multi-tenants/atlas.hcl",
    "chars": 188,
    "preview": "env {\n  for_each = toset([\n    \"sqlite://bar.db?_fk=1\",\n    \"sqlite://foo.db?_fk=1\",\n  ])\n  name     = atlas.env\n  url  "
  },
  {
    "path": "atlasexec/internal/e2e/testdata/multi-tenants/migrations/20240112070806.sql",
    "chars": 25,
    "preview": "CREATE TABLE t1(c1 int);\n"
  },
  {
    "path": "atlasexec/internal/e2e/testdata/multi-tenants/migrations/20240116003831.sql",
    "chars": 41,
    "preview": "CREATE UNIQUE INDEX c1_unique ON t1(c1);\n"
  },
  {
    "path": "atlasexec/internal/e2e/testdata/multi-tenants/migrations/atlas.sum",
    "chars": 182,
    "preview": "h1:S0UEXIKYA1mHhjFJbnzZh7bzeb42+5KM4HLzVlGuE4Q=\n20240112070806.sql h1:nhoPxDs1H3UH6aEpy1qJ6Bj6zbFRt61sB4ndi0sx7zw=\n20240"
  },
  {
    "path": "atlasexec/internal/e2e/testdata/schema-plan/schema-1.lt.hcl",
    "chars": 135,
    "preview": "schema \"public\" {\n  comment = \"This is a test schema\"\n}\n\ntable \"t1\" {\n  schema = schema.public\n  column \"c1\" {\n    type "
  },
  {
    "path": "atlasexec/internal/e2e/testdata/schema-plan/schema-2.lt.hcl",
    "chars": 171,
    "preview": "schema \"public\" {\n  comment = \"This is a test schema\"\n}\n\ntable \"t1\" {\n  schema = schema.public\n  column \"c1\" {\n    type "
  },
  {
    "path": "atlasexec/internal/e2e/testdata/versioned-basic/atlas.hcl",
    "chars": 64,
    "preview": "env \"local\" {\n  migration {\n    dir = \"file://migrations\"\n  }\n}\n"
  },
  {
    "path": "atlasexec/internal/e2e/testdata/versioned-basic/migrations/20240112070806.sql",
    "chars": 25,
    "preview": "CREATE TABLE t1(c1 int);\n"
  },
  {
    "path": "atlasexec/internal/e2e/testdata/versioned-basic/migrations/atlas.sum",
    "chars": 115,
    "preview": "h1:vefBQWShy7/4OI7C1NqFH9y2PtGtOUS5zFQ1492XitE=\n20240112070806.sql h1:nhoPxDs1H3UH6aEpy1qJ6Bj6zbFRt61sB4ndi0sx7zw=\n"
  },
  {
    "path": "atlasexec/internal/e2e/util_e2e.go",
    "chars": 3317,
    "preview": "// Copyright 2021-present The Atlas Authors. All rights reserved.\n// This source code is licensed under the Apache 2.0 l"
  },
  {
    "path": "atlasexec/mock-atlas.sh",
    "chars": 1406,
    "preview": "#!/bin/bash\n\n# TEST_BATCH provide the directory contains all\n# outputs for multiple runs. The path should be absolute\n# "
  },
  {
    "path": "atlasexec/testdata/broken/20231029112426.sql",
    "chars": 7,
    "preview": "broken;"
  },
  {
    "path": "atlasexec/testdata/broken/atlas.sum",
    "chars": 115,
    "preview": "h1:Enr95HgKxQs2iSsOANpqDUOaHc6eZeQ+ak0ZF2wjmZE=\n20231029112426.sql h1:lHLnIyWaiYac90Ad0I1SOsPxvQng3tGlq++/8RkpJaI=\n"
  },
  {
    "path": "atlasexec/testdata/migrations/20230727105553_init.sql",
    "chars": 28,
    "preview": "CREATE TABLE t1 ( c1 int );\n"
  },
  {
    "path": "atlasexec/testdata/migrations/20230727105615_t2.sql",
    "chars": 37,
    "preview": "CREATE TABLE t2 ( c1 int, c2 text );\n"
  },
  {
    "path": "atlasexec/testdata/migrations/20230926085734_destructive-change.sql",
    "chars": 15,
    "preview": "DROP TABLE t2;\n"
  },
  {
    "path": "atlasexec/testdata/migrations/atlas.sum",
    "chars": 276,
    "preview": "h1:hnQZfRcN6sV+y+0YePtkLazMy+Ty3lhyGv69ixeYoXc=\n20230727105553_init.sql h1:jxgvnWO6tZD3lSPpH1ao5E/6VjapP7iwvBCUJ6aez58=\n"
  },
  {
    "path": "atlasexec/working_dir.go",
    "chars": 5250,
    "preview": "// Copyright 2021-present The Atlas Authors. All rights reserved.\n// This source code is licensed under the Apache 2.0 l"
  },
  {
    "path": "atlasexec/working_dir_test.go",
    "chars": 3189,
    "preview": "// Copyright 2021-present The Atlas Authors. All rights reserved.\n// This source code is licensed under the Apache 2.0 l"
  },
  {
    "path": "cmd/atlas/go.mod",
    "chars": 4805,
    "preview": "module ariga.io/atlas/cmd/atlas\n\ngo 1.24.13\n\nreplace ariga.io/atlas => ../..\n\nrequire (\n\tariga.io/atlas v0.32.1-0.202503"
  },
  {
    "path": "cmd/atlas/go.sum",
    "chars": 27073,
    "preview": "cloud.google.com/go v0.121.4 h1:cVvUiY0sX0xwyxPwdSU2KsF9knOVmtRyAMt8xou0iTs=\ncloud.google.com/go v0.121.4/go.mod h1:XEBc"
  },
  {
    "path": "cmd/atlas/internal/cloudapi/client.go",
    "chars": 12068,
    "preview": "// Copyright 2021-present The Atlas Authors. All rights reserved.\n// This source code is licensed under the Apache 2.0 l"
  },
  {
    "path": "cmd/atlas/internal/cloudapi/client_oss.go",
    "chars": 439,
    "preview": "// Copyright 2021-present The Atlas Authors. All rights reserved.\n// This source code is licensed under the Apache 2.0 l"
  },
  {
    "path": "cmd/atlas/internal/cloudapi/client_test.go",
    "chars": 8182,
    "preview": "// Copyright 2021-present The Atlas Authors. All rights reserved.\n// This source code is licensed under the Apache 2.0 l"
  },
  {
    "path": "cmd/atlas/internal/cmdapi/cmdapi.go",
    "chars": 17083,
    "preview": "// Copyright 2021-present The Atlas Authors. All rights reserved.\n// This source code is licensed under the Apache 2.0 l"
  },
  {
    "path": "cmd/atlas/internal/cmdapi/cmdapi_oss.go",
    "chars": 19977,
    "preview": "// Copyright 2021-present The Atlas Authors. All rights reserved.\n// This source code is licensed under the Apache 2.0 l"
  },
  {
    "path": "cmd/atlas/internal/cmdapi/cmdapi_test.go",
    "chars": 1991,
    "preview": "// Copyright 2021-present The Atlas Authors. All rights reserved.\n// This source code is licensed under the Apache 2.0 l"
  },
  {
    "path": "cmd/atlas/internal/cmdapi/migrate.go",
    "chars": 55092,
    "preview": "// Copyright 2021-present The Atlas Authors. All rights reserved.\n// This source code is licensed under the Apache 2.0 l"
  },
  {
    "path": "cmd/atlas/internal/cmdapi/migrate_oss.go",
    "chars": 4415,
    "preview": "// Copyright 2021-present The Atlas Authors. All rights reserved.\n// This source code is licensed under the Apache 2.0 l"
  },
  {
    "path": "cmd/atlas/internal/cmdapi/migrate_test.go",
    "chars": 55389,
    "preview": "// Copyright 2021-present The Atlas Authors. All rights reserved.\n// This source code is licensed under the Apache 2.0 l"
  },
  {
    "path": "cmd/atlas/internal/cmdapi/project.go",
    "chars": 21211,
    "preview": "// Copyright 2021-present The Atlas Authors. All rights reserved.\n// This source code is licensed under the Apache 2.0 l"
  },
  {
    "path": "cmd/atlas/internal/cmdapi/project_test.go",
    "chars": 12168,
    "preview": "// Copyright 2021-present The Atlas Authors. All rights reserved.\n// This source code is licensed under the Apache 2.0 l"
  },
  {
    "path": "cmd/atlas/internal/cmdapi/schema.go",
    "chars": 18997,
    "preview": "// Copyright 2021-present The Atlas Authors. All rights reserved.\n// This source code is licensed under the Apache 2.0 l"
  },
  {
    "path": "cmd/atlas/internal/cmdapi/schema_test.go",
    "chars": 30055,
    "preview": "// Copyright 2021-present The Atlas Authors. All rights reserved.\n// This source code is licensed under the Apache 2.0 l"
  },
  {
    "path": "cmd/atlas/internal/cmdapi/testdata/baseline1/1_baseline.sql",
    "chars": 69,
    "preview": "-- create \"baseline\" table\nCREATE TABLE baseline (`c` int NOT NULL);\n"
  },
  {
    "path": "cmd/atlas/internal/cmdapi/testdata/baseline1/atlas.sum",
    "chars": 111,
    "preview": "h1:GqOjMVGk2H0qYhhtJ1SPCyyHEBbWP/LD2ueWQTY4e6A=\n1_baseline.sql h1:rZgkRmNcN2UEKgxru1nHCpBRVn/fjFavyQ4xxPxhrD4=\n"
  },
  {
    "path": "cmd/atlas/internal/cmdapi/testdata/baseline2/1_baseline.sql",
    "chars": 69,
    "preview": "-- create \"baseline\" table\nCREATE TABLE baseline (`c` int NOT NULL);\n"
  },
  {
    "path": "cmd/atlas/internal/cmdapi/testdata/baseline2/20220318104614_initial.sql",
    "chars": 61,
    "preview": "-- create \"tbl\" table\nCREATE TABLE tbl (`col` int NOT NULL);\n"
  },
  {
    "path": "cmd/atlas/internal/cmdapi/testdata/baseline2/20220318104615_second.sql",
    "chars": 38,
    "preview": "ALTER TABLE `tbl` ADD `col_2` bigint;\n"
  },
  {
    "path": "cmd/atlas/internal/cmdapi/testdata/baseline2/atlas.sum",
    "chars": 260,
    "preview": "h1:sxNQqhuqhm1fLpr3WN9N/M/niaS81Y7k5RrSaKpmBZE=\n1_baseline.sql h1:rZgkRmNcN2UEKgxru1nHCpBRVn/fjFavyQ4xxPxhrD4=\n202203181"
  },
  {
    "path": "cmd/atlas/internal/cmdapi/testdata/import/dbmate/1_initial.sql",
    "chars": 339,
    "preview": "-- migrate:up\nCREATE TABLE post\n(\n    id    int NOT NULL,\n    title text,\n    body  text,\n    PRIMARY KEY (id)\n);\n\n/*\n M"
  },
  {
    "path": "cmd/atlas/internal/cmdapi/testdata/import/dbmate/2_second_migration.sql",
    "chars": 50,
    "preview": "\n\n\n-- migrate:up\n\n\n\n\nCREATE TABLE tbl_2 (col INT);"
  },
  {
    "path": "cmd/atlas/internal/cmdapi/testdata/import/dbmate_gold/1_initial.sql",
    "chars": 288,
    "preview": "CREATE TABLE post\n(\n    id    int NOT NULL,\n    title text,\n    body  text,\n    PRIMARY KEY (id)\n);\n/*\n Multiline commen"
  },
  {
    "path": "cmd/atlas/internal/cmdapi/testdata/import/dbmate_gold/2_second_migration.sql",
    "chars": 30,
    "preview": "CREATE TABLE tbl_2 (col INT);\n"
  },
  {
    "path": "cmd/atlas/internal/cmdapi/testdata/import/flyway/B2__baseline.sql",
    "chars": 219,
    "preview": "CREATE TABLE post\n(\n    id    int NOT NULL,\n    title text,\n    body  text,\n    created_at TIMESTAMP NOT NULL\n    PRIMAR"
  },
  {
    "path": "cmd/atlas/internal/cmdapi/testdata/import/flyway/R__views.sql",
    "chars": 46,
    "preview": "CREATE VIEW `my_view` AS SELECT * FROM `post`;"
  },
  {
    "path": "cmd/atlas/internal/cmdapi/testdata/import/flyway/U1__initial.sql",
    "chars": 15,
    "preview": "DROP TABLE tbl;"
  },
  {
    "path": "cmd/atlas/internal/cmdapi/testdata/import/flyway/V1__initial.sql",
    "chars": 250,
    "preview": "-- comment\nCREATE TABLE post\n(\n    id    int NOT NULL,\n    title text,\n    body  text,\n    PRIMARY KEY (id)\n);\n\nALTER TA"
  },
  {
    "path": "cmd/atlas/internal/cmdapi/testdata/import/flyway/V2__second_migration.sql",
    "chars": 50,
    "preview": "\n\n\n-- migrate:up\n\n\n\n\nCREATE TABLE tbl_2 (col INT);"
  },
  {
    "path": "cmd/atlas/internal/cmdapi/testdata/import/flyway/V3__third_migration.sql",
    "chars": 45,
    "preview": "ALTER TABLE tbl_2 ADD col_1 INTEGER NOT NULL;"
  },
  {
    "path": "cmd/atlas/internal/cmdapi/testdata/import/flyway_gold/2_baseline.sql",
    "chars": 219,
    "preview": "CREATE TABLE post\n(\n    id    int NOT NULL,\n    title text,\n    body  text,\n    created_at TIMESTAMP NOT NULL\n    PRIMAR"
  },
  {
    "path": "cmd/atlas/internal/cmdapi/testdata/import/flyway_gold/3R_views.sql",
    "chars": 47,
    "preview": "CREATE VIEW `my_view` AS SELECT * FROM `post`;\n"
  },
  {
    "path": "cmd/atlas/internal/cmdapi/testdata/import/flyway_gold/3_third_migration.sql",
    "chars": 46,
    "preview": "ALTER TABLE tbl_2 ADD col_1 INTEGER NOT NULL;\n"
  },
  {
    "path": "cmd/atlas/internal/cmdapi/testdata/import/golang-migrate/1_initial.down.sql",
    "chars": 15,
    "preview": "DROP TABLE tbl;"
  },
  {
    "path": "cmd/atlas/internal/cmdapi/testdata/import/golang-migrate/1_initial.up.sql",
    "chars": 33,
    "preview": "CREATE TABLE tbl\n(\n    col INT\n);"
  },
  {
    "path": "cmd/atlas/internal/cmdapi/testdata/import/golang-migrate/2_second_migration.down.sql",
    "chars": 17,
    "preview": "DROP TABLE tbl_2;"
  },
  {
    "path": "cmd/atlas/internal/cmdapi/testdata/import/golang-migrate/2_second_migration.up.sql",
    "chars": 29,
    "preview": "CREATE TABLE tbl_2 (col INT);"
  },
  {
    "path": "cmd/atlas/internal/cmdapi/testdata/import/golang-migrate_gold/1_initial.sql",
    "chars": 34,
    "preview": "CREATE TABLE tbl\n(\n    col INT\n);\n"
  },
  {
    "path": "cmd/atlas/internal/cmdapi/testdata/import/golang-migrate_gold/2_second_migration.sql",
    "chars": 30,
    "preview": "CREATE TABLE tbl_2 (col INT);\n"
  },
  {
    "path": "cmd/atlas/internal/cmdapi/testdata/import/goose/1_initial.sql",
    "chars": 265,
    "preview": "-- +goose Up\nCREATE TABLE post\n(\n    id    int NOT NULL,\n    title text,\n    body  text,\n    PRIMARY KEY (id)\n);\n\nALTER "
  },
  {
    "path": "cmd/atlas/internal/cmdapi/testdata/import/goose/2_second_migration.sql",
    "chars": 799,
    "preview": "\n\n\n-- +goose Up\n\n\nALTER TABLE post ADD updated_at TIMESTAMP NOT NULL;\n\n-- +goose StatementBegin\n-- Comment for the funct"
  },
  {
    "path": "cmd/atlas/internal/cmdapi/testdata/import/goose_gold/1_initial.sql",
    "chars": 218,
    "preview": "CREATE TABLE post\n(\n    id    int NOT NULL,\n    title text,\n    body  text,\n    PRIMARY KEY (id)\n);\nALTER TABLE post ADD"
  },
  {
    "path": "cmd/atlas/internal/cmdapi/testdata/import/goose_gold/2_second_migration.sql",
    "chars": 733,
    "preview": "ALTER TABLE post ADD updated_at TIMESTAMP NOT NULL;\n-- Comment for the function declaration.\nCREATE\nOR REPLACE FUNCTION "
  },
  {
    "path": "cmd/atlas/internal/cmdapi/testdata/import/liquibase/1_initial.sql",
    "chars": 388,
    "preview": "--liquibase formatted sql\n\n--changeset atlas:1-1\nCREATE TABLE post\n(\n    id    int NOT NULL,\n    title text,\n    body  t"
  },
  {
    "path": "cmd/atlas/internal/cmdapi/testdata/import/liquibase/2_second_migration.sql",
    "chars": 108,
    "preview": "--liquibase formatted sql\n\n--changeset atlas:2-1\nCREATE TABLE tbl_2 (col INT);\n--rollback DROP TABLE tbl_2;\n"
  },
  {
    "path": "cmd/atlas/internal/cmdapi/testdata/import/liquibase_gold/1_initial.sql",
    "chars": 284,
    "preview": "--changeset atlas:1-1\nCREATE TABLE post\n(\n    id    int NOT NULL,\n    title text,\n    body  text,\n    PRIMARY KEY (id)\n)"
  },
  {
    "path": "cmd/atlas/internal/cmdapi/testdata/import/liquibase_gold/2_second_migration.sql",
    "chars": 52,
    "preview": "--changeset atlas:2-1\nCREATE TABLE tbl_2 (col INT);\n"
  },
  {
    "path": "cmd/atlas/internal/cmdapi/testdata/mysql/20220318104614_initial.sql",
    "chars": 180,
    "preview": "-- add new schema named \"atlantis\"\nCREATE DATABASE `atlantis`;\n-- create \"tbl\" table\nCREATE TABLE `atlantis`.`tbl` (`col"
  },
  {
    "path": "cmd/atlas/internal/cmdapi/testdata/mysql/20220420213403_second.sql",
    "chars": 47,
    "preview": "ALTER TABLE `atlantis`.`tbl` ADD `col_2` TEXT;\n"
  },
  {
    "path": "cmd/atlas/internal/cmdapi/testdata/mysql/atlas.sum",
    "chars": 197,
    "preview": "h1:EGX5/CEEerpLWqYQNHB1veTXon8t05wEGJiX2fOtFXg=\n20220318104614_initial.sql h1:EoDHPlX7fTGn5qiCdR5xhwFh+DrOi3cQ7Y49BsIy97"
  },
  {
    "path": "cmd/atlas/internal/cmdapi/testdata/sqlite/20220318104614_initial.sql",
    "chars": 61,
    "preview": "-- create \"tbl\" table\nCREATE TABLE tbl (`col` int NOT NULL);\n"
  },
  {
    "path": "cmd/atlas/internal/cmdapi/testdata/sqlite/20220318104615_second.sql",
    "chars": 38,
    "preview": "ALTER TABLE `tbl` ADD `col_2` bigint;\n"
  },
  {
    "path": "cmd/atlas/internal/cmdapi/testdata/sqlite/atlas.sum",
    "chars": 197,
    "preview": "h1:GMi7mvWSIHv0I/Wrc2NCGVt9Z5hWZbPa6wL986t7Z2o=\n20220318104614_initial.sql h1:FifWjY2X0g2YVnb18Qm+QBPvoldDOOob7bS0LrFuCX"
  },
  {
    "path": "cmd/atlas/internal/cmdapi/testdata/sqlite2/20220318104614_initial.sql",
    "chars": 61,
    "preview": "-- create \"tbl\" table\nCREATE TABLE tbl (`col` int NOT NULL);\n"
  },
  {
    "path": "cmd/atlas/internal/cmdapi/testdata/sqlite2/20220318104615_second.sql",
    "chars": 134,
    "preview": "ALTER TABLE `tbl` ADD `col_2` bigint;\nasdasd ALTER TABLE `tbl` ADD `col_3` bigint; -- will fail\nALTER TABLE `tbl` ADD `c"
  },
  {
    "path": "cmd/atlas/internal/cmdapi/testdata/sqlite2/atlas.sum",
    "chars": 197,
    "preview": "h1:lXdG49p5Vr5b9eARNKq3Gkgd+flbQXDM+XDyB6b2nzw=\n20220318104614_initial.sql h1:FifWjY2X0g2YVnb18Qm+QBPvoldDOOob7bS0LrFuCX"
  },
  {
    "path": "cmd/atlas/internal/cmdapi/testdata/sqlitetx/20220925092817_initial.sql",
    "chars": 108,
    "preview": "-- create \"users\" table\nCREATE TABLE `users` (`id` integer NOT NULL, `name` text NULL, PRIMARY KEY (`id`));\n"
  },
  {
    "path": "cmd/atlas/internal/cmdapi/testdata/sqlitetx/20220925094021_second.sql",
    "chars": 462,
    "preview": "-- create \"friendships\" table\nCREATE TABLE `friendships` (`user_id` integer NOT NULL, `friend_id` integer NOT NULL, PRIM"
  },
  {
    "path": "cmd/atlas/internal/cmdapi/testdata/sqlitetx/20220925094437_third.sql",
    "chars": 546,
    "preview": "-- disable the enforcement of foreign-keys constraints\nPRAGMA foreign_keys = off;\n-- create \"new_users\" table\nCREATE TAB"
  },
  {
    "path": "cmd/atlas/internal/cmdapi/testdata/sqlitetx/atlas.sum",
    "chars": 270,
    "preview": "h1:09lkmQGTxdoqPwK0ZXtU4+KHipufkVp1Jlje3t6Opy4=\n20220925092817_initial.sql h1:ZGeLdeqNUMXqJm+hPkhBrhzbtUzSBH8yVTsnSnJo/q"
  },
  {
    "path": "cmd/atlas/internal/cmdapi/testdata/sqlitetx2/20220925092817_initial.sql",
    "chars": 108,
    "preview": "-- create \"users\" table\nCREATE TABLE `users` (`id` integer NOT NULL, `name` text NULL, PRIMARY KEY (`id`));\n"
  },
  {
    "path": "cmd/atlas/internal/cmdapi/testdata/sqlitetx2/20220925094021_second.sql",
    "chars": 462,
    "preview": "-- create \"friendships\" table\nCREATE TABLE `friendships` (`user_id` integer NOT NULL, `friend_id` integer NOT NULL, PRIM"
  },
  {
    "path": "cmd/atlas/internal/cmdapi/testdata/sqlitetx2/20220925094437_third.sql",
    "chars": 633,
    "preview": "-- disable the enforcement of foreign-keys constraints\nPRAGMA foreign_keys = off;\n-- create \"new_users\" table\nCREATE TAB"
  },
  {
    "path": "cmd/atlas/internal/cmdapi/testdata/sqlitetx2/atlas.sum",
    "chars": 270,
    "preview": "h1:eH+7c2mVWbrhky00/3SKYklyHLyz+QzDk1UZJ9+ZJsg=\n20220925092817_initial.sql h1:ZGeLdeqNUMXqJm+hPkhBrhzbtUzSBH8yVTsnSnJo/q"
  },
  {
    "path": "cmd/atlas/internal/cmdapi/testdata/sqlitetx3/20220925092817_initial.sql",
    "chars": 108,
    "preview": "-- create \"users\" table\nCREATE TABLE `users` (`id` integer NOT NULL, `name` text NULL, PRIMARY KEY (`id`));\n"
  },
  {
    "path": "cmd/atlas/internal/cmdapi/testdata/sqlitetx3/20220925094021_second.sql",
    "chars": 144,
    "preview": "-- atlas:txmode none\n\n-- Create a table.\nCREATE TABLE t1 (a INTEGER PRIMARY KEY);\n\n-- Cause migrations to fail.\nINSERT I"
  },
  {
    "path": "cmd/atlas/internal/cmdapi/testdata/sqlitetx3/atlas.sum",
    "chars": 197,
    "preview": "h1:tTdOsRIKj8kX3o4eUQpw6znQsGVorkUrxi2o3C/ELL4=\n20220925092817_initial.sql h1:ZGeLdeqNUMXqJm+hPkhBrhzbtUzSBH8yVTsnSnJo/q"
  },
  {
    "path": "cmd/atlas/internal/cmdapi/testdata/sqlitetx4/20220925092817_initial.sql",
    "chars": 108,
    "preview": "-- create \"users\" table\nCREATE TABLE `users` (`id` integer NOT NULL, `name` text NULL, PRIMARY KEY (`id`));\n"
  },
  {
    "path": "cmd/atlas/internal/cmdapi/testdata/sqlitetx4/20220925094021_second.sql",
    "chars": 85,
    "preview": "-- atlas:txmode unknown\n\n-- Create a table.\nCREATE TABLE t1 (a INTEGER PRIMARY KEY);\n"
  },
  {
    "path": "cmd/atlas/internal/cmdapi/testdata/sqlitetx4/atlas.sum",
    "chars": 197,
    "preview": "h1:RO76A3Kj66lD13e+iIb5lafWPtz4S3ypswaBm5kPRrI=\n20220925092817_initial.sql h1:ZGeLdeqNUMXqJm+hPkhBrhzbtUzSBH8yVTsnSnJo/q"
  },
  {
    "path": "cmd/atlas/internal/cmdapi/testdata/templatedir/1.sql",
    "chars": 112,
    "preview": "{{- if eq .Env \"dev\" }}\n    create table dev1 (c text);\n{{- else  }}\n    create table prod1 (c text);\n{{- end }}"
  },
  {
    "path": "cmd/atlas/internal/cmdapi/testdata/templatedir/2.sql",
    "chars": 195,
    "preview": "{{- if eq .Env \"dev\" }}\n    create table dev2 (c text);\n    {{ template \"shared/users\" \"dev2\" }}\n{{- else  }}\n    create"
  },
  {
    "path": "cmd/atlas/internal/cmdapi/testdata/templatedir/atlas.sum",
    "chars": 156,
    "preview": "h1:qhwlEKNEXRVSUiyBXmbiSiS26un12DoxHCR3WDzrDdA=\n1.sql h1:b/5P45x6+CVoyVbBJ/BVc5Z2cI46XfoW92QH3T1kqxY=\n2.sql h1:El2EOcXWK"
  },
  {
    "path": "cmd/atlas/internal/cmdapi/testdata/templatedir/shared/users.sql",
    "chars": 75,
    "preview": "{{- define \"shared/users\" }}\ncreate table users_{{ $ }} (c text);\n{{- end}}"
  },
  {
    "path": "cmd/atlas/internal/cmdapi/vercheck/notification.tmpl",
    "chars": 223,
    "preview": "{{- with .Advisory -}}\nSECURITY ADVISORY\n{{ .Text }}\n{{- end }}\n{{- with .Latest -}}\nA new version of Atlas is available"
  },
  {
    "path": "cmd/atlas/internal/cmdapi/vercheck/req_oss.go",
    "chars": 427,
    "preview": "// Copyright 2021-present The Atlas Authors. All rights reserved.\n// This source code is licensed under the Apache 2.0 l"
  },
  {
    "path": "cmd/atlas/internal/cmdapi/vercheck/vercheck.go",
    "chars": 3385,
    "preview": "// Copyright 2021-present The Atlas Authors. All rights reserved.\n// This source code is licensed under the Apache 2.0 l"
  },
  {
    "path": "cmd/atlas/internal/cmdapi/vercheck/vercheck_test.go",
    "chars": 4686,
    "preview": "// Copyright 2021-present The Atlas Authors. All rights reserved.\n// This source code is licensed under the Apache 2.0 l"
  },
  {
    "path": "cmd/atlas/internal/cmdapi/version_oss.go",
    "chars": 398,
    "preview": "// Copyright 2021-present The Atlas Authors. All rights reserved.\n// This source code is licensed under the Apache 2.0 l"
  },
  {
    "path": "cmd/atlas/internal/cmdapi/version_oss_test.go",
    "chars": 1929,
    "preview": "// Copyright 2021-present The Atlas Authors. All rights reserved.\n// This source code is licensed under the Apache 2.0 l"
  },
  {
    "path": "cmd/atlas/internal/cmdext/cmdext.go",
    "chars": 18990,
    "preview": "// Copyright 2021-present The Atlas Authors. All rights reserved.\n// This source code is licensed under the Apache 2.0 l"
  },
  {
    "path": "cmd/atlas/internal/cmdext/cmdext_oss.go",
    "chars": 4894,
    "preview": "// Copyright 2021-present The Atlas Authors. All rights reserved.\n// This source code is licensed under the Apache 2.0 l"
  },
  {
    "path": "cmd/atlas/internal/cmdext/cmdext_test.go",
    "chars": 12400,
    "preview": "// Copyright 2021-present The Atlas Authors. All rights reserved.\n// This source code is licensed under the Apache 2.0 l"
  },
  {
    "path": "cmd/atlas/internal/cmdext/reader.go",
    "chars": 12350,
    "preview": "// Copyright 2021-present The Atlas Authors. All rights reserved.\n// This source code is licensed under the Apache 2.0 l"
  },
  {
    "path": "cmd/atlas/internal/cmdext/reader_test.go",
    "chars": 4792,
    "preview": "// Copyright 2021-present The Atlas Authors. All rights reserved.\n// This source code is licensed under the Apache 2.0 l"
  },
  {
    "path": "cmd/atlas/internal/cmdlog/cmdlog.go",
    "chars": 35309,
    "preview": "// Copyright 2021-present The Atlas Authors. All rights reserved.\n// This source code is licensed under the Apache 2.0 l"
  },
  {
    "path": "cmd/atlas/internal/cmdlog/cmdlog_oss.go",
    "chars": 1448,
    "preview": "// Copyright 2021-present The Atlas Authors. All rights reserved.\n// This source code is licensed under the Apache 2.0 l"
  },
  {
    "path": "cmd/atlas/internal/cmdlog/cmdlog_test.go",
    "chars": 23163,
    "preview": "// Copyright 2021-present The Atlas Authors. All rights reserved.\n// This source code is licensed under the Apache 2.0 l"
  },
  {
    "path": "cmd/atlas/internal/cmdstate/cmdstate.go",
    "chars": 2264,
    "preview": "// Copyright 2021-present The Atlas Authors. All rights reserved.\n// This source code is licensed under the Apache 2.0 l"
  },
  {
    "path": "cmd/atlas/internal/cmdstate/cmdstate_test.go",
    "chars": 1367,
    "preview": "// Copyright 2021-present The Atlas Authors. All rights reserved.\n// This source code is licensed under the Apache 2.0 l"
  },
  {
    "path": "cmd/atlas/internal/docker/docker.go",
    "chars": 16128,
    "preview": "// Copyright 2021-present The Atlas Authors. All rights reserved.\n// This source code is licensed under the Apache 2.0 l"
  },
  {
    "path": "cmd/atlas/internal/docker/docker_test.go",
    "chars": 12633,
    "preview": "// Copyright 2021-present The Atlas Authors. All rights reserved.\n// This source code is licensed under the Apache 2.0 l"
  },
  {
    "path": "cmd/atlas/internal/migrate/ent/client.go",
    "chars": 12002,
    "preview": "// Copyright 2021-present The Atlas Authors. All rights reserved.\n// This source code is licensed under the Apache 2.0 l"
  },
  {
    "path": "cmd/atlas/internal/migrate/ent/convert.go",
    "chars": 1379,
    "preview": "// Copyright 2021-present The Atlas Authors. All rights reserved.\n// This source code is licensed under the Apache 2.0 l"
  },
  {
    "path": "cmd/atlas/internal/migrate/ent/ent.go",
    "chars": 16268,
    "preview": "// Copyright 2021-present The Atlas Authors. All rights reserved.\n// This source code is licensed under the Apache 2.0 l"
  },
  {
    "path": "cmd/atlas/internal/migrate/ent/entc.go",
    "chars": 822,
    "preview": "// Copyright 2021-present The Atlas Authors. All rights reserved.\n// This source code is licensed under the Apache 2.0 l"
  },
  {
    "path": "cmd/atlas/internal/migrate/ent/enttest/enttest.go",
    "chars": 2105,
    "preview": "// Copyright 2021-present The Atlas Authors. All rights reserved.\n// This source code is licensed under the Apache 2.0 l"
  },
  {
    "path": "cmd/atlas/internal/migrate/ent/generate.go",
    "chars": 251,
    "preview": "// Copyright 2021-present The Atlas Authors. All rights reserved.\n// This source code is licensed under the Apache 2.0 l"
  },
  {
    "path": "cmd/atlas/internal/migrate/ent/hook/hook.go",
    "chars": 5352,
    "preview": "// Copyright 2021-present The Atlas Authors. All rights reserved.\n// This source code is licensed under the Apache 2.0 l"
  },
  {
    "path": "cmd/atlas/internal/migrate/ent/internal/schemaconfig.go",
    "chars": 951,
    "preview": "// Copyright 2021-present The Atlas Authors. All rights reserved.\n// This source code is licensed under the Apache 2.0 l"
  },
  {
    "path": "cmd/atlas/internal/migrate/ent/migrate/migrate.go",
    "chars": 2565,
    "preview": "// Copyright 2021-present The Atlas Authors. All rights reserved.\n// This source code is licensed under the Apache 2.0 l"
  },
  {
    "path": "cmd/atlas/internal/migrate/ent/migrate/schema.go",
    "chars": 1700,
    "preview": "// Copyright 2021-present The Atlas Authors. All rights reserved.\n// This source code is licensed under the Apache 2.0 l"
  },
  {
    "path": "cmd/atlas/internal/migrate/ent/mutation.go",
    "chars": 33592,
    "preview": "// Copyright 2021-present The Atlas Authors. All rights reserved.\n// This source code is licensed under the Apache 2.0 l"
  },
  {
    "path": "cmd/atlas/internal/migrate/ent/predicate/predicate.go",
    "chars": 395,
    "preview": "// Copyright 2021-present The Atlas Authors. All rights reserved.\n// This source code is licensed under the Apache 2.0 l"
  },
  {
    "path": "cmd/atlas/internal/migrate/ent/revision/revision.go",
    "chars": 4955,
    "preview": "// Copyright 2021-present The Atlas Authors. All rights reserved.\n// This source code is licensed under the Apache 2.0 l"
  },
  {
    "path": "cmd/atlas/internal/migrate/ent/revision/where.go",
    "chars": 25918,
    "preview": "// Copyright 2021-present The Atlas Authors. All rights reserved.\n// This source code is licensed under the Apache 2.0 l"
  },
  {
    "path": "cmd/atlas/internal/migrate/ent/revision.go",
    "chars": 8225,
    "preview": "// Copyright 2021-present The Atlas Authors. All rights reserved.\n// This source code is licensed under the Apache 2.0 l"
  },
  {
    "path": "cmd/atlas/internal/migrate/ent/revision_create.go",
    "chars": 34072,
    "preview": "// Copyright 2021-present The Atlas Authors. All rights reserved.\n// This source code is licensed under the Apache 2.0 l"
  },
  {
    "path": "cmd/atlas/internal/migrate/ent/revision_delete.go",
    "chars": 2670,
    "preview": "// Copyright 2021-present The Atlas Authors. All rights reserved.\n// This source code is licensed under the Apache 2.0 l"
  },
  {
    "path": "cmd/atlas/internal/migrate/ent/revision_query.go",
    "chars": 15524,
    "preview": "// Copyright 2021-present The Atlas Authors. All rights reserved.\n// This source code is licensed under the Apache 2.0 l"
  },
  {
    "path": "cmd/atlas/internal/migrate/ent/revision_update.go",
    "chars": 20043,
    "preview": "// Copyright 2021-present The Atlas Authors. All rights reserved.\n// This source code is licensed under the Apache 2.0 l"
  },
  {
    "path": "cmd/atlas/internal/migrate/ent/runtime/runtime.go",
    "chars": 544,
    "preview": "// Copyright 2021-present The Atlas Authors. All rights reserved.\n// This source code is licensed under the Apache 2.0 l"
  },
  {
    "path": "cmd/atlas/internal/migrate/ent/runtime.go",
    "chars": 1838,
    "preview": "// Copyright 2021-present The Atlas Authors. All rights reserved.\n// This source code is licensed under the Apache 2.0 l"
  },
  {
    "path": "cmd/atlas/internal/migrate/ent/schema/revision.go",
    "chars": 1490,
    "preview": "// Copyright 2021-present The Atlas Authors. All rights reserved.\n// This source code is licensed under the Apache 2.0 l"
  },
  {
    "path": "cmd/atlas/internal/migrate/ent/template/convert.tmpl",
    "chars": 1201,
    "preview": "{{/* gotype: entgo.io/ent/entc/gen.Graph */}}\n\n{{ define \"convert\" }}\n\n{{ $pkg := base $.Config.Package }}\n{{ template \""
  },
  {
    "path": "cmd/atlas/internal/migrate/ent/tx.go",
    "chars": 7486,
    "preview": "// Copyright 2021-present The Atlas Authors. All rights reserved.\n// This source code is licensed under the Apache 2.0 l"
  },
  {
    "path": "cmd/atlas/internal/migrate/migrate.go",
    "chars": 15431,
    "preview": "// Copyright 2021-present The Atlas Authors. All rights reserved.\n// This source code is licensed under the Apache 2.0 l"
  },
  {
    "path": "cmd/atlas/internal/migrate/migrate_oss.go",
    "chars": 500,
    "preview": "// Copyright 2021-present The Atlas Authors. All rights reserved.\n// This source code is licensed under the Apache 2.0 l"
  },
  {
    "path": "cmd/atlas/internal/migrate/migrate_test.go",
    "chars": 6503,
    "preview": "// Copyright 2021-present The Atlas Authors. All rights reserved.\n// This source code is licensed under the Apache 2.0 l"
  },
  {
    "path": "cmd/atlas/internal/migrate/testdata/broken/1.sql",
    "chars": 53,
    "preview": "CREATE TABLE `users` (`id` int NOT NULL PRIMARY KEY);"
  },
  {
    "path": "cmd/atlas/internal/migrate/testdata/broken/2.sql",
    "chars": 69,
    "preview": "ALTER TABLE `users` ADD COLUMN `happy` boolean NOT NULL DEFAULT true;"
  },
  {
    "path": "cmd/atlas/internal/migrate/testdata/broken/3.sql",
    "chars": 83,
    "preview": "CREATE TABLE `pets` (`id` int NOT NULL PRIMARY KEY);\nTHIS LINE ADDS A SYNTAX ERROR;"
  },
  {
    "path": "cmd/atlas/internal/migrate/testdata/broken/atlas.sum",
    "chars": 210,
    "preview": "h1:0YTkvowN+aAuYuJY5ZANPAq6QAZ0wAXunU9sUXsuZcI=\n1.sql h1:twN+zPVp8JzWEUcPPfNIT6/62Wa08dfxxZhT4gZxBzg=\n2.sql h1:KHLlrSPwS"
  },
  {
    "path": "cmd/atlas/internal/migrate/testdata/fixed/1.sql",
    "chars": 53,
    "preview": "CREATE TABLE `users` (`id` int NOT NULL PRIMARY KEY);"
  },
  {
    "path": "cmd/atlas/internal/migrate/testdata/fixed/2.sql",
    "chars": 69,
    "preview": "ALTER TABLE `users` ADD COLUMN `happy` boolean NOT NULL DEFAULT true;"
  },
  {
    "path": "cmd/atlas/internal/migrate/testdata/fixed/3.sql",
    "chars": 104,
    "preview": "CREATE TABLE `pets` (`id` int NOT NULL PRIMARY KEY);\nALTER TABLE `pets` ADD COLUMN `happy` boolean NULL;"
  },
  {
    "path": "cmd/atlas/internal/migrate/testdata/fixed/atlas.sum",
    "chars": 210,
    "preview": "h1:oNV0f9HzMMCf2pzF+sA6CmsSHGjdkWYmcTjoc/lWxLs=\n1.sql h1:twN+zPVp8JzWEUcPPfNIT6/62Wa08dfxxZhT4gZxBzg=\n2.sql h1:KHLlrSPwS"
  },
  {
    "path": "cmd/atlas/internal/migratelint/lint.go",
    "chars": 13431,
    "preview": "// Copyright 2021-present The Atlas Authors. All rights reserved.\n// This source code is licensed under the Apache 2.0 l"
  },
  {
    "path": "cmd/atlas/internal/migratelint/lint_oss.go",
    "chars": 21920,
    "preview": "// Copyright 2021-present The Atlas Authors. All rights reserved.\n// This source code is licensed under the Apache 2.0 l"
  },
  {
    "path": "cmd/atlas/internal/migratelint/lint_test.go",
    "chars": 5093,
    "preview": "// Copyright 2021-present The Atlas Authors. All rights reserved.\n// This source code is licensed under the Apache 2.0 l"
  },
  {
    "path": "cmd/atlas/internal/sqlparse/myparse/myparse_oss.go",
    "chars": 1075,
    "preview": "// Copyright 2021-present The Atlas Authors. All rights reserved.\n// This source code is licensed under the Apache 2.0 l"
  },
  {
    "path": "cmd/atlas/internal/sqlparse/parseutil/parseutil.go",
    "chars": 3215,
    "preview": "// Copyright 2021-present The Atlas Authors. All rights reserved.\n// This source code is licensed under the Apache 2.0 l"
  },
  {
    "path": "cmd/atlas/internal/sqlparse/pgparse/pgparse_oss.go",
    "chars": 762,
    "preview": "// Copyright 2021-present The Atlas Authors. All rights reserved.\n// This source code is licensed under the Apache 2.0 l"
  },
  {
    "path": "cmd/atlas/internal/sqlparse/sqliteparse/Lexer.g4",
    "chars": 7397,
    "preview": "/*\n * The MIT License (MIT)\n *\n * Copyright (c) 2020 by Martin Mirchev\n *\n * Permission is hereby granted, free of charg"
  },
  {
    "path": "cmd/atlas/internal/sqlparse/sqliteparse/Parser.g4",
    "chars": 19215,
    "preview": "/*\n * The MIT License (MIT)\n *\n * Copyright (c) 2014 by Bart Kiers\n *\n * Permission is hereby granted, free of charge, t"
  },
  {
    "path": "cmd/atlas/internal/sqlparse/sqliteparse/README.md",
    "chars": 478,
    "preview": "### SQLite parser based on ANTLR4\n\n#### Resources\n\n1. SQLite syntax: https://www.sqlite.org/syntaxdiagrams.html\n2. Gramm"
  },
  {
    "path": "cmd/atlas/internal/sqlparse/sqliteparse/lexer.go",
    "chars": 72084,
    "preview": "// Code generated from Lexer.g4 by ANTLR 4.13.1. DO NOT EDIT.\n\npackage sqliteparse\n\nimport (\n\t\"fmt\"\n\t\"github.com/antlr4-"
  },
  {
    "path": "cmd/atlas/internal/sqlparse/sqliteparse/parser.go",
    "chars": 801804,
    "preview": "// Code generated from Parser.g4 by ANTLR 4.13.1. DO NOT EDIT.\n\npackage sqliteparse // Parser\nimport (\n\t\"fmt\"\n\t\"strconv\""
  },
  {
    "path": "cmd/atlas/internal/sqlparse/sqliteparse/parser_base_listener.go",
    "chars": 35418,
    "preview": "// Code generated from Parser.g4 by ANTLR 4.13.1. DO NOT EDIT.\n\npackage sqliteparse // Parser\nimport \"github.com/antlr4-"
  },
  {
    "path": "cmd/atlas/internal/sqlparse/sqliteparse/parser_base_visitor.go",
    "chars": 13847,
    "preview": "// Code generated from Parser.g4 by ANTLR 4.13.1. DO NOT EDIT.\n\npackage sqliteparse // Parser\nimport \"github.com/antlr4-"
  },
  {
    "path": "cmd/atlas/internal/sqlparse/sqliteparse/parser_listener.go",
    "chars": 28090,
    "preview": "// Code generated from Parser.g4 by ANTLR 4.13.1. DO NOT EDIT.\n\npackage sqliteparse // Parser\nimport \"github.com/antlr4-"
  },
  {
    "path": "cmd/atlas/internal/sqlparse/sqliteparse/parser_visitor.go",
    "chars": 13606,
    "preview": "// Code generated from Parser.g4 by ANTLR 4.13.1. DO NOT EDIT.\n\npackage sqliteparse // Parser\nimport \"github.com/antlr4-"
  },
  {
    "path": "cmd/atlas/internal/sqlparse/sqliteparse/sqliteparse_oss.go",
    "chars": 782,
    "preview": "// Copyright 2021-present The Atlas Authors. All rights reserved.\n// This source code is licensed under the Apache 2.0 l"
  },
  {
    "path": "cmd/atlas/internal/sqlparse/sqlparse.go",
    "chars": 1948,
    "preview": "// Copyright 2021-present The Atlas Authors. All rights reserved.\n// This source code is licensed under the Apache 2.0 l"
  },
  {
    "path": "cmd/atlas/main.go",
    "chars": 3484,
    "preview": "// Copyright 2021-present The Atlas Authors. All rights reserved.\n// This source code is licensed under the Apache 2.0 l"
  },
  {
    "path": "cmd/atlas/main_oss.go",
    "chars": 1581,
    "preview": "// Copyright 2021-present The Atlas Authors. All rights reserved.\n// This source code is licensed under the Apache 2.0 l"
  },
  {
    "path": "go.mod",
    "chars": 1044,
    "preview": "module ariga.io/atlas\n\ngo 1.24.13\n\nrequire (\n\tgithub.com/DATA-DOG/go-sqlmock v1.5.0\n\tgithub.com/bmatcuk/doublestar v1.3."
  },
  {
    "path": "go.sum",
    "chars": 4587,
    "preview": "github.com/DATA-DOG/go-sqlmock v1.5.0 h1:Shsta01QNfFxHCfpW6YH2STWB0MudeXXEWMr20OEh60=\ngithub.com/DATA-DOG/go-sqlmock v1."
  },
  {
    "path": "internal/ci/ci_dialect.tmpl",
    "chars": 2084,
    "preview": "# # # # # # # # # # # # # # # #\n# CODE GENERATED - DO NOT EDIT\n# # # # # # # # # # # # # # # #\nname: CI - Dialect Tests{"
  },
  {
    "path": "internal/ci/ci_go.tmpl",
    "chars": 4129,
    "preview": "# # # # # # # # # # # # # # # #\n# CODE GENERATED - DO NOT EDIT\n# # # # # # # # # # # # # # # #\nname: CI - General{{ with"
  },
  {
    "path": "internal/ci/ci_revisions.tmpl",
    "chars": 1416,
    "preview": "# # # # # # # # # # # # # # # #\n# CODE GENERATED - DO NOT EDIT\n# # # # # # # # # # # # # # # #\nname: CI - Revisions{{ wi"
  },
  {
    "path": "internal/ci/cockroach/Dockerfile.tmpl",
    "chars": 138,
    "preview": "FROM cockroachdb/cockroach:{{ .Version}}\n\nEXPOSE 8080\nEXPOSE 26257\n\nENTRYPOINT [\"/cockroach/cockroach\", \"start-single-no"
  },
  {
    "path": "internal/ci/cockroach/main.go",
    "chars": 668,
    "preview": "// Copyright 2021-present The Atlas Authors. All rights reserved.\n// This source code is licensed under the Apache 2.0 l"
  },
  {
    "path": "internal/ci/jobs_oss.go",
    "chars": 868,
    "preview": "// Copyright 2021-present The Atlas Authors. All rights reserved.\n// This source code is licensed under the Apache 2.0 l"
  },
  {
    "path": "internal/ci/main.go",
    "chars": 5700,
    "preview": "// Copyright 2021-present The Atlas Authors. All rights reserved.\n// This source code is licensed under the Apache 2.0 l"
  },
  {
    "path": "internal/integration/README.md",
    "chars": 1640,
    "preview": "### This directory contains all integration tests for Atlas.\n\nThe provided `docker-compose.yaml` file contains images fo"
  },
  {
    "path": "internal/integration/cockroach_test.go",
    "chars": 33027,
    "preview": "// Copyright 2021-present The Atlas Authors. All rights reserved.\n// This source code is licensed under the Apache 2.0 l"
  }
]

// ... and 330 more files (download for full content)

About this extraction

This page contains the full source code of the ariga/atlas GitHub repository, extracted and formatted as plain text for AI agents and large language models (LLMs). The extraction includes 530 files (4.0 MB), approximately 1.1M tokens, and a symbol index with 8271 extracted functions, classes, methods, constants, and types. Use this with OpenClaw, Claude, ChatGPT, Cursor, Windsurf, or any other AI tool that accepts text input. You can copy the full output to your clipboard or download it as a .txt file.

Extracted by GitExtract — free GitHub repo to text converter for AI. Built by Nikandr Surkov.

Copied to clipboard!