Closed jnardiello closed 1 year ago
I might have had just now an epiphany. Is by any chance default_database
actually an environment
name that would be executed when no -e
parameter is supplied by console?
Confused ... yeah ... you and me both. When I first started, your post is almost word for word the same as mine.
Without a doubt default_database
should be default_environment
, but that'll probably have to wait for a while - can't change that in a minor or patch release.
And yes, default_database
is the default environment to be used when there is no --environment
parameter.
Thanks @rquadling for the feedback. I think there are two actions we can do immediately to "mitigate" this naming issue:
Also, any idea about the last question? Is there a documented list of available properties for postgresql? I mean, schema
is working but I totally tried it randomly. I will try to dive deep into the source code and see if I can find anything.
I also just noticed a bit of code from the PostgresqlAdapter that smells a lot like forcing a column id
whenever it is not defined explicitly in the createTable
- this is a pretty strong assumption. In my schema I don't have an id
column for every table as my primary key
is simply another column (with just a different name). But yeah, this is another issue which I will try to check later.
Merry Christmas!
I think the source is the only place at the moment. Ideally, each setting needs to be documented along with what adapters it is available in.
IMHO, in the next version of phinx
, if the configuration file has default_database
, show a warning in the output with something like "deprecated option, change to default_environment
... using default_database
as default_environment
".
... and there's some outputs like
$output->writeln('<info>using database</info> ' . $envOptions['name']);
... that must be changed to using environment
.
ignore my last comment, it's right to output using database
because there is an using enviroment
.
I got confused by the default_database
name too initially. For my two penneth, I think the name could just be default
. Then the config might be like this...
environments:
default_migration_table: phinxlog
default: vagrant
vagrant:
...
production:
...
I like Phinx though, so I'd be up for putting some lunch breaks into helping on this issue.
I think changing this would have to be a V1 change. And things don't move too quick here.
Does it have to wait til then? Can we do it sooner as long as we don't break backwards compatibility?
Not my call. But a BC is going to have to sniff different values and deal with conflicts where someone may already have added something to the config.
Are you able to provide a patch with your suggested changes as PR?
Hello everyone, first time using Phinx and I thought I would add my 2 cents as I really think that names defined in the config file are really misleading for anyone getting started. I would catch the opportunity to clearify a few things for myself and (eventually) open a PR with improved docs.
So, here is a typical config file:
default_database
? how does it relate todevelopment.name
?name
? I mean, name of what? I honestly think thatdb_name
or more simplydb
would be a better choice.schema
property to not use thepublic
schema inpgsql
.Thanks a lot and keep up with the great work :)