pwweb / artomator

Artomator: Custom commands making life easier for Laravel.
MIT License
4 stars 1 forks source link

Initialisation of schema.graphql #23

Closed frankpde closed 4 years ago

frankpde commented 4 years ago

I believe the schema.graphql needs to be initialised if it does not yet exist:


-> artisan artomator:graphql_scaffold Test --prefix=Namespace/Prefix/Here
Specify fields for the model (skip id & timestamp fields, we will add it automatically)
Read docs carefully to specify field inputs)
Enter "exit" to finish

 Field: (name db_type html_type options) []:
 > name string

 Enter validations:  []:
 > required   

 Field: (name db_type html_type options) []:
 > exit

Migration created: 
2020_03_29_124346_create_tests_table.php

Model created: 
Test.php

Repository created: 
TestRepository.php

   ErrorException 

  file_get_contents(/Users/admin/Webserver/laravel.com.demo/graphql/schema.graphql): failed to open stream: No such file or directory

  at vendor/pwweb/artomator/src/Generators/GraphQL/GraphQLMutationGenerator.php:35
    31|     public function __construct(CommandData $commandData)
    32|     {
    33|         $this->commandData = $commandData;
    34|         $this->fileName = $commandData->config->pathGraphQL;
  > 35|         $this->fileContents = file_get_contents($this->fileName);
    36|         $this->templateData = get_artomator_template('graphql.mutations');
    37|         $this->templateData = fill_template($this->commandData->dynamicVars, $this->templateData);
    38|         $this->templateData = fill_template($this->generateSchema(), $this->templateData);
    39|     }

  • Database name seems incorrect: You're using the default database name `laravel`. This database does not exist.

    Edit the `.env` file and use the correct database name in the `DB_DATABASE` key. 
    https://laravel.com/docs/master/database#configuration

      +17 vendor frames 
  18  artisan:37
      Illuminate\Foundation\Console\Kernel::handle(Object(Symfony\Component\Console\Input\ArgvInput), Object(Symfony\Component\Console\Output\ConsoleOutput))-> artisan artomator:graphql_scaffold Test --prefix=Namespace/Prefix/Here
Specify fields for the model (skip id & timestamp fields, we will add it automatically)
Read docs carefully to specify field inputs)
Enter "exit" to finish

 Field: (name db_type html_type options) []:
 > name string

 Enter validations:  []:
 > required   

 Field: (name db_type html_type options) []:
 > exit

Migration created: 
2020_03_29_124346_create_tests_table.php

Model created: 
Test.php

Repository created: 
TestRepository.php

   ErrorException 

  file_get_contents(/Users/admin/Webserver/laravel.com.demo/graphql/schema.graphql): failed to open stream: No such file or directory

  at vendor/pwweb/artomator/src/Generators/GraphQL/GraphQLMutationGenerator.php:35
    31|     public function __construct(CommandData $commandData)
    32|     {
    33|         $this->commandData = $commandData;
    34|         $this->fileName = $commandData->config->pathGraphQL;
  > 35|         $this->fileContents = file_get_contents($this->fileName);
    36|         $this->templateData = get_artomator_template('graphql.mutations');
    37|         $this->templateData = fill_template($this->commandData->dynamicVars, $this->templateData);
    38|         $this->templateData = fill_template($this->generateSchema(), $this->templateData);
    39|     }

  • Database name seems incorrect: You're using the default database name `laravel`. This database does not exist.

    Edit the `.env` file and use the correct database name in the `DB_DATABASE` key. 
    https://laravel.com/docs/master/database#configuration

      +17 vendor frames 
  18  artisan:37
      Illuminate\Foundation\Console\Kernel::handle(Object(Symfony\Component\Console\Input\ArgvInput), Object(Symfony\Component\Console\Output\ConsoleOutput))```
rabrowne85 commented 4 years ago
rabrowne85 commented 4 years ago

Updated the publish command to include the lighthouse config file and the base schema file.

See commit: 3c06afd34005de614d90760ea5ffd4c253fcfa0f