Skip to content

Commit 1283ebc

Browse files
committed
Add notes around running production builds
1 parent f4bfddf commit 1283ebc

File tree

1 file changed

+35
-1
lines changed

1 file changed

+35
-1
lines changed

resources/views/docs/1/publishing/building.md

Lines changed: 35 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -74,7 +74,8 @@ NativePHP makes this as easy for you as it can, but each platform does have slig
7474

7575
[See the Electron documentation](https://www.electronforge.io/guides/code-signing/code-signing-macos) for more details.
7676

77-
To prepare for signing and notarizing, please provide the following environment variables when running `php artisan native:build`:
77+
To prepare for signing and notarizing, please provide the following environment variables when running
78+
`php artisan native:build`:
7879

7980
```dotenv
8081
@@ -83,3 +84,36 @@ NATIVEPHP_APPLE_TEAM_ID=8XCUU22SN2
8384
```
8485

8586
These can be added to your `.env` file as they will be stripped out when your app is built.
87+
88+
## First run
89+
90+
When your application runs for the first time, a number of things occur.
91+
92+
NativePHP will:
93+
94+
1. Create the `appdata` folder - where this is created depends which platform you're developing on. It is named
95+
according to your `nativephp.app_id` [config](/docs/getting-started/configuration) value (which is based on the
96+
`NATIVEPHP_APP_ID` env variable).
97+
2. Creating the `{appdata}/database/database.sqlite` SQLite database - your user's copy of your app's database.
98+
3. Migrate this database.
99+
100+
If you wish to seed the user's database, you should run this somewhere that runs
101+
[every time your app boots](/docs/the-basics/app-lifecycle#codeApplicationBootedcode).
102+
103+
Check if the database was already seeded and, if not, run the appropriate `db:seed` command. For example:
104+
105+
```php
106+
use App\Models\Config;
107+
use Illuminate\Support\Facades\Artisan;
108+
109+
if (Config::where('seeded', true)->count() === 1) {
110+
Artisan::call('db:seed');
111+
}
112+
```
113+
114+
## Subsequent runs
115+
116+
Each time a user opens your app, NativePHP will check to see if the [app version](#versioning) has changed and attempt
117+
to migrate the user's copy of your database in their `appdata` folder.
118+
119+
This is why you should change the version identifier for each release.

0 commit comments

Comments
 (0)