Comments (4)
nice, this is actually very elegant way to express it.
from atlas.
btw i'm not sure about HCL interpolation internals. but from working on terraform this is an option on how to avoid this matter
table "some_table_1" { /* name for reference */
name = "some_table" /* actual table_name */
schema = schema.some_schema_1
column "key" { type = varchar(255) }
column "value" { type = longtext }
primary_key {
columns = [table.some_table_1.column.key]
}
index "key" {
unique = true
columns = [table.some_table_1.column.key]
}
}
table "some_table_2" { /* name for reference */
name = "some_table" /* actual table_name */
schema = schema.some_schema_2
column "my_key" { type = varchar(255) }
column "value" { type = longtext }
primary_key {
columns = [table.some_table_2.column.my_key]
}
index "my_key" {
unique = true
columns = [table.some_table_2.column.my_key]
}
}
schema "some_schema_1" {}
schema "some_schema_2" {}
from atlas.
@marxus thanks for reporting this. I'm aware of this issue which results from the way we load symbols into the HCL context for parsing. We will work on this and update
from atlas.
hey @marxus,
This issue is solved by recent work we did on supporting qualifiers for tables. You can read about it in the doc change.
You can get the latest (canary) version of atlas
using brew:
brew upgrade ariga/tap/atlas
Consider a situation where we have two schema a
and b
, and both of them contain a table named users
, with schema qualifiers if you run:
atlas schema inspect -d "mysql://root:pass@localhost:3306/" --schema a --schema b
You get:
table "a" "users" {
schema = schema.a
column "id" {
null = true
type = int
}
}
table "b" "users" {
schema = schema.b
column "id" {
null = true
type = int
}
}
schema "a" {
charset = "utf8mb4"
collate = "utf8mb4_0900_ai_ci"
}
schema "b" {
charset = "utf8mb4"
collate = "utf8mb4_0900_ai_ci"
}
As you see the table names are qualified with a prefix table "a" "users"
and table "b" "users"
.
HTH
Closing this, let me know if you need anything else.
from atlas.
Related Issues (20)
- Declarative workflow breaks on YugabyteDB HOT 6
- Atlas HCL Syntax: String Not Recognized by Linter HOT 5
- [Multi-file schema]: Allow glob pattern for `env.src` HOT 2
- [Multi-file schema / vsCode extension]: Load related schema files into extension context HOT 5
- [vsCode extension]: Do not require schema files to end in `.pg.hcl` HOT 1
- Go 1.23 support with ent schema loader HOT 4
- Possible patch release 0.26.1 HOT 1
- Intermittent errors on Atlas schema inspect SQL Server using docker (Terraform) HOT 5
- `Unknown variable; There is no variable named "PLpgSQL".` when creating Function HOT 4
- `atlas migrate lint` takes very long HOT 1
- Atlas can't revert back data type that already changed HOT 2
- migrate apply fails first apply to CockroachDB v24.2 HOT 1
- Jetbrains IntelliJ Plugin and Code Folding
- The unique index constraint was not updated after adding a new field. HOT 5
- Incorrect migration DDL generated for simple views with `null as` HOT 5
- schema inspect can not parse url correctly with '#' in password HOT 1
- Support implicit names for PG indexes and constraints HOT 3
- Ensure the atlas CLI tool can be installed via the go tools HOT 1
- Schema loading from Prisma
- Planner creates failing ALTER COLUMN for column changing from int to enum HOT 1
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from atlas.