aboutsummaryrefslogtreecommitdiffhomepage
path: root/src/Wallabag
diff options
context:
space:
mode:
authorJérémy Benoist <j0k3r@users.noreply.github.com>2017-11-25 12:28:41 +0100
committerGitHub <noreply@github.com>2017-11-25 12:28:41 +0100
commitceff312db8354049d97c2a84889cd7f56d37fd99 (patch)
treeda86b7c571676f5d3b600d4b20963be611351528 /src/Wallabag
parentf818f64145fa929c399277b665a84a87f31bbacd (diff)
parentf4e7a0df0e5917c51889f95e049eda2f81a8416e (diff)
downloadwallabag-ceff312db8354049d97c2a84889cd7f56d37fd99.tar.gz
wallabag-ceff312db8354049d97c2a84889cd7f56d37fd99.tar.zst
wallabag-ceff312db8354049d97c2a84889cd7f56d37fd99.zip
Merge pull request #3401 from aaa2000/migration-initial
Add an initial doctrine migration
Diffstat (limited to 'src/Wallabag')
-rw-r--r--src/Wallabag/CoreBundle/Command/InstallCommand.php31
1 files changed, 9 insertions, 22 deletions
diff --git a/src/Wallabag/CoreBundle/Command/InstallCommand.php b/src/Wallabag/CoreBundle/Command/InstallCommand.php
index 877dbfa2..dec2bf9c 100644
--- a/src/Wallabag/CoreBundle/Command/InstallCommand.php
+++ b/src/Wallabag/CoreBundle/Command/InstallCommand.php
@@ -61,7 +61,6 @@ class InstallCommand extends ContainerAwareCommand
61 ->setupDatabase() 61 ->setupDatabase()
62 ->setupAdmin() 62 ->setupAdmin()
63 ->setupConfig() 63 ->setupConfig()
64 ->runMigrations()
65 ; 64 ;
66 65
67 $this->io->success('Wallabag has been successfully installed.'); 66 $this->io->success('Wallabag has been successfully installed.');
@@ -70,7 +69,7 @@ class InstallCommand extends ContainerAwareCommand
70 69
71 protected function checkRequirements() 70 protected function checkRequirements()
72 { 71 {
73 $this->io->section('Step 1 of 5: Checking system requirements.'); 72 $this->io->section('Step 1 of 4: Checking system requirements.');
74 73
75 $doctrineManager = $this->getContainer()->get('doctrine')->getManager(); 74 $doctrineManager = $this->getContainer()->get('doctrine')->getManager();
76 75
@@ -169,7 +168,7 @@ class InstallCommand extends ContainerAwareCommand
169 168
170 protected function setupDatabase() 169 protected function setupDatabase()
171 { 170 {
172 $this->io->section('Step 2 of 5: Setting up database.'); 171 $this->io->section('Step 2 of 4: Setting up database.');
173 172
174 // user want to reset everything? Don't care about what is already here 173 // user want to reset everything? Don't care about what is already here
175 if (true === $this->defaultInput->getOption('reset')) { 174 if (true === $this->defaultInput->getOption('reset')) {
@@ -178,7 +177,7 @@ class InstallCommand extends ContainerAwareCommand
178 $this 177 $this
179 ->runCommand('doctrine:database:drop', ['--force' => true]) 178 ->runCommand('doctrine:database:drop', ['--force' => true])
180 ->runCommand('doctrine:database:create') 179 ->runCommand('doctrine:database:create')
181 ->runCommand('doctrine:schema:create') 180 ->runCommand('doctrine:migrations:migrate', ['--no-interaction' => true])
182 ->runCommand('cache:clear') 181 ->runCommand('cache:clear')
183 ; 182 ;
184 183
@@ -192,7 +191,7 @@ class InstallCommand extends ContainerAwareCommand
192 191
193 $this 192 $this
194 ->runCommand('doctrine:database:create') 193 ->runCommand('doctrine:database:create')
195 ->runCommand('doctrine:schema:create') 194 ->runCommand('doctrine:migrations:migrate', ['--no-interaction' => true])
196 ->runCommand('cache:clear') 195 ->runCommand('cache:clear')
197 ; 196 ;
198 197
@@ -207,7 +206,7 @@ class InstallCommand extends ContainerAwareCommand
207 $this 206 $this
208 ->runCommand('doctrine:database:drop', ['--force' => true]) 207 ->runCommand('doctrine:database:drop', ['--force' => true])
209 ->runCommand('doctrine:database:create') 208 ->runCommand('doctrine:database:create')
210 ->runCommand('doctrine:schema:create') 209 ->runCommand('doctrine:migrations:migrate', ['--no-interaction' => true])
211 ; 210 ;
212 } elseif ($this->isSchemaPresent()) { 211 } elseif ($this->isSchemaPresent()) {
213 if ($this->io->confirm('Seems like your database contains schema. Do you want to reset it?', false)) { 212 if ($this->io->confirm('Seems like your database contains schema. Do you want to reset it?', false)) {
@@ -215,14 +214,14 @@ class InstallCommand extends ContainerAwareCommand
215 214
216 $this 215 $this
217 ->runCommand('doctrine:schema:drop', ['--force' => true]) 216 ->runCommand('doctrine:schema:drop', ['--force' => true])
218 ->runCommand('doctrine:schema:create') 217 ->runCommand('doctrine:migrations:migrate', ['--no-interaction' => true])
219 ; 218 ;
220 } 219 }
221 } else { 220 } else {
222 $this->io->text('Creating schema...'); 221 $this->io->text('Creating schema...');
223 222
224 $this 223 $this
225 ->runCommand('doctrine:schema:create') 224 ->runCommand('doctrine:migrations:migrate', ['--no-interaction' => true])
226 ; 225 ;
227 } 226 }
228 227
@@ -237,7 +236,7 @@ class InstallCommand extends ContainerAwareCommand
237 236
238 protected function setupAdmin() 237 protected function setupAdmin()
239 { 238 {
240 $this->io->section('Step 3 of 5: Administration setup.'); 239 $this->io->section('Step 3 of 4: Administration setup.');
241 240
242 if (!$this->io->confirm('Would you like to create a new admin user (recommended)?', true)) { 241 if (!$this->io->confirm('Would you like to create a new admin user (recommended)?', true)) {
243 return $this; 242 return $this;
@@ -272,7 +271,7 @@ class InstallCommand extends ContainerAwareCommand
272 271
273 protected function setupConfig() 272 protected function setupConfig()
274 { 273 {
275 $this->io->section('Step 4 of 5: Config setup.'); 274 $this->io->section('Step 4 of 4: Config setup.');
276 $em = $this->getContainer()->get('doctrine.orm.entity_manager'); 275 $em = $this->getContainer()->get('doctrine.orm.entity_manager');
277 276
278 // cleanup before insert new stuff 277 // cleanup before insert new stuff
@@ -293,18 +292,6 @@ class InstallCommand extends ContainerAwareCommand
293 return $this; 292 return $this;
294 } 293 }
295 294
296 protected function runMigrations()
297 {
298 $this->io->section('Step 5 of 5: Run migrations.');
299
300 $this
301 ->runCommand('doctrine:migrations:migrate', ['--no-interaction' => true]);
302
303 $this->io->text('<info>Migrations successfully executed.</info>');
304
305 return $this;
306 }
307
308 /** 295 /**
309 * Run a command. 296 * Run a command.
310 * 297 *