Add database overwrite checkbox on Install wizard

Allows overwriting the existing database when installing InvoiceShelf
This commit is contained in:
Darko Gjorgjijoski
2024-07-29 14:20:43 +02:00
parent 56a555bc4a
commit da600d0144
5 changed files with 18 additions and 1 deletions

View File

@@ -7,6 +7,7 @@ use App\Http\Requests\DiskEnvironmentRequest;
use App\Http\Requests\DomainEnvironmentRequest;
use App\Http\Requests\MailEnvironmentRequest;
use Exception;
use Illuminate\Support\Facades\Artisan;
use Illuminate\Support\Facades\DB;
class EnvironmentManager
@@ -149,7 +150,9 @@ class EnvironmentManager
try {
$this->checkDatabaseConnection($request);
if ($request->get('database_overwrite')) {
Artisan::call('db:wipe --force');
}
if (\Schema::hasTable('users')) {
return [
'error' => 'database_should_be_empty',

View File

@@ -1440,6 +1440,7 @@
"username": "Database Username",
"db_name": "Database Name",
"db_path": "Database Path",
"overwrite": "Overwrite existing database and proceed",
"desc": "Create a database on your server and set the credentials using the form below."
},
"permissions": {

View File

@@ -19,6 +19,7 @@ export const useInstallationStore = (useWindow = false) => {
database_name: null,
database_username: null,
database_password: null,
database_overwrite: false,
app_url: window.location.origin,
app_locale: null
},

View File

@@ -84,6 +84,11 @@
:invalid="v$.database_hostname.$error"
/>
</BaseInputGroup>
</div>
<div class="w-full">
<BaseCheckbox v-model="databaseData.database_overwrite" :label="$t('wizard.database.overwrite')"/>
</div>
<BaseButton
@@ -106,6 +111,8 @@ import { useInstallationStore } from '@/scripts/admin/stores/installation'
import { helpers, required, numeric } from '@vuelidate/validators'
import useVuelidate from '@vuelidate/core'
import { useI18n } from 'vue-i18n'
import BaseInputGroup from '@/scripts/components/base/BaseInputGroup.vue'
import BaseCheckbox from '@/scripts/components/base/BaseCheckbox.vue'
const props = defineProps({
configData: {

View File

@@ -105,6 +105,10 @@
</BaseInputGroup>
</div>
<div class="w-full">
<BaseCheckbox v-model="databaseData.database_overwrite" :label="$t('wizard.database.overwrite')"/>
</div>
<BaseButton
v-show="!isFetchingInitialData"
:content-loading="isFetchingInitialData"
@@ -127,6 +131,7 @@ import { useInstallationStore } from '@/scripts/admin/stores/installation'
import { helpers, required, numeric } from '@vuelidate/validators'
import useVuelidate from '@vuelidate/core'
import { useI18n } from 'vue-i18n'
import BaseCheckbox from '@/scripts/components/base/BaseCheckbox.vue'
const props = defineProps({
configData: {