lunarphp / livewire-starter-kit

Demonstration store for Lunar
https://docs.lunarphp.io/core/starter-kits.html
149 stars 50 forks source link

Migration not found and its not work #69

Closed tarun-themesbrand closed 11 months ago

tarun-themesbrand commented 12 months ago

When I follow the step for starterkit install and migrating database. but there are no migrations found and its give error specify key was too long.

glennjacobs commented 12 months ago

Could do with more information. What database are you using, can you include the full error message?

lCHECHOl commented 12 months ago

Hi, I have a similar error when following the starter kit guide.

first try to do it with a postgresql database with psql version (PostgreSQL) 13.10 (Ubuntu13.10-1.pgdg20.04+1)

when i run php artisan migrate i get the following error:

  2023_06_07_100000_add_cart_id_to_orders_table ........................................................................................... 6ms DONE

   Illuminate\Database\QueryException 

  SQLSTATE[42883]: Undefined function: 7 ERROR:  operator does not exist: json = unknown
LINE 1: ...regate from "lunar_product_options" where "label" = $1 or "l...
                                                             ^
HINT:  No operator matches the given name and argument types. You might need to add explicit type casts. (SQL: select count(*) as aggregate from "lunar_product_options" where "label" =  or "label" is null)

  at vendor/laravel/framework/src/Illuminate/Database/Connection.php:760
    756▕         // If an exception occurs when attempting to run a query, we'll format the error
    757▕         // message to include the bindings with SQL, which will make this exception a
    758▕         // lot more helpful to the developer instead of just the database's errors.
    759▕         catch (Exception $e) {
  ➜ 760▕             throw new QueryException(
    761▕                 $query, $this->prepareBindings($bindings), $e
    762▕             );
    763▕         }
    764▕     }

      +46 vendor frames 
  47  artisan:37
      Illuminate\Foundation\Console\Kernel::handle()

and when running php artisan db:seed i am also getting the following error.


  Database\Seeders\CollectionSeeder ........................................................................................................ RUNNING  

   ErrorException 

  Attempt to read property "id" on null

  at database/seeders/CollectionSeeder.php:27
     23▕ 
     24▕         DB::transaction(function () use ($collections, $collectionGroup) {
     25▕             foreach ($collections as $collection) {
     26▕                 Collection::create([
  ➜  27▕                     'collection_group_id' => $collectionGroup->id,
     28▕                     'attribute_data' => [
     29▕                         'name' => new TranslatedText([
     30▕                             'en' => new Text($collection->name),
     31▕                         ]),

  1   database/seeders/CollectionSeeder.php:27
      Illuminate\Foundation\Bootstrap\HandleExceptions::Illuminate\Foundation\Bootstrap\{closure}()

      +3 vendor frames 
  5   database/seeders/CollectionSeeder.php:38
      Illuminate\Support\Facades\Facade::__callStatic()

I did a test with a mysql database and the php artisan migrate command worked fine but when running php artisan db:seed I got the following error in mysql with the following version (mysql Ver 8.0.32-0ubuntu0.20.04.2 for Linux on x86_64 ((Ubuntu)))

error:


  Database\Seeders\CollectionSeeder ........................................................................................................ RUNNING  

   ErrorException 

  Attempt to read property "id" on null

  at database/seeders/CollectionSeeder.php:27
     23▕ 
     24▕         DB::transaction(function () use ($collections, $collectionGroup) {
     25▕             foreach ($collections as $collection) {
     26▕                 Collection::create([
  ➜  27▕                     'collection_group_id' => $collectionGroup->id,
     28▕                     'attribute_data' => [
     29▕                         'name' => new TranslatedText([
     30▕                             'en' => new Text($collection->name),
     31▕                         ]),

  1   database/seeders/CollectionSeeder.php:27
      Illuminate\Foundation\Bootstrap\HandleExceptions::Illuminate\Foundation\Bootstrap\{closure}()

      +3 vendor frames 
  5   database/seeders/CollectionSeeder.php:38
      Illuminate\Support\Facades\Facade::__callStatic()

thank you in advance for your attention, I am waiting for any solution please.

tarun-themesbrand commented 12 months ago

Sure, I am using MySQL database and seems everything fine but getting the below error on migration. I think need to add length in this migration file for the string columns.


2021_07_29_100005_create_attributes_table ........................ 38ms FAIL

SQLSTATE[42000]: Syntax error or access violation: 1071 Specified key was too
long; max key length is 1000 bytes (SQL: alter table `lunar_attributes` add uniq
ue `lunar_attributes_attribute_type_handle_unique`(`attribute_type`, `handle`))
glennjacobs commented 11 months ago

This isn't an issue with the starter kit, it's the Lunar package. I believe this has been resolved now anyhow, so closing.