Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > comp.lang.php > #17995
| Path | csiph.com!weretis.net!feeder7.news.weretis.net!news.unit0.net!fu-berlin.de!uni-berlin.de!individual.net!not-for-mail |
|---|---|
| From | Arno Welzel <usenet@arnowelzel.de> |
| Newsgroups | comp.lang.php |
| Subject | Re: Symfony 4 - how to get to the documentation of setting up event subscribers? |
| Date | Sat, 15 Jun 2019 18:00:32 +0200 |
| Lines | 64 |
| Message-ID | <gmkj15Fp3lrU1@mid.individual.net> (permalink) |
| References | <qdrf5n$j7j$1@node2.news.atman.pl> <gmev4hFi9soU1@mid.individual.net> <qdu78n$37q$1@node2.news.atman.pl> <gmhe05F45bsU1@mid.individual.net> <qe0p50$bqt$1@node2.news.atman.pl> |
| Mime-Version | 1.0 |
| Content-Type | text/plain; charset=utf-8 |
| Content-Transfer-Encoding | 8bit |
| X-Trace | individual.net Js1WQFC48wskSiV7rvIXXQlAhcU+f0J3qT9tMo2d361D0L/vkH |
| Cancel-Lock | sha1:gWMKEiivm44SdgB68jgfDAqtD3g= |
| Openpgp | preference=signencrypt |
| In-Reply-To | <qe0p50$bqt$1@node2.news.atman.pl> |
| Xref | csiph.com comp.lang.php:17995 |
Show key headers only | View raw
Marek S:
> W dniu 2019-06-14 o 13:16, Arno Welzel pisze:
>>
>> Ok - maybe the other way: why do you need to handle migration events?
>> What exactly is the your case which can not be solved using the
>> migration itself?
>
> Yeah, you are right. Making the question precise, instead of general,
> will allow to get answer easier.
>
> Below I attached automatically created migration (first one).
> Assumptions to this:
>
> 1. The database is a PostgreSQL.
> 2. Database contains 3 namespaces: public, external, ext.
> 3. Only public namespace is dedicated to Symfony.
> 4. Other namespaces contain third party objects, which will be used by
> Symfony from time to time. For now, let's keep them not touched.
> 5. The migrations are created via console (doctrine:migrations:migrate)
doctrine:migrations:migrate does not *create* a migration but *execute*
them as needed.
If you want to *create* a migration you either use
doctrine:migrations:create to get a new, blank migration you have to
fill with your statements as required or you use
doctrine:migrations:diff to create migration wich contains all the
statements to upgrade the existing database schema to fit your ORM. A
downgrade migration will then also be created.
> Each of exported migrations contain bugs:
>
> $this->addSql('CREATE SCHEMA public');
> $this->addSql('CREATE SCHEMA exclude');
> $this->addSql('CREATE SCHEMA exc');
>
> Executing such a code will result exception saying that existing schema
> can not be created.
And why is the code there at all?
[...]
> public function down(Schema $schema): void {
> // this down() migration is auto-generated, please modify it to
> your needs
See above - "modify it to your needs"!
> $this->abortIf($this->connection->getDatabasePlatform()->getName() !==
> 'postgresql', 'Migration can only be executed safely on \'postgresql\'.');
>
> $this->addSql('CREATE SCHEMA public');
> $this->addSql('CREATE SCHEMA exclude');
> $this->addSql('CREATE SCHEMA exc');
> $this->addSql('DROP TABLE task');
Why should a *downgrade* migration create a schema? I would just delete
these statements. It's totally fine to modify migrations if required.
--
Arno Welzel
https://arnowelzel.de
Back to comp.lang.php | Previous | Next — Previous in thread | Next in thread | Find similar | Unroll thread
Symfony 4 - how to get to the documentation of setting up event subscribers? Marek S <precz@spamowi.com> - 2019-06-12 20:09 +0200
Re: Symfony 4 - how to get to the documentation of setting up event subscribers? Arno Welzel <usenet@arnowelzel.de> - 2019-06-13 14:50 +0200
Re: Symfony 4 - how to get to the documentation of setting up event subscribers? Marek S <precz@spamowi.com> - 2019-06-13 21:13 +0200
Re: Symfony 4 - how to get to the documentation of setting up event subscribers? Arno Welzel <usenet@arnowelzel.de> - 2019-06-14 13:16 +0200
Re: Symfony 4 - how to get to the documentation of setting up event subscribers? Marek S <precz@spamowi.com> - 2019-06-14 20:30 +0200
Re: Symfony 4 - how to get to the documentation of setting up event subscribers? Arno Welzel <usenet@arnowelzel.de> - 2019-06-15 18:00 +0200
Re: Symfony 4 - how to get to the documentation of setting up event subscribers? Marek S <precz@spamowi.com> - 2019-06-15 22:57 +0200
Re: Symfony 4 - how to get to the documentation of setting up event subscribers? Arno Welzel <usenet@arnowelzel.de> - 2019-06-16 09:31 +0200
Re: Symfony 4 - how to get to the documentation of setting up event subscribers? Marek S <precz@spamowi.com> - 2019-06-16 14:29 +0200
Re: Symfony 4 - how to get to the documentation of setting up event subscribers? Arno Welzel <usenet@arnowelzel.de> - 2019-06-17 00:18 +0200
csiph-web