New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Some commands not finding the conf correctly #324
Comments
My
Also, may be worth mentioning that the current directory I run these in is a symlink. |
I am not able to replicate this using your |
This is the exact way the directories are: ~/db$ pwd
/home/user/db
~/db$ tree -L 2 -l
.
├── current -> /home/user/db/releases/20170417223451
│ ├── Capfile
│ ├── deploy
│ ├── Gemfile
│ ├── migrations
│ ├── README.md
│ └── REVISION
├── releases
│ ├── 20170412232918
│ ├── 20170412233911
│ ├── 20170412234336
│ ├── 20170412234525
│ └── 20170417223451
└── sqitch.conf
~/db$ cd current
~/db/current$ sqitch plan ve
Plan file sqitch.plan does not exist
~/db/current$ sqitch deploy ve
Plan file sqitch.plan does not exist
~/db/current$ sqitch revert ve
Plan file sqitch.plan does not exist
~/db/current$ sqitch status ve
# On database ve
# Project: project_name
# Change: change_sha
# Name: migration_name
# Deployed: 2017-04-12 01:08:28 +0000
# By: ...
#
Nothing to deploy (up-to-date) |
You need |
When I run the commands it is in |
Tried either way: ~/db$ ls
current releases sqitch.conf
~/db$ cp sqitch.conf current/
~/db$ cd current
~/db/current$ ls
Capfile deploy Gemfile migrations README.md REVISION sqitch.conf
~/db/current$ sqitch plan ve
Plan file sqitch.plan does not exist |
So what's happening is it's finding your |
My plan file for that particular target is in ~/db/current/migrations/country$ pwd
/home/user/db/current/migrations/country
~/db/current/migrations/country$ ls
co.plan deploy revert reworked ve.plan verify As stated in the
|
So if it's finding However, it should work if you're in |
Does not work either. It's weird. ~$ cd db/releases/20170417223451/
~/db/releases/20170417223451$ ls
Capfile deploy Gemfile migrations README.md REVISION sqitch.conf
~/db/releases/20170417223451$ sqitch status ve
# On database ve
# Project: project_name
# Change: change_sha
# Name: migration_name
# Deployed: 2017-04-12 01:08:28 +0000
# By: ...
#
Nothing to deploy (up-to-date)
~/db/releases/20170417223451$ sqitch plan ve
Plan file sqitch.plan does not exist Just in case:
|
And |
Yes, it does: ~/db/releases/20170417223451$ ls migrations/country/
co.plan deploy revert reworked ve.plan verify |
Let's do a little debugging. Would you apply this patch and paste the output here?
|
Finally did it: ~/db/current$ sqitch status ve
# On database ve
In /home/user/db/releases/20170417223451
Looking for 'migrations/country/ve.plan'
Absolute path is '/home/user/db/releases/20170417223451/migrations/country/ve.plan'
Absolute exists: yes
# Project: project_name
# Change: change_sha
# Name: migration_name
# Deployed: 2017-04-12 01:08:28 +0000
# By: ...
#
Nothing to deploy (up-to-date)
~/db/current$ sqitch plan ve
In /home/user/db/releases/20170417223451
Looking for 'sqitch.plan'
Absolute path is '/home/user/db/releases/20170417223451/sqitch.plan'
Absolute exists: no
Plan file sqitch.plan does not exist Same output if I run it from |
WTF. Did you change anything other than the patch, which was just debugging output? Does it work if you run it from |
I ran it from |
By the way, this happens in our production and staging machines, so it's probably not a install gone wrong. |
Can you tell what the problem is? Because I sure can't. :-( |
It may be worth mentioning that it works if I set the flag ~/db/current$ sqitch --plan-file migrations/country/ve.plan deploy ve
In /home/user/db/releases/20170417223451
Looking for 'migrations/country/ve.plan'
Absolute path is '/home/user/db/releases/20170417223451/migrations/country/ve.plan'
Absolute exists: yes
In /home/user/db/releases/20170417223451
Looking for 'migrations/country/ve.plan'
Absolute path is '/home/user/db/releases/20170417223451/migrations/country/ve.plan'
Absolute exists: yes
Nothing to deploy (up-to-date) (It still has the patch you asked me to apply) Without flag ~/db/current$ sqitch deploy ve
In /home/user/db/releases/20170417223451
Looking for 'sqitch.plan'
Absolute path is '/home/user/db/releases/20170417223451/sqitch.plan'
Absolute exists: no
Plan file sqitch.plan does not exist |
I think the problem is more with the ~/db/current$ sqitch deploy adsa
In /home/user/db/releases/20170417223451
Looking for 'sqitch.plan'
Absolute path is '/home/user/db/releases/20170417223451/sqitch.plan'
Absolute exists: no
Plan file sqitch.plan does not exist |
That looks like the same error to me. I do not understand this issue. If the plan file exists at the absolute path and Sqitch says it doesn't, it's…well, weird. |
What I mean is that I think it's not finding the conf, not the plan, so it's falling to a default sqitch.plan file . Is there any patch I could apply to see the configuration it has loaded from the sqitch.conf ? |
No, it's finding the |
Ok, testing if it is finding it or not, it did something I did not expect: ~/db$ ls
current releases repo revisions.log shared sqitch.conf
~/db$ mv sqitch.conf noconf
~/db$ cd current
~/db/current$ sqitch status ve
# On database ve
In /home/user/db/releases/20170417223451
Looking for 'migrations/country/ve.plan'
Absolute path is '/home/user/db/releases/20170417223451/migrations/country/ve.plan'
Absolute exists: yes
# Project: project_name
# Change: change_sha
# Name: migration_name
# Deployed: 2017-04-12 01:08:28 +0000
# By: ...
#
Nothing to deploy (up-to-date)
~/db/current$ sqitch deploy ve
In /home/user/db/releases/20170417223451
Looking for 'sqitch.plan'
Absolute path is '/home/user/db/releases/20170417223451/sqitch.plan'
Absolute exists: no
Plan file sqitch.plan does not exist Even with no Maybe it's caching the information in the schemas it uses for migrations? |
Ah-ha! Have a look at your |
Or else any |
Ok, I do have a |
You should remove all paths to plan files from |
So sqitch reads both configurations? |
Yes, Sqitch uses the same approach as Git to configuration, even relying on exactly the same format. From the docs:
It's that last bit that matters: It merges the contents of all the config files when reading config values. |
Ok, trying like this: ~/db/current$ ls
Capfile deploy Gemfile migrations README.md REVISION sqitch.conf
~/db/current$ cat sqitch.conf
[target "common"]
top_dir = migrations/common
plan_file = migrations/common/common.plan
reworked_dir = migrations/common/reworked
[target "ve"]
top_dir = migrations/country
plan_file = migrations/country/ve.plan
reworked_dir = migrations/country/reworked
[target "co"]
top_dir = migrations/country
plan_file = migrations/country/co.plan
reworked_dir = migrations/country/reworked
~/db/current$ cat ~/.sqitch/sqitch.conf
[core]
engine = pg
[target "common"]
uri = db:pg://sqitch_common@db/db
registry = sqitch_common
[target "ve"]
uri = db:pg://sqitch_ve@db/db
registry = sqitch_ve
[target "co"]
uri = db:pg://sqitch_co@db/db
registry = sqitch_co
[deploy]
verify = true
~/db/current$ sqitch deploy ve
In /home/user/db/releases/20170424142741
Looking for 'sqitch.plan'
Absolute path is '/home/user/db/releases/20170424142741/sqitch.plan'
Absolute exists: no
Plan file sqitch.plan does not exist |
Yeah, so that's not finding the local
|
Output: ~/db/current$ sqitch target show ve
* ve
URI: db:pg://sqitch_ve@db/db
Registry: sqitch_ve
Client: psql
Top Directory: migrations/country
Plan File: migrations/country/ve.plan
Extension: sql
Script Directories:
Deploy: migrations/country/deploy
Revert: migrations/country/revert
Verify: migrations/country/verify
Reworked Script Directories:
Reworked: migrations/country/reworked
Deploy: migrations/country/reworked/deploy
Revert: migrations/country/reworked/revert
Verify: migrations/country/reworked/verify
~/db/current$ sqitch config --local target.ve.plan_file
migrations/country/ve.plan |
Okay, I managed to recreate this issue, I think, although none of the commands worked for me; they all said, “Plan file sqitch.plan does not exist”. Anyway, I believe this patch fixes it:
I'll figure out how to add a test for this and get it committed. Meanwhile, please let me know if it fixes the issue for you. |
Awesome! It did fix it for the |
Confirmed. Hrm… |
Looks like the |
Okay, 36149b0 fixes |
Okay, that should do it, thanks! |
Sure thing, thanks to you! |
Look at the output of running these two commands one after the other:
The
sqitch.conf
is in the directory these commands were run.status
works well, butdeploy
doesn't. The ones I have tried are:log
: works ✅status
: ✅plan
: does not work ❌deploy
: ❌Thank you for your help!
The text was updated successfully, but these errors were encountered: