diff --git a/VERSION.txt b/VERSION.txt index 417fbb1548ee..dbf3366489b1 100644 --- a/VERSION.txt +++ b/VERSION.txt @@ -1 +1 @@ -5.0.21 +5.0.22 diff --git a/app/Http/Requests/Client/StoreClientRequest.php b/app/Http/Requests/Client/StoreClientRequest.php index 1b8bba5dde70..93c8877a22f1 100644 --- a/app/Http/Requests/Client/StoreClientRequest.php +++ b/app/Http/Requests/Client/StoreClientRequest.php @@ -84,9 +84,8 @@ class StoreClientRequest extends Request } } - if (array_key_exists('assigned_user_id', $input) && is_string($input['assigned_user_id'])) { - $input['assigned_user_id'] = $this->decodePrimaryKey($input['assigned_user_id']); - } + $input = $this->decodePrimaryKeys($input); + //is no settings->currency_id is set then lets dive in and find either a group or company currency all the below may be redundant!! if (! property_exists($settings, 'currency_id') && isset($input['group_settings_id'])) { @@ -108,29 +107,6 @@ class StoreClientRequest extends Request $input['settings'] = $settings; - if (isset($input['contacts'])) { - foreach ($input['contacts'] as $key => $contact) { - if (array_key_exists('id', $contact) && is_numeric($contact['id'])) { - unset($input['contacts'][$key]['id']); - } elseif (array_key_exists('id', $contact) && is_string($contact['id'])) { - $input['contacts'][$key]['id'] = $this->decodePrimaryKey($contact['id']); - } - - //Filter the client contact password - if it is sent with ***** we should ignore it! - if (isset($contact['password'])) { - if (strlen($contact['password']) == 0) { - $input['contacts'][$key]['password'] = ''; - } else { - $contact['password'] = str_replace('*', '', $contact['password']); - - if (strlen($contact['password']) == 0) { - unset($input['contacts'][$key]['password']); - } - } - } - } - } - if (isset($input['country_code'])) { $input['country_id'] = $this->getCountryCode($input['country_code']); } diff --git a/app/Http/Requests/Client/UpdateClientRequest.php b/app/Http/Requests/Client/UpdateClientRequest.php index 7d9e05f4966f..a29416c06bcf 100644 --- a/app/Http/Requests/Client/UpdateClientRequest.php +++ b/app/Http/Requests/Client/UpdateClientRequest.php @@ -95,33 +95,7 @@ class UpdateClientRequest extends Request $input['group_settings_id'] = $this->decodePrimaryKey($input['group_settings_id']); } - if (array_key_exists('assigned_user_id', $input) && is_string($input['assigned_user_id'])) { - $input['assigned_user_id'] = $this->decodePrimaryKey($input['assigned_user_id']); - } - - if (isset($input['contacts'])) { - foreach ($input['contacts'] as $key => $contact) { - if (array_key_exists('id', $contact) && is_numeric($contact['id'])) { - unset($input['contacts'][$key]['id']); - } elseif (array_key_exists('id', $contact) && is_string($contact['id'])) { - $input['contacts'][$key]['id'] = $this->decodePrimaryKey($contact['id']); - } - - //Filter the client contact password - if it is sent with ***** we should ignore it! - if (isset($contact['password'])) { - if (strlen($contact['password']) == 0) { - $input['contacts'][$key]['password'] = ''; - } else { - $input['contacts'][$key]['password'] = str_replace('*', '', $contact['password']); - - if (strlen($contact['password']) == 0) { - unset($input['contacts'][$key]['password']); - } - - } - } - } - } + $input = $this->decodePrimaryKeys($input); if (array_key_exists('settings', $input)) { $input['settings'] = $this->filterSaveableSettings($input['settings']); diff --git a/app/Http/Requests/ClientPortal/CreatePaymentMethodRequest.php b/app/Http/Requests/ClientPortal/CreatePaymentMethodRequest.php index 8af355a95f79..7997eb9efa69 100644 --- a/app/Http/Requests/ClientPortal/CreatePaymentMethodRequest.php +++ b/app/Http/Requests/ClientPortal/CreatePaymentMethodRequest.php @@ -2,6 +2,7 @@ namespace App\Http\Requests\ClientPortal; +use App\Http\Requests\Request; use Illuminate\Foundation\Http\FormRequest; class CreatePaymentMethodRequest extends FormRequest diff --git a/app/Http/Requests/ClientPortal/Documents/ShowDocumentRequest.php b/app/Http/Requests/ClientPortal/Documents/ShowDocumentRequest.php index dadcd7ec25a4..6db1346cbbc1 100644 --- a/app/Http/Requests/ClientPortal/Documents/ShowDocumentRequest.php +++ b/app/Http/Requests/ClientPortal/Documents/ShowDocumentRequest.php @@ -14,6 +14,7 @@ namespace App\Http\Requests\ClientPortal\Documents; use App\Models\Document; use App\Utils\Traits\MakesHash; + use Illuminate\Foundation\Http\FormRequest; class ShowDocumentRequest extends FormRequest diff --git a/app/Http/Requests/Credit/ActionCreditRequest.php b/app/Http/Requests/Credit/ActionCreditRequest.php index 6889c663831a..41919c632822 100644 --- a/app/Http/Requests/Credit/ActionCreditRequest.php +++ b/app/Http/Requests/Credit/ActionCreditRequest.php @@ -1,4 +1,13 @@ decodePrimaryKey($input['design_id']); } - if (array_key_exists('client_id', $input) && is_string($input['client_id'])) { - $input['client_id'] = $this->decodePrimaryKey($input['client_id']); - } - - if (array_key_exists('assigned_user_id', $input) && is_string($input['assigned_user_id'])) { - $input['assigned_user_id'] = $this->decodePrimaryKey($input['assigned_user_id']); - } - - if (isset($input['client_contacts'])) { - foreach ($input['client_contacts'] as $key => $contact) { - if (! array_key_exists('send_email', $contact) || ! array_key_exists('id', $contact)) { - unset($input['client_contacts'][$key]); - } - } - } - - if (isset($input['invitations'])) { - foreach ($input['invitations'] as $key => $value) { - if (isset($input['invitations'][$key]['id']) && is_numeric($input['invitations'][$key]['id'])) { - unset($input['invitations'][$key]['id']); - } - - if (isset($input['invitations'][$key]['id']) && is_string($input['invitations'][$key]['id'])) { - $input['invitations'][$key]['id'] = $this->decodePrimaryKey($input['invitations'][$key]['id']); - } - - if (is_string($input['invitations'][$key]['client_contact_id'])) { - $input['invitations'][$key]['client_contact_id'] = $this->decodePrimaryKey($input['invitations'][$key]['client_contact_id']); - } - } - } + $input = $this->decodePrimaryKeys($input); $input['line_items'] = isset($input['line_items']) ? $this->cleanItems($input['line_items']) : []; //$input['line_items'] = json_encode($input['line_items']); diff --git a/app/Http/Requests/Credit/UpdateCreditRequest.php b/app/Http/Requests/Credit/UpdateCreditRequest.php index 03e7ca722116..a1d1acecb056 100644 --- a/app/Http/Requests/Credit/UpdateCreditRequest.php +++ b/app/Http/Requests/Credit/UpdateCreditRequest.php @@ -1,13 +1,23 @@ all(); - if (array_key_exists('design_id', $input) && is_string($input['design_id'])) { - $input['design_id'] = $this->decodePrimaryKey($input['design_id']); - } - - if (isset($input['client_id'])) { - $input['client_id'] = $this->decodePrimaryKey($input['client_id']); - } - - if (array_key_exists('assigned_user_id', $input) && is_string($input['assigned_user_id'])) { - $input['assigned_user_id'] = $this->decodePrimaryKey($input['assigned_user_id']); - } - - if (isset($input['invitations'])) { - foreach ($input['invitations'] as $key => $value) { - if (is_numeric($input['invitations'][$key]['id'])) { - unset($input['invitations'][$key]['id']); - } - - if (is_string($input['invitations'][$key]['id'])) { - $input['invitations'][$key]['id'] = $this->decodePrimaryKey($input['invitations'][$key]['id']); - } - - if (is_string($input['invitations'][$key]['client_contact_id'])) { - $input['invitations'][$key]['client_contact_id'] = $this->decodePrimaryKey($input['invitations'][$key]['client_contact_id']); - } - } - } + $input = $this->decodePrimaryKeys($input); $input['line_items'] = isset($input['line_items']) ? $this->cleanItems($input['line_items']) : []; diff --git a/app/Http/Requests/Document/DownloadMultipleDocumentsRequest.php b/app/Http/Requests/Document/DownloadMultipleDocumentsRequest.php index 34c6b11e3b3d..38e3b419a85d 100644 --- a/app/Http/Requests/Document/DownloadMultipleDocumentsRequest.php +++ b/app/Http/Requests/Document/DownloadMultipleDocumentsRequest.php @@ -12,9 +12,9 @@ namespace App\Http\Requests\Document; -use Illuminate\Foundation\Http\FormRequest; +use App\Http\Requests\Request; -class DownloadMultipleDocumentsRequest extends FormRequest +class DownloadMultipleDocumentsRequest extends Request { /** * Determine if the user is authorized to make this request. diff --git a/app/Http/Requests/Expense/BulkExpenseRequest.php b/app/Http/Requests/Expense/BulkExpenseRequest.php index ac0fade1591b..9d4d430d2586 100644 --- a/app/Http/Requests/Expense/BulkExpenseRequest.php +++ b/app/Http/Requests/Expense/BulkExpenseRequest.php @@ -1,12 +1,22 @@ id.',id,company_id,'.$this->company_id; - $rules['contacts.*.email'] = 'nullable|distinct'; - $rules['number'] = new UniqueExpenseNumberRule($this->all()); + $rules['client_id'] = 'bail|sometimes|exists:clients,id,company_id,'.auth()->user()->company()->id; - return $rules; + + return $this->globalRules($rules); } protected function prepareForValidation() { - // $input = $this->all(); + $input = $this->all(); + $input = $this->decodePrimaryKeys($input); - // $this->replace($input); + $this->replace($input); } public function messages() diff --git a/app/Http/Requests/ExpenseCategory/BulkExpenseCategoryRequest.php b/app/Http/Requests/ExpenseCategory/BulkExpenseCategoryRequest.php index 92b72f5e5b13..39ea6f22b2e7 100644 --- a/app/Http/Requests/ExpenseCategory/BulkExpenseCategoryRequest.php +++ b/app/Http/Requests/ExpenseCategory/BulkExpenseCategoryRequest.php @@ -1,12 +1,22 @@ all(); - if (array_key_exists('design_id', $input) && is_string($input['design_id'])) { - $input['design_id'] = $this->decodePrimaryKey($input['design_id']); - } - - if (array_key_exists('client_id', $input) && is_string($input['client_id'])) { - $input['client_id'] = $this->decodePrimaryKey($input['client_id']); - } - - if (array_key_exists('project_id', $input) && is_string($input['project_id'])) { - $input['project_id'] = $this->decodePrimaryKey($input['project_id']); - } - - if (array_key_exists('assigned_user_id', $input) && is_string($input['assigned_user_id'])) { - $input['assigned_user_id'] = $this->decodePrimaryKey($input['assigned_user_id']); - } - - if (isset($input['client_contacts'])) { - foreach ($input['client_contacts'] as $key => $contact) { - if (! array_key_exists('send_email', $contact) || ! array_key_exists('id', $contact)) { - unset($input['client_contacts'][$key]); - } - } - } - - if (isset($input['invitations'])) { - foreach ($input['invitations'] as $key => $value) { - if (isset($input['invitations'][$key]['id']) && is_numeric($input['invitations'][$key]['id'])) { - unset($input['invitations'][$key]['id']); - } - - if (isset($input['invitations'][$key]['id']) && is_string($input['invitations'][$key]['id'])) { - $input['invitations'][$key]['id'] = $this->decodePrimaryKey($input['invitations'][$key]['id']); - } - - if (is_string($input['invitations'][$key]['client_contact_id'])) { - $input['invitations'][$key]['client_contact_id'] = $this->decodePrimaryKey($input['invitations'][$key]['client_contact_id']); - } - } - } + $input = $this->decodePrimaryKeys($input); $input['line_items'] = isset($input['line_items']) ? $this->cleanItems($input['line_items']) : []; //$input['line_items'] = json_encode($input['line_items']); diff --git a/app/Http/Requests/Invoice/UpdateInvoiceRequest.php b/app/Http/Requests/Invoice/UpdateInvoiceRequest.php index a38cbe90f14d..6f71c4ab6dc5 100644 --- a/app/Http/Requests/Invoice/UpdateInvoiceRequest.php +++ b/app/Http/Requests/Invoice/UpdateInvoiceRequest.php @@ -62,35 +62,10 @@ class UpdateInvoiceRequest extends Request { $input = $this->all(); - if (array_key_exists('design_id', $input) && is_string($input['design_id'])) { - $input['design_id'] = $this->decodePrimaryKey($input['design_id']); - } - - if (isset($input['client_id'])) { - $input['client_id'] = $this->decodePrimaryKey($input['client_id']); - } - - if (array_key_exists('assigned_user_id', $input) && is_string($input['assigned_user_id'])) { - $input['assigned_user_id'] = $this->decodePrimaryKey($input['assigned_user_id']); - } - - if (isset($input['invitations'])) { - foreach ($input['invitations'] as $key => $value) { - if (array_key_exists('id', $input['invitations'][$key]) && is_numeric($input['invitations'][$key]['id'])) { - unset($input['invitations'][$key]['id']); - } - - if (array_key_exists('id', $input['invitations'][$key]) && is_string($input['invitations'][$key]['id'])) { - $input['invitations'][$key]['id'] = $this->decodePrimaryKey($input['invitations'][$key]['id']); - } - - if (is_string($input['invitations'][$key]['client_contact_id'])) { - $input['invitations'][$key]['client_contact_id'] = $this->decodePrimaryKey($input['invitations'][$key]['client_contact_id']); - } - } - } + $input = $this->decodePrimaryKeys($input); $input['id'] = $this->invoice->id; + $input['line_items'] = isset($input['line_items']) ? $this->cleanItems($input['line_items']) : []; $this->replace($input); diff --git a/app/Http/Requests/Migration/UploadMigrationFileRequest.php b/app/Http/Requests/Migration/UploadMigrationFileRequest.php index 0900f634a34c..6beae1f5c8c0 100644 --- a/app/Http/Requests/Migration/UploadMigrationFileRequest.php +++ b/app/Http/Requests/Migration/UploadMigrationFileRequest.php @@ -1,10 +1,20 @@ all(); - if (array_key_exists('assigned_user_id', $input) && is_string($input['assigned_user_id'])) { - $input['assigned_user_id'] = $this->decodePrimaryKey($input['assigned_user_id']); - } + $input = $this->decodePrimaryKeys($input); if (isset($input['client_id'])) { unset($input['client_id']); @@ -72,18 +70,6 @@ class UpdatePaymentRequest extends Request unset($input['amount']); } - // if (isset($input['type_id'])) { - // unset($input['type_id']); - // } - - // if (isset($input['date'])) { - // unset($input['date']); - // } - - // if (isset($input['transaction_reference'])) { - // unset($input['transaction_reference']); - // } - if (isset($input['number'])) { unset($input['number']); } diff --git a/app/Http/Requests/Payments/PaymentWebhookRequest.php b/app/Http/Requests/Payments/PaymentWebhookRequest.php index 48896cd418d1..f4177fe8b4b6 100644 --- a/app/Http/Requests/Payments/PaymentWebhookRequest.php +++ b/app/Http/Requests/Payments/PaymentWebhookRequest.php @@ -1,12 +1,22 @@ all() as $key => $value) + { + if(method_exists($this, $key)) + $rules = $this->{$key}($rules); + } + + return $rules; + } + + private function assigned_user_id($rules) + { + $rules['assigned_user_id'] = [ + 'bail' , + 'sometimes', + 'nullable', + new RelatedUserRule($this->all()) + ]; + + return $rules; + } + + private function invoice_id($rules) + { + $rules['invoice_id'] = 'bail|nullable|sometimes|exists:invoices,id,company_id,'.auth()->user()->company()->id.',client_id,'.$this['client_id']; + + return $rules; + } + + private function vendor_id($rules) + { + $rules['vendor_id'] = 'bail|sometimes|exists:vendors,id,company_id,'.auth()->user()->company()->id; + + return $rules; + } + + public function decodePrimaryKeys($input) + { + + if (array_key_exists('assigned_user_id', $input) && is_string($input['assigned_user_id'])) { + $input['assigned_user_id'] = $this->decodePrimaryKey($input['assigned_user_id']); + } + + if (array_key_exists('user_id', $input) && is_string($input['user_id'])) { + $input['user_id'] = $this->decodePrimaryKey($input['user_id']); + } + + if (array_key_exists('vendor_id', $input) && is_string($input['vendor_id'])) { + $input['vendor_id'] = $this->decodePrimaryKey($input['vendor_id']); + } + + if (array_key_exists('client_id', $input) && is_string($input['client_id'])) { + $input['client_id'] = $this->decodePrimaryKey($input['client_id']); + } + + if (array_key_exists('invoice_id', $input) && is_string($input['invoice_id'])) { + $input['invoice_id'] = $this->decodePrimaryKey($input['invoice_id']); + } + + if (array_key_exists('design_id', $input) && is_string($input['design_id'])) { + $input['design_id'] = $this->decodePrimaryKey($input['design_id']); + } + + if (array_key_exists('project_id', $input) && is_string($input['project_id'])) { + $input['project_id'] = $this->decodePrimaryKey($input['project_id']); + } + + if (isset($input['client_contacts'])) { + foreach ($input['client_contacts'] as $key => $contact) { + if (! array_key_exists('send_email', $contact) || ! array_key_exists('id', $contact)) { + unset($input['client_contacts'][$key]); + } + } + } + + if (isset($input['invitations'])) { + foreach ($input['invitations'] as $key => $value) { + if (isset($input['invitations'][$key]['id']) && is_numeric($input['invitations'][$key]['id'])) { + unset($input['invitations'][$key]['id']); + } + + if (isset($input['invitations'][$key]['id']) && is_string($input['invitations'][$key]['id'])) { + $input['invitations'][$key]['id'] = $this->decodePrimaryKey($input['invitations'][$key]['id']); + } + + if (is_string($input['invitations'][$key]['client_contact_id'])) { + $input['invitations'][$key]['client_contact_id'] = $this->decodePrimaryKey($input['invitations'][$key]['client_contact_id']); + } + } + } + + if (isset($input['contacts'])) { + foreach ($input['contacts'] as $key => $contact) { + if (array_key_exists('id', $contact) && is_numeric($contact['id'])) { + unset($input['contacts'][$key]['id']); + } elseif (array_key_exists('id', $contact) && is_string($contact['id'])) { + $input['contacts'][$key]['id'] = $this->decodePrimaryKey($contact['id']); + } + + //Filter the client contact password - if it is sent with ***** we should ignore it! + if (isset($contact['password'])) { + if (strlen($contact['password']) == 0) { + $input['contacts'][$key]['password'] = ''; + } else { + $contact['password'] = str_replace('*', '', $contact['password']); + + if (strlen($contact['password']) == 0) { + unset($input['contacts'][$key]['password']); + } + } + } + } + } + + return $input; + } } diff --git a/app/Http/Requests/Setup/CheckDatabaseRequest.php b/app/Http/Requests/Setup/CheckDatabaseRequest.php index 082cd56cf4cc..9de2aa8a3c41 100644 --- a/app/Http/Requests/Setup/CheckDatabaseRequest.php +++ b/app/Http/Requests/Setup/CheckDatabaseRequest.php @@ -1,10 +1,20 @@ all(); - if (array_key_exists('assigned_user_id', $input) && is_string($input['assigned_user_id'])) { - $input['assigned_user_id'] = $this->decodePrimaryKey($input['assigned_user_id']); - } + $input = $this->decodePrimaryKeys($input); $this->replace($input); } diff --git a/app/Http/Requests/Webhook/BulkWebhookRequest.php b/app/Http/Requests/Webhook/BulkWebhookRequest.php index aa178f22f266..4d10836505d2 100644 --- a/app/Http/Requests/Webhook/BulkWebhookRequest.php +++ b/app/Http/Requests/Webhook/BulkWebhookRequest.php @@ -1,12 +1,22 @@ input = $input; + } + /** + * @param string $attribute + * @param mixed $value + * @return bool + */ + public function passes($attribute, $value) + { + return $this->checkUserIsRelated($value); + } + + /** + * @return string + */ + public function message() + { + return 'User not associated with this account'; + } + + /** + * @param $email + * @return bool + */ + private function checkUserIsRelated($user_id) : bool + { + return User::query() + ->where('id', $user_id) + ->where('account_id', auth()->user()->company()->account_id) + ->exists(); + } +} diff --git a/app/Models/Expense.php b/app/Models/Expense.php index e8db121cb19d..1747164b7769 100644 --- a/app/Models/Expense.php +++ b/app/Models/Expense.php @@ -23,7 +23,9 @@ class Expense extends BaseModel protected $fillable = [ 'client_id', + 'assigned_user_id', 'vendor_id', + 'invoice_id', 'expense_currency_id', 'date', 'invoice_currency_id', @@ -34,7 +36,7 @@ class Expense extends BaseModel 'public_notes', 'bank_id', 'transaction_id', - 'expense_category_id', + 'category_id', 'tax_rate1', 'tax_name1', 'tax_rate2', diff --git a/app/Transformers/ExpenseTransformer.php b/app/Transformers/ExpenseTransformer.php index ac2f0eac9b6f..c26bde1dc1d6 100644 --- a/app/Transformers/ExpenseTransformer.php +++ b/app/Transformers/ExpenseTransformer.php @@ -80,6 +80,7 @@ class ExpenseTransformer extends EntityTransformer 'transaction_id' => (string) $expense->transaction_id ?: '', //'date' => $expense->date ?: '', 'expense_date' => $expense->date ?: '', + 'number' => (string)$expense->number ?: '', 'payment_date' => $expense->payment_date ?: '', 'custom_value1' => $expense->custom_value1 ?: '', 'custom_value2' => $expense->custom_value2 ?: '', diff --git a/app/Transformers/VendorTransformer.php b/app/Transformers/VendorTransformer.php index e6a4c7799c03..5f5da73700fa 100644 --- a/app/Transformers/VendorTransformer.php +++ b/app/Transformers/VendorTransformer.php @@ -106,6 +106,7 @@ class VendorTransformer extends EntityTransformer 'updated_at' => (int) $vendor->updated_at, 'archived_at' => (int) $vendor->deleted_at, 'created_at' => (int) $vendor->created_at, + 'number' => (string)$vendor->number ?: '', ]; } } diff --git a/composer.lock b/composer.lock index 6240140f017d..a013bee1626f 100644 --- a/composer.lock +++ b/composer.lock @@ -108,16 +108,16 @@ }, { "name": "aws/aws-sdk-php", - "version": "3.158.10", + "version": "3.158.11", "source": { "type": "git", "url": "https://github.com/aws/aws-sdk-php.git", - "reference": "a492e9aac7cba87177c06095c4e5bc9adcb1e397" + "reference": "cdf3c097a606087654ac90ea1ffb8f3e86c423be" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/aws/aws-sdk-php/zipball/a492e9aac7cba87177c06095c4e5bc9adcb1e397", - "reference": "a492e9aac7cba87177c06095c4e5bc9adcb1e397", + "url": "https://api.github.com/repos/aws/aws-sdk-php/zipball/cdf3c097a606087654ac90ea1ffb8f3e86c423be", + "reference": "cdf3c097a606087654ac90ea1ffb8f3e86c423be", "shasum": "" }, "require": { @@ -189,7 +189,7 @@ "s3", "sdk" ], - "time": "2020-10-20T18:11:49+00:00" + "time": "2020-10-21T18:12:19+00:00" }, { "name": "brick/math", @@ -2716,16 +2716,16 @@ }, { "name": "laravel/socialite", - "version": "v5.0.2", + "version": "v5.0.3", "source": { "type": "git", "url": "https://github.com/laravel/socialite.git", - "reference": "87dfaaa0e0a85b707582e4f9bc8dab9664dcb0a4" + "reference": "8197acf2fe5446a2800b95d250c1da72fd6051bc" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/laravel/socialite/zipball/87dfaaa0e0a85b707582e4f9bc8dab9664dcb0a4", - "reference": "87dfaaa0e0a85b707582e4f9bc8dab9664dcb0a4", + "url": "https://api.github.com/repos/laravel/socialite/zipball/8197acf2fe5446a2800b95d250c1da72fd6051bc", + "reference": "8197acf2fe5446a2800b95d250c1da72fd6051bc", "shasum": "" }, "require": { @@ -2777,7 +2777,7 @@ "laravel", "oauth" ], - "time": "2020-10-20T18:53:05+00:00" + "time": "2020-10-21T12:45:02+00:00" }, { "name": "laravel/tinker", @@ -4475,21 +4475,21 @@ }, { "name": "php-http/guzzle7-adapter", - "version": "0.1.0", + "version": "0.1.1", "source": { "type": "git", "url": "https://github.com/php-http/guzzle7-adapter.git", - "reference": "5b361e0dbd7d9d5e21f80400bcccf9fb8d5d1f1e" + "reference": "1967de656b9679a2a6a66d0e4e16fa99bbed1ad1" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/php-http/guzzle7-adapter/zipball/5b361e0dbd7d9d5e21f80400bcccf9fb8d5d1f1e", - "reference": "5b361e0dbd7d9d5e21f80400bcccf9fb8d5d1f1e", + "url": "https://api.github.com/repos/php-http/guzzle7-adapter/zipball/1967de656b9679a2a6a66d0e4e16fa99bbed1ad1", + "reference": "1967de656b9679a2a6a66d0e4e16fa99bbed1ad1", "shasum": "" }, "require": { "guzzlehttp/guzzle": "^7.0", - "php": "^7.2", + "php": "^7.2 | ^8.0", "php-http/httplug": "^2.0", "psr/http-client": "^1.0" }, @@ -4499,8 +4499,8 @@ "psr/http-client-implementation": "1.0" }, "require-dev": { - "php-http/client-integration-tests": "^2.0", - "phpunit/phpunit": "^7.4" + "php-http/client-integration-tests": "^3.0", + "phpunit/phpunit": "^8.0|^9.3" }, "type": "library", "extra": { @@ -4529,7 +4529,7 @@ "Guzzle", "http" ], - "time": "2020-09-17T07:29:54+00:00" + "time": "2020-10-21T17:30:51+00:00" }, { "name": "php-http/httplug", @@ -6588,7 +6588,7 @@ "type": "tidelift" } ], - "time": "2020-09-18T14:27:32+00:00" + "time": "2020-10-07T15:23:00+00:00" }, { "name": "symfony/css-selector", @@ -9875,22 +9875,22 @@ }, { "name": "facade/flare-client-php", - "version": "1.3.6", + "version": "1.3.7", "source": { "type": "git", "url": "https://github.com/facade/flare-client-php.git", - "reference": "451fadf38e9f635e7f8e1f5b3cf5c9eb82f11799" + "reference": "fd688d3c06658f2b3b5f7bb19f051ee4ddf02492" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/facade/flare-client-php/zipball/451fadf38e9f635e7f8e1f5b3cf5c9eb82f11799", - "reference": "451fadf38e9f635e7f8e1f5b3cf5c9eb82f11799", + "url": "https://api.github.com/repos/facade/flare-client-php/zipball/fd688d3c06658f2b3b5f7bb19f051ee4ddf02492", + "reference": "fd688d3c06658f2b3b5f7bb19f051ee4ddf02492", "shasum": "" }, "require": { "facade/ignition-contracts": "~1.0", "illuminate/pipeline": "^5.5|^6.0|^7.0|^8.0", - "php": "^7.1", + "php": "^7.1|^8.0", "symfony/http-foundation": "^3.3|^4.1|^5.0", "symfony/mime": "^3.4|^4.0|^5.1", "symfony/var-dumper": "^3.4|^4.0|^5.0" @@ -9932,7 +9932,7 @@ "type": "github" } ], - "time": "2020-09-18T06:35:11+00:00" + "time": "2020-10-21T16:02:39+00:00" }, { "name": "facade/ignition", diff --git a/config/ninja.php b/config/ninja.php index b5ab21f67e7b..2ea9e28e7557 100644 --- a/config/ninja.php +++ b/config/ninja.php @@ -12,7 +12,7 @@ return [ 'require_https' => env('REQUIRE_HTTPS', true), 'app_url' => rtrim(env('APP_URL', ''), '/').'/', 'app_domain' => env('APP_DOMAIN', ''), - 'app_version' => '5.0.21', + 'app_version' => '5.0.22', 'minimum_client_version' => '5.0.16', 'terms_version' => '1.0.1', 'api_secret' => env('API_SECRET', ''), diff --git a/database/migrations/2014_10_12_100000_create_password_resets_table.php b/database/migrations/2014_10_12_100000_create_password_resets_table.php index 28edf4625a34..a19aa434da38 100644 --- a/database/migrations/2014_10_12_100000_create_password_resets_table.php +++ b/database/migrations/2014_10_12_100000_create_password_resets_table.php @@ -1,4 +1,14 @@ unsignedInteger('assigned_user_id')->nullable()->change(); + + }); + } + + /** + * Reverse the migrations. + * + * @return void + */ + public function down() + { + // + } +} diff --git a/database/schema/db-ninja-01-schema.dump b/database/schema/db-ninja-01-schema.dump new file mode 100644 index 000000000000..d51c60492349 --- /dev/null +++ b/database/schema/db-ninja-01-schema.dump @@ -0,0 +1,1691 @@ +/*!40103 SET @OLD_TIME_ZONE=@@TIME_ZONE */; +/*!40103 SET TIME_ZONE='+00:00' */; +/*!40014 SET @OLD_UNIQUE_CHECKS=@@UNIQUE_CHECKS, UNIQUE_CHECKS=0 */; +/*!40014 SET @OLD_FOREIGN_KEY_CHECKS=@@FOREIGN_KEY_CHECKS, FOREIGN_KEY_CHECKS=0 */; +/*!40101 SET @OLD_SQL_MODE=@@SQL_MODE, SQL_MODE='NO_AUTO_VALUE_ON_ZERO' */; +/*!40111 SET @OLD_SQL_NOTES=@@SQL_NOTES, SQL_NOTES=0 */; +/*!40101 SET @saved_cs_client = @@character_set_client */; +/*!40101 SET character_set_client = utf8 */; +CREATE TABLE `accounts` ( + `id` int(10) unsigned NOT NULL AUTO_INCREMENT, + `plan` enum('pro','enterprise','white_label') COLLATE utf8mb4_unicode_ci DEFAULT NULL, + `plan_term` enum('month','year') COLLATE utf8mb4_unicode_ci DEFAULT NULL, + `plan_started` date DEFAULT NULL, + `plan_paid` date DEFAULT NULL, + `plan_expires` date DEFAULT NULL, + `user_agent` varchar(191) COLLATE utf8mb4_unicode_ci DEFAULT NULL, + `key` varchar(191) COLLATE utf8mb4_unicode_ci DEFAULT NULL, + `payment_id` int(10) unsigned DEFAULT NULL, + `default_company_id` int(10) unsigned NOT NULL, + `trial_started` date DEFAULT NULL, + `trial_plan` enum('pro','enterprise') COLLATE utf8mb4_unicode_ci DEFAULT NULL, + `plan_price` decimal(7,2) DEFAULT NULL, + `num_users` smallint(6) NOT NULL DEFAULT '1', + `utm_source` varchar(191) COLLATE utf8mb4_unicode_ci DEFAULT NULL, + `utm_medium` varchar(191) COLLATE utf8mb4_unicode_ci DEFAULT NULL, + `utm_campaign` varchar(191) COLLATE utf8mb4_unicode_ci DEFAULT NULL, + `utm_term` varchar(191) COLLATE utf8mb4_unicode_ci DEFAULT NULL, + `utm_content` varchar(191) COLLATE utf8mb4_unicode_ci DEFAULT NULL, + `latest_version` varchar(191) COLLATE utf8mb4_unicode_ci NOT NULL DEFAULT '0.0.0', + `report_errors` tinyint(1) NOT NULL DEFAULT '0', + `referral_code` varchar(191) COLLATE utf8mb4_unicode_ci DEFAULT NULL, + `created_at` timestamp(6) NULL DEFAULT NULL, + `updated_at` timestamp(6) NULL DEFAULT NULL, + PRIMARY KEY (`id`), + KEY `accounts_payment_id_index` (`payment_id`) +) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci ROW_FORMAT=COMPRESSED KEY_BLOCK_SIZE=8; +/*!40101 SET character_set_client = @saved_cs_client */; +/*!40101 SET @saved_cs_client = @@character_set_client */; +/*!40101 SET character_set_client = utf8 */; +CREATE TABLE `activities` ( + `id` int(10) unsigned NOT NULL AUTO_INCREMENT, + `user_id` int(10) unsigned DEFAULT NULL, + `company_id` int(10) unsigned NOT NULL, + `client_id` int(10) unsigned DEFAULT NULL, + `client_contact_id` int(10) unsigned DEFAULT NULL, + `account_id` int(10) unsigned DEFAULT NULL, + `project_id` int(10) unsigned DEFAULT NULL, + `vendor_id` int(10) unsigned DEFAULT NULL, + `payment_id` int(10) unsigned DEFAULT NULL, + `invoice_id` int(10) unsigned DEFAULT NULL, + `credit_id` int(10) unsigned DEFAULT NULL, + `invitation_id` int(10) unsigned DEFAULT NULL, + `task_id` int(10) unsigned DEFAULT NULL, + `expense_id` int(10) unsigned DEFAULT NULL, + `activity_type_id` int(10) unsigned DEFAULT NULL, + `ip` varchar(191) COLLATE utf8mb4_unicode_ci NOT NULL, + `is_system` tinyint(1) NOT NULL DEFAULT '0', + `notes` text COLLATE utf8mb4_unicode_ci NOT NULL, + `created_at` timestamp(6) NULL DEFAULT NULL, + `updated_at` timestamp(6) NULL DEFAULT NULL, + `token_id` int(10) unsigned DEFAULT NULL, + `quote_id` int(10) unsigned DEFAULT NULL, + PRIMARY KEY (`id`), + KEY `activities_vendor_id_company_id_index` (`vendor_id`,`company_id`), + KEY `activities_project_id_company_id_index` (`project_id`,`company_id`), + KEY `activities_user_id_company_id_index` (`user_id`,`company_id`), + KEY `activities_client_id_company_id_index` (`client_id`,`company_id`), + KEY `activities_payment_id_company_id_index` (`payment_id`,`company_id`), + KEY `activities_invoice_id_company_id_index` (`invoice_id`,`company_id`), + KEY `activities_credit_id_company_id_index` (`credit_id`,`company_id`), + KEY `activities_invitation_id_company_id_index` (`invitation_id`,`company_id`), + KEY `activities_task_id_company_id_index` (`task_id`,`company_id`), + KEY `activities_expense_id_company_id_index` (`expense_id`,`company_id`), + KEY `activities_client_contact_id_company_id_index` (`client_contact_id`,`company_id`), + KEY `activities_company_id_foreign` (`company_id`), + CONSTRAINT `activities_company_id_foreign` FOREIGN KEY (`company_id`) REFERENCES `companies` (`id`) ON DELETE CASCADE ON UPDATE CASCADE +) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci ROW_FORMAT=COMPRESSED KEY_BLOCK_SIZE=8; +/*!40101 SET character_set_client = @saved_cs_client */; +/*!40101 SET @saved_cs_client = @@character_set_client */; +/*!40101 SET character_set_client = utf8 */; +CREATE TABLE `backups` ( + `id` int(10) unsigned NOT NULL AUTO_INCREMENT, + `activity_id` int(10) unsigned NOT NULL, + `json_backup` mediumtext COLLATE utf8mb4_unicode_ci, + `html_backup` longtext COLLATE utf8mb4_unicode_ci, + `created_at` timestamp(6) NULL DEFAULT NULL, + `updated_at` timestamp(6) NULL DEFAULT NULL, + `amount` decimal(16,4) NOT NULL, + PRIMARY KEY (`id`), + KEY `backups_activity_id_foreign` (`activity_id`), + CONSTRAINT `backups_activity_id_foreign` FOREIGN KEY (`activity_id`) REFERENCES `activities` (`id`) ON DELETE CASCADE ON UPDATE CASCADE +) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci ROW_FORMAT=COMPRESSED KEY_BLOCK_SIZE=8; +/*!40101 SET character_set_client = @saved_cs_client */; +/*!40101 SET @saved_cs_client = @@character_set_client */; +/*!40101 SET character_set_client = utf8 */; +CREATE TABLE `bank_companies` ( + `id` int(10) unsigned NOT NULL AUTO_INCREMENT, + `company_id` int(10) unsigned NOT NULL, + `bank_id` int(10) unsigned NOT NULL, + `user_id` int(10) unsigned NOT NULL, + `username` varchar(191) COLLATE utf8mb4_unicode_ci DEFAULT NULL, + `created_at` timestamp(6) NULL DEFAULT NULL, + `updated_at` timestamp(6) NULL DEFAULT NULL, + `deleted_at` timestamp(6) NULL DEFAULT NULL, + PRIMARY KEY (`id`), + KEY `bank_companies_company_id_deleted_at_index` (`company_id`,`deleted_at`), + KEY `bank_companies_user_id_foreign` (`user_id`), + KEY `bank_companies_bank_id_foreign` (`bank_id`), + CONSTRAINT `bank_companies_bank_id_foreign` FOREIGN KEY (`bank_id`) REFERENCES `banks` (`id`), + CONSTRAINT `bank_companies_company_id_foreign` FOREIGN KEY (`company_id`) REFERENCES `companies` (`id`) ON DELETE CASCADE ON UPDATE CASCADE, + CONSTRAINT `bank_companies_user_id_foreign` FOREIGN KEY (`user_id`) REFERENCES `users` (`id`) ON DELETE CASCADE ON UPDATE CASCADE +) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci ROW_FORMAT=COMPRESSED KEY_BLOCK_SIZE=8; +/*!40101 SET character_set_client = @saved_cs_client */; +/*!40101 SET @saved_cs_client = @@character_set_client */; +/*!40101 SET character_set_client = utf8 */; +CREATE TABLE `bank_subcompanies` ( + `id` int(10) unsigned NOT NULL AUTO_INCREMENT, + `company_id` int(10) unsigned NOT NULL, + `user_id` int(10) unsigned NOT NULL, + `bank_company_id` int(10) unsigned NOT NULL, + `account_name` varchar(191) COLLATE utf8mb4_unicode_ci DEFAULT NULL, + `website` varchar(191) COLLATE utf8mb4_unicode_ci DEFAULT NULL, + `account_number` varchar(191) COLLATE utf8mb4_unicode_ci DEFAULT NULL, + `created_at` timestamp(6) NULL DEFAULT NULL, + `updated_at` timestamp(6) NULL DEFAULT NULL, + `deleted_at` timestamp(6) NULL DEFAULT NULL, + PRIMARY KEY (`id`), + KEY `bank_subcompanies_company_id_deleted_at_index` (`company_id`,`deleted_at`), + KEY `bank_subcompanies_user_id_foreign` (`user_id`), + KEY `bank_subcompanies_bank_company_id_foreign` (`bank_company_id`), + CONSTRAINT `bank_subcompanies_bank_company_id_foreign` FOREIGN KEY (`bank_company_id`) REFERENCES `bank_companies` (`id`) ON DELETE CASCADE ON UPDATE CASCADE, + CONSTRAINT `bank_subcompanies_company_id_foreign` FOREIGN KEY (`company_id`) REFERENCES `companies` (`id`) ON DELETE CASCADE ON UPDATE CASCADE, + CONSTRAINT `bank_subcompanies_user_id_foreign` FOREIGN KEY (`user_id`) REFERENCES `users` (`id`) ON DELETE CASCADE ON UPDATE CASCADE +) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci ROW_FORMAT=COMPRESSED KEY_BLOCK_SIZE=8; +/*!40101 SET character_set_client = @saved_cs_client */; +/*!40101 SET @saved_cs_client = @@character_set_client */; +/*!40101 SET character_set_client = utf8 */; +CREATE TABLE `banks` ( + `id` int(10) unsigned NOT NULL AUTO_INCREMENT, + `name` varchar(191) COLLATE utf8mb4_unicode_ci DEFAULT NULL, + `remote_id` varchar(191) COLLATE utf8mb4_unicode_ci DEFAULT NULL, + `bank_library_id` int(11) NOT NULL DEFAULT '1', + `config` text COLLATE utf8mb4_unicode_ci, + PRIMARY KEY (`id`) +) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci ROW_FORMAT=COMPRESSED KEY_BLOCK_SIZE=8; +/*!40101 SET character_set_client = @saved_cs_client */; +/*!40101 SET @saved_cs_client = @@character_set_client */; +/*!40101 SET character_set_client = utf8 */; +CREATE TABLE `client_contacts` ( + `id` int(10) unsigned NOT NULL AUTO_INCREMENT, + `company_id` int(10) unsigned NOT NULL, + `client_id` int(10) unsigned NOT NULL, + `user_id` int(10) unsigned NOT NULL, + `first_name` varchar(191) COLLATE utf8mb4_unicode_ci DEFAULT NULL, + `last_name` varchar(191) COLLATE utf8mb4_unicode_ci DEFAULT NULL, + `phone` varchar(191) COLLATE utf8mb4_unicode_ci DEFAULT NULL, + `custom_value1` varchar(191) COLLATE utf8mb4_unicode_ci DEFAULT NULL, + `custom_value2` varchar(191) COLLATE utf8mb4_unicode_ci DEFAULT NULL, + `custom_value3` varchar(191) COLLATE utf8mb4_unicode_ci DEFAULT NULL, + `custom_value4` varchar(191) COLLATE utf8mb4_unicode_ci DEFAULT NULL, + `email` varchar(100) COLLATE utf8mb4_unicode_ci DEFAULT NULL, + `email_verified_at` timestamp NULL DEFAULT NULL, + `confirmation_code` varchar(191) COLLATE utf8mb4_unicode_ci DEFAULT NULL, + `is_primary` tinyint(1) NOT NULL DEFAULT '0', + `confirmed` tinyint(1) NOT NULL DEFAULT '0', + `last_login` timestamp NULL DEFAULT NULL, + `failed_logins` smallint(6) DEFAULT NULL, + `oauth_user_id` varchar(100) COLLATE utf8mb4_unicode_ci DEFAULT NULL, + `oauth_provider_id` int(10) unsigned DEFAULT NULL, + `google_2fa_secret` varchar(191) COLLATE utf8mb4_unicode_ci DEFAULT NULL, + `accepted_terms_version` varchar(191) COLLATE utf8mb4_unicode_ci DEFAULT NULL, + `avatar` varchar(255) COLLATE utf8mb4_unicode_ci DEFAULT NULL, + `avatar_type` varchar(255) COLLATE utf8mb4_unicode_ci DEFAULT NULL, + `avatar_size` varchar(255) COLLATE utf8mb4_unicode_ci DEFAULT NULL, + `password` varchar(191) COLLATE utf8mb4_unicode_ci NOT NULL, + `token` varchar(191) COLLATE utf8mb4_unicode_ci DEFAULT NULL, + `is_locked` tinyint(1) NOT NULL DEFAULT '0', + `send_email` tinyint(1) NOT NULL DEFAULT '1', + `contact_key` varchar(191) COLLATE utf8mb4_unicode_ci DEFAULT NULL, + `remember_token` varchar(100) COLLATE utf8mb4_unicode_ci DEFAULT NULL, + `created_at` timestamp(6) NULL DEFAULT NULL, + `updated_at` timestamp(6) NULL DEFAULT NULL, + `deleted_at` timestamp(6) NULL DEFAULT NULL, + PRIMARY KEY (`id`), + UNIQUE KEY `client_contacts_oauth_user_id_unique` (`oauth_user_id`), + UNIQUE KEY `client_contacts_oauth_provider_id_unique` (`oauth_provider_id`), + KEY `client_contacts_company_id_deleted_at_index` (`company_id`,`deleted_at`), + KEY `client_contacts_company_id_email_deleted_at_index` (`company_id`,`email`,`deleted_at`), + KEY `client_contacts_company_id_index` (`company_id`), + KEY `client_contacts_client_id_index` (`client_id`), + KEY `client_contacts_user_id_index` (`user_id`), + CONSTRAINT `client_contacts_client_id_foreign` FOREIGN KEY (`client_id`) REFERENCES `clients` (`id`) ON DELETE CASCADE ON UPDATE CASCADE +) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci ROW_FORMAT=COMPRESSED KEY_BLOCK_SIZE=8; +/*!40101 SET character_set_client = @saved_cs_client */; +/*!40101 SET @saved_cs_client = @@character_set_client */; +/*!40101 SET character_set_client = utf8 */; +CREATE TABLE `client_gateway_tokens` ( + `id` int(10) unsigned NOT NULL AUTO_INCREMENT, + `company_id` int(10) unsigned NOT NULL, + `client_id` int(10) unsigned DEFAULT NULL, + `token` text COLLATE utf8mb4_unicode_ci, + `routing_number` text COLLATE utf8mb4_unicode_ci, + `company_gateway_id` int(10) unsigned NOT NULL, + `gateway_customer_reference` varchar(191) COLLATE utf8mb4_unicode_ci DEFAULT NULL, + `gateway_type_id` int(10) unsigned NOT NULL, + `is_default` tinyint(1) NOT NULL DEFAULT '0', + `meta` text COLLATE utf8mb4_unicode_ci, + `deleted_at` timestamp(6) NULL DEFAULT NULL, + `created_at` timestamp(6) NULL DEFAULT NULL, + `updated_at` timestamp(6) NULL DEFAULT NULL, + `is_deleted` tinyint(1) NOT NULL DEFAULT '0', + PRIMARY KEY (`id`), + KEY `client_gateway_tokens_company_id_deleted_at_index` (`company_id`,`deleted_at`), + KEY `client_gateway_tokens_client_id_foreign` (`client_id`), + CONSTRAINT `client_gateway_tokens_client_id_foreign` FOREIGN KEY (`client_id`) REFERENCES `clients` (`id`) ON DELETE CASCADE ON UPDATE CASCADE, + CONSTRAINT `client_gateway_tokens_company_id_foreign` FOREIGN KEY (`company_id`) REFERENCES `companies` (`id`) ON DELETE CASCADE ON UPDATE CASCADE +) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci ROW_FORMAT=COMPRESSED KEY_BLOCK_SIZE=8; +/*!40101 SET character_set_client = @saved_cs_client */; +/*!40101 SET @saved_cs_client = @@character_set_client */; +/*!40101 SET character_set_client = utf8 */; +CREATE TABLE `clients` ( + `id` int(10) unsigned NOT NULL AUTO_INCREMENT, + `company_id` int(10) unsigned NOT NULL, + `user_id` int(10) unsigned NOT NULL, + `assigned_user_id` int(10) unsigned DEFAULT NULL, + `name` varchar(191) COLLATE utf8mb4_unicode_ci DEFAULT NULL, + `website` varchar(191) COLLATE utf8mb4_unicode_ci DEFAULT NULL, + `private_notes` text COLLATE utf8mb4_unicode_ci, + `public_notes` text COLLATE utf8mb4_unicode_ci, + `client_hash` text COLLATE utf8mb4_unicode_ci, + `logo` varchar(255) COLLATE utf8mb4_unicode_ci DEFAULT NULL, + `phone` varchar(255) COLLATE utf8mb4_unicode_ci DEFAULT NULL, + `balance` decimal(16,4) NOT NULL DEFAULT '0.0000', + `paid_to_date` decimal(16,4) NOT NULL DEFAULT '0.0000', + `credit_balance` decimal(16,4) NOT NULL DEFAULT '0.0000', + `last_login` timestamp NULL DEFAULT NULL, + `industry_id` int(10) unsigned DEFAULT NULL, + `size_id` int(10) unsigned DEFAULT NULL, + `address1` varchar(191) COLLATE utf8mb4_unicode_ci DEFAULT NULL, + `address2` varchar(191) COLLATE utf8mb4_unicode_ci DEFAULT NULL, + `city` varchar(191) COLLATE utf8mb4_unicode_ci DEFAULT NULL, + `state` varchar(191) COLLATE utf8mb4_unicode_ci DEFAULT NULL, + `postal_code` varchar(191) COLLATE utf8mb4_unicode_ci DEFAULT NULL, + `country_id` int(10) unsigned DEFAULT NULL, + `custom_value1` varchar(191) COLLATE utf8mb4_unicode_ci DEFAULT NULL, + `custom_value2` varchar(191) COLLATE utf8mb4_unicode_ci DEFAULT NULL, + `custom_value3` varchar(191) COLLATE utf8mb4_unicode_ci DEFAULT NULL, + `custom_value4` varchar(191) COLLATE utf8mb4_unicode_ci DEFAULT NULL, + `shipping_address1` varchar(191) COLLATE utf8mb4_unicode_ci DEFAULT NULL, + `shipping_address2` varchar(191) COLLATE utf8mb4_unicode_ci DEFAULT NULL, + `shipping_city` varchar(191) COLLATE utf8mb4_unicode_ci DEFAULT NULL, + `shipping_state` varchar(191) COLLATE utf8mb4_unicode_ci DEFAULT NULL, + `shipping_postal_code` varchar(191) COLLATE utf8mb4_unicode_ci DEFAULT NULL, + `shipping_country_id` int(10) unsigned DEFAULT NULL, + `settings` mediumtext COLLATE utf8mb4_unicode_ci, + `is_deleted` tinyint(1) NOT NULL DEFAULT '0', + `group_settings_id` int(10) unsigned DEFAULT NULL, + `vat_number` varchar(191) COLLATE utf8mb4_unicode_ci DEFAULT NULL, + `id_number` varchar(191) COLLATE utf8mb4_unicode_ci DEFAULT NULL, + `created_at` timestamp(6) NULL DEFAULT NULL, + `updated_at` timestamp(6) NULL DEFAULT NULL, + `deleted_at` timestamp(6) NULL DEFAULT NULL, + PRIMARY KEY (`id`), + KEY `clients_company_id_deleted_at_index` (`company_id`,`deleted_at`), + KEY `clients_industry_id_foreign` (`industry_id`), + KEY `clients_size_id_foreign` (`size_id`), + KEY `clients_company_id_index` (`company_id`), + KEY `clients_user_id_index` (`user_id`), + CONSTRAINT `clients_company_id_foreign` FOREIGN KEY (`company_id`) REFERENCES `companies` (`id`) ON DELETE CASCADE ON UPDATE CASCADE, + CONSTRAINT `clients_industry_id_foreign` FOREIGN KEY (`industry_id`) REFERENCES `industries` (`id`), + CONSTRAINT `clients_size_id_foreign` FOREIGN KEY (`size_id`) REFERENCES `sizes` (`id`) +) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci ROW_FORMAT=COMPRESSED KEY_BLOCK_SIZE=8; +/*!40101 SET character_set_client = @saved_cs_client */; +/*!40101 SET @saved_cs_client = @@character_set_client */; +/*!40101 SET character_set_client = utf8 */; +CREATE TABLE `companies` ( + `id` int(10) unsigned NOT NULL AUTO_INCREMENT, + `account_id` int(10) unsigned NOT NULL, + `industry_id` int(10) unsigned DEFAULT NULL, + `ip` varchar(191) COLLATE utf8mb4_unicode_ci DEFAULT NULL, + `company_key` varchar(100) COLLATE utf8mb4_unicode_ci NOT NULL, + `logo` varchar(191) COLLATE utf8mb4_unicode_ci DEFAULT NULL, + `convert_products` tinyint(1) NOT NULL DEFAULT '0', + `fill_products` tinyint(1) NOT NULL DEFAULT '1', + `update_products` tinyint(1) NOT NULL DEFAULT '1', + `show_product_details` tinyint(1) NOT NULL DEFAULT '1', + `client_can_register` tinyint(1) NOT NULL DEFAULT '0', + `custom_surcharge_taxes1` tinyint(1) NOT NULL DEFAULT '0', + `custom_surcharge_taxes2` tinyint(1) NOT NULL DEFAULT '0', + `custom_surcharge_taxes3` tinyint(1) NOT NULL DEFAULT '0', + `custom_surcharge_taxes4` tinyint(1) NOT NULL DEFAULT '0', + `show_product_cost` tinyint(1) NOT NULL DEFAULT '0', + `enabled_tax_rates` int(10) unsigned NOT NULL DEFAULT '0', + `enabled_modules` int(10) unsigned NOT NULL DEFAULT '0', + `enable_product_cost` tinyint(1) NOT NULL DEFAULT '0', + `enable_product_quantity` tinyint(1) NOT NULL DEFAULT '1', + `default_quantity` tinyint(1) NOT NULL DEFAULT '1', + `subdomain` varchar(191) COLLATE utf8mb4_unicode_ci DEFAULT NULL, + `db` varchar(191) COLLATE utf8mb4_unicode_ci DEFAULT NULL, + `size_id` int(10) unsigned DEFAULT NULL, + `first_day_of_week` varchar(191) COLLATE utf8mb4_unicode_ci DEFAULT NULL, + `first_month_of_year` varchar(191) COLLATE utf8mb4_unicode_ci DEFAULT NULL, + `portal_mode` varchar(191) COLLATE utf8mb4_unicode_ci NOT NULL DEFAULT 'subdomain', + `portal_domain` varchar(191) COLLATE utf8mb4_unicode_ci DEFAULT NULL, + `enable_modules` smallint(6) NOT NULL DEFAULT '0', + `custom_fields` mediumtext COLLATE utf8mb4_unicode_ci NOT NULL, + `settings` mediumtext COLLATE utf8mb4_unicode_ci NOT NULL, + `slack_webhook_url` varchar(191) COLLATE utf8mb4_unicode_ci NOT NULL, + `google_analytics_key` varchar(191) COLLATE utf8mb4_unicode_ci NOT NULL, + `created_at` timestamp(6) NULL DEFAULT NULL, + `updated_at` timestamp(6) NULL DEFAULT NULL, + `enabled_item_tax_rates` int(11) NOT NULL DEFAULT '0', + `is_large` tinyint(1) NOT NULL DEFAULT '0', + `enable_shop_api` tinyint(1) NOT NULL DEFAULT '0', + `default_auto_bill` enum('off','always','optin','optout') COLLATE utf8mb4_unicode_ci NOT NULL DEFAULT 'off', + `mark_expenses_invoiceable` tinyint(1) NOT NULL DEFAULT '0', + `mark_expenses_paid` tinyint(1) NOT NULL DEFAULT '0', + `use_credits_payment` enum('always','off','option') COLLATE utf8mb4_unicode_ci NOT NULL DEFAULT 'off', + `invoice_expense_documents` tinyint(1) NOT NULL DEFAULT '0', + `auto_start_tasks` tinyint(1) NOT NULL DEFAULT '0', + PRIMARY KEY (`id`), + UNIQUE KEY `companies_company_key_unique` (`company_key`), + KEY `companies_industry_id_foreign` (`industry_id`), + KEY `companies_size_id_foreign` (`size_id`), + KEY `companies_account_id_index` (`account_id`), + CONSTRAINT `companies_account_id_foreign` FOREIGN KEY (`account_id`) REFERENCES `accounts` (`id`) ON DELETE CASCADE ON UPDATE CASCADE, + CONSTRAINT `companies_industry_id_foreign` FOREIGN KEY (`industry_id`) REFERENCES `industries` (`id`), + CONSTRAINT `companies_size_id_foreign` FOREIGN KEY (`size_id`) REFERENCES `sizes` (`id`) +) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci ROW_FORMAT=COMPRESSED KEY_BLOCK_SIZE=8; +/*!40101 SET character_set_client = @saved_cs_client */; +/*!40101 SET @saved_cs_client = @@character_set_client */; +/*!40101 SET character_set_client = utf8 */; +CREATE TABLE `company_gateways` ( + `id` int(10) unsigned NOT NULL AUTO_INCREMENT, + `company_id` int(10) unsigned NOT NULL, + `user_id` int(10) unsigned NOT NULL, + `gateway_key` varchar(191) COLLATE utf8mb4_unicode_ci NOT NULL, + `accepted_credit_cards` int(10) unsigned NOT NULL, + `require_cvv` tinyint(1) NOT NULL DEFAULT '1', + `show_billing_address` tinyint(1) DEFAULT '1', + `show_shipping_address` tinyint(1) DEFAULT '1', + `update_details` tinyint(1) DEFAULT '0', + `is_deleted` tinyint(1) NOT NULL DEFAULT '0', + `config` mediumtext COLLATE utf8mb4_unicode_ci NOT NULL, + `fees_and_limits` text COLLATE utf8mb4_unicode_ci NOT NULL, + `custom_value1` varchar(191) COLLATE utf8mb4_unicode_ci DEFAULT NULL, + `custom_value2` varchar(191) COLLATE utf8mb4_unicode_ci DEFAULT NULL, + `custom_value3` varchar(191) COLLATE utf8mb4_unicode_ci DEFAULT NULL, + `custom_value4` varchar(191) COLLATE utf8mb4_unicode_ci DEFAULT NULL, + `created_at` timestamp(6) NULL DEFAULT NULL, + `updated_at` timestamp(6) NULL DEFAULT NULL, + `deleted_at` timestamp(6) NULL DEFAULT NULL, + `token_billing` enum('off','always','optin','optout') COLLATE utf8mb4_unicode_ci NOT NULL DEFAULT 'off', + `label` varchar(255) COLLATE utf8mb4_unicode_ci DEFAULT NULL, + PRIMARY KEY (`id`), + KEY `company_gateways_company_id_deleted_at_index` (`company_id`,`deleted_at`), + KEY `company_gateways_gateway_key_foreign` (`gateway_key`), + KEY `company_gateways_user_id_foreign` (`user_id`), + CONSTRAINT `company_gateways_company_id_foreign` FOREIGN KEY (`company_id`) REFERENCES `companies` (`id`) ON DELETE CASCADE ON UPDATE CASCADE, + CONSTRAINT `company_gateways_gateway_key_foreign` FOREIGN KEY (`gateway_key`) REFERENCES `gateways` (`key`), + CONSTRAINT `company_gateways_user_id_foreign` FOREIGN KEY (`user_id`) REFERENCES `users` (`id`) ON DELETE CASCADE ON UPDATE CASCADE +) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci ROW_FORMAT=COMPRESSED KEY_BLOCK_SIZE=8; +/*!40101 SET character_set_client = @saved_cs_client */; +/*!40101 SET @saved_cs_client = @@character_set_client */; +/*!40101 SET character_set_client = utf8 */; +CREATE TABLE `company_ledgers` ( + `id` int(10) unsigned NOT NULL AUTO_INCREMENT, + `company_id` int(10) unsigned NOT NULL, + `client_id` int(10) unsigned DEFAULT NULL, + `user_id` int(10) unsigned DEFAULT NULL, + `activity_id` int(10) unsigned DEFAULT NULL, + `adjustment` decimal(16,4) DEFAULT NULL, + `balance` decimal(16,4) DEFAULT NULL, + `notes` text COLLATE utf8mb4_unicode_ci, + `hash` text COLLATE utf8mb4_unicode_ci, + `company_ledgerable_id` int(10) unsigned NOT NULL, + `company_ledgerable_type` varchar(191) COLLATE utf8mb4_unicode_ci NOT NULL, + `created_at` timestamp(6) NULL DEFAULT NULL, + `updated_at` timestamp(6) NULL DEFAULT NULL, + PRIMARY KEY (`id`), + KEY `company_ledgers_company_id_foreign` (`company_id`), + KEY `company_ledgers_client_id_foreign` (`client_id`), + CONSTRAINT `company_ledgers_client_id_foreign` FOREIGN KEY (`client_id`) REFERENCES `clients` (`id`) ON DELETE CASCADE ON UPDATE CASCADE, + CONSTRAINT `company_ledgers_company_id_foreign` FOREIGN KEY (`company_id`) REFERENCES `companies` (`id`) ON DELETE CASCADE ON UPDATE CASCADE +) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci ROW_FORMAT=COMPRESSED KEY_BLOCK_SIZE=8; +/*!40101 SET character_set_client = @saved_cs_client */; +/*!40101 SET @saved_cs_client = @@character_set_client */; +/*!40101 SET character_set_client = utf8 */; +CREATE TABLE `company_tokens` ( + `id` int(10) unsigned NOT NULL AUTO_INCREMENT, + `company_id` int(10) unsigned NOT NULL, + `account_id` int(10) unsigned NOT NULL, + `user_id` int(10) unsigned NOT NULL, + `token` varchar(191) COLLATE utf8mb4_unicode_ci DEFAULT NULL, + `name` varchar(191) COLLATE utf8mb4_unicode_ci DEFAULT NULL, + `created_at` timestamp(6) NULL DEFAULT NULL, + `updated_at` timestamp(6) NULL DEFAULT NULL, + `deleted_at` timestamp(6) NULL DEFAULT NULL, + `is_deleted` tinyint(1) NOT NULL DEFAULT '0', + `is_system` tinyint(1) NOT NULL DEFAULT '0', + PRIMARY KEY (`id`), + KEY `company_tokens_company_id_deleted_at_index` (`company_id`,`deleted_at`), + KEY `company_tokens_account_id_foreign` (`account_id`), + KEY `company_tokens_user_id_foreign` (`user_id`), + KEY `company_tokens_company_id_index` (`company_id`), + CONSTRAINT `company_tokens_account_id_foreign` FOREIGN KEY (`account_id`) REFERENCES `accounts` (`id`) ON DELETE CASCADE ON UPDATE CASCADE, + CONSTRAINT `company_tokens_company_id_foreign` FOREIGN KEY (`company_id`) REFERENCES `companies` (`id`) ON DELETE CASCADE ON UPDATE CASCADE, + CONSTRAINT `company_tokens_user_id_foreign` FOREIGN KEY (`user_id`) REFERENCES `users` (`id`) ON DELETE CASCADE ON UPDATE CASCADE +) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci ROW_FORMAT=COMPRESSED KEY_BLOCK_SIZE=8; +/*!40101 SET character_set_client = @saved_cs_client */; +/*!40101 SET @saved_cs_client = @@character_set_client */; +/*!40101 SET character_set_client = utf8 */; +CREATE TABLE `company_user` ( + `id` int(10) unsigned NOT NULL AUTO_INCREMENT, + `company_id` int(10) unsigned NOT NULL, + `account_id` int(10) unsigned NOT NULL, + `user_id` int(10) unsigned NOT NULL, + `permissions` mediumtext COLLATE utf8mb4_unicode_ci, + `notifications` mediumtext COLLATE utf8mb4_unicode_ci, + `settings` mediumtext COLLATE utf8mb4_unicode_ci, + `slack_webhook_url` varchar(191) COLLATE utf8mb4_unicode_ci NOT NULL, + `is_owner` tinyint(1) NOT NULL DEFAULT '0', + `is_admin` tinyint(1) NOT NULL DEFAULT '0', + `is_migrating` tinyint(1) NOT NULL DEFAULT '0', + `is_locked` tinyint(1) NOT NULL DEFAULT '0', + `deleted_at` timestamp(6) NULL DEFAULT NULL, + `created_at` timestamp(6) NULL DEFAULT NULL, + `updated_at` timestamp(6) NULL DEFAULT NULL, + PRIMARY KEY (`id`), + UNIQUE KEY `company_user_company_id_user_id_unique` (`company_id`,`user_id`), + KEY `company_user_account_id_company_id_deleted_at_index` (`account_id`,`company_id`,`deleted_at`), + KEY `company_user_user_id_index` (`user_id`), + CONSTRAINT `company_user_account_id_foreign` FOREIGN KEY (`account_id`) REFERENCES `accounts` (`id`) ON DELETE CASCADE, + CONSTRAINT `company_user_company_id_foreign` FOREIGN KEY (`company_id`) REFERENCES `companies` (`id`) ON DELETE CASCADE +) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci ROW_FORMAT=COMPRESSED KEY_BLOCK_SIZE=8; +/*!40101 SET character_set_client = @saved_cs_client */; +/*!40101 SET @saved_cs_client = @@character_set_client */; +/*!40101 SET character_set_client = utf8 */; +CREATE TABLE `countries` ( + `id` int(10) unsigned NOT NULL AUTO_INCREMENT, + `capital` varchar(255) COLLATE utf8mb4_unicode_ci DEFAULT NULL, + `citizenship` varchar(255) COLLATE utf8mb4_unicode_ci DEFAULT NULL, + `country_code` varchar(3) COLLATE utf8mb4_unicode_ci DEFAULT NULL, + `currency` varchar(255) COLLATE utf8mb4_unicode_ci DEFAULT NULL, + `currency_code` varchar(255) COLLATE utf8mb4_unicode_ci DEFAULT NULL, + `currency_sub_unit` varchar(255) COLLATE utf8mb4_unicode_ci DEFAULT NULL, + `full_name` varchar(255) COLLATE utf8mb4_unicode_ci DEFAULT NULL, + `iso_3166_2` varchar(2) COLLATE utf8mb4_unicode_ci DEFAULT NULL, + `iso_3166_3` varchar(3) COLLATE utf8mb4_unicode_ci DEFAULT NULL, + `name` varchar(255) COLLATE utf8mb4_unicode_ci DEFAULT NULL, + `region_code` varchar(3) COLLATE utf8mb4_unicode_ci DEFAULT NULL, + `sub_region_code` varchar(3) COLLATE utf8mb4_unicode_ci DEFAULT NULL, + `eea` tinyint(1) NOT NULL DEFAULT '0', + `swap_postal_code` tinyint(1) NOT NULL DEFAULT '0', + `swap_currency_symbol` tinyint(1) NOT NULL DEFAULT '0', + `thousand_separator` varchar(191) COLLATE utf8mb4_unicode_ci DEFAULT NULL, + `decimal_separator` varchar(191) COLLATE utf8mb4_unicode_ci DEFAULT NULL, + PRIMARY KEY (`id`) +) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci ROW_FORMAT=COMPRESSED KEY_BLOCK_SIZE=8; +/*!40101 SET character_set_client = @saved_cs_client */; +/*!40101 SET @saved_cs_client = @@character_set_client */; +/*!40101 SET character_set_client = utf8 */; +CREATE TABLE `credit_invitations` ( + `id` int(10) unsigned NOT NULL AUTO_INCREMENT, + `company_id` int(10) unsigned NOT NULL, + `user_id` int(10) unsigned NOT NULL, + `client_contact_id` int(10) unsigned NOT NULL, + `credit_id` int(10) unsigned NOT NULL, + `key` varchar(191) COLLATE utf8mb4_unicode_ci NOT NULL, + `transaction_reference` varchar(191) COLLATE utf8mb4_unicode_ci DEFAULT NULL, + `message_id` varchar(191) COLLATE utf8mb4_unicode_ci DEFAULT NULL, + `email_error` mediumtext COLLATE utf8mb4_unicode_ci, + `signature_base64` text COLLATE utf8mb4_unicode_ci, + `signature_date` datetime DEFAULT NULL, + `sent_date` datetime DEFAULT NULL, + `viewed_date` datetime DEFAULT NULL, + `opened_date` datetime DEFAULT NULL, + `created_at` timestamp(6) NULL DEFAULT NULL, + `updated_at` timestamp(6) NULL DEFAULT NULL, + `deleted_at` timestamp(6) NULL DEFAULT NULL, + PRIMARY KEY (`id`), + UNIQUE KEY `credit_invitations_client_contact_id_credit_id_unique` (`client_contact_id`,`credit_id`), + KEY `credit_invitations_user_id_foreign` (`user_id`), + KEY `credit_invitations_company_id_foreign` (`company_id`), + KEY `credit_invitations_deleted_at_credit_id_company_id_index` (`deleted_at`,`credit_id`,`company_id`), + KEY `credit_invitations_credit_id_index` (`credit_id`), + KEY `credit_invitations_key_index` (`key`), + CONSTRAINT `credit_invitations_client_contact_id_foreign` FOREIGN KEY (`client_contact_id`) REFERENCES `client_contacts` (`id`) ON DELETE CASCADE ON UPDATE CASCADE, + CONSTRAINT `credit_invitations_company_id_foreign` FOREIGN KEY (`company_id`) REFERENCES `companies` (`id`) ON DELETE CASCADE ON UPDATE CASCADE, + CONSTRAINT `credit_invitations_credit_id_foreign` FOREIGN KEY (`credit_id`) REFERENCES `credits` (`id`) ON DELETE CASCADE ON UPDATE CASCADE, + CONSTRAINT `credit_invitations_user_id_foreign` FOREIGN KEY (`user_id`) REFERENCES `users` (`id`) ON DELETE CASCADE ON UPDATE CASCADE +) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci ROW_FORMAT=COMPRESSED KEY_BLOCK_SIZE=8; +/*!40101 SET character_set_client = @saved_cs_client */; +/*!40101 SET @saved_cs_client = @@character_set_client */; +/*!40101 SET character_set_client = utf8 */; +CREATE TABLE `credits` ( + `id` int(10) unsigned NOT NULL AUTO_INCREMENT, + `client_id` int(10) unsigned NOT NULL, + `user_id` int(10) unsigned NOT NULL, + `assigned_user_id` int(10) unsigned DEFAULT NULL, + `company_id` int(10) unsigned NOT NULL, + `status_id` int(10) unsigned NOT NULL, + `project_id` int(10) unsigned DEFAULT NULL, + `vendor_id` int(10) unsigned DEFAULT NULL, + `recurring_id` int(10) unsigned DEFAULT NULL, + `design_id` int(10) unsigned DEFAULT NULL, + `invoice_id` int(10) unsigned DEFAULT NULL, + `number` varchar(191) COLLATE utf8mb4_unicode_ci DEFAULT NULL, + `discount` double(8,2) NOT NULL DEFAULT '0.00', + `is_amount_discount` tinyint(1) NOT NULL DEFAULT '0', + `po_number` varchar(191) COLLATE utf8mb4_unicode_ci DEFAULT NULL, + `date` date DEFAULT NULL, + `last_sent_date` datetime DEFAULT NULL, + `due_date` date DEFAULT NULL, + `is_deleted` tinyint(1) NOT NULL DEFAULT '0', + `line_items` mediumtext COLLATE utf8mb4_unicode_ci, + `backup` mediumtext COLLATE utf8mb4_unicode_ci, + `footer` text COLLATE utf8mb4_unicode_ci, + `public_notes` text COLLATE utf8mb4_unicode_ci, + `private_notes` text COLLATE utf8mb4_unicode_ci, + `terms` text COLLATE utf8mb4_unicode_ci, + `tax_name1` varchar(191) COLLATE utf8mb4_unicode_ci DEFAULT NULL, + `tax_rate1` decimal(13,3) NOT NULL DEFAULT '0.000', + `tax_name2` varchar(191) COLLATE utf8mb4_unicode_ci DEFAULT NULL, + `tax_rate2` decimal(13,3) NOT NULL DEFAULT '0.000', + `tax_name3` varchar(191) COLLATE utf8mb4_unicode_ci DEFAULT NULL, + `tax_rate3` decimal(13,3) NOT NULL DEFAULT '0.000', + `total_taxes` decimal(13,3) NOT NULL DEFAULT '0.000', + `uses_inclusive_taxes` tinyint(1) NOT NULL DEFAULT '0', + `custom_value1` varchar(191) COLLATE utf8mb4_unicode_ci DEFAULT NULL, + `custom_value2` varchar(191) COLLATE utf8mb4_unicode_ci DEFAULT NULL, + `custom_value3` varchar(191) COLLATE utf8mb4_unicode_ci DEFAULT NULL, + `custom_value4` varchar(191) COLLATE utf8mb4_unicode_ci DEFAULT NULL, + `next_send_date` datetime DEFAULT NULL, + `custom_surcharge1` varchar(191) COLLATE utf8mb4_unicode_ci DEFAULT NULL, + `custom_surcharge2` varchar(191) COLLATE utf8mb4_unicode_ci DEFAULT NULL, + `custom_surcharge3` varchar(191) COLLATE utf8mb4_unicode_ci DEFAULT NULL, + `custom_surcharge4` varchar(191) COLLATE utf8mb4_unicode_ci DEFAULT NULL, + `custom_surcharge_tax1` tinyint(1) NOT NULL DEFAULT '0', + `custom_surcharge_tax2` tinyint(1) NOT NULL DEFAULT '0', + `custom_surcharge_tax3` tinyint(1) NOT NULL DEFAULT '0', + `custom_surcharge_tax4` tinyint(1) NOT NULL DEFAULT '0', + `exchange_rate` decimal(13,6) NOT NULL DEFAULT '1.000000', + `amount` decimal(16,4) NOT NULL, + `balance` decimal(16,4) NOT NULL, + `partial` decimal(16,4) DEFAULT NULL, + `partial_due_date` datetime DEFAULT NULL, + `last_viewed` datetime DEFAULT NULL, + `created_at` timestamp(6) NULL DEFAULT NULL, + `updated_at` timestamp(6) NULL DEFAULT NULL, + `deleted_at` timestamp(6) NULL DEFAULT NULL, + `reminder1_sent` date DEFAULT NULL, + `reminder2_sent` date DEFAULT NULL, + `reminder3_sent` date DEFAULT NULL, + `reminder_last_sent` date DEFAULT NULL, + PRIMARY KEY (`id`), + UNIQUE KEY `credits_company_id_number_unique` (`company_id`,`number`), + KEY `credits_user_id_foreign` (`user_id`), + KEY `credits_company_id_deleted_at_index` (`company_id`,`deleted_at`), + KEY `credits_client_id_index` (`client_id`), + KEY `credits_company_id_index` (`company_id`), + CONSTRAINT `credits_client_id_foreign` FOREIGN KEY (`client_id`) REFERENCES `clients` (`id`) ON DELETE CASCADE ON UPDATE CASCADE, + CONSTRAINT `credits_company_id_foreign` FOREIGN KEY (`company_id`) REFERENCES `companies` (`id`) ON DELETE CASCADE ON UPDATE CASCADE, + CONSTRAINT `credits_user_id_foreign` FOREIGN KEY (`user_id`) REFERENCES `users` (`id`) ON DELETE CASCADE ON UPDATE CASCADE +) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci ROW_FORMAT=COMPRESSED KEY_BLOCK_SIZE=8; +/*!40101 SET character_set_client = @saved_cs_client */; +/*!40101 SET @saved_cs_client = @@character_set_client */; +/*!40101 SET character_set_client = utf8 */; +CREATE TABLE `currencies` ( + `id` int(10) unsigned NOT NULL AUTO_INCREMENT, + `name` varchar(191) COLLATE utf8mb4_unicode_ci NOT NULL, + `symbol` varchar(191) COLLATE utf8mb4_unicode_ci NOT NULL, + `precision` varchar(191) COLLATE utf8mb4_unicode_ci NOT NULL, + `thousand_separator` varchar(191) COLLATE utf8mb4_unicode_ci NOT NULL, + `decimal_separator` varchar(191) COLLATE utf8mb4_unicode_ci NOT NULL, + `code` varchar(191) COLLATE utf8mb4_unicode_ci NOT NULL, + `swap_currency_symbol` tinyint(1) NOT NULL DEFAULT '0', + `exchange_rate` decimal(13,6) NOT NULL DEFAULT '1.000000', + PRIMARY KEY (`id`) +) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci ROW_FORMAT=COMPRESSED KEY_BLOCK_SIZE=8; +/*!40101 SET character_set_client = @saved_cs_client */; +/*!40101 SET @saved_cs_client = @@character_set_client */; +/*!40101 SET character_set_client = utf8 */; +CREATE TABLE `date_formats` ( + `id` int(10) unsigned NOT NULL AUTO_INCREMENT, + `format` varchar(191) COLLATE utf8mb4_unicode_ci NOT NULL, + `format_moment` varchar(191) COLLATE utf8mb4_unicode_ci NOT NULL, + `format_dart` varchar(191) COLLATE utf8mb4_unicode_ci NOT NULL, + PRIMARY KEY (`id`) +) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci ROW_FORMAT=COMPRESSED KEY_BLOCK_SIZE=8; +/*!40101 SET character_set_client = @saved_cs_client */; +/*!40101 SET @saved_cs_client = @@character_set_client */; +/*!40101 SET character_set_client = utf8 */; +CREATE TABLE `datetime_formats` ( + `id` int(10) unsigned NOT NULL AUTO_INCREMENT, + `format` varchar(191) COLLATE utf8mb4_unicode_ci NOT NULL, + `format_moment` varchar(191) COLLATE utf8mb4_unicode_ci NOT NULL, + `format_dart` varchar(191) COLLATE utf8mb4_unicode_ci NOT NULL, + PRIMARY KEY (`id`) +) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci ROW_FORMAT=COMPRESSED KEY_BLOCK_SIZE=8; +/*!40101 SET character_set_client = @saved_cs_client */; +/*!40101 SET @saved_cs_client = @@character_set_client */; +/*!40101 SET character_set_client = utf8 */; +CREATE TABLE `designs` ( + `id` int(10) unsigned NOT NULL AUTO_INCREMENT, + `user_id` int(10) unsigned DEFAULT NULL, + `company_id` int(10) unsigned DEFAULT NULL, + `name` varchar(191) COLLATE utf8mb4_unicode_ci NOT NULL, + `is_custom` tinyint(1) NOT NULL DEFAULT '1', + `is_active` tinyint(1) NOT NULL DEFAULT '1', + `design` mediumtext COLLATE utf8mb4_unicode_ci, + `is_deleted` tinyint(1) NOT NULL DEFAULT '0', + `created_at` timestamp(6) NULL DEFAULT NULL, + `updated_at` timestamp(6) NULL DEFAULT NULL, + `deleted_at` timestamp(6) NULL DEFAULT NULL, + PRIMARY KEY (`id`), + KEY `designs_company_id_deleted_at_index` (`company_id`,`deleted_at`), + KEY `designs_company_id_index` (`company_id`), + CONSTRAINT `designs_company_id_foreign` FOREIGN KEY (`company_id`) REFERENCES `companies` (`id`) ON DELETE CASCADE ON UPDATE CASCADE +) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci ROW_FORMAT=COMPRESSED KEY_BLOCK_SIZE=8; +/*!40101 SET character_set_client = @saved_cs_client */; +/*!40101 SET @saved_cs_client = @@character_set_client */; +/*!40101 SET character_set_client = utf8 */; +CREATE TABLE `documents` ( + `id` int(10) unsigned NOT NULL AUTO_INCREMENT, + `user_id` int(10) unsigned NOT NULL, + `assigned_user_id` int(10) unsigned NOT NULL, + `company_id` int(10) unsigned NOT NULL, + `project_id` int(10) unsigned DEFAULT NULL, + `vendor_id` int(10) unsigned DEFAULT NULL, + `url` varchar(191) COLLATE utf8mb4_unicode_ci DEFAULT NULL, + `preview` varchar(191) COLLATE utf8mb4_unicode_ci DEFAULT NULL, + `name` varchar(191) COLLATE utf8mb4_unicode_ci DEFAULT NULL, + `type` varchar(191) COLLATE utf8mb4_unicode_ci DEFAULT NULL, + `disk` varchar(191) COLLATE utf8mb4_unicode_ci DEFAULT NULL, + `hash` varchar(100) COLLATE utf8mb4_unicode_ci DEFAULT NULL, + `size` int(10) unsigned DEFAULT NULL, + `width` int(10) unsigned DEFAULT NULL, + `height` int(10) unsigned DEFAULT NULL, + `is_default` tinyint(1) NOT NULL DEFAULT '0', + `custom_value1` varchar(191) COLLATE utf8mb4_unicode_ci DEFAULT NULL, + `custom_value2` varchar(191) COLLATE utf8mb4_unicode_ci DEFAULT NULL, + `custom_value3` varchar(191) COLLATE utf8mb4_unicode_ci DEFAULT NULL, + `custom_value4` varchar(191) COLLATE utf8mb4_unicode_ci DEFAULT NULL, + `deleted_at` timestamp(6) NULL DEFAULT NULL, + `documentable_id` int(10) unsigned NOT NULL, + `documentable_type` varchar(191) COLLATE utf8mb4_unicode_ci NOT NULL, + `created_at` timestamp(6) NULL DEFAULT NULL, + `updated_at` timestamp(6) NULL DEFAULT NULL, + `is_public` tinyint(1) NOT NULL DEFAULT '1', + PRIMARY KEY (`id`), + KEY `documents_company_id_index` (`company_id`), + CONSTRAINT `documents_company_id_foreign` FOREIGN KEY (`company_id`) REFERENCES `companies` (`id`) ON DELETE CASCADE ON UPDATE CASCADE +) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci ROW_FORMAT=COMPRESSED KEY_BLOCK_SIZE=8; +/*!40101 SET character_set_client = @saved_cs_client */; +/*!40101 SET @saved_cs_client = @@character_set_client */; +/*!40101 SET character_set_client = utf8 */; +CREATE TABLE `expense_categories` ( + `id` int(10) unsigned NOT NULL AUTO_INCREMENT, + `user_id` int(10) unsigned NOT NULL, + `company_id` int(10) unsigned NOT NULL, + `name` varchar(191) COLLATE utf8mb4_unicode_ci DEFAULT NULL, + `created_at` timestamp(6) NULL DEFAULT NULL, + `updated_at` timestamp(6) NULL DEFAULT NULL, + `deleted_at` timestamp NULL DEFAULT NULL, + `is_deleted` tinyint(1) NOT NULL DEFAULT '0', + PRIMARY KEY (`id`), + KEY `expense_categories_company_id_deleted_at_index` (`company_id`,`deleted_at`), + KEY `expense_categories_company_id_index` (`company_id`), + CONSTRAINT `expense_categories_company_id_foreign` FOREIGN KEY (`company_id`) REFERENCES `companies` (`id`) ON DELETE CASCADE ON UPDATE CASCADE +) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci ROW_FORMAT=COMPRESSED KEY_BLOCK_SIZE=8; +/*!40101 SET character_set_client = @saved_cs_client */; +/*!40101 SET @saved_cs_client = @@character_set_client */; +/*!40101 SET character_set_client = utf8 */; +CREATE TABLE `expenses` ( + `id` int(10) unsigned NOT NULL AUTO_INCREMENT, + `created_at` timestamp(6) NULL DEFAULT NULL, + `updated_at` timestamp(6) NULL DEFAULT NULL, + `deleted_at` timestamp NULL DEFAULT NULL, + `company_id` int(10) unsigned NOT NULL, + `vendor_id` int(10) unsigned DEFAULT NULL, + `user_id` int(10) unsigned NOT NULL, + `assigned_user_id` int(10) unsigned DEFAULT NULL, + `invoice_id` int(10) unsigned DEFAULT NULL, + `client_id` int(10) unsigned DEFAULT NULL, + `bank_id` int(10) unsigned DEFAULT NULL, + `invoice_currency_id` int(10) unsigned DEFAULT NULL, + `expense_currency_id` int(10) unsigned DEFAULT NULL, + `category_id` int(10) unsigned DEFAULT NULL, + `payment_type_id` int(10) unsigned DEFAULT NULL, + `recurring_expense_id` int(10) unsigned DEFAULT NULL, + `is_deleted` tinyint(1) NOT NULL DEFAULT '0', + `amount` decimal(13,2) NOT NULL, + `foreign_amount` decimal(13,2) NOT NULL, + `exchange_rate` decimal(13,6) NOT NULL DEFAULT '1.000000', + `tax_name1` varchar(191) COLLATE utf8mb4_unicode_ci DEFAULT NULL, + `tax_rate1` decimal(13,3) NOT NULL DEFAULT '0.000', + `tax_name2` varchar(191) COLLATE utf8mb4_unicode_ci DEFAULT NULL, + `tax_rate2` decimal(13,3) NOT NULL DEFAULT '0.000', + `tax_name3` varchar(191) COLLATE utf8mb4_unicode_ci DEFAULT NULL, + `tax_rate3` decimal(13,3) NOT NULL DEFAULT '0.000', + `date` date DEFAULT NULL, + `payment_date` date DEFAULT NULL, + `private_notes` text COLLATE utf8mb4_unicode_ci, + `public_notes` text COLLATE utf8mb4_unicode_ci, + `transaction_reference` text COLLATE utf8mb4_unicode_ci, + `should_be_invoiced` tinyint(1) NOT NULL DEFAULT '0', + `invoice_documents` tinyint(1) NOT NULL DEFAULT '1', + `transaction_id` varchar(191) COLLATE utf8mb4_unicode_ci DEFAULT NULL, + `custom_value1` varchar(191) COLLATE utf8mb4_unicode_ci DEFAULT NULL, + `custom_value2` varchar(191) COLLATE utf8mb4_unicode_ci DEFAULT NULL, + `custom_value3` varchar(191) COLLATE utf8mb4_unicode_ci DEFAULT NULL, + `custom_value4` varchar(191) COLLATE utf8mb4_unicode_ci DEFAULT NULL, + `number` varchar(191) COLLATE utf8mb4_unicode_ci DEFAULT NULL, + `project_id` int(10) unsigned DEFAULT NULL, + PRIMARY KEY (`id`), + KEY `expenses_company_id_deleted_at_index` (`company_id`,`deleted_at`), + KEY `expenses_user_id_foreign` (`user_id`), + KEY `expenses_company_id_index` (`company_id`), + CONSTRAINT `expenses_company_id_foreign` FOREIGN KEY (`company_id`) REFERENCES `companies` (`id`) ON DELETE CASCADE ON UPDATE CASCADE, + CONSTRAINT `expenses_user_id_foreign` FOREIGN KEY (`user_id`) REFERENCES `users` (`id`) ON DELETE CASCADE ON UPDATE CASCADE +) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci ROW_FORMAT=COMPRESSED KEY_BLOCK_SIZE=8; +/*!40101 SET character_set_client = @saved_cs_client */; +/*!40101 SET @saved_cs_client = @@character_set_client */; +/*!40101 SET character_set_client = utf8 */; +CREATE TABLE `failed_jobs` ( + `id` bigint(20) unsigned NOT NULL AUTO_INCREMENT, + `connection` text COLLATE utf8mb4_unicode_ci NOT NULL, + `queue` text COLLATE utf8mb4_unicode_ci NOT NULL, + `payload` longtext COLLATE utf8mb4_unicode_ci NOT NULL, + `exception` longtext COLLATE utf8mb4_unicode_ci NOT NULL, + `failed_at` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP, + PRIMARY KEY (`id`) +) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci ROW_FORMAT=COMPRESSED KEY_BLOCK_SIZE=8; +/*!40101 SET character_set_client = @saved_cs_client */; +/*!40101 SET @saved_cs_client = @@character_set_client */; +/*!40101 SET character_set_client = utf8 */; +CREATE TABLE `gateway_types` ( + `id` int(10) unsigned NOT NULL AUTO_INCREMENT, + `alias` varchar(191) COLLATE utf8mb4_unicode_ci DEFAULT NULL, + `name` varchar(191) COLLATE utf8mb4_unicode_ci DEFAULT NULL, + PRIMARY KEY (`id`) +) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci ROW_FORMAT=COMPRESSED KEY_BLOCK_SIZE=8; +/*!40101 SET character_set_client = @saved_cs_client */; +/*!40101 SET @saved_cs_client = @@character_set_client */; +/*!40101 SET character_set_client = utf8 */; +CREATE TABLE `gateways` ( + `id` int(10) unsigned NOT NULL AUTO_INCREMENT, + `name` varchar(191) COLLATE utf8mb4_unicode_ci NOT NULL, + `key` varchar(191) COLLATE utf8mb4_unicode_ci NOT NULL, + `provider` varchar(191) COLLATE utf8mb4_unicode_ci NOT NULL, + `visible` tinyint(1) NOT NULL DEFAULT '1', + `sort_order` int(10) unsigned NOT NULL DEFAULT '10000', + `site_url` varchar(200) COLLATE utf8mb4_unicode_ci DEFAULT NULL, + `is_offsite` tinyint(1) NOT NULL DEFAULT '0', + `is_secure` tinyint(1) NOT NULL DEFAULT '0', + `fields` longtext COLLATE utf8mb4_unicode_ci, + `default_gateway_type_id` int(10) unsigned NOT NULL DEFAULT '1', + `created_at` timestamp(6) NULL DEFAULT NULL, + `updated_at` timestamp(6) NULL DEFAULT NULL, + PRIMARY KEY (`id`), + UNIQUE KEY `gateways_key_unique` (`key`) +) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci ROW_FORMAT=COMPRESSED KEY_BLOCK_SIZE=8; +/*!40101 SET character_set_client = @saved_cs_client */; +/*!40101 SET @saved_cs_client = @@character_set_client */; +/*!40101 SET character_set_client = utf8 */; +CREATE TABLE `group_settings` ( + `id` int(10) unsigned NOT NULL AUTO_INCREMENT, + `company_id` int(10) unsigned NOT NULL, + `user_id` int(10) unsigned DEFAULT NULL, + `name` varchar(191) COLLATE utf8mb4_unicode_ci DEFAULT NULL, + `settings` mediumtext COLLATE utf8mb4_unicode_ci, + `is_default` tinyint(1) NOT NULL DEFAULT '0', + `deleted_at` timestamp(6) NULL DEFAULT NULL, + `created_at` timestamp(6) NULL DEFAULT NULL, + `updated_at` timestamp(6) NULL DEFAULT NULL, + `is_deleted` tinyint(1) NOT NULL DEFAULT '0', + PRIMARY KEY (`id`), + KEY `group_settings_company_id_deleted_at_index` (`company_id`,`deleted_at`), + CONSTRAINT `group_settings_company_id_foreign` FOREIGN KEY (`company_id`) REFERENCES `companies` (`id`) ON DELETE CASCADE ON UPDATE CASCADE +) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci ROW_FORMAT=COMPRESSED KEY_BLOCK_SIZE=8; +/*!40101 SET character_set_client = @saved_cs_client */; +/*!40101 SET @saved_cs_client = @@character_set_client */; +/*!40101 SET character_set_client = utf8 */; +CREATE TABLE `industries` ( + `id` int(10) unsigned NOT NULL AUTO_INCREMENT, + `name` varchar(191) COLLATE utf8mb4_unicode_ci NOT NULL, + PRIMARY KEY (`id`) +) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci ROW_FORMAT=COMPRESSED KEY_BLOCK_SIZE=8; +/*!40101 SET character_set_client = @saved_cs_client */; +/*!40101 SET @saved_cs_client = @@character_set_client */; +/*!40101 SET character_set_client = utf8 */; +CREATE TABLE `invoice_invitations` ( + `id` int(10) unsigned NOT NULL AUTO_INCREMENT, + `company_id` int(10) unsigned NOT NULL, + `user_id` int(10) unsigned NOT NULL, + `client_contact_id` int(10) unsigned NOT NULL, + `invoice_id` int(10) unsigned NOT NULL, + `key` varchar(191) COLLATE utf8mb4_unicode_ci NOT NULL, + `transaction_reference` varchar(191) COLLATE utf8mb4_unicode_ci DEFAULT NULL, + `message_id` varchar(191) COLLATE utf8mb4_unicode_ci DEFAULT NULL, + `email_error` mediumtext COLLATE utf8mb4_unicode_ci, + `signature_base64` text COLLATE utf8mb4_unicode_ci, + `signature_date` datetime DEFAULT NULL, + `sent_date` datetime DEFAULT NULL, + `viewed_date` datetime DEFAULT NULL, + `opened_date` datetime DEFAULT NULL, + `created_at` timestamp(6) NULL DEFAULT NULL, + `updated_at` timestamp(6) NULL DEFAULT NULL, + `deleted_at` timestamp(6) NULL DEFAULT NULL, + PRIMARY KEY (`id`), + UNIQUE KEY `invoice_invitations_client_contact_id_invoice_id_unique` (`client_contact_id`,`invoice_id`), + KEY `invoice_invitations_user_id_foreign` (`user_id`), + KEY `invoice_invitations_company_id_foreign` (`company_id`), + KEY `invoice_invitations_deleted_at_invoice_id_company_id_index` (`deleted_at`,`invoice_id`,`company_id`), + KEY `invoice_invitations_invoice_id_index` (`invoice_id`), + KEY `invoice_invitations_key_index` (`key`), + CONSTRAINT `invoice_invitations_client_contact_id_foreign` FOREIGN KEY (`client_contact_id`) REFERENCES `client_contacts` (`id`) ON DELETE CASCADE ON UPDATE CASCADE, + CONSTRAINT `invoice_invitations_company_id_foreign` FOREIGN KEY (`company_id`) REFERENCES `companies` (`id`) ON DELETE CASCADE ON UPDATE CASCADE, + CONSTRAINT `invoice_invitations_invoice_id_foreign` FOREIGN KEY (`invoice_id`) REFERENCES `invoices` (`id`) ON DELETE CASCADE ON UPDATE CASCADE, + CONSTRAINT `invoice_invitations_user_id_foreign` FOREIGN KEY (`user_id`) REFERENCES `users` (`id`) ON DELETE CASCADE ON UPDATE CASCADE +) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci ROW_FORMAT=COMPRESSED KEY_BLOCK_SIZE=8; +/*!40101 SET character_set_client = @saved_cs_client */; +/*!40101 SET @saved_cs_client = @@character_set_client */; +/*!40101 SET character_set_client = utf8 */; +CREATE TABLE `invoices` ( + `id` int(10) unsigned NOT NULL AUTO_INCREMENT, + `client_id` int(10) unsigned NOT NULL, + `user_id` int(10) unsigned NOT NULL, + `assigned_user_id` int(10) unsigned DEFAULT NULL, + `company_id` int(10) unsigned NOT NULL, + `status_id` int(10) unsigned NOT NULL, + `project_id` int(10) unsigned DEFAULT NULL, + `vendor_id` int(10) unsigned DEFAULT NULL, + `recurring_id` int(10) unsigned DEFAULT NULL, + `design_id` int(10) unsigned DEFAULT NULL, + `number` varchar(191) COLLATE utf8mb4_unicode_ci DEFAULT NULL, + `discount` double(8,2) NOT NULL DEFAULT '0.00', + `is_amount_discount` tinyint(1) NOT NULL DEFAULT '0', + `po_number` varchar(191) COLLATE utf8mb4_unicode_ci DEFAULT NULL, + `date` date DEFAULT NULL, + `last_sent_date` date DEFAULT NULL, + `due_date` datetime DEFAULT NULL, + `is_deleted` tinyint(1) NOT NULL DEFAULT '0', + `line_items` mediumtext COLLATE utf8mb4_unicode_ci, + `backup` mediumtext COLLATE utf8mb4_unicode_ci, + `footer` text COLLATE utf8mb4_unicode_ci, + `public_notes` text COLLATE utf8mb4_unicode_ci, + `private_notes` text COLLATE utf8mb4_unicode_ci, + `terms` text COLLATE utf8mb4_unicode_ci, + `tax_name1` varchar(191) COLLATE utf8mb4_unicode_ci DEFAULT NULL, + `tax_rate1` decimal(13,3) NOT NULL DEFAULT '0.000', + `tax_name2` varchar(191) COLLATE utf8mb4_unicode_ci DEFAULT NULL, + `tax_rate2` decimal(13,3) NOT NULL DEFAULT '0.000', + `tax_name3` varchar(191) COLLATE utf8mb4_unicode_ci DEFAULT NULL, + `tax_rate3` decimal(13,3) NOT NULL DEFAULT '0.000', + `total_taxes` decimal(13,3) NOT NULL DEFAULT '0.000', + `uses_inclusive_taxes` tinyint(1) NOT NULL DEFAULT '0', + `custom_value1` varchar(191) COLLATE utf8mb4_unicode_ci DEFAULT NULL, + `custom_value2` varchar(191) COLLATE utf8mb4_unicode_ci DEFAULT NULL, + `custom_value3` varchar(191) COLLATE utf8mb4_unicode_ci DEFAULT NULL, + `custom_value4` varchar(191) COLLATE utf8mb4_unicode_ci DEFAULT NULL, + `next_send_date` datetime DEFAULT NULL, + `custom_surcharge1` varchar(191) COLLATE utf8mb4_unicode_ci DEFAULT NULL, + `custom_surcharge2` varchar(191) COLLATE utf8mb4_unicode_ci DEFAULT NULL, + `custom_surcharge3` varchar(191) COLLATE utf8mb4_unicode_ci DEFAULT NULL, + `custom_surcharge4` varchar(191) COLLATE utf8mb4_unicode_ci DEFAULT NULL, + `custom_surcharge_tax1` tinyint(1) NOT NULL DEFAULT '0', + `custom_surcharge_tax2` tinyint(1) NOT NULL DEFAULT '0', + `custom_surcharge_tax3` tinyint(1) NOT NULL DEFAULT '0', + `custom_surcharge_tax4` tinyint(1) NOT NULL DEFAULT '0', + `exchange_rate` decimal(13,6) NOT NULL DEFAULT '1.000000', + `amount` decimal(16,4) NOT NULL, + `balance` decimal(16,4) NOT NULL, + `partial` decimal(16,4) DEFAULT NULL, + `partial_due_date` datetime DEFAULT NULL, + `last_viewed` datetime DEFAULT NULL, + `created_at` timestamp(6) NULL DEFAULT NULL, + `updated_at` timestamp(6) NULL DEFAULT NULL, + `deleted_at` timestamp(6) NULL DEFAULT NULL, + `reminder1_sent` date DEFAULT NULL, + `reminder2_sent` date DEFAULT NULL, + `reminder3_sent` date DEFAULT NULL, + `reminder_last_sent` date DEFAULT NULL, + `auto_bill_enabled` tinyint(1) NOT NULL DEFAULT '0', + PRIMARY KEY (`id`), + UNIQUE KEY `invoices_company_id_number_unique` (`company_id`,`number`), + KEY `invoices_user_id_foreign` (`user_id`), + KEY `invoices_company_id_deleted_at_index` (`company_id`,`deleted_at`), + KEY `invoices_client_id_index` (`client_id`), + KEY `invoices_company_id_index` (`company_id`), + CONSTRAINT `invoices_client_id_foreign` FOREIGN KEY (`client_id`) REFERENCES `clients` (`id`) ON DELETE CASCADE ON UPDATE CASCADE, + CONSTRAINT `invoices_company_id_foreign` FOREIGN KEY (`company_id`) REFERENCES `companies` (`id`) ON DELETE CASCADE ON UPDATE CASCADE, + CONSTRAINT `invoices_user_id_foreign` FOREIGN KEY (`user_id`) REFERENCES `users` (`id`) ON DELETE CASCADE ON UPDATE CASCADE +) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci ROW_FORMAT=COMPRESSED KEY_BLOCK_SIZE=8; +/*!40101 SET character_set_client = @saved_cs_client */; +/*!40101 SET @saved_cs_client = @@character_set_client */; +/*!40101 SET character_set_client = utf8 */; +CREATE TABLE `jobs` ( + `id` bigint(20) unsigned NOT NULL AUTO_INCREMENT, + `queue` varchar(191) COLLATE utf8mb4_unicode_ci NOT NULL, + `payload` longtext COLLATE utf8mb4_unicode_ci NOT NULL, + `attempts` tinyint(3) unsigned NOT NULL, + `reserved_at` int(10) unsigned DEFAULT NULL, + `available_at` int(10) unsigned NOT NULL, + `created_at` int(10) unsigned NOT NULL, + PRIMARY KEY (`id`), + KEY `jobs_queue_index` (`queue`) +) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci ROW_FORMAT=COMPRESSED KEY_BLOCK_SIZE=8; +/*!40101 SET character_set_client = @saved_cs_client */; +/*!40101 SET @saved_cs_client = @@character_set_client */; +/*!40101 SET character_set_client = utf8 */; +CREATE TABLE `languages` ( + `id` int(10) unsigned NOT NULL AUTO_INCREMENT, + `name` varchar(191) COLLATE utf8mb4_unicode_ci NOT NULL, + `locale` varchar(191) COLLATE utf8mb4_unicode_ci NOT NULL, + PRIMARY KEY (`id`) +) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci ROW_FORMAT=COMPRESSED KEY_BLOCK_SIZE=8; +/*!40101 SET character_set_client = @saved_cs_client */; +/*!40101 SET @saved_cs_client = @@character_set_client */; +/*!40101 SET character_set_client = utf8 */; +CREATE TABLE `migrations` ( + `id` int(10) unsigned NOT NULL AUTO_INCREMENT, + `migration` varchar(191) COLLATE utf8mb4_unicode_ci NOT NULL, + `batch` int(11) NOT NULL, + PRIMARY KEY (`id`) +) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci ROW_FORMAT=COMPRESSED KEY_BLOCK_SIZE=8; +/*!40101 SET character_set_client = @saved_cs_client */; +/*!40101 SET @saved_cs_client = @@character_set_client */; +/*!40101 SET character_set_client = utf8 */; +CREATE TABLE `password_resets` ( + `email` varchar(128) COLLATE utf8mb4_unicode_ci NOT NULL, + `token` varchar(255) COLLATE utf8mb4_unicode_ci NOT NULL, + `created_at` timestamp NULL DEFAULT NULL, + KEY `password_resets_email_index` (`email`) +) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci ROW_FORMAT=COMPRESSED KEY_BLOCK_SIZE=8; +/*!40101 SET character_set_client = @saved_cs_client */; +/*!40101 SET @saved_cs_client = @@character_set_client */; +/*!40101 SET character_set_client = utf8 */; +CREATE TABLE `payment_hashes` ( + `id` int(10) unsigned NOT NULL AUTO_INCREMENT, + `hash` varchar(255) COLLATE utf8mb4_unicode_ci NOT NULL, + `fee_total` decimal(16,4) NOT NULL, + `fee_invoice_id` int(10) unsigned DEFAULT NULL, + `data` mediumtext COLLATE utf8mb4_unicode_ci NOT NULL, + `payment_id` int(10) unsigned DEFAULT NULL, + `created_at` timestamp(6) NULL DEFAULT NULL, + `updated_at` timestamp(6) NULL DEFAULT NULL, + PRIMARY KEY (`id`), + KEY `payment_hashes_payment_id_foreign` (`payment_id`), + CONSTRAINT `payment_hashes_payment_id_foreign` FOREIGN KEY (`payment_id`) REFERENCES `payments` (`id`) ON DELETE CASCADE ON UPDATE CASCADE +) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci ROW_FORMAT=COMPRESSED KEY_BLOCK_SIZE=8; +/*!40101 SET character_set_client = @saved_cs_client */; +/*!40101 SET @saved_cs_client = @@character_set_client */; +/*!40101 SET character_set_client = utf8 */; +CREATE TABLE `payment_libraries` ( + `id` int(10) unsigned NOT NULL AUTO_INCREMENT, + `created_at` timestamp(6) NULL DEFAULT NULL, + `updated_at` timestamp(6) NULL DEFAULT NULL, + `name` varchar(191) COLLATE utf8mb4_unicode_ci DEFAULT NULL, + `visible` tinyint(1) NOT NULL DEFAULT '1', + PRIMARY KEY (`id`) +) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci ROW_FORMAT=COMPRESSED KEY_BLOCK_SIZE=8; +/*!40101 SET character_set_client = @saved_cs_client */; +/*!40101 SET @saved_cs_client = @@character_set_client */; +/*!40101 SET character_set_client = utf8 */; +CREATE TABLE `payment_terms` ( + `id` int(10) unsigned NOT NULL AUTO_INCREMENT, + `num_days` int(11) DEFAULT NULL, + `name` varchar(191) COLLATE utf8mb4_unicode_ci DEFAULT NULL, + `company_id` int(10) unsigned DEFAULT NULL, + `user_id` int(10) unsigned DEFAULT NULL, + `is_deleted` tinyint(1) NOT NULL DEFAULT '0', + `created_at` timestamp(6) NULL DEFAULT NULL, + `updated_at` timestamp(6) NULL DEFAULT NULL, + `deleted_at` timestamp(6) NULL DEFAULT NULL, + PRIMARY KEY (`id`), + KEY `payment_terms_company_id_deleted_at_index` (`company_id`,`deleted_at`), + KEY `payment_terms_user_id_foreign` (`user_id`), + CONSTRAINT `payment_terms_company_id_foreign` FOREIGN KEY (`company_id`) REFERENCES `companies` (`id`) ON DELETE CASCADE ON UPDATE CASCADE, + CONSTRAINT `payment_terms_user_id_foreign` FOREIGN KEY (`user_id`) REFERENCES `users` (`id`) ON DELETE CASCADE ON UPDATE CASCADE +) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci ROW_FORMAT=COMPRESSED KEY_BLOCK_SIZE=8; +/*!40101 SET character_set_client = @saved_cs_client */; +/*!40101 SET @saved_cs_client = @@character_set_client */; +/*!40101 SET character_set_client = utf8 */; +CREATE TABLE `payment_types` ( + `id` int(10) unsigned NOT NULL AUTO_INCREMENT, + `name` varchar(191) COLLATE utf8mb4_unicode_ci NOT NULL, + `gateway_type_id` int(11) DEFAULT NULL, + PRIMARY KEY (`id`) +) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci ROW_FORMAT=COMPRESSED KEY_BLOCK_SIZE=8; +/*!40101 SET character_set_client = @saved_cs_client */; +/*!40101 SET @saved_cs_client = @@character_set_client */; +/*!40101 SET character_set_client = utf8 */; +CREATE TABLE `paymentables` ( + `id` int(10) unsigned NOT NULL AUTO_INCREMENT, + `payment_id` int(10) unsigned NOT NULL, + `paymentable_id` int(10) unsigned NOT NULL, + `amount` decimal(16,4) NOT NULL DEFAULT '0.0000', + `refunded` decimal(16,4) NOT NULL DEFAULT '0.0000', + `paymentable_type` varchar(191) COLLATE utf8mb4_unicode_ci NOT NULL, + `created_at` timestamp NULL DEFAULT NULL, + `updated_at` timestamp NULL DEFAULT NULL, + PRIMARY KEY (`id`), + KEY `paymentables_payment_id_foreign` (`payment_id`), + CONSTRAINT `paymentables_payment_id_foreign` FOREIGN KEY (`payment_id`) REFERENCES `payments` (`id`) ON DELETE CASCADE ON UPDATE CASCADE +) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci ROW_FORMAT=COMPRESSED KEY_BLOCK_SIZE=8; +/*!40101 SET character_set_client = @saved_cs_client */; +/*!40101 SET @saved_cs_client = @@character_set_client */; +/*!40101 SET character_set_client = utf8 */; +CREATE TABLE `payments` ( + `id` int(10) unsigned NOT NULL AUTO_INCREMENT, + `company_id` int(10) unsigned NOT NULL, + `client_id` int(10) unsigned NOT NULL, + `project_id` int(10) unsigned DEFAULT NULL, + `vendor_id` int(10) unsigned DEFAULT NULL, + `user_id` int(10) unsigned DEFAULT NULL, + `assigned_user_id` int(10) unsigned DEFAULT NULL, + `client_contact_id` int(10) unsigned DEFAULT NULL, + `invitation_id` int(10) unsigned DEFAULT NULL, + `company_gateway_id` int(10) unsigned DEFAULT NULL, + `gateway_type_id` int(10) unsigned DEFAULT NULL, + `type_id` int(10) unsigned DEFAULT NULL, + `status_id` int(10) unsigned NOT NULL, + `amount` decimal(16,4) NOT NULL DEFAULT '0.0000', + `refunded` decimal(16,4) NOT NULL DEFAULT '0.0000', + `applied` decimal(16,4) NOT NULL DEFAULT '0.0000', + `date` date DEFAULT NULL, + `transaction_reference` varchar(191) COLLATE utf8mb4_unicode_ci DEFAULT NULL, + `payer_id` varchar(191) COLLATE utf8mb4_unicode_ci DEFAULT NULL, + `number` varchar(191) COLLATE utf8mb4_unicode_ci DEFAULT NULL, + `private_notes` text COLLATE utf8mb4_unicode_ci, + `created_at` timestamp(6) NULL DEFAULT NULL, + `updated_at` timestamp(6) NULL DEFAULT NULL, + `deleted_at` timestamp(6) NULL DEFAULT NULL, + `is_deleted` tinyint(1) NOT NULL DEFAULT '0', + `is_manual` tinyint(1) NOT NULL DEFAULT '0', + `exchange_rate` decimal(13,6) NOT NULL DEFAULT '1.000000', + `currency_id` int(10) unsigned NOT NULL, + `exchange_currency_id` int(10) unsigned NOT NULL, + `meta` text COLLATE utf8mb4_unicode_ci, + PRIMARY KEY (`id`), + KEY `payments_company_id_deleted_at_index` (`company_id`,`deleted_at`), + KEY `payments_client_contact_id_foreign` (`client_contact_id`), + KEY `payments_company_gateway_id_foreign` (`company_gateway_id`), + KEY `payments_user_id_foreign` (`user_id`), + KEY `payments_company_id_index` (`company_id`), + KEY `payments_client_id_index` (`client_id`), + KEY `payments_status_id_index` (`status_id`), + CONSTRAINT `payments_client_contact_id_foreign` FOREIGN KEY (`client_contact_id`) REFERENCES `client_contacts` (`id`) ON DELETE CASCADE ON UPDATE CASCADE, + CONSTRAINT `payments_client_id_foreign` FOREIGN KEY (`client_id`) REFERENCES `clients` (`id`) ON DELETE CASCADE ON UPDATE CASCADE, + CONSTRAINT `payments_company_gateway_id_foreign` FOREIGN KEY (`company_gateway_id`) REFERENCES `company_gateways` (`id`) ON DELETE CASCADE ON UPDATE CASCADE, + CONSTRAINT `payments_company_id_foreign` FOREIGN KEY (`company_id`) REFERENCES `companies` (`id`) ON DELETE CASCADE ON UPDATE CASCADE, + CONSTRAINT `payments_user_id_foreign` FOREIGN KEY (`user_id`) REFERENCES `users` (`id`) ON DELETE CASCADE ON UPDATE CASCADE +) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci ROW_FORMAT=COMPRESSED KEY_BLOCK_SIZE=8; +/*!40101 SET character_set_client = @saved_cs_client */; +/*!40101 SET @saved_cs_client = @@character_set_client */; +/*!40101 SET character_set_client = utf8 */; +CREATE TABLE `products` ( + `id` int(10) unsigned NOT NULL AUTO_INCREMENT, + `company_id` int(10) unsigned NOT NULL, + `user_id` int(10) unsigned NOT NULL, + `assigned_user_id` int(10) unsigned DEFAULT NULL, + `project_id` int(10) unsigned DEFAULT NULL, + `vendor_id` int(10) unsigned DEFAULT NULL, + `custom_value1` varchar(191) COLLATE utf8mb4_unicode_ci DEFAULT NULL, + `custom_value2` varchar(191) COLLATE utf8mb4_unicode_ci DEFAULT NULL, + `custom_value3` varchar(191) COLLATE utf8mb4_unicode_ci DEFAULT NULL, + `custom_value4` varchar(191) COLLATE utf8mb4_unicode_ci DEFAULT NULL, + `product_key` varchar(191) COLLATE utf8mb4_unicode_ci DEFAULT NULL, + `notes` text COLLATE utf8mb4_unicode_ci, + `cost` decimal(16,4) NOT NULL DEFAULT '0.0000', + `price` decimal(16,4) NOT NULL DEFAULT '0.0000', + `quantity` decimal(16,4) NOT NULL DEFAULT '0.0000', + `tax_name1` varchar(191) COLLATE utf8mb4_unicode_ci DEFAULT NULL, + `tax_rate1` decimal(13,3) NOT NULL DEFAULT '0.000', + `tax_name2` varchar(191) COLLATE utf8mb4_unicode_ci DEFAULT NULL, + `tax_rate2` decimal(13,3) NOT NULL DEFAULT '0.000', + `tax_name3` varchar(191) COLLATE utf8mb4_unicode_ci DEFAULT NULL, + `tax_rate3` decimal(13,3) NOT NULL DEFAULT '0.000', + `deleted_at` timestamp(6) NULL DEFAULT NULL, + `created_at` timestamp(6) NULL DEFAULT NULL, + `updated_at` timestamp(6) NULL DEFAULT NULL, + `is_deleted` tinyint(1) NOT NULL DEFAULT '0', + PRIMARY KEY (`id`), + KEY `products_company_id_deleted_at_index` (`company_id`,`deleted_at`), + KEY `products_user_id_foreign` (`user_id`), + KEY `products_company_id_index` (`company_id`), + CONSTRAINT `products_company_id_foreign` FOREIGN KEY (`company_id`) REFERENCES `companies` (`id`) ON DELETE CASCADE ON UPDATE CASCADE, + CONSTRAINT `products_user_id_foreign` FOREIGN KEY (`user_id`) REFERENCES `users` (`id`) ON DELETE CASCADE ON UPDATE CASCADE +) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci ROW_FORMAT=COMPRESSED KEY_BLOCK_SIZE=8; +/*!40101 SET character_set_client = @saved_cs_client */; +/*!40101 SET @saved_cs_client = @@character_set_client */; +/*!40101 SET character_set_client = utf8 */; +CREATE TABLE `projects` ( + `id` int(10) unsigned NOT NULL AUTO_INCREMENT, + `user_id` int(10) unsigned NOT NULL, + `assigned_user_id` int(10) unsigned NOT NULL, + `company_id` int(10) unsigned NOT NULL, + `client_id` int(10) unsigned DEFAULT NULL, + `name` varchar(191) COLLATE utf8mb4_unicode_ci NOT NULL, + `task_rate` decimal(12,4) NOT NULL DEFAULT '0.0000', + `due_date` date DEFAULT NULL, + `private_notes` text COLLATE utf8mb4_unicode_ci, + `budgeted_hours` decimal(12,2) NOT NULL, + `custom_value1` text COLLATE utf8mb4_unicode_ci, + `custom_value2` text COLLATE utf8mb4_unicode_ci, + `custom_value3` text COLLATE utf8mb4_unicode_ci, + `custom_value4` text COLLATE utf8mb4_unicode_ci, + `created_at` timestamp(6) NULL DEFAULT NULL, + `updated_at` timestamp(6) NULL DEFAULT NULL, + `deleted_at` timestamp NULL DEFAULT NULL, + `public_notes` text COLLATE utf8mb4_unicode_ci, + `is_deleted` tinyint(1) NOT NULL DEFAULT '0', + `number` varchar(191) COLLATE utf8mb4_unicode_ci DEFAULT NULL, + PRIMARY KEY (`id`), + KEY `projects_user_id_foreign` (`user_id`), + KEY `projects_company_id_deleted_at_index` (`company_id`,`deleted_at`), + KEY `projects_company_id_index` (`company_id`), + CONSTRAINT `projects_company_id_foreign` FOREIGN KEY (`company_id`) REFERENCES `companies` (`id`) ON DELETE CASCADE ON UPDATE CASCADE, + CONSTRAINT `projects_user_id_foreign` FOREIGN KEY (`user_id`) REFERENCES `users` (`id`) ON DELETE CASCADE ON UPDATE CASCADE +) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci ROW_FORMAT=COMPRESSED KEY_BLOCK_SIZE=8; +/*!40101 SET character_set_client = @saved_cs_client */; +/*!40101 SET @saved_cs_client = @@character_set_client */; +/*!40101 SET character_set_client = utf8 */; +CREATE TABLE `quote_invitations` ( + `id` int(10) unsigned NOT NULL AUTO_INCREMENT, + `company_id` int(10) unsigned NOT NULL, + `user_id` int(10) unsigned NOT NULL, + `client_contact_id` int(10) unsigned NOT NULL, + `quote_id` int(10) unsigned NOT NULL, + `key` varchar(191) COLLATE utf8mb4_unicode_ci NOT NULL, + `transaction_reference` varchar(191) COLLATE utf8mb4_unicode_ci DEFAULT NULL, + `message_id` varchar(191) COLLATE utf8mb4_unicode_ci DEFAULT NULL, + `email_error` mediumtext COLLATE utf8mb4_unicode_ci, + `signature_base64` text COLLATE utf8mb4_unicode_ci, + `signature_date` datetime DEFAULT NULL, + `sent_date` datetime DEFAULT NULL, + `viewed_date` datetime DEFAULT NULL, + `opened_date` datetime DEFAULT NULL, + `created_at` timestamp(6) NULL DEFAULT NULL, + `updated_at` timestamp(6) NULL DEFAULT NULL, + `deleted_at` timestamp(6) NULL DEFAULT NULL, + PRIMARY KEY (`id`), + UNIQUE KEY `quote_invitations_client_contact_id_quote_id_unique` (`client_contact_id`,`quote_id`), + KEY `quote_invitations_user_id_foreign` (`user_id`), + KEY `quote_invitations_company_id_foreign` (`company_id`), + KEY `quote_invitations_deleted_at_quote_id_company_id_index` (`deleted_at`,`quote_id`,`company_id`), + KEY `quote_invitations_quote_id_index` (`quote_id`), + KEY `quote_invitations_key_index` (`key`), + CONSTRAINT `quote_invitations_client_contact_id_foreign` FOREIGN KEY (`client_contact_id`) REFERENCES `client_contacts` (`id`) ON DELETE CASCADE ON UPDATE CASCADE, + CONSTRAINT `quote_invitations_company_id_foreign` FOREIGN KEY (`company_id`) REFERENCES `companies` (`id`) ON DELETE CASCADE ON UPDATE CASCADE, + CONSTRAINT `quote_invitations_quote_id_foreign` FOREIGN KEY (`quote_id`) REFERENCES `quotes` (`id`) ON DELETE CASCADE ON UPDATE CASCADE, + CONSTRAINT `quote_invitations_user_id_foreign` FOREIGN KEY (`user_id`) REFERENCES `users` (`id`) ON DELETE CASCADE ON UPDATE CASCADE +) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci ROW_FORMAT=COMPRESSED KEY_BLOCK_SIZE=8; +/*!40101 SET character_set_client = @saved_cs_client */; +/*!40101 SET @saved_cs_client = @@character_set_client */; +/*!40101 SET character_set_client = utf8 */; +CREATE TABLE `quotes` ( + `id` int(10) unsigned NOT NULL AUTO_INCREMENT, + `client_id` int(10) unsigned NOT NULL, + `user_id` int(10) unsigned NOT NULL, + `assigned_user_id` int(10) unsigned DEFAULT NULL, + `company_id` int(10) unsigned NOT NULL, + `status_id` int(10) unsigned NOT NULL, + `project_id` int(10) unsigned DEFAULT NULL, + `vendor_id` int(10) unsigned DEFAULT NULL, + `recurring_id` int(10) unsigned DEFAULT NULL, + `design_id` int(10) unsigned DEFAULT NULL, + `invoice_id` int(10) unsigned DEFAULT NULL, + `number` varchar(191) COLLATE utf8mb4_unicode_ci DEFAULT NULL, + `discount` double(8,2) NOT NULL DEFAULT '0.00', + `is_amount_discount` tinyint(1) NOT NULL DEFAULT '0', + `po_number` varchar(191) COLLATE utf8mb4_unicode_ci DEFAULT NULL, + `date` date DEFAULT NULL, + `last_sent_date` date DEFAULT NULL, + `due_date` datetime DEFAULT NULL, + `next_send_date` datetime DEFAULT NULL, + `is_deleted` tinyint(1) NOT NULL DEFAULT '0', + `line_items` mediumtext COLLATE utf8mb4_unicode_ci, + `backup` mediumtext COLLATE utf8mb4_unicode_ci, + `footer` text COLLATE utf8mb4_unicode_ci, + `public_notes` text COLLATE utf8mb4_unicode_ci, + `private_notes` text COLLATE utf8mb4_unicode_ci, + `terms` text COLLATE utf8mb4_unicode_ci, + `tax_name1` varchar(191) COLLATE utf8mb4_unicode_ci DEFAULT NULL, + `tax_rate1` decimal(13,3) NOT NULL DEFAULT '0.000', + `tax_name2` varchar(191) COLLATE utf8mb4_unicode_ci DEFAULT NULL, + `tax_rate2` decimal(13,3) NOT NULL DEFAULT '0.000', + `tax_name3` varchar(191) COLLATE utf8mb4_unicode_ci DEFAULT NULL, + `tax_rate3` decimal(13,3) NOT NULL DEFAULT '0.000', + `total_taxes` decimal(13,3) NOT NULL DEFAULT '0.000', + `uses_inclusive_taxes` tinyint(1) NOT NULL DEFAULT '0', + `custom_value1` varchar(191) COLLATE utf8mb4_unicode_ci DEFAULT NULL, + `custom_value2` varchar(191) COLLATE utf8mb4_unicode_ci DEFAULT NULL, + `custom_value3` varchar(191) COLLATE utf8mb4_unicode_ci DEFAULT NULL, + `custom_value4` varchar(191) COLLATE utf8mb4_unicode_ci DEFAULT NULL, + `custom_surcharge1` varchar(191) COLLATE utf8mb4_unicode_ci DEFAULT NULL, + `custom_surcharge2` varchar(191) COLLATE utf8mb4_unicode_ci DEFAULT NULL, + `custom_surcharge3` varchar(191) COLLATE utf8mb4_unicode_ci DEFAULT NULL, + `custom_surcharge4` varchar(191) COLLATE utf8mb4_unicode_ci DEFAULT NULL, + `custom_surcharge_tax1` tinyint(1) NOT NULL DEFAULT '0', + `custom_surcharge_tax2` tinyint(1) NOT NULL DEFAULT '0', + `custom_surcharge_tax3` tinyint(1) NOT NULL DEFAULT '0', + `custom_surcharge_tax4` tinyint(1) NOT NULL DEFAULT '0', + `exchange_rate` decimal(13,6) NOT NULL DEFAULT '1.000000', + `amount` decimal(16,4) NOT NULL, + `balance` decimal(16,4) NOT NULL, + `partial` decimal(16,4) DEFAULT NULL, + `partial_due_date` datetime DEFAULT NULL, + `last_viewed` datetime DEFAULT NULL, + `created_at` timestamp(6) NULL DEFAULT NULL, + `updated_at` timestamp(6) NULL DEFAULT NULL, + `deleted_at` timestamp(6) NULL DEFAULT NULL, + `reminder1_sent` date DEFAULT NULL, + `reminder2_sent` date DEFAULT NULL, + `reminder3_sent` date DEFAULT NULL, + `reminder_last_sent` date DEFAULT NULL, + PRIMARY KEY (`id`), + UNIQUE KEY `quotes_company_id_number_unique` (`company_id`,`number`), + KEY `quotes_user_id_foreign` (`user_id`), + KEY `quotes_company_id_deleted_at_index` (`company_id`,`deleted_at`), + KEY `quotes_client_id_index` (`client_id`), + KEY `quotes_company_id_index` (`company_id`), + CONSTRAINT `quotes_client_id_foreign` FOREIGN KEY (`client_id`) REFERENCES `clients` (`id`) ON DELETE CASCADE ON UPDATE CASCADE, + CONSTRAINT `quotes_company_id_foreign` FOREIGN KEY (`company_id`) REFERENCES `companies` (`id`) ON DELETE CASCADE ON UPDATE CASCADE, + CONSTRAINT `quotes_user_id_foreign` FOREIGN KEY (`user_id`) REFERENCES `users` (`id`) ON DELETE CASCADE ON UPDATE CASCADE +) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci ROW_FORMAT=COMPRESSED KEY_BLOCK_SIZE=8; +/*!40101 SET character_set_client = @saved_cs_client */; +/*!40101 SET @saved_cs_client = @@character_set_client */; +/*!40101 SET character_set_client = utf8 */; +CREATE TABLE `recurring_invoice_invitations` ( + `id` int(10) unsigned NOT NULL AUTO_INCREMENT, + `company_id` int(10) unsigned NOT NULL, + `user_id` int(10) unsigned NOT NULL, + `client_contact_id` int(10) unsigned NOT NULL, + `recurring_invoice_id` int(10) unsigned NOT NULL, + `key` varchar(191) COLLATE utf8mb4_unicode_ci NOT NULL, + `created_at` timestamp(6) NULL DEFAULT NULL, + `updated_at` timestamp(6) NULL DEFAULT NULL, + `deleted_at` timestamp(6) NULL DEFAULT NULL, + `transaction_reference` varchar(191) COLLATE utf8mb4_unicode_ci DEFAULT NULL, + `message_id` varchar(191) COLLATE utf8mb4_unicode_ci DEFAULT NULL, + `email_error` mediumtext COLLATE utf8mb4_unicode_ci, + `signature_base64` text COLLATE utf8mb4_unicode_ci, + `signature_date` datetime DEFAULT NULL, + `sent_date` datetime DEFAULT NULL, + `viewed_date` datetime DEFAULT NULL, + `opened_date` datetime DEFAULT NULL, + PRIMARY KEY (`id`), + UNIQUE KEY `cli_rec` (`client_contact_id`,`recurring_invoice_id`), + KEY `recurring_invoice_invitations_user_id_foreign` (`user_id`), + KEY `recurring_invoice_invitations_company_id_foreign` (`company_id`), + KEY `rec_co_del` (`deleted_at`,`recurring_invoice_id`,`company_id`), + KEY `recurring_invoice_invitations_recurring_invoice_id_index` (`recurring_invoice_id`), + KEY `recurring_invoice_invitations_key_index` (`key`), + CONSTRAINT `recurring_invoice_invitations_client_contact_id_foreign` FOREIGN KEY (`client_contact_id`) REFERENCES `client_contacts` (`id`) ON DELETE CASCADE ON UPDATE CASCADE, + CONSTRAINT `recurring_invoice_invitations_company_id_foreign` FOREIGN KEY (`company_id`) REFERENCES `companies` (`id`) ON DELETE CASCADE ON UPDATE CASCADE, + CONSTRAINT `recurring_invoice_invitations_recurring_invoice_id_foreign` FOREIGN KEY (`recurring_invoice_id`) REFERENCES `recurring_invoices` (`id`) ON DELETE CASCADE ON UPDATE CASCADE, + CONSTRAINT `recurring_invoice_invitations_user_id_foreign` FOREIGN KEY (`user_id`) REFERENCES `users` (`id`) ON DELETE CASCADE ON UPDATE CASCADE +) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci ROW_FORMAT=COMPRESSED KEY_BLOCK_SIZE=8; +/*!40101 SET character_set_client = @saved_cs_client */; +/*!40101 SET @saved_cs_client = @@character_set_client */; +/*!40101 SET character_set_client = utf8 */; +CREATE TABLE `recurring_invoices` ( + `id` int(10) unsigned NOT NULL AUTO_INCREMENT, + `client_id` int(10) unsigned NOT NULL, + `user_id` int(10) unsigned NOT NULL, + `assigned_user_id` int(10) unsigned DEFAULT NULL, + `company_id` int(10) unsigned NOT NULL, + `project_id` int(10) unsigned DEFAULT NULL, + `vendor_id` int(10) unsigned DEFAULT NULL, + `status_id` int(10) unsigned NOT NULL, + `number` text COLLATE utf8mb4_unicode_ci, + `discount` double(8,2) NOT NULL DEFAULT '0.00', + `is_amount_discount` tinyint(1) NOT NULL DEFAULT '0', + `po_number` varchar(191) COLLATE utf8mb4_unicode_ci DEFAULT NULL, + `date` date DEFAULT NULL, + `due_date` datetime DEFAULT NULL, + `is_deleted` tinyint(1) NOT NULL DEFAULT '0', + `line_items` mediumtext COLLATE utf8mb4_unicode_ci, + `backup` mediumtext COLLATE utf8mb4_unicode_ci, + `footer` text COLLATE utf8mb4_unicode_ci, + `public_notes` text COLLATE utf8mb4_unicode_ci, + `private_notes` text COLLATE utf8mb4_unicode_ci, + `terms` text COLLATE utf8mb4_unicode_ci, + `tax_name1` varchar(191) COLLATE utf8mb4_unicode_ci DEFAULT NULL, + `tax_rate1` decimal(13,3) NOT NULL DEFAULT '0.000', + `tax_name2` varchar(191) COLLATE utf8mb4_unicode_ci DEFAULT NULL, + `tax_rate2` decimal(13,3) NOT NULL DEFAULT '0.000', + `tax_name3` varchar(191) COLLATE utf8mb4_unicode_ci DEFAULT NULL, + `tax_rate3` decimal(13,3) NOT NULL DEFAULT '0.000', + `total_taxes` decimal(13,3) NOT NULL DEFAULT '0.000', + `custom_value1` varchar(191) COLLATE utf8mb4_unicode_ci DEFAULT NULL, + `custom_value2` varchar(191) COLLATE utf8mb4_unicode_ci DEFAULT NULL, + `custom_value3` varchar(191) COLLATE utf8mb4_unicode_ci DEFAULT NULL, + `custom_value4` varchar(191) COLLATE utf8mb4_unicode_ci DEFAULT NULL, + `amount` decimal(16,4) NOT NULL, + `balance` decimal(16,4) NOT NULL, + `partial` decimal(16,4) DEFAULT NULL, + `last_viewed` datetime DEFAULT NULL, + `frequency_id` int(10) unsigned NOT NULL, + `last_sent_date` datetime DEFAULT NULL, + `next_send_date` datetime DEFAULT NULL, + `remaining_cycles` int(11) DEFAULT NULL, + `created_at` timestamp(6) NULL DEFAULT NULL, + `updated_at` timestamp(6) NULL DEFAULT NULL, + `deleted_at` timestamp(6) NULL DEFAULT NULL, + `auto_bill` varchar(191) COLLATE utf8mb4_unicode_ci NOT NULL DEFAULT 'off', + `auto_bill_enabled` tinyint(1) NOT NULL DEFAULT '0', + `design_id` int(10) unsigned DEFAULT NULL, + `uses_inclusive_taxes` tinyint(1) NOT NULL DEFAULT '0', + `custom_surcharge1` varchar(191) COLLATE utf8mb4_unicode_ci DEFAULT NULL, + `custom_surcharge2` varchar(191) COLLATE utf8mb4_unicode_ci DEFAULT NULL, + `custom_surcharge3` varchar(191) COLLATE utf8mb4_unicode_ci DEFAULT NULL, + `custom_surcharge4` varchar(191) COLLATE utf8mb4_unicode_ci DEFAULT NULL, + `custom_surcharge_tax1` tinyint(1) NOT NULL DEFAULT '0', + `custom_surcharge_tax2` tinyint(1) NOT NULL DEFAULT '0', + `custom_surcharge_tax3` tinyint(1) NOT NULL DEFAULT '0', + `custom_surcharge_tax4` tinyint(1) NOT NULL DEFAULT '0', + `due_date_days` varchar(191) COLLATE utf8mb4_unicode_ci DEFAULT NULL, + `partial_due_date` date DEFAULT NULL, + `exchange_rate` decimal(13,6) NOT NULL DEFAULT '1.000000', + PRIMARY KEY (`id`), + KEY `recurring_invoices_company_id_deleted_at_index` (`company_id`,`deleted_at`), + KEY `recurring_invoices_user_id_foreign` (`user_id`), + KEY `recurring_invoices_client_id_index` (`client_id`), + KEY `recurring_invoices_company_id_index` (`company_id`), + KEY `recurring_invoices_status_id_index` (`status_id`), + CONSTRAINT `recurring_invoices_client_id_foreign` FOREIGN KEY (`client_id`) REFERENCES `clients` (`id`) ON DELETE CASCADE ON UPDATE CASCADE, + CONSTRAINT `recurring_invoices_company_id_foreign` FOREIGN KEY (`company_id`) REFERENCES `companies` (`id`) ON DELETE CASCADE ON UPDATE CASCADE, + CONSTRAINT `recurring_invoices_user_id_foreign` FOREIGN KEY (`user_id`) REFERENCES `users` (`id`) ON DELETE CASCADE ON UPDATE CASCADE +) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci ROW_FORMAT=COMPRESSED KEY_BLOCK_SIZE=8; +/*!40101 SET character_set_client = @saved_cs_client */; +/*!40101 SET @saved_cs_client = @@character_set_client */; +/*!40101 SET character_set_client = utf8 */; +CREATE TABLE `recurring_quotes` ( + `id` int(10) unsigned NOT NULL AUTO_INCREMENT, + `client_id` int(10) unsigned NOT NULL, + `user_id` int(10) unsigned NOT NULL, + `assigned_user_id` int(10) unsigned DEFAULT NULL, + `company_id` int(10) unsigned NOT NULL, + `project_id` int(10) unsigned DEFAULT NULL, + `vendor_id` int(10) unsigned DEFAULT NULL, + `status_id` int(10) unsigned NOT NULL, + `discount` double(8,2) NOT NULL DEFAULT '0.00', + `is_amount_discount` tinyint(1) NOT NULL DEFAULT '0', + `number` varchar(191) COLLATE utf8mb4_unicode_ci DEFAULT NULL, + `po_number` varchar(191) COLLATE utf8mb4_unicode_ci DEFAULT NULL, + `date` date DEFAULT NULL, + `due_date` datetime DEFAULT NULL, + `is_deleted` tinyint(1) NOT NULL DEFAULT '0', + `line_items` mediumtext COLLATE utf8mb4_unicode_ci, + `backup` mediumtext COLLATE utf8mb4_unicode_ci, + `footer` text COLLATE utf8mb4_unicode_ci, + `public_notes` text COLLATE utf8mb4_unicode_ci, + `private_notes` text COLLATE utf8mb4_unicode_ci, + `terms` text COLLATE utf8mb4_unicode_ci, + `tax_name1` varchar(191) COLLATE utf8mb4_unicode_ci DEFAULT NULL, + `tax_rate1` decimal(13,3) NOT NULL DEFAULT '0.000', + `tax_name2` varchar(191) COLLATE utf8mb4_unicode_ci DEFAULT NULL, + `tax_rate2` decimal(13,3) NOT NULL DEFAULT '0.000', + `tax_name3` varchar(191) COLLATE utf8mb4_unicode_ci DEFAULT NULL, + `tax_rate3` decimal(13,3) NOT NULL DEFAULT '0.000', + `total_taxes` decimal(13,3) NOT NULL DEFAULT '0.000', + `custom_value1` varchar(191) COLLATE utf8mb4_unicode_ci DEFAULT NULL, + `custom_value2` varchar(191) COLLATE utf8mb4_unicode_ci DEFAULT NULL, + `custom_value3` varchar(191) COLLATE utf8mb4_unicode_ci DEFAULT NULL, + `custom_value4` varchar(191) COLLATE utf8mb4_unicode_ci DEFAULT NULL, + `amount` decimal(16,4) NOT NULL DEFAULT '0.0000', + `balance` decimal(16,4) NOT NULL DEFAULT '0.0000', + `last_viewed` datetime DEFAULT NULL, + `frequency_id` int(10) unsigned NOT NULL, + `start_date` date DEFAULT NULL, + `last_sent_date` datetime DEFAULT NULL, + `next_send_date` datetime DEFAULT NULL, + `remaining_cycles` int(10) unsigned DEFAULT NULL, + `created_at` timestamp(6) NULL DEFAULT NULL, + `updated_at` timestamp(6) NULL DEFAULT NULL, + `deleted_at` timestamp(6) NULL DEFAULT NULL, + PRIMARY KEY (`id`), + KEY `recurring_quotes_company_id_deleted_at_index` (`company_id`,`deleted_at`), + KEY `recurring_quotes_user_id_foreign` (`user_id`), + KEY `recurring_quotes_client_id_index` (`client_id`), + KEY `recurring_quotes_company_id_index` (`company_id`), + KEY `recurring_quotes_status_id_index` (`status_id`), + CONSTRAINT `recurring_quotes_client_id_foreign` FOREIGN KEY (`client_id`) REFERENCES `clients` (`id`) ON DELETE CASCADE ON UPDATE CASCADE, + CONSTRAINT `recurring_quotes_company_id_foreign` FOREIGN KEY (`company_id`) REFERENCES `companies` (`id`) ON DELETE CASCADE ON UPDATE CASCADE, + CONSTRAINT `recurring_quotes_user_id_foreign` FOREIGN KEY (`user_id`) REFERENCES `users` (`id`) ON DELETE CASCADE ON UPDATE CASCADE +) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci ROW_FORMAT=COMPRESSED KEY_BLOCK_SIZE=8; +/*!40101 SET character_set_client = @saved_cs_client */; +/*!40101 SET @saved_cs_client = @@character_set_client */; +/*!40101 SET character_set_client = utf8 */; +CREATE TABLE `sizes` ( + `id` int(10) unsigned NOT NULL AUTO_INCREMENT, + `name` varchar(191) COLLATE utf8mb4_unicode_ci NOT NULL, + PRIMARY KEY (`id`) +) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci ROW_FORMAT=COMPRESSED KEY_BLOCK_SIZE=8; +/*!40101 SET character_set_client = @saved_cs_client */; +/*!40101 SET @saved_cs_client = @@character_set_client */; +/*!40101 SET character_set_client = utf8 */; +CREATE TABLE `system_logs` ( + `id` int(10) unsigned NOT NULL AUTO_INCREMENT, + `company_id` int(10) unsigned NOT NULL, + `user_id` int(10) unsigned DEFAULT NULL, + `client_id` int(10) unsigned DEFAULT NULL, + `category_id` int(10) unsigned DEFAULT NULL, + `event_id` int(10) unsigned DEFAULT NULL, + `type_id` int(10) unsigned DEFAULT NULL, + `log` mediumtext COLLATE utf8mb4_unicode_ci NOT NULL, + `created_at` timestamp(6) NULL DEFAULT NULL, + `updated_at` timestamp(6) NULL DEFAULT NULL, + `deleted_at` timestamp(6) NULL DEFAULT NULL, + PRIMARY KEY (`id`), + KEY `system_logs_company_id_foreign` (`company_id`), + KEY `system_logs_client_id_foreign` (`client_id`), + CONSTRAINT `system_logs_client_id_foreign` FOREIGN KEY (`client_id`) REFERENCES `clients` (`id`) ON DELETE CASCADE ON UPDATE CASCADE, + CONSTRAINT `system_logs_company_id_foreign` FOREIGN KEY (`company_id`) REFERENCES `companies` (`id`) ON DELETE CASCADE ON UPDATE CASCADE +) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci ROW_FORMAT=COMPRESSED KEY_BLOCK_SIZE=8; +/*!40101 SET character_set_client = @saved_cs_client */; +/*!40101 SET @saved_cs_client = @@character_set_client */; +/*!40101 SET character_set_client = utf8 */; +CREATE TABLE `task_statuses` ( + `id` int(10) unsigned NOT NULL AUTO_INCREMENT, + `name` varchar(191) COLLATE utf8mb4_unicode_ci DEFAULT NULL, + `company_id` int(10) unsigned DEFAULT NULL, + `user_id` int(10) unsigned DEFAULT NULL, + `is_deleted` tinyint(1) NOT NULL DEFAULT '0', + `created_at` timestamp(6) NULL DEFAULT NULL, + `updated_at` timestamp(6) NULL DEFAULT NULL, + `deleted_at` timestamp(6) NULL DEFAULT NULL, + PRIMARY KEY (`id`), + KEY `task_statuses_company_id_deleted_at_index` (`company_id`,`deleted_at`), + KEY `task_statuses_user_id_foreign` (`user_id`), + CONSTRAINT `task_statuses_company_id_foreign` FOREIGN KEY (`company_id`) REFERENCES `companies` (`id`) ON DELETE CASCADE ON UPDATE CASCADE, + CONSTRAINT `task_statuses_user_id_foreign` FOREIGN KEY (`user_id`) REFERENCES `users` (`id`) ON DELETE CASCADE ON UPDATE CASCADE +) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci ROW_FORMAT=COMPRESSED KEY_BLOCK_SIZE=8; +/*!40101 SET character_set_client = @saved_cs_client */; +/*!40101 SET @saved_cs_client = @@character_set_client */; +/*!40101 SET character_set_client = utf8 */; +CREATE TABLE `tasks` ( + `id` int(10) unsigned NOT NULL AUTO_INCREMENT, + `user_id` int(10) unsigned NOT NULL, + `assigned_user_id` int(10) unsigned NOT NULL, + `company_id` int(10) unsigned NOT NULL, + `client_id` int(10) unsigned DEFAULT NULL, + `invoice_id` int(10) unsigned DEFAULT NULL, + `project_id` int(10) unsigned DEFAULT NULL, + `status_id` int(10) unsigned DEFAULT NULL, + `sort_order` smallint(6) DEFAULT NULL, + `created_at` timestamp(6) NULL DEFAULT NULL, + `updated_at` timestamp(6) NULL DEFAULT NULL, + `deleted_at` timestamp NULL DEFAULT NULL, + `custom_value1` text COLLATE utf8mb4_unicode_ci, + `custom_value2` text COLLATE utf8mb4_unicode_ci, + `custom_value3` text COLLATE utf8mb4_unicode_ci, + `custom_value4` text COLLATE utf8mb4_unicode_ci, + `start_time` timestamp NULL DEFAULT NULL, + `duration` int(11) DEFAULT NULL, + `description` text COLLATE utf8mb4_unicode_ci, + `is_deleted` tinyint(1) NOT NULL DEFAULT '0', + `is_running` tinyint(1) NOT NULL DEFAULT '0', + `time_log` text COLLATE utf8mb4_unicode_ci, + `number` varchar(191) COLLATE utf8mb4_unicode_ci DEFAULT NULL, + `rate` decimal(16,4) NOT NULL DEFAULT '0.0000', + PRIMARY KEY (`id`), + KEY `tasks_company_id_deleted_at_index` (`company_id`,`deleted_at`), + KEY `tasks_user_id_foreign` (`user_id`), + KEY `tasks_invoice_id_foreign` (`invoice_id`), + KEY `tasks_client_id_foreign` (`client_id`), + KEY `tasks_company_id_index` (`company_id`), + CONSTRAINT `tasks_client_id_foreign` FOREIGN KEY (`client_id`) REFERENCES `clients` (`id`) ON DELETE CASCADE ON UPDATE CASCADE, + CONSTRAINT `tasks_company_id_foreign` FOREIGN KEY (`company_id`) REFERENCES `companies` (`id`) ON DELETE CASCADE ON UPDATE CASCADE, + CONSTRAINT `tasks_invoice_id_foreign` FOREIGN KEY (`invoice_id`) REFERENCES `invoices` (`id`) ON DELETE CASCADE ON UPDATE CASCADE, + CONSTRAINT `tasks_user_id_foreign` FOREIGN KEY (`user_id`) REFERENCES `users` (`id`) ON DELETE CASCADE ON UPDATE CASCADE +) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci ROW_FORMAT=COMPRESSED KEY_BLOCK_SIZE=8; +/*!40101 SET character_set_client = @saved_cs_client */; +/*!40101 SET @saved_cs_client = @@character_set_client */; +/*!40101 SET character_set_client = utf8 */; +CREATE TABLE `tax_rates` ( + `id` int(10) unsigned NOT NULL AUTO_INCREMENT, + `company_id` int(10) unsigned NOT NULL, + `user_id` int(10) unsigned DEFAULT NULL, + `created_at` timestamp(6) NULL DEFAULT NULL, + `updated_at` timestamp(6) NULL DEFAULT NULL, + `deleted_at` timestamp(6) NULL DEFAULT NULL, + `name` varchar(100) COLLATE utf8mb4_unicode_ci NOT NULL, + `rate` decimal(13,3) NOT NULL DEFAULT '0.000', + `is_deleted` tinyint(1) NOT NULL DEFAULT '0', + PRIMARY KEY (`id`), + KEY `tax_rates_company_id_deleted_at_index` (`company_id`,`deleted_at`), + KEY `tax_rates_user_id_foreign` (`user_id`), + KEY `tax_rates_company_id_index` (`company_id`), + CONSTRAINT `tax_rates_company_id_foreign` FOREIGN KEY (`company_id`) REFERENCES `companies` (`id`) ON DELETE CASCADE ON UPDATE CASCADE, + CONSTRAINT `tax_rates_user_id_foreign` FOREIGN KEY (`user_id`) REFERENCES `users` (`id`) ON DELETE CASCADE ON UPDATE CASCADE +) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci ROW_FORMAT=COMPRESSED KEY_BLOCK_SIZE=8; +/*!40101 SET character_set_client = @saved_cs_client */; +/*!40101 SET @saved_cs_client = @@character_set_client */; +/*!40101 SET character_set_client = utf8 */; +CREATE TABLE `timezones` ( + `id` int(10) unsigned NOT NULL AUTO_INCREMENT, + `name` varchar(191) COLLATE utf8mb4_unicode_ci NOT NULL, + `location` varchar(191) COLLATE utf8mb4_unicode_ci NOT NULL, + `utc_offset` int(11) NOT NULL DEFAULT '0', + PRIMARY KEY (`id`) +) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci ROW_FORMAT=COMPRESSED KEY_BLOCK_SIZE=8; +/*!40101 SET character_set_client = @saved_cs_client */; +/*!40101 SET @saved_cs_client = @@character_set_client */; +/*!40101 SET character_set_client = utf8 */; +CREATE TABLE `users` ( + `id` int(10) unsigned NOT NULL AUTO_INCREMENT, + `account_id` int(10) unsigned NOT NULL, + `first_name` varchar(191) COLLATE utf8mb4_unicode_ci DEFAULT NULL, + `last_name` varchar(191) COLLATE utf8mb4_unicode_ci DEFAULT NULL, + `phone` varchar(191) COLLATE utf8mb4_unicode_ci DEFAULT NULL, + `ip` varchar(191) COLLATE utf8mb4_unicode_ci DEFAULT NULL, + `device_token` varchar(191) COLLATE utf8mb4_unicode_ci DEFAULT NULL, + `email` varchar(100) COLLATE utf8mb4_unicode_ci NOT NULL, + `email_verified_at` timestamp NULL DEFAULT NULL, + `confirmation_code` varchar(191) COLLATE utf8mb4_unicode_ci DEFAULT NULL, + `theme_id` int(11) DEFAULT NULL, + `failed_logins` smallint(6) DEFAULT NULL, + `referral_code` varchar(191) COLLATE utf8mb4_unicode_ci DEFAULT NULL, + `oauth_user_id` varchar(100) COLLATE utf8mb4_unicode_ci DEFAULT NULL, + `oauth_user_token` text COLLATE utf8mb4_unicode_ci, + `oauth_provider_id` varchar(191) COLLATE utf8mb4_unicode_ci DEFAULT NULL, + `google_2fa_secret` varchar(191) COLLATE utf8mb4_unicode_ci DEFAULT NULL, + `accepted_terms_version` varchar(191) COLLATE utf8mb4_unicode_ci DEFAULT NULL, + `avatar` varchar(100) COLLATE utf8mb4_unicode_ci DEFAULT NULL, + `avatar_width` int(10) unsigned DEFAULT NULL, + `avatar_height` int(10) unsigned DEFAULT NULL, + `avatar_size` int(10) unsigned DEFAULT NULL, + `is_deleted` tinyint(1) NOT NULL DEFAULT '0', + `last_login` datetime DEFAULT NULL, + `signature` mediumtext COLLATE utf8mb4_unicode_ci, + `password` varchar(191) COLLATE utf8mb4_unicode_ci NOT NULL, + `remember_token` varchar(100) COLLATE utf8mb4_unicode_ci DEFAULT NULL, + `custom_value1` varchar(191) COLLATE utf8mb4_unicode_ci DEFAULT NULL, + `custom_value2` varchar(191) COLLATE utf8mb4_unicode_ci DEFAULT NULL, + `custom_value3` varchar(191) COLLATE utf8mb4_unicode_ci DEFAULT NULL, + `custom_value4` varchar(191) COLLATE utf8mb4_unicode_ci DEFAULT NULL, + `created_at` timestamp(6) NULL DEFAULT NULL, + `updated_at` timestamp(6) NULL DEFAULT NULL, + `deleted_at` timestamp(6) NULL DEFAULT NULL, + `oauth_user_refresh_token` varchar(191) COLLATE utf8mb4_unicode_ci DEFAULT NULL, + PRIMARY KEY (`id`), + UNIQUE KEY `users_email_unique` (`email`), + UNIQUE KEY `users_oauth_user_id_oauth_provider_id_unique` (`oauth_user_id`,`oauth_provider_id`), + KEY `users_account_id_index` (`account_id`), + CONSTRAINT `users_account_id_foreign` FOREIGN KEY (`account_id`) REFERENCES `accounts` (`id`) ON DELETE CASCADE ON UPDATE CASCADE +) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci ROW_FORMAT=COMPRESSED KEY_BLOCK_SIZE=8; +/*!40101 SET character_set_client = @saved_cs_client */; +/*!40101 SET @saved_cs_client = @@character_set_client */; +/*!40101 SET character_set_client = utf8 */; +CREATE TABLE `vendor_contacts` ( + `id` int(10) unsigned NOT NULL AUTO_INCREMENT, + `company_id` int(10) unsigned NOT NULL, + `user_id` int(10) unsigned NOT NULL, + `vendor_id` int(10) unsigned NOT NULL, + `created_at` timestamp(6) NULL DEFAULT NULL, + `updated_at` timestamp(6) NULL DEFAULT NULL, + `deleted_at` timestamp NULL DEFAULT NULL, + `is_primary` tinyint(1) NOT NULL DEFAULT '0', + `first_name` varchar(191) COLLATE utf8mb4_unicode_ci DEFAULT NULL, + `last_name` varchar(191) COLLATE utf8mb4_unicode_ci DEFAULT NULL, + `email` varchar(191) COLLATE utf8mb4_unicode_ci DEFAULT NULL, + `phone` varchar(191) COLLATE utf8mb4_unicode_ci DEFAULT NULL, + `custom_value1` varchar(191) COLLATE utf8mb4_unicode_ci DEFAULT NULL, + `custom_value2` varchar(191) COLLATE utf8mb4_unicode_ci DEFAULT NULL, + `custom_value3` varchar(191) COLLATE utf8mb4_unicode_ci DEFAULT NULL, + `custom_value4` varchar(191) COLLATE utf8mb4_unicode_ci DEFAULT NULL, + `send_email` tinyint(1) NOT NULL DEFAULT '0', + `email_verified_at` timestamp NULL DEFAULT NULL, + `confirmation_code` varchar(191) COLLATE utf8mb4_unicode_ci DEFAULT NULL, + `confirmed` tinyint(1) NOT NULL DEFAULT '0', + `last_login` timestamp NULL DEFAULT NULL, + `failed_logins` smallint(6) DEFAULT NULL, + `oauth_user_id` varchar(100) COLLATE utf8mb4_unicode_ci DEFAULT NULL, + `oauth_provider_id` int(10) unsigned DEFAULT NULL, + `google_2fa_secret` varchar(191) COLLATE utf8mb4_unicode_ci DEFAULT NULL, + `accepted_terms_version` varchar(191) COLLATE utf8mb4_unicode_ci DEFAULT NULL, + `avatar` varchar(255) COLLATE utf8mb4_unicode_ci DEFAULT NULL, + `avatar_type` varchar(255) COLLATE utf8mb4_unicode_ci DEFAULT NULL, + `avatar_size` varchar(255) COLLATE utf8mb4_unicode_ci DEFAULT NULL, + `password` varchar(191) COLLATE utf8mb4_unicode_ci NOT NULL, + `token` varchar(191) COLLATE utf8mb4_unicode_ci DEFAULT NULL, + `is_locked` tinyint(1) NOT NULL DEFAULT '0', + `contact_key` varchar(191) COLLATE utf8mb4_unicode_ci DEFAULT NULL, + `remember_token` varchar(100) COLLATE utf8mb4_unicode_ci DEFAULT NULL, + PRIMARY KEY (`id`), + UNIQUE KEY `vendor_contacts_oauth_user_id_unique` (`oauth_user_id`), + UNIQUE KEY `vendor_contacts_oauth_provider_id_unique` (`oauth_provider_id`), + KEY `vendor_contacts_company_id_deleted_at_index` (`company_id`,`deleted_at`), + KEY `vendor_contacts_user_id_foreign` (`user_id`), + KEY `vendor_contacts_vendor_id_index` (`vendor_id`), + KEY `vendor_contacts_company_id_email_deleted_at_index` (`company_id`,`email`,`deleted_at`), + CONSTRAINT `vendor_contacts_company_id_foreign` FOREIGN KEY (`company_id`) REFERENCES `companies` (`id`) ON DELETE CASCADE ON UPDATE CASCADE, + CONSTRAINT `vendor_contacts_user_id_foreign` FOREIGN KEY (`user_id`) REFERENCES `users` (`id`) ON DELETE CASCADE ON UPDATE CASCADE, + CONSTRAINT `vendor_contacts_vendor_id_foreign` FOREIGN KEY (`vendor_id`) REFERENCES `vendors` (`id`) ON DELETE CASCADE ON UPDATE CASCADE +) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci ROW_FORMAT=COMPRESSED KEY_BLOCK_SIZE=8; +/*!40101 SET character_set_client = @saved_cs_client */; +/*!40101 SET @saved_cs_client = @@character_set_client */; +/*!40101 SET character_set_client = utf8 */; +CREATE TABLE `vendors` ( + `id` int(10) unsigned NOT NULL AUTO_INCREMENT, + `created_at` timestamp(6) NULL DEFAULT NULL, + `updated_at` timestamp(6) NULL DEFAULT NULL, + `deleted_at` timestamp NULL DEFAULT NULL, + `user_id` int(10) unsigned NOT NULL, + `assigned_user_id` int(10) unsigned DEFAULT NULL, + `company_id` int(10) unsigned NOT NULL, + `currency_id` int(10) unsigned DEFAULT NULL, + `name` varchar(191) COLLATE utf8mb4_unicode_ci DEFAULT NULL, + `address1` varchar(191) COLLATE utf8mb4_unicode_ci DEFAULT NULL, + `address2` varchar(191) COLLATE utf8mb4_unicode_ci DEFAULT NULL, + `city` varchar(191) COLLATE utf8mb4_unicode_ci DEFAULT NULL, + `state` varchar(191) COLLATE utf8mb4_unicode_ci DEFAULT NULL, + `postal_code` varchar(191) COLLATE utf8mb4_unicode_ci DEFAULT NULL, + `country_id` int(10) unsigned DEFAULT NULL, + `work_phone` varchar(191) COLLATE utf8mb4_unicode_ci DEFAULT NULL, + `private_notes` text COLLATE utf8mb4_unicode_ci, + `website` varchar(191) COLLATE utf8mb4_unicode_ci DEFAULT NULL, + `is_deleted` tinyint(4) NOT NULL DEFAULT '0', + `vat_number` varchar(191) COLLATE utf8mb4_unicode_ci DEFAULT NULL, + `transaction_name` varchar(191) COLLATE utf8mb4_unicode_ci DEFAULT NULL, + `id_number` varchar(191) COLLATE utf8mb4_unicode_ci DEFAULT NULL, + `custom_value1` varchar(191) COLLATE utf8mb4_unicode_ci DEFAULT NULL, + `custom_value2` varchar(191) COLLATE utf8mb4_unicode_ci DEFAULT NULL, + `custom_value3` varchar(191) COLLATE utf8mb4_unicode_ci DEFAULT NULL, + `custom_value4` varchar(191) COLLATE utf8mb4_unicode_ci DEFAULT NULL, + `vendor_hash` text COLLATE utf8mb4_unicode_ci, + `public_notes` text COLLATE utf8mb4_unicode_ci, + PRIMARY KEY (`id`), + KEY `vendors_company_id_deleted_at_index` (`company_id`,`deleted_at`), + KEY `vendors_user_id_foreign` (`user_id`), + KEY `vendors_country_id_foreign` (`country_id`), + KEY `vendors_currency_id_foreign` (`currency_id`), + CONSTRAINT `vendors_company_id_foreign` FOREIGN KEY (`company_id`) REFERENCES `companies` (`id`) ON DELETE CASCADE ON UPDATE CASCADE, + CONSTRAINT `vendors_country_id_foreign` FOREIGN KEY (`country_id`) REFERENCES `countries` (`id`), + CONSTRAINT `vendors_currency_id_foreign` FOREIGN KEY (`currency_id`) REFERENCES `currencies` (`id`), + CONSTRAINT `vendors_user_id_foreign` FOREIGN KEY (`user_id`) REFERENCES `users` (`id`) ON DELETE CASCADE ON UPDATE CASCADE +) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci ROW_FORMAT=COMPRESSED KEY_BLOCK_SIZE=8; +/*!40101 SET character_set_client = @saved_cs_client */; +/*!40101 SET @saved_cs_client = @@character_set_client */; +/*!40101 SET character_set_client = utf8 */; +CREATE TABLE `webhooks` ( + `id` int(10) unsigned NOT NULL AUTO_INCREMENT, + `company_id` int(10) unsigned DEFAULT NULL, + `user_id` int(10) unsigned DEFAULT NULL, + `event_id` int(10) unsigned DEFAULT NULL, + `is_deleted` tinyint(1) NOT NULL DEFAULT '0', + `target_url` varchar(191) COLLATE utf8mb4_unicode_ci NOT NULL, + `format` enum('JSON','UBL') COLLATE utf8mb4_unicode_ci NOT NULL DEFAULT 'JSON', + `created_at` timestamp(6) NULL DEFAULT NULL, + `updated_at` timestamp(6) NULL DEFAULT NULL, + `deleted_at` timestamp(6) NULL DEFAULT NULL, + PRIMARY KEY (`id`), + KEY `subscriptions_company_id_foreign` (`company_id`), + KEY `subscriptions_event_id_company_id_index` (`event_id`,`company_id`), + CONSTRAINT `subscriptions_company_id_foreign` FOREIGN KEY (`company_id`) REFERENCES `companies` (`id`) ON DELETE CASCADE +) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci ROW_FORMAT=COMPRESSED KEY_BLOCK_SIZE=8; +/*!40101 SET character_set_client = @saved_cs_client */; +/*!40103 SET TIME_ZONE=@OLD_TIME_ZONE */; + +/*!40101 SET SQL_MODE=@OLD_SQL_MODE */; +/*!40014 SET FOREIGN_KEY_CHECKS=@OLD_FOREIGN_KEY_CHECKS */; +/*!40014 SET UNIQUE_CHECKS=@OLD_UNIQUE_CHECKS */; +/*!40111 SET SQL_NOTES=@OLD_SQL_NOTES */; + +INSERT INTO `migrations` VALUES (1,'2014_10_12_100000_create_password_resets_table',1); +INSERT INTO `migrations` VALUES (2,'2014_10_13_000000_create_users_table',1); +INSERT INTO `migrations` VALUES (3,'2019_11_10_115926_create_failed_jobs_table',1); +INSERT INTO `migrations` VALUES (4,'2020_03_05_123315_create_jobs_table',1); +INSERT INTO `migrations` VALUES (5,'2020_04_08_234530_add_is_deleted_column_to_company_tokens_table',1); +INSERT INTO `migrations` VALUES (6,'2020_05_13_035355_add_google_refresh_token_to_users_table',1); +INSERT INTO `migrations` VALUES (7,'2020_07_05_084934_company_too_large_attribute',1); +INSERT INTO `migrations` VALUES (8,'2020_07_08_065301_add_token_id_to_activity_table',1); +INSERT INTO `migrations` VALUES (9,'2020_07_21_112424_update_enabled_modules_value',1); +INSERT INTO `migrations` VALUES (10,'2020_07_28_104218_shop_token',1); +INSERT INTO `migrations` VALUES (11,'2020_08_04_080851_add_is_deleted_to_group_settings',1); +INSERT INTO `migrations` VALUES (12,'2020_08_11_221627_add_is_deleted_flag_to_client_gateway_token_table',1); +INSERT INTO `migrations` VALUES (13,'2020_08_13_095946_remove_photo_design',1); +INSERT INTO `migrations` VALUES (14,'2020_08_13_212702_add_reminder_sent_fields_to_entity_tables',1); +INSERT INTO `migrations` VALUES (15,'2020_08_18_140557_add_is_public_to_documents_table',1); +INSERT INTO `migrations` VALUES (16,'2020_09_22_205113_id_number_fields_for_missing_entities',1); +INSERT INTO `migrations` VALUES (17,'2020_09_27_215800_update_gateway_table_visible_column',1); +INSERT INTO `migrations` VALUES (18,'2020_10_11_211122_vendor_schema_update',1); +INSERT INTO `migrations` VALUES (19,'2020_10_12_204517_project_number_column',1); +INSERT INTO `migrations` VALUES (20,'2020_10_14_201320_project_ids_to_entities',1); +INSERT INTO `migrations` VALUES (21,'2020_10_19_101823_project_name_unique_removal',1); +INSERT INTO `migrations` VALUES (22,'2020_10_21_222738_expenses_nullable_assigned_user',1); diff --git a/routes/api.php b/routes/api.php index 440ecfdd3001..1834a754da2a 100644 --- a/routes/api.php +++ b/routes/api.php @@ -18,7 +18,6 @@ Route::group(['middleware' => ['api_secret_check']], function () { Route::group(['api_secret_check', 'email_db'], function () { Route::post('api/v1/login', 'Auth\LoginController@apiLogin')->name('login.submit'); - // Route::post('api/v1/reset_password', 'Auth\ForgotPasswordController@sendResetLinkEmail')->name('password.reset'); Route::post('api/v1/reset_password', 'Auth\ForgotPasswordController@sendResetLinkEmail'); }); diff --git a/tests/Feature/ActivityApiTest.php b/tests/Feature/ActivityApiTest.php new file mode 100644 index 000000000000..70357b0d5110 --- /dev/null +++ b/tests/Feature/ActivityApiTest.php @@ -0,0 +1,46 @@ +makeTestData(); + + } + + public function testActivityGet() + { + $response = $this->withHeaders([ + 'X-API-SECRET' => config('ninja.api_secret'), + 'X-API-TOKEN' => $this->token, + ])->get('/api/v1/activities/'); + + $response->assertStatus(200); + } + +} diff --git a/tests/Feature/ClientTest.php b/tests/Feature/ClientTest.php index d7496d1d9fcf..5a2f51c530c3 100644 --- a/tests/Feature/ClientTest.php +++ b/tests/Feature/ClientTest.php @@ -516,7 +516,7 @@ class ClientTest extends TestCase $response->assertStatus(200); $arr = $response->json(); - +info($arr); $this->client = Client::find($this->decodePrimaryKey($arr['data']['id'])); $this->client->fresh(); diff --git a/tests/Feature/PingTest.php b/tests/Feature/PingTest.php new file mode 100644 index 000000000000..ae808d5d7d01 --- /dev/null +++ b/tests/Feature/PingTest.php @@ -0,0 +1,56 @@ +makeTestData(); + + } + + public function testPingEndPoint() + { + + $response = $this->withHeaders([ + 'X-API-SECRET' => config('ninja.api_secret'), + 'X-API-TOKEN' => $this->token, + ])->get('/api/v1/ping'); + + $response->assertStatus(200); + + } + + public function testHealthCheck() + { + + $response = $this->withHeaders([ + 'X-API-SECRET' => config('ninja.api_secret'), + 'X-API-TOKEN' => $this->token, + ])->get('/api/v1/health_check'); + + $response->assertStatus(200); + + } +} diff --git a/tests/Integration/CompanyLedgerTest.php b/tests/Integration/CompanyLedgerTest.php index 0f438b5c8c57..d7216518ffd5 100644 --- a/tests/Integration/CompanyLedgerTest.php +++ b/tests/Integration/CompanyLedgerTest.php @@ -36,6 +36,7 @@ use Illuminate\Support\Facades\Hash; use Illuminate\Support\Facades\Schema; use Tests\MockAccountData; use Tests\TestCase; +use Illuminate\Validation\ValidationException; /** @test*/ class CompanyLedgerTest extends TestCase @@ -57,6 +58,9 @@ class CompanyLedgerTest extends TestCase { parent::setUp(); + $this->withoutExceptionHandling(); + + /* Warm up the cache !*/ $cached_tables = config('ninja.cached_tables'); @@ -222,10 +226,15 @@ class CompanyLedgerTest extends TestCase 'date' => '2020/12/11', ]; + try { $response = $this->withHeaders([ 'X-API-SECRET' => config('ninja.api_secret'), 'X-API-TOKEN' => $this->token, ])->post('/api/v1/payments/', $data); + + } catch (ValidationException $e) { + info(print_r($e->validator->getMessageBag(), 1)); + } $acc = $response->json();