Skip to content

Commit

Permalink
more acceptance tests (#9)
Browse files Browse the repository at this point in the history
* added some more tests

* return deleted stmt

* lint

* cleanup

* CR

* fix example source

* docs link

* fix tests

* readme example

* bump atlas

* miltiple schemas test

* fix lint

* rm comment

* rename
  • Loading branch information
hedwigz authored May 9, 2022
1 parent 8cd5081 commit f15f5d5
Show file tree
Hide file tree
Showing 5 changed files with 283 additions and 40 deletions.
10 changes: 6 additions & 4 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,9 @@ Contrary to existing tools, Atlas intelligently plans schema migrations for you,
* SQLite
* TiDB

Link to Terraform documentation.
### Docs
* [Provider Docs](https://registry.terraform.io/providers/ariga/atlas/latest/docs)
* [Atlas Docs](https://atlasgo.io)

## Installation

Expand Down Expand Up @@ -60,13 +62,13 @@ provider "atlas" {}
```terraform
data "atlas_schema" "my_schema" {
src = file("${path.module}/schema.hcl")
dev_db_url = "mysql://root:pass@localhost:3307/test"
dev_db_url = "mysql://root:pass@localhost:3307/example"
}
resource "atlas_schema" "example_db" {
hcl = data.atlas_schema.my_schema.hcl
url = "mysql://root:pass@localhost:3306/test"
dev_db_url = "mysql://root:pass@localhost:3307/test"
url = "mysql://root:pass@localhost:3306/example"
dev_db_url = "mysql://root:pass@localhost:3307/example"
}
```

Expand Down
6 changes: 5 additions & 1 deletion atlas/resource_atlas_schema.go
Original file line number Diff line number Diff line change
Expand Up @@ -76,7 +76,11 @@ func readSchema(ctx context.Context, d *schema.ResourceData, m interface{}) diag
if err != nil {
return diag.FromErr(err)
}
realm, err := cli.InspectRealm(ctx, nil)
var schemas []string
if cli.URL.Schema != "" {
schemas = append(schemas, cli.URL.Schema)
}
realm, err := cli.InspectRealm(ctx, &atlaschema.InspectRealmOption{Schemas: schemas})
if err != nil {
return diag.FromErr(err)
}
Expand Down
Loading

0 comments on commit f15f5d5

Please sign in to comment.