zxbodya / yii2-gallery-manager

93 stars 61 forks source link

Can't migrate #32

Closed mydesign closed 7 years ago

mydesign commented 8 years ago

PHP Fatal error: Class 'm140930_003227_gallery_manager' not found in /var/www/vendor/yiisoft/yii2/console/controllers/MigrateController.php on line 170

zxbodya commented 8 years ago

Looks like, you copied migration file without changing namespace in it

chomnan commented 8 years ago

Hi zxbodya, Could you please help me show me the instruction how to yii migrate for yii2-gallery-manager? I've done installed via composer but I don't the ways how to migrate the table.

kwazaro commented 7 years ago

Hello! There's really something wrong with migration. It can't be done.

zxbodya commented 7 years ago

I do not understand why it is not working for you, if doing like described in readme:

By creating migration extending example from extension:

class m150318_154933_gallery_ext
    extends zxbodya\yii2\galleryManager\migrations\m140930_003227_gallery_manager
{ }

Or by copying it and changing namespace in copied file.

It should work.

kwazaro commented 7 years ago

1) Creating new fresh Yii2 project; 2) Configuring database access via /config/db.php 3) Installing extension (php composer require --prefer-dist zxbodya/yii2-gallery-manager "*@dev"); 4) Copy /vendor/zxbodya/yii2-gallery-manager/migrations/m140930_003227_gallery_manager.php to '/migrations/'; 5) Changing namespace of copied file to 'app\migrations'; 5) Run 'php yii migrate'; 7) Getting the next listings:

Yii Migration Tool (based on Yii v2.0.10)

Creating migration history table "migration"...Done.
Total 1 new migration to be applied:
    m140930_003227_gallery_manager

Apply the above migration? (yes|no) [no]:yes
*** applying m140930_003227_gallery_manager
Exception 'Error' with message 'Class 'm140930_003227_gallery_manager' not found'

in /home/webdioni/webdionix.com/app_test/vendor/yiisoft/yii2/console/controllers/MigrateController.php:191

Stack trace:
#0 /home/webdioni/webdionix.com/app_test/vendor/yiisoft/yii2/console/controllers/BaseMigrateController.php(650): yii\console\controllers\MigrateController->createMigration('m140930_003227_...')
#1 /home/webdioni/webdionix.com/app_test/vendor/yiisoft/yii2/console/controllers/BaseMigrateController.php(163): yii\console\controllers\BaseMigrateController->migrateUp('m140930_003227_...')
#2 [internal function]: yii\console\controllers\BaseMigrateController->actionUp(0)
#3 /home/webdioni/webdionix.com/app_test/vendor/yiisoft/yii2/base/InlineAction.php(55): call_user_func_array(Array, Array)
#4 /home/webdioni/webdionix.com/app_test/vendor/yiisoft/yii2/base/Controller.php(154): yii\base\InlineAction->runWithParams(Array)
#5 /home/webdioni/webdionix.com/app_test/vendor/yiisoft/yii2/console/Controller.php(128): yii\base\Controller->runAction('', Array)
#6 /home/webdioni/webdionix.com/app_test/vendor/yiisoft/yii2/base/Module.php(454): yii\console\Controller->runAction('', Array)
#7 /home/webdioni/webdionix.com/app_test/vendor/yiisoft/yii2/console/Application.php(180): yii\base\Module->runAction('migrate', Array)
#8 /home/webdioni/webdionix.com/app_test/vendor/yiisoft/yii2/console/Application.php(147): yii\console\Application->runAction('migrate', Array)
#9 /home/webdioni/webdionix.com/app_test/vendor/yiisoft/yii2/base/Application.php(375): yii\console\Application->handleRequest(Object(yii\console\Request))
#10 /home/webdioni/webdionix.com/app_test/yii(20): yii\base\Application->run()
#11 {main}

What I'm doing wrong?

kwazaro commented 7 years ago

I tried to delete the namespace line in copied file and it works! Maybe, it should be mentioned in Installation instructions.

zxbodya commented 7 years ago

yes, migration should be in global namespace(it is true for all migrations there),

added note about namespace in readme file

chomnan commented 7 years ago

Hi Sir,

Thank you very much for your reply. It's working properly right now the problem is I didn't call the correct namespace that's why is not working. Best regards, Chomnan Cheng (Mr.)

Senior Support Team | Cambodia

[H/P] (+855) 77 46 60 82 / (+855) 10 60 44 80 [Tel] (+855) 63 900 089 [Skype] chomnan.cheng [Email] chomnan@hotellinksolutions.com.kh

HOTEL LINK SOLUTIONS CAMBODIA

Address: #B29, Second Floor, Oung Eun road, Oung Eun

           Borei Pram Prey, Siem reap, Cambodia.

Website: www.hotellinksolutions.com

Provide Solutions:

booking engine booking widget mobile website website

channel manager premium website social media reputation manager

---- On Thu, 08 Dec 2016 21:13:31 +0700 Bogdan Savluk <notifications@github.com> wrote ----

I do not understand why it is not working for you, if doing like described in readme:

By creating migration extending example from extension:

class m150318_154933_gallery_ext extends zxbodya\yii2\galleryManager\migrations\m140930_003227_gallery_manager { } Or by copying it and changing namespace in copied file.

It should work.

— You are receiving this because you commented. Reply to this email directly, view it on GitHub, or mute the thread.