MannikJ / laravel-wallet

An easy-to-use virtual wallet implementation for Laravel
MIT License
35 stars 13 forks source link

Crossgrading from depsimon/laravel-wallet into Laravel 8 #10

Open userneeds-ahe opened 3 years ago

userneeds-ahe commented 3 years ago

Hi guys,

So I've been using depsimon's version since laravel 5.7 with great success and now, upgrading to Laravel 8 I seem destined to change the dependency to yours. So I was wondering if you could supply the upgrade instructions. I see there's some differences i.r.t. the migrations, perhaps among other things. What do I need to do?

Thanks in advance!

Error message: Column not found: 1054 Unknown column 'wallets.owner_id'

MannikJ commented 3 years ago

Thank you for your interest in this package! Unfortunately I cannot provide a complete migration guide since this fork has become quite different from the original package over time and although we still use it in one of our applications, we make only the most necessary changes.

If it's even still relevant for you I can try to help you with your problems, but I would also encourage you to see if it makes sense for you to migrate to this package instead of using our fork, because it is way more popular and therefor better maintained.

If you still want to use our package you need to update your tables: The first thing that is essential is that the user_id column was replaced by morph columns named owner_id and owner_type:

  $table->renameColumn('user_id', 'owner_id');
  $table->string('owner_type')->nullable();

And you will need to add timestamp columns called 'deleted_at' to the wallets and wallet_transactions tables:

   $table->softDeletes();