antonioribeiro / tddd

A Laravel Continuous Integration Package
MIT License
721 stars 57 forks source link

Migration not working #9

Closed nWidart closed 7 years ago

nWidart commented 7 years ago

Causes the following issue:

  [Symfony\Component\Debug\Exception\FatalThrowableError]              
  Call to undefined method Illuminate\Foundation\Application::share()  
antonioribeiro commented 7 years ago

Should work now on version 0.9.0.

nWidart commented 7 years ago

Fyi docs say php artisan migrates but it's migrate.

nWidart commented 7 years ago

They also fail with this


  [Illuminate\Database\QueryException]                                                                                                                                                                
  SQLSTATE[42000]: Syntax error or access violation: 1067 Invalid default value for 'started_at' (SQL: alter table `ci_runs` add `started_at` timestamp not null, add `ended_at` timestamp not null,  
   add `notified_at` timestamp null) (SQL: SQLSTATE[42000]: Syntax error or access violation: 1067 Invalid default value for 'started_at' (SQL: alter table `ci_runs` add `started_at` timestamp not  
   null, add `ended_at` timestamp not null, add `notified_at` timestamp null))                                                                                                                        

  [Illuminate\Database\QueryException]                                                                                                                                                                
  SQLSTATE[42000]: Syntax error or access violation: 1067 Invalid default value for 'started_at' (SQL: alter table `ci_runs` add `started_at` timestamp not null, add `ended_at` timestamp not null,  
   add `notified_at` timestamp null)                                                                                                                                                                  

  [PDOException]                                                                                  
  SQLSTATE[42000]: Syntax error or access violation: 1067 Invalid default value for 'started_at'  
antonioribeiro commented 7 years ago

Which database server?

nWidart commented 7 years ago

Mysql 5.7

antonioribeiro commented 7 years ago

Ok, tested it only with PostgreSQL

Just tweeted the install process here: https://twitter.com/iantonioribeiro/status/917078384961875968

nWidart commented 7 years ago

mysql 5.7 is stricter indeed. https://github.com/antonioribeiro/ci/blob/master/src/migrations/2017_09_27_800002_create_runs_start_end.php#L20 this needs a default value, or make it nullable. Same for other timestamp columns like ended_at.

antonioribeiro commented 7 years ago

Just did. 0.9.1 tagged. Thank you

nWidart commented 7 years ago

Awesome. 👍

nWidart commented 7 years ago

I'm getting the following error on mysql 5.6:

 [Illuminate\Database\QueryException]                                                                                                                                                                
  SQLSTATE[42000]: Syntax error or access violation: 1064 You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near 'jso  
  n null' at line 1 (SQL: alter table `ci_runs` add `screenshots` json null) (SQL: SQLSTATE[42000]: Syntax error or access violation: 1064 You have an error in your SQL syntax; check the manual th  
  at corresponds to your MySQL server version for the right syntax to use near 'json null' at line 1 (SQL: alter table `ci_runs` add `screenshots` json null))                                        

  [Illuminate\Database\QueryException]                                                                                                                                                                
  SQLSTATE[42000]: Syntax error or access violation: 1064 You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near 'jso  
  n null' at line 1 (SQL: alter table `ci_runs` add `screenshots` json null)                                                                                                                          

  [PDOException]                                                                                                                                                                                      
  SQLSTATE[42000]: Syntax error or access violation: 1064 You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near 'jso  
  n null' at line 1                                                                                                                                                                                   
antonioribeiro commented 7 years ago

I'll have to do a full run on MySQL, sorry about that. And maybe change that json column to text.

cdarken commented 7 years ago

@antonioribeiro since laravel 5.4 the minimum php version is is 7.0, right? I remember ubuntu 16.04 taken as reference. mysql 5.7 is default in 16.04, I wouldn't bother making it compatible with 5.6. Maybe just add the option to publish the migrations to customize them if you're not using other json specific functions in the models

antonioribeiro commented 7 years ago

I just moved it from json to text, since I'm not using any json specific functions.

Tagged 0.9.2, with this one and some other fixes. And one nice change, if you enable script on your tester it should give you all the reds and greens you usually see in terminal


    /**
     * script
     *
     */
    'script' => '/usr/bin/script -q %s %s', // sprintf()

    /**
     * Testers
     *
     */
    'testers' => [

        'phpunit' => [
            'command' => 'vendor/bin/phpunit',
            'require_script' => true,
        ],

image