atlas: Atlas Kubernetes Operator migration baseline error
Hi there, and firstly, thanks for this awesome project!
Im currently testing atlas as k8s operator and trying to apply AtlasMigration
As I already have the data inside my database, I firstly created the baseline file
atlas migrate diff my_baseline \
--dir "file://migrations" \
--dev-url "docker://postgres/13" \
--to "postgres://MY_URL/MY_DB"
then i created the migration file itself and atlas.sum. Then I applied them as configmap
apiVersion: v1
kind: ConfigMap
metadata:
name: migrations
namespace: default
data:
20240430_cars.sql: |-
CREATE TABLE cars (
brand VARCHAR(255),
model VARCHAR(255),
year INT
);
20240430130416_my_baseline.sql: |
...
atlas.sum: |
h1:XvxavNQEVsV5YOhis38sBUhE7EcQbJtD4WjZ2a/r48o=
20240430130416_my_baseline.sql h1:opoj6rJBR24O4XrnEZrck6nFGhJ7iQyvRYzDELx0bJU=
20240430_cars.sql h1:2D4fsS8tMnRswHQU8CS42arptXNv/lbgAggfkJ3f948=
After that I declared AtlasMigration
apiVersion: db.atlasgo.io/v1alpha1
kind: AtlasMigration
metadata:
name: atlasmigration-test
namespace: default
spec:
baseline: "20240430130416"
dir:
configMapRef:
name: migrations
execOrder: linear
urlFrom:
secretKeyRef:
key: url
name: psql-creds
But after applying, I receive an error
Error: sql/migrate: connected database is not clean: found schema "NAME". baseline version or allow-dirty is required
Could you explain what am I doing wrong ?
About this issue
- Original URL
- State: open
- Created 3 years ago
- Comments: 17 (7 by maintainers)
After reading through the atlas operator code and making some iterative guesses over a few hours I figured out I could change the revisionSchema to a different one than the default with a baseline value and it worked for me. Hopefully, this helps someone else 😄
@giautm
arigaio/atlas-operator:0.4.4i have 30 schemas in this database, so i use db bound url
postgres://USER:PASS@RDS_ADDRESS:5432/DB