Skip to content

Jobs table #300

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
avazquez-bit opened this issue May 10, 2024 · 5 comments
Closed

Jobs table #300

avazquez-bit opened this issue May 10, 2024 · 5 comments
Labels
bug Something isn't working linux

Comments

@avazquez-bit
Copy link

avazquez-bit commented May 10, 2024

What were you trying to do?

When execute native:serve command and app is running in dev console appears an error of trying to read a jobs table, i don't have more migrations to run but message still apperaing

image

What happened?

the app run without errors or interruptions, crashes or something else, but the message appears too much, as i said, no migrations left to run and I haven't seen if there is something to publish

How to reproduce the bug

php artisan native:serve in linux

Package Versions

{ "installed": [ { "name": "nativephp/electron", "direct-dependency": true, "homepage": "https://github.com/nativephp/electron", "source": "https://github.com/NativePHP/electron/tree/0.6.3", "version": "0.6.3", "description": "Electron wrapper for the NativePHP framework.", "abandoned": false }, { "name": "nativephp/laravel", "direct-dependency": false, "homepage": "https://github.com/nativephp/laravel", "source": "https://github.com/NativePHP/laravel/tree/0.5.2", "version": "0.5.2", "description": "Laravel wrapper for the NativePHP framework.", "abandoned": false }, { "name": "nativephp/php-bin", "direct-dependency": false, "homepage": "https://nativephp.com", "source": "https://github.com/NativePHP/php-bin/tree/0.4.0", "version": "0.4.0", "description": "PHP binaries used by the NativePHP framework", "abandoned": false } ] }

PHP Version

8.2.10

Laravel Version

10.10

Node Version

18.20.2

Which operating systems have you seen this occur on?

Linux

OS version

Ubuntu 23.10 budgie 10.8

Notes

No response

@avazquez-bit avazquez-bit added the bug Something isn't working label May 10, 2024
@Fludem
Copy link

Fludem commented May 12, 2024

Hey,

It's because the connection is currently defaulting to one called "nativephp"

I'm not sure why this functionality exists or why it's the default, but if you run the native:migrate command it will fix this error

@avazquez-bit
Copy link
Author

I had no migrations left to run but, now, for check I try to run it, but I got this

image

I have no problems to run migrates before, I have all composer packages updated, I've changed database file, permissions thinking that the problem could be there, run command as root, change file owner, but nothig whatever I do even the message is the same, I dont know if this si part of the problem

@Rudeisnice
Copy link

You could just publish the Laravel jobs migration with "php artisan queue:table".
I've done the same on my boilerplate:
https://github.com/Rudeisnice/nativephp-boilerplate

@gitnyasha
Copy link

I had a similar issue on windows so before I ran php artisan native:build win I ran the following commands first and it worked

php artisan queue:table         
php artisan migrate

@simonhamp
Copy link
Member

First of all, please make sure you're running the latest versions of the packages (as of today, nativephp/laravel v0.6.2 and nativephp/electron v0.8.5).

There are 3 databases involved when developing your NativePHP application:

  1. Your default Laravel application database: This is the one defined between your .env and config and is what your application will use if you simply load it from a browser.
    It's best if you use SQLite here for consistency and to avoid problems with differences in the underlying query languages, but it doesn't need to be SQLite. Generally tho, when you're developing and running your app with native:serve, this database will be inactive.
  2. The database/nativephp.sqlite database: This is the development version of your application's database.
    We have to create this for you because we don't want to modify your application and NativePHP won't know what database type you're using or what state it's in. This database gets you closer to the experience your users will have when running your app on their devices, which in turn will better help you debug issues.
  3. The [APPDATA]/database/database.sqlite database: This is your application's production database, considered "the user's copy".
    The actual location of this file will vary based on the OS that your app is installed under. We call it "the user's copy" as it is owned by them (usually under their user profile directory tree), created when they first boot your app, and automatically migrated when they run updated versions of your app. At any point the user could do what they want with this file and your application needs to be able to handle that.

The docs have been updated to better indicate the steps taken by NativePHP and what the developer needs to do during development, but the main gist of it is:

If your dev database (database/nativephp.sqlite) file already exists and you create new migrations, then you'll need to manually migrate your dev database before running dev builds (native:serve) of your app.

At any point during development, you should also be able to run php artisan native:migrate:fresh to completely rebuild your development database.

Alternatively, if you want to start from scratch, you can simply delete database/nativephp.sqlite and this will be recreated and migrated for you the next time you run native:serve.

Note that for production builds (php artisan native:build), your user's copy of the database will be migrated intelligently on app bootup.

I hope this all makes sense.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working linux
Projects
None yet
Development

No branches or pull requests

5 participants