Page 2 of 2 FirstFirst 12
Results 11 to 18 of 18

Thread: Laravel Database Migrations

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

    Default

    Look at result of git status command. You will see a section, that says "Untracked files", that list 3 files.

    Can you post name of that 3 files ?
    Become PHP Expert in 30 days
    FreeMarriage.com - Free Online Matrimonial
    FlashWebHost.com - Professional Web Hosting, Designing.

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

    Default

    "Untracked files" names are:

    app/config/database.php~
    app/database/migrations/2015_01_14_052420_create_users_table.php
    app/database/migrations/2015_01_14_052730_create_users_table.php
    Last edited by sherlyk; 01-15-2015 at 06:26 AM.

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

    Default

    These are files that you created (not yet committed to git).

    If you check gitlab, these files are not there.

    The file ending with ~ is created by gedit, don't use gedit, use sublime text for programing, we don't need our code base polluted by backup files like these.

    Other 2 files in migrations folder is created by "php artisan migrate:make" command.

    You can delete those 2 files, make sure you only delete the files (verify name) that listed as Untracked files.
    Become PHP Expert in 30 days
    FreeMarriage.com - Free Online Matrimonial
    FlashWebHost.com - Professional Web Hosting, Designing.

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

    Default

    I have deleted those two files now. I run the command again.

    Result following:

    Code:
    sherly@HOME:~/www/imagehostnow.com$ php artisan migrate
    **************************************
    *     Application In Production!     *
    **************************************
    
    Do you really wish to run this command? yes
    Migrated: 2015_01_05_044852_create_table_users
    Migrated: 2015_01_06_090738_create_table_images
    sherly@HOME:~/www/imagehostnow.com$

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

    Default

    Now check the database in phpMyAdmin, see tables are created or not. Post a screenshot of phpMyAdmin with the database/tables.
    Become PHP Expert in 30 days
    FreeMarriage.com - Free Online Matrimonial
    FlashWebHost.com - Professional Web Hosting, Designing.

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

    Default

    Screenshot of phpMyAdmin with the database/tables.


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

    Default

    Good, so migrations are successful.

    Click on the tables (users, images and migrations are tables inside database imagehostnow) to see the structure.

    Can you post content of migration file for users table here ? It will be in folder

    Code:
    app/databases/migrations
    There will be 2 files, one for users and other for images tables.
    Become PHP Expert in 30 days
    FreeMarriage.com - Free Online Matrimonial
    FlashWebHost.com - Professional Web Hosting, Designing.

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

    Default

    Here is how i run Laravel migration on my PC

    Code:
    boby@fwhlin:~/www/imagehostnow.com (master)$ php artisan migrate
    
    
                                                              
      [PDOException]                                          
      SQLSTATE[42000] [1049] Unknown database 'imagehostnow'  
                                                              
    
    
    migrate [--bench[="..."]] [--database[="..."]] [--force] [--path[="..."]] [--package[="..."]] [--pretend] [--seed]
    
    
    boby@fwhlin:~/www/imagehostnow.com (master)$ mysql 
    Welcome to the MySQL monitor.  Commands end with ; or \g.
    Your MySQL connection id is 9
    Server version: 5.5.40-0ubuntu0.14.04.1 (Ubuntu)
    
    Copyright (c) 2000, 2014, Oracle and/or its affiliates. All rights reserved.
    
    Oracle is a registered trademark of Oracle Corporation and/or its
    affiliates. Other names may be trademarks of their respective
    owners.
    
    Type 'help;' or '\h' for help. Type '\c' to clear the current input statement.
    
    mysql> create database imagehostnow;
    Query OK, 1 row affected (0.00 sec)
    
    mysql> Bye
    boby@fwhlin:~/www/imagehostnow.com (master)$ php artisan migrate
    Migration table created successfully.
    Migrated: 2015_01_05_044852_create_table_users
    Migrated: 2015_01_06_090738_create_table_images
    Migrated: 2015_01_09_084809_add_type_in_images
    Migrated: 2015_01_10_040524_add_default_image_privacy_in_users
    Migrated: 2015_01_10_062030_create_settings
    Migrated: 2015_01_13_053228_create_spam_reports
    boby@fwhlin:~/www/imagehostnow.com (master)$
    First when i run php artisan migrate, i get database not found error. I created a database, after that migrate command works properly.
    Become PHP Expert in 30 days
    FreeMarriage.com - Free Online Matrimonial
    FlashWebHost.com - Professional Web Hosting, Designing.

Page 2 of 2 FirstFirst 12

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
  •