mirror of
https://github.com/InvoiceShelf/InvoiceShelf.git
synced 2026-04-07 05:31:24 +00:00
Add database overwrite checkbox on Install wizard
Allows overwriting the existing database when installing InvoiceShelf
This commit is contained in:
@@ -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',
|
||||
|
||||
@@ -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": {
|
||||
|
||||
@@ -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
|
||||
},
|
||||
|
||||
@@ -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: {
|
||||
|
||||
@@ -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: {
|
||||
|
||||
Reference in New Issue
Block a user