Yii Framework Forum: Migrate does not work - chapter 2 - Yii Framework Forum

Jump to content

Page 1 of 1
  • You cannot start a new topic
  • This topic is locked

Migrate does not work - chapter 2 Unable to migrate.

#1 User is offline   StreetCoder 

  • Junior Member
  • Pip
  • Yii
  • Group: Members
  • Posts: 61
  • Joined: 13-April 13

Posted 17 February 2015 - 11:44 AM

Hello,

In the chapter 2 of the book "Web Application Development with Yii 2 and PHP", there is command
$ ./yii migrate/create init_customer_table
to migrate. I have applied this command but it does not work. Rather it shows the error:

bash: ./yii: No such file or directory


I have tried to use the command
yii migrate
it gives me the error:

No command 'yii' found, did you mean:
 Command 'yi' from package 'yi' (universe)
 Command 'yri' from package 'yard' (universe)
 Command 'ii' from package 'ii' (universe)
yii: command not found


Can you tell me where I am doing wrong. I am using ubuntu 14.04.

Thanks in advance.
0

#2 User is offline   TurtleWolf 

  • Newbie
  • Yii
  • Group: Members
  • Posts: 8
  • Joined: 16-February 15

Posted 04 March 2015 - 10:26 AM

Thanks for posting... I thought it was just me. I'm at the same point but may be having a different issue. I wasn't sure how to add a db to a Vagrant host and I didn't want to risk sorting out multiple local host, so I put my database up at fatcow and assumed that would be ok, but now I'm getting this same error of no such file or directory. So no solution yet, but maybe a collective effort!
0

#3 User is offline   TurtleWolf 

  • Newbie
  • Yii
  • Group: Members
  • Posts: 8
  • Joined: 16-February 15

Posted 04 March 2015 - 11:35 AM

this appears to have to do with what is being loaded in environmental variables, once I pointed my path to make sure it could see the yii file it's loading the commands.
0

#4 User is offline   TurtleWolf 

  • Newbie
  • Yii
  • Group: Members
  • Posts: 8
  • Joined: 16-February 15

Posted 04 March 2015 - 11:38 AM

and if you're on a windows machine it's better to drop the .
so just
/yii migrate/create init_customer_table
0

#5 User is offline   TurtleWolf 

  • Newbie
  • Yii
  • Group: Members
  • Posts: 8
  • Joined: 16-February 15

Posted 12 March 2015 - 10:13 AM

I've been coming back to this several times over the last week.. I'll try a few different articles and tutorials, just trying to immerse myself in Yii2 as quickly as I can and get enough perspective to jump this hurdle. One of my earliest hunches in the difference in his bare bones examples and the advance template, is he never calls init. I've never seen anyone call it for the basic either, but I've been trying to replace his example with the basic installation, just to see if I could complete the migrations and finish the chapter on ORM.. well, I was noticing this line in the index he never calls,
require(__DIR__ . '/../vendor/autoload.php'); so I looked to see what's it auto loading! It does have an init, but that's for composer..
I'll try it again, if not I'm just gonna keep trying with the standard template, he's just dissecting it to it's bare bones anyways.
0

#6 User is offline   TurtleWolf 

  • Newbie
  • Yii
  • Group: Members
  • Posts: 8
  • Joined: 16-February 15

Posted 12 March 2015 - 10:29 AM

View PostTurtleWolf, on 04 March 2015 - 11:35 AM, said:

this appears to have to do with what is being loaded in environmental variables, once I pointed my path to make sure it could see the yii file it's loading the commands.


.. nevermind, while that did allow the yii commands to be seen, the migrations are loading in a much deeper directory and that tends to open up another can of worms.
0

#7 User is offline   hijarian 

  • Newbie
  • Yii
  • Group: Members
  • Posts: 7
  • Joined: 28-January 14

Posted 12 August 2015 - 08:13 AM

I would kindly point out that it's clearly stated in the preface to the book that working knowledge of bash is required for this book, as nothing will be explained about commandline examples for brevity.

If bash tells you that "./yii" is not found then it means that you are calling it from wrong directory.

If you'll follow the instructions in the book, then `yii` entry point will be in the root of your codebase so if you `cd` to it you'll run the migrations just fine.
0

#8 User is offline   hijarian 

  • Newbie
  • Yii
  • Group: Members
  • Posts: 7
  • Joined: 28-January 14

Posted 12 August 2015 - 08:17 AM

TurtleWolf, if you'd collect your problems in one place and explain clearly what you tried and what you get instead of the expected result it'll be a lot easier to answer you.

Vagrant box is just another virtual machine. If you don't know how to install a RDBMS into a virtual machine, learn about it first or just do not use Vagrant at all, it was used as a simplest possible way to get a would-be remote machine for experiments.
0

Share this topic:


Page 1 of 1
  • You cannot start a new topic
  • This topic is locked

1 User(s) are reading this topic
0 members, 1 guests, 0 anonymous users