Results 1 to 10 of 18

Thread: Laravel Database Migrations

Hybrid View

Previous Post Previous Post   Next Post Next Post
  1. #1
    Join Date
    Sep 2003
    Posts
    3,040

    Default Laravel Database Migrations

    Laravel allow you to easily create database with database migration.

    First you need to edit

    Code:
    app/config/database.php
    and set the database.

    To create database migration, see

    http://laravel.com/docs/4.2/migrations

    Once database migrations are created, you can run it, so database will be created in MySQL database.

    To create MySQL database from existing Database migration file, run

    Code:
    php artisan migrate
    This command will read migrations file stored in folder

    Code:
    app/database/migrations/
    and create corresponding database tables.
    Become PHP Expert in 30 days
    FreeMarriage.com - Free Online Matrimonial
    FlashWebHost.com - Professional Web Hosting, Designing.

  2. #2
    Join Date
    Nov 2009
    Posts
    76,596

    Default

    As per the instructions in http://laravel.com/docs/4.2/migrations

    I run this command:

    Code:
    php artisan migrate:make create_users_table
    But received following error:


  3. #3
    Join Date
    Sep 2003
    Posts
    3,040

    Default

    First of all, you need to run this from project folder, not some random folder.

    As for imagehostnow project, all database migrations are created, check folder

    Code:
    app/database/migrations/
    Since all database migration files are already there, you only need to migrate with the command i given in above post, that will create tables as per migration files already created.

    Check these database migrations files, so you get an idea how it is created, also read laravel documentation.
    Become PHP Expert in 30 days
    FreeMarriage.com - Free Online Matrimonial
    FlashWebHost.com - Professional Web Hosting, Designing.

  4. #4
    Join Date
    Nov 2009
    Posts
    76,596

    Default

    I run the command.

    Code:
    php artisan migrate
    Find below the result.


  5. #5
    Join Date
    Sep 2003
    Posts
    3,040

    Default

    Good. Now google and try to find out why that error happend. Try to fix it yourself.

    You may also verify all database information is properly set in laravel configuration file.
    Become PHP Expert in 30 days
    FreeMarriage.com - Free Online Matrimonial
    FlashWebHost.com - Professional Web Hosting, Designing.

  6. #6
    Join Date
    Nov 2009
    Posts
    76,596

    Default

    I have connected to mysql server and created a new db called 'imagehostnow' and edited the database info in app/config/database.php file.

    Inserted database name, username and password.

    Then I run following command:

    Code:
    php artisan migrate
    I got below message:

    Then I set permission for www/imagehostnow.com/app/storage/ folder using below command:

    Code:
    chmod -R 777 ~/www/imagehostnow.com/vendor/monolog

    again run below command

    Code:
    php artisan migrate
    But still error got



Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •