mirror of
https://github.com/InvoiceShelf/InvoiceShelf.git
synced 2026-04-07 13:41:23 +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\DomainEnvironmentRequest;
|
||||||
use App\Http\Requests\MailEnvironmentRequest;
|
use App\Http\Requests\MailEnvironmentRequest;
|
||||||
use Exception;
|
use Exception;
|
||||||
|
use Illuminate\Support\Facades\Artisan;
|
||||||
use Illuminate\Support\Facades\DB;
|
use Illuminate\Support\Facades\DB;
|
||||||
|
|
||||||
class EnvironmentManager
|
class EnvironmentManager
|
||||||
@@ -149,7 +150,9 @@ class EnvironmentManager
|
|||||||
|
|
||||||
try {
|
try {
|
||||||
$this->checkDatabaseConnection($request);
|
$this->checkDatabaseConnection($request);
|
||||||
|
if ($request->get('database_overwrite')) {
|
||||||
|
Artisan::call('db:wipe --force');
|
||||||
|
}
|
||||||
if (\Schema::hasTable('users')) {
|
if (\Schema::hasTable('users')) {
|
||||||
return [
|
return [
|
||||||
'error' => 'database_should_be_empty',
|
'error' => 'database_should_be_empty',
|
||||||
|
|||||||
@@ -1440,6 +1440,7 @@
|
|||||||
"username": "Database Username",
|
"username": "Database Username",
|
||||||
"db_name": "Database Name",
|
"db_name": "Database Name",
|
||||||
"db_path": "Database Path",
|
"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."
|
"desc": "Create a database on your server and set the credentials using the form below."
|
||||||
},
|
},
|
||||||
"permissions": {
|
"permissions": {
|
||||||
|
|||||||
@@ -19,6 +19,7 @@ export const useInstallationStore = (useWindow = false) => {
|
|||||||
database_name: null,
|
database_name: null,
|
||||||
database_username: null,
|
database_username: null,
|
||||||
database_password: null,
|
database_password: null,
|
||||||
|
database_overwrite: false,
|
||||||
app_url: window.location.origin,
|
app_url: window.location.origin,
|
||||||
app_locale: null
|
app_locale: null
|
||||||
},
|
},
|
||||||
|
|||||||
@@ -84,6 +84,11 @@
|
|||||||
:invalid="v$.database_hostname.$error"
|
:invalid="v$.database_hostname.$error"
|
||||||
/>
|
/>
|
||||||
</BaseInputGroup>
|
</BaseInputGroup>
|
||||||
|
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<div class="w-full">
|
||||||
|
<BaseCheckbox v-model="databaseData.database_overwrite" :label="$t('wizard.database.overwrite')"/>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<BaseButton
|
<BaseButton
|
||||||
@@ -106,6 +111,8 @@ import { useInstallationStore } from '@/scripts/admin/stores/installation'
|
|||||||
import { helpers, required, numeric } from '@vuelidate/validators'
|
import { helpers, required, numeric } from '@vuelidate/validators'
|
||||||
import useVuelidate from '@vuelidate/core'
|
import useVuelidate from '@vuelidate/core'
|
||||||
import { useI18n } from 'vue-i18n'
|
import { useI18n } from 'vue-i18n'
|
||||||
|
import BaseInputGroup from '@/scripts/components/base/BaseInputGroup.vue'
|
||||||
|
import BaseCheckbox from '@/scripts/components/base/BaseCheckbox.vue'
|
||||||
|
|
||||||
const props = defineProps({
|
const props = defineProps({
|
||||||
configData: {
|
configData: {
|
||||||
|
|||||||
@@ -105,6 +105,10 @@
|
|||||||
</BaseInputGroup>
|
</BaseInputGroup>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
|
<div class="w-full">
|
||||||
|
<BaseCheckbox v-model="databaseData.database_overwrite" :label="$t('wizard.database.overwrite')"/>
|
||||||
|
</div>
|
||||||
|
|
||||||
<BaseButton
|
<BaseButton
|
||||||
v-show="!isFetchingInitialData"
|
v-show="!isFetchingInitialData"
|
||||||
:content-loading="isFetchingInitialData"
|
:content-loading="isFetchingInitialData"
|
||||||
@@ -127,6 +131,7 @@ import { useInstallationStore } from '@/scripts/admin/stores/installation'
|
|||||||
import { helpers, required, numeric } from '@vuelidate/validators'
|
import { helpers, required, numeric } from '@vuelidate/validators'
|
||||||
import useVuelidate from '@vuelidate/core'
|
import useVuelidate from '@vuelidate/core'
|
||||||
import { useI18n } from 'vue-i18n'
|
import { useI18n } from 'vue-i18n'
|
||||||
|
import BaseCheckbox from '@/scripts/components/base/BaseCheckbox.vue'
|
||||||
|
|
||||||
const props = defineProps({
|
const props = defineProps({
|
||||||
configData: {
|
configData: {
|
||||||
|
|||||||
Reference in New Issue
Block a user