Elastic migrations
This commit is contained in:
parent
8b0c5a1ca4
commit
8231d967dd
|
|
@ -0,0 +1,89 @@
|
||||||
|
<?php
|
||||||
|
declare(strict_types=1);
|
||||||
|
|
||||||
|
use Elastic\Adapter\Indices\Mapping;
|
||||||
|
use Elastic\Adapter\Indices\Settings;
|
||||||
|
use Elastic\Migrations\Facades\Index;
|
||||||
|
use Elastic\Migrations\MigrationInterface;
|
||||||
|
|
||||||
|
final class CreateInvoicesIndex implements MigrationInterface
|
||||||
|
{
|
||||||
|
/**
|
||||||
|
* Run the migration.
|
||||||
|
*/
|
||||||
|
public function up(): void
|
||||||
|
{
|
||||||
|
$mapping = [
|
||||||
|
'properties' => [
|
||||||
|
// Core invoice fields
|
||||||
|
'id' => ['type' => 'keyword'],
|
||||||
|
'name' => [
|
||||||
|
'type' => 'text',
|
||||||
|
'analyzer' => 'standard'
|
||||||
|
],
|
||||||
|
'hashed_id' => ['type' => 'keyword'],
|
||||||
|
'number' => ['type' => 'keyword'],
|
||||||
|
'is_deleted' => ['type' => 'boolean'],
|
||||||
|
'amount' => ['type' => 'float'],
|
||||||
|
'balance' => ['type' => 'float'],
|
||||||
|
'due_date' => ['type' => 'date'],
|
||||||
|
'date' => ['type' => 'date'],
|
||||||
|
|
||||||
|
// Custom fields
|
||||||
|
'custom_value1' => ['type' => 'keyword'],
|
||||||
|
'custom_value2' => ['type' => 'keyword'],
|
||||||
|
'custom_value3' => ['type' => 'keyword'],
|
||||||
|
'custom_value4' => ['type' => 'keyword'],
|
||||||
|
|
||||||
|
// Additional fields
|
||||||
|
'company_key' => ['type' => 'keyword'],
|
||||||
|
'po_number' => ['type' => 'keyword'],
|
||||||
|
|
||||||
|
// Line items
|
||||||
|
'line_items' => [
|
||||||
|
'type' => 'nested',
|
||||||
|
'properties' => [
|
||||||
|
'quantity' => ['type' => 'float'],
|
||||||
|
'net_cost' => ['type' => 'float'],
|
||||||
|
'cost' => ['type' => 'float'],
|
||||||
|
'product_key' => ['type' => 'text', 'analyzer' => 'standard'],
|
||||||
|
'product_cost' => ['type' => 'float'],
|
||||||
|
'notes' => ['type' => 'text', 'analyzer' => 'standard'],
|
||||||
|
'discount' => ['type' => 'float'],
|
||||||
|
'is_amount_discount' => ['type' => 'boolean'],
|
||||||
|
'tax_name1' => ['type' => 'keyword'],
|
||||||
|
'tax_rate1' => ['type' => 'float'],
|
||||||
|
'tax_name2' => ['type' => 'keyword'],
|
||||||
|
'tax_rate2' => ['type' => 'float'],
|
||||||
|
'tax_name3' => ['type' => 'keyword'],
|
||||||
|
'tax_rate3' => ['type' => 'float'],
|
||||||
|
'sort_id' => ['type' => 'keyword'],
|
||||||
|
'line_total' => ['type' => 'float'],
|
||||||
|
'gross_line_total' => ['type' => 'float'],
|
||||||
|
'tax_amount' => ['type' => 'float'],
|
||||||
|
'date' => ['type' => 'keyword'],
|
||||||
|
'custom_value1' => ['type' => 'keyword'],
|
||||||
|
'custom_value2' => ['type' => 'keyword'],
|
||||||
|
'custom_value3' => ['type' => 'keyword'],
|
||||||
|
'custom_value4' => ['type' => 'keyword'],
|
||||||
|
'type_id' => ['type' => 'keyword'],
|
||||||
|
'tax_id' => ['type' => 'keyword'],
|
||||||
|
'task_id' => ['type' => 'keyword'],
|
||||||
|
'expense_id' => ['type' => 'keyword'],
|
||||||
|
'unit_code' => ['type' => 'keyword'],
|
||||||
|
]
|
||||||
|
],
|
||||||
|
]
|
||||||
|
];
|
||||||
|
|
||||||
|
Index::createRaw('invoices_v2', $mapping);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Reverse the migration.
|
||||||
|
*/
|
||||||
|
public function down(): void
|
||||||
|
{
|
||||||
|
Index::dropIfExists('invoices_v2');
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
@ -0,0 +1,89 @@
|
||||||
|
<?php
|
||||||
|
declare(strict_types=1);
|
||||||
|
|
||||||
|
use Elastic\Adapter\Indices\Mapping;
|
||||||
|
use Elastic\Adapter\Indices\Settings;
|
||||||
|
use Elastic\Migrations\Facades\Index;
|
||||||
|
use Elastic\Migrations\MigrationInterface;
|
||||||
|
|
||||||
|
final class CreateQuotesIndex implements MigrationInterface
|
||||||
|
{
|
||||||
|
/**
|
||||||
|
* Run the migration.
|
||||||
|
*/
|
||||||
|
public function up(): void
|
||||||
|
{
|
||||||
|
$mapping = [
|
||||||
|
'properties' => [
|
||||||
|
// Core quote fields
|
||||||
|
'id' => ['type' => 'keyword'],
|
||||||
|
'name' => [
|
||||||
|
'type' => 'text',
|
||||||
|
'analyzer' => 'standard'
|
||||||
|
],
|
||||||
|
'hashed_id' => ['type' => 'keyword'],
|
||||||
|
'number' => ['type' => 'keyword'],
|
||||||
|
'is_deleted' => ['type' => 'boolean'],
|
||||||
|
'amount' => ['type' => 'float'],
|
||||||
|
'balance' => ['type' => 'float'],
|
||||||
|
'due_date' => ['type' => 'date'],
|
||||||
|
'date' => ['type' => 'date'],
|
||||||
|
|
||||||
|
// Custom fields
|
||||||
|
'custom_value1' => ['type' => 'keyword'],
|
||||||
|
'custom_value2' => ['type' => 'keyword'],
|
||||||
|
'custom_value3' => ['type' => 'keyword'],
|
||||||
|
'custom_value4' => ['type' => 'keyword'],
|
||||||
|
|
||||||
|
// Additional fields
|
||||||
|
'company_key' => ['type' => 'keyword'],
|
||||||
|
'po_number' => ['type' => 'keyword'],
|
||||||
|
|
||||||
|
// Line items
|
||||||
|
'line_items' => [
|
||||||
|
'type' => 'nested',
|
||||||
|
'properties' => [
|
||||||
|
'quantity' => ['type' => 'float'],
|
||||||
|
'net_cost' => ['type' => 'float'],
|
||||||
|
'cost' => ['type' => 'float'],
|
||||||
|
'product_key' => ['type' => 'text', 'analyzer' => 'standard'],
|
||||||
|
'product_cost' => ['type' => 'float'],
|
||||||
|
'notes' => ['type' => 'text', 'analyzer' => 'standard'],
|
||||||
|
'discount' => ['type' => 'float'],
|
||||||
|
'is_amount_discount' => ['type' => 'boolean'],
|
||||||
|
'tax_name1' => ['type' => 'keyword'],
|
||||||
|
'tax_rate1' => ['type' => 'float'],
|
||||||
|
'tax_name2' => ['type' => 'keyword'],
|
||||||
|
'tax_rate2' => ['type' => 'float'],
|
||||||
|
'tax_name3' => ['type' => 'keyword'],
|
||||||
|
'tax_rate3' => ['type' => 'float'],
|
||||||
|
'sort_id' => ['type' => 'keyword'],
|
||||||
|
'line_total' => ['type' => 'float'],
|
||||||
|
'gross_line_total' => ['type' => 'float'],
|
||||||
|
'tax_amount' => ['type' => 'float'],
|
||||||
|
'date' => ['type' => 'keyword'],
|
||||||
|
'custom_value1' => ['type' => 'keyword'],
|
||||||
|
'custom_value2' => ['type' => 'keyword'],
|
||||||
|
'custom_value3' => ['type' => 'keyword'],
|
||||||
|
'custom_value4' => ['type' => 'keyword'],
|
||||||
|
'type_id' => ['type' => 'keyword'],
|
||||||
|
'tax_id' => ['type' => 'keyword'],
|
||||||
|
'task_id' => ['type' => 'keyword'],
|
||||||
|
'expense_id' => ['type' => 'keyword'],
|
||||||
|
'unit_code' => ['type' => 'keyword'],
|
||||||
|
]
|
||||||
|
],
|
||||||
|
]
|
||||||
|
];
|
||||||
|
|
||||||
|
Index::createRaw('quotes_v2', $mapping);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Reverse the migration.
|
||||||
|
*/
|
||||||
|
public function down(): void
|
||||||
|
{
|
||||||
|
Index::dropIfExists('quotes_v2');
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
@ -0,0 +1,89 @@
|
||||||
|
<?php
|
||||||
|
declare(strict_types=1);
|
||||||
|
|
||||||
|
use Elastic\Adapter\Indices\Mapping;
|
||||||
|
use Elastic\Adapter\Indices\Settings;
|
||||||
|
use Elastic\Migrations\Facades\Index;
|
||||||
|
use Elastic\Migrations\MigrationInterface;
|
||||||
|
|
||||||
|
final class CreateCreditsIndex implements MigrationInterface
|
||||||
|
{
|
||||||
|
/**
|
||||||
|
* Run the migration.
|
||||||
|
*/
|
||||||
|
public function up(): void
|
||||||
|
{
|
||||||
|
$mapping = [
|
||||||
|
'properties' => [
|
||||||
|
// Core credit fields
|
||||||
|
'id' => ['type' => 'keyword'],
|
||||||
|
'name' => [
|
||||||
|
'type' => 'text',
|
||||||
|
'analyzer' => 'standard'
|
||||||
|
],
|
||||||
|
'hashed_id' => ['type' => 'keyword'],
|
||||||
|
'number' => ['type' => 'keyword'],
|
||||||
|
'is_deleted' => ['type' => 'boolean'],
|
||||||
|
'amount' => ['type' => 'float'],
|
||||||
|
'balance' => ['type' => 'float'],
|
||||||
|
'due_date' => ['type' => 'date'],
|
||||||
|
'date' => ['type' => 'date'],
|
||||||
|
|
||||||
|
// Custom fields
|
||||||
|
'custom_value1' => ['type' => 'keyword'],
|
||||||
|
'custom_value2' => ['type' => 'keyword'],
|
||||||
|
'custom_value3' => ['type' => 'keyword'],
|
||||||
|
'custom_value4' => ['type' => 'keyword'],
|
||||||
|
|
||||||
|
// Additional fields
|
||||||
|
'company_key' => ['type' => 'keyword'],
|
||||||
|
'po_number' => ['type' => 'keyword'],
|
||||||
|
|
||||||
|
// Line items
|
||||||
|
'line_items' => [
|
||||||
|
'type' => 'nested',
|
||||||
|
'properties' => [
|
||||||
|
'quantity' => ['type' => 'float'],
|
||||||
|
'net_cost' => ['type' => 'float'],
|
||||||
|
'cost' => ['type' => 'float'],
|
||||||
|
'product_key' => ['type' => 'text', 'analyzer' => 'standard'],
|
||||||
|
'product_cost' => ['type' => 'float'],
|
||||||
|
'notes' => ['type' => 'text', 'analyzer' => 'standard'],
|
||||||
|
'discount' => ['type' => 'float'],
|
||||||
|
'is_amount_discount' => ['type' => 'boolean'],
|
||||||
|
'tax_name1' => ['type' => 'keyword'],
|
||||||
|
'tax_rate1' => ['type' => 'float'],
|
||||||
|
'tax_name2' => ['type' => 'keyword'],
|
||||||
|
'tax_rate2' => ['type' => 'float'],
|
||||||
|
'tax_name3' => ['type' => 'keyword'],
|
||||||
|
'tax_rate3' => ['type' => 'float'],
|
||||||
|
'sort_id' => ['type' => 'keyword'],
|
||||||
|
'line_total' => ['type' => 'float'],
|
||||||
|
'gross_line_total' => ['type' => 'float'],
|
||||||
|
'tax_amount' => ['type' => 'float'],
|
||||||
|
'date' => ['type' => 'keyword'],
|
||||||
|
'custom_value1' => ['type' => 'keyword'],
|
||||||
|
'custom_value2' => ['type' => 'keyword'],
|
||||||
|
'custom_value3' => ['type' => 'keyword'],
|
||||||
|
'custom_value4' => ['type' => 'keyword'],
|
||||||
|
'type_id' => ['type' => 'keyword'],
|
||||||
|
'tax_id' => ['type' => 'keyword'],
|
||||||
|
'task_id' => ['type' => 'keyword'],
|
||||||
|
'expense_id' => ['type' => 'keyword'],
|
||||||
|
'unit_code' => ['type' => 'keyword'],
|
||||||
|
]
|
||||||
|
],
|
||||||
|
]
|
||||||
|
];
|
||||||
|
|
||||||
|
Index::createRaw('credits_v2', $mapping);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Reverse the migration.
|
||||||
|
*/
|
||||||
|
public function down(): void
|
||||||
|
{
|
||||||
|
Index::dropIfExists('credits_v2');
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
@ -0,0 +1,89 @@
|
||||||
|
<?php
|
||||||
|
declare(strict_types=1);
|
||||||
|
|
||||||
|
use Elastic\Adapter\Indices\Mapping;
|
||||||
|
use Elastic\Adapter\Indices\Settings;
|
||||||
|
use Elastic\Migrations\Facades\Index;
|
||||||
|
use Elastic\Migrations\MigrationInterface;
|
||||||
|
|
||||||
|
final class CreateRecurringInvoicesIndex implements MigrationInterface
|
||||||
|
{
|
||||||
|
/**
|
||||||
|
* Run the migration.
|
||||||
|
*/
|
||||||
|
public function up(): void
|
||||||
|
{
|
||||||
|
$mapping = [
|
||||||
|
'properties' => [
|
||||||
|
// Core recurring invoice fields
|
||||||
|
'id' => ['type' => 'keyword'],
|
||||||
|
'name' => [
|
||||||
|
'type' => 'text',
|
||||||
|
'analyzer' => 'standard'
|
||||||
|
],
|
||||||
|
'hashed_id' => ['type' => 'keyword'],
|
||||||
|
'number' => ['type' => 'keyword'],
|
||||||
|
'is_deleted' => ['type' => 'boolean'],
|
||||||
|
'amount' => ['type' => 'float'],
|
||||||
|
'balance' => ['type' => 'float'],
|
||||||
|
'due_date' => ['type' => 'date'],
|
||||||
|
'date' => ['type' => 'date'],
|
||||||
|
|
||||||
|
// Custom fields
|
||||||
|
'custom_value1' => ['type' => 'keyword'],
|
||||||
|
'custom_value2' => ['type' => 'keyword'],
|
||||||
|
'custom_value3' => ['type' => 'keyword'],
|
||||||
|
'custom_value4' => ['type' => 'keyword'],
|
||||||
|
|
||||||
|
// Additional fields
|
||||||
|
'company_key' => ['type' => 'keyword'],
|
||||||
|
'po_number' => ['type' => 'keyword'],
|
||||||
|
|
||||||
|
// Line items
|
||||||
|
'line_items' => [
|
||||||
|
'type' => 'nested',
|
||||||
|
'properties' => [
|
||||||
|
'quantity' => ['type' => 'float'],
|
||||||
|
'net_cost' => ['type' => 'float'],
|
||||||
|
'cost' => ['type' => 'float'],
|
||||||
|
'product_key' => ['type' => 'text', 'analyzer' => 'standard'],
|
||||||
|
'product_cost' => ['type' => 'float'],
|
||||||
|
'notes' => ['type' => 'text', 'analyzer' => 'standard'],
|
||||||
|
'discount' => ['type' => 'float'],
|
||||||
|
'is_amount_discount' => ['type' => 'boolean'],
|
||||||
|
'tax_name1' => ['type' => 'keyword'],
|
||||||
|
'tax_rate1' => ['type' => 'float'],
|
||||||
|
'tax_name2' => ['type' => 'keyword'],
|
||||||
|
'tax_rate2' => ['type' => 'float'],
|
||||||
|
'tax_name3' => ['type' => 'keyword'],
|
||||||
|
'tax_rate3' => ['type' => 'float'],
|
||||||
|
'sort_id' => ['type' => 'keyword'],
|
||||||
|
'line_total' => ['type' => 'float'],
|
||||||
|
'gross_line_total' => ['type' => 'float'],
|
||||||
|
'tax_amount' => ['type' => 'float'],
|
||||||
|
'date' => ['type' => 'keyword'],
|
||||||
|
'custom_value1' => ['type' => 'keyword'],
|
||||||
|
'custom_value2' => ['type' => 'keyword'],
|
||||||
|
'custom_value3' => ['type' => 'keyword'],
|
||||||
|
'custom_value4' => ['type' => 'keyword'],
|
||||||
|
'type_id' => ['type' => 'keyword'],
|
||||||
|
'tax_id' => ['type' => 'keyword'],
|
||||||
|
'task_id' => ['type' => 'keyword'],
|
||||||
|
'expense_id' => ['type' => 'keyword'],
|
||||||
|
'unit_code' => ['type' => 'keyword'],
|
||||||
|
]
|
||||||
|
],
|
||||||
|
]
|
||||||
|
];
|
||||||
|
|
||||||
|
Index::createRaw('recurring_invoices_v2', $mapping);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Reverse the migration.
|
||||||
|
*/
|
||||||
|
public function down(): void
|
||||||
|
{
|
||||||
|
Index::dropIfExists('recurring_invoices_v2');
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
@ -0,0 +1,89 @@
|
||||||
|
<?php
|
||||||
|
declare(strict_types=1);
|
||||||
|
|
||||||
|
use Elastic\Adapter\Indices\Mapping;
|
||||||
|
use Elastic\Adapter\Indices\Settings;
|
||||||
|
use Elastic\Migrations\Facades\Index;
|
||||||
|
use Elastic\Migrations\MigrationInterface;
|
||||||
|
|
||||||
|
final class CreatePurchaseOrdersIndex implements MigrationInterface
|
||||||
|
{
|
||||||
|
/**
|
||||||
|
* Run the migration.
|
||||||
|
*/
|
||||||
|
public function up(): void
|
||||||
|
{
|
||||||
|
$mapping = [
|
||||||
|
'properties' => [
|
||||||
|
// Core purchase order fields
|
||||||
|
'id' => ['type' => 'keyword'],
|
||||||
|
'name' => [
|
||||||
|
'type' => 'text',
|
||||||
|
'analyzer' => 'standard'
|
||||||
|
],
|
||||||
|
'hashed_id' => ['type' => 'keyword'],
|
||||||
|
'number' => ['type' => 'keyword'],
|
||||||
|
'is_deleted' => ['type' => 'boolean'],
|
||||||
|
'amount' => ['type' => 'float'],
|
||||||
|
'balance' => ['type' => 'float'],
|
||||||
|
'due_date' => ['type' => 'date'],
|
||||||
|
'date' => ['type' => 'date'],
|
||||||
|
|
||||||
|
// Custom fields
|
||||||
|
'custom_value1' => ['type' => 'keyword'],
|
||||||
|
'custom_value2' => ['type' => 'keyword'],
|
||||||
|
'custom_value3' => ['type' => 'keyword'],
|
||||||
|
'custom_value4' => ['type' => 'keyword'],
|
||||||
|
|
||||||
|
// Additional fields
|
||||||
|
'company_key' => ['type' => 'keyword'],
|
||||||
|
'po_number' => ['type' => 'keyword'],
|
||||||
|
|
||||||
|
// Line items
|
||||||
|
'line_items' => [
|
||||||
|
'type' => 'nested',
|
||||||
|
'properties' => [
|
||||||
|
'quantity' => ['type' => 'float'],
|
||||||
|
'net_cost' => ['type' => 'float'],
|
||||||
|
'cost' => ['type' => 'float'],
|
||||||
|
'product_key' => ['type' => 'text', 'analyzer' => 'standard'],
|
||||||
|
'product_cost' => ['type' => 'float'],
|
||||||
|
'notes' => ['type' => 'text', 'analyzer' => 'standard'],
|
||||||
|
'discount' => ['type' => 'float'],
|
||||||
|
'is_amount_discount' => ['type' => 'boolean'],
|
||||||
|
'tax_name1' => ['type' => 'keyword'],
|
||||||
|
'tax_rate1' => ['type' => 'float'],
|
||||||
|
'tax_name2' => ['type' => 'keyword'],
|
||||||
|
'tax_rate2' => ['type' => 'float'],
|
||||||
|
'tax_name3' => ['type' => 'keyword'],
|
||||||
|
'tax_rate3' => ['type' => 'float'],
|
||||||
|
'sort_id' => ['type' => 'keyword'],
|
||||||
|
'line_total' => ['type' => 'float'],
|
||||||
|
'gross_line_total' => ['type' => 'float'],
|
||||||
|
'tax_amount' => ['type' => 'float'],
|
||||||
|
'date' => ['type' => 'keyword'],
|
||||||
|
'custom_value1' => ['type' => 'keyword'],
|
||||||
|
'custom_value2' => ['type' => 'keyword'],
|
||||||
|
'custom_value3' => ['type' => 'keyword'],
|
||||||
|
'custom_value4' => ['type' => 'keyword'],
|
||||||
|
'type_id' => ['type' => 'keyword'],
|
||||||
|
'tax_id' => ['type' => 'keyword'],
|
||||||
|
'task_id' => ['type' => 'keyword'],
|
||||||
|
'expense_id' => ['type' => 'keyword'],
|
||||||
|
'unit_code' => ['type' => 'keyword'],
|
||||||
|
]
|
||||||
|
],
|
||||||
|
]
|
||||||
|
];
|
||||||
|
|
||||||
|
Index::createRaw('purchase_orders_v2', $mapping);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Reverse the migration.
|
||||||
|
*/
|
||||||
|
public function down(): void
|
||||||
|
{
|
||||||
|
Index::dropIfExists('purchase_orders_v2');
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
@ -0,0 +1,72 @@
|
||||||
|
<?php
|
||||||
|
declare(strict_types=1);
|
||||||
|
|
||||||
|
use Elastic\Adapter\Indices\Mapping;
|
||||||
|
use Elastic\Adapter\Indices\Settings;
|
||||||
|
use Elastic\Migrations\Facades\Index;
|
||||||
|
use Elastic\Migrations\MigrationInterface;
|
||||||
|
|
||||||
|
final class CreateVendorsIndex implements MigrationInterface
|
||||||
|
{
|
||||||
|
/**
|
||||||
|
* Run the migration.
|
||||||
|
*/
|
||||||
|
public function up(): void
|
||||||
|
{
|
||||||
|
$mapping = [
|
||||||
|
'properties' => [
|
||||||
|
// Core vendor fields
|
||||||
|
'id' => ['type' => 'keyword'],
|
||||||
|
'name' => [
|
||||||
|
'type' => 'text',
|
||||||
|
'analyzer' => 'standard'
|
||||||
|
],
|
||||||
|
'is_deleted' => ['type' => 'boolean'],
|
||||||
|
'hashed_id' => ['type' => 'keyword'],
|
||||||
|
'number' => ['type' => 'keyword'],
|
||||||
|
'id_number' => ['type' => 'keyword'],
|
||||||
|
'vat_number' => ['type' => 'keyword'],
|
||||||
|
|
||||||
|
// Contact information
|
||||||
|
'phone' => ['type' => 'keyword'],
|
||||||
|
|
||||||
|
// Address fields
|
||||||
|
'address1' => ['type' => 'keyword'],
|
||||||
|
'address2' => ['type' => 'keyword'],
|
||||||
|
'city' => ['type' => 'keyword'],
|
||||||
|
'state' => ['type' => 'keyword'],
|
||||||
|
'postal_code' => ['type' => 'keyword'],
|
||||||
|
|
||||||
|
// Additional fields
|
||||||
|
'website' => ['type' => 'keyword'],
|
||||||
|
'private_notes' => [
|
||||||
|
'type' => 'text',
|
||||||
|
'analyzer' => 'standard'
|
||||||
|
],
|
||||||
|
'public_notes' => [
|
||||||
|
'type' => 'text',
|
||||||
|
'analyzer' => 'standard'
|
||||||
|
],
|
||||||
|
|
||||||
|
// Custom fields
|
||||||
|
'custom_value1' => ['type' => 'keyword'],
|
||||||
|
'custom_value2' => ['type' => 'keyword'],
|
||||||
|
'custom_value3' => ['type' => 'keyword'],
|
||||||
|
'custom_value4' => ['type' => 'keyword'],
|
||||||
|
|
||||||
|
// Company
|
||||||
|
'company_key' => ['type' => 'keyword'],
|
||||||
|
]
|
||||||
|
];
|
||||||
|
|
||||||
|
Index::createRaw('vendors_v2', $mapping);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Reverse the migration.
|
||||||
|
*/
|
||||||
|
public function down(): void
|
||||||
|
{
|
||||||
|
Index::dropIfExists('vendors_v2');
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
@ -0,0 +1,71 @@
|
||||||
|
<?php
|
||||||
|
declare(strict_types=1);
|
||||||
|
|
||||||
|
use Elastic\Adapter\Indices\Mapping;
|
||||||
|
use Elastic\Adapter\Indices\Settings;
|
||||||
|
use Elastic\Migrations\Facades\Index;
|
||||||
|
use Elastic\Migrations\MigrationInterface;
|
||||||
|
|
||||||
|
final class CreateExpensesIndex implements MigrationInterface
|
||||||
|
{
|
||||||
|
/**
|
||||||
|
* Run the migration.
|
||||||
|
*/
|
||||||
|
public function up(): void
|
||||||
|
{
|
||||||
|
$mapping = [
|
||||||
|
'properties' => [
|
||||||
|
// Core expense fields
|
||||||
|
'id' => ['type' => 'keyword'],
|
||||||
|
'name' => [
|
||||||
|
'type' => 'text',
|
||||||
|
'analyzer' => 'standard'
|
||||||
|
],
|
||||||
|
'is_deleted' => ['type' => 'boolean'],
|
||||||
|
'hashed_id' => ['type' => 'keyword'],
|
||||||
|
'number' => ['type' => 'keyword'],
|
||||||
|
'amount' => ['type' => 'float'],
|
||||||
|
'tax_amount' => ['type' => 'float'],
|
||||||
|
'tax_name1' => ['type' => 'keyword'],
|
||||||
|
'tax_rate1' => ['type' => 'float'],
|
||||||
|
'tax_name2' => ['type' => 'keyword'],
|
||||||
|
'tax_rate2' => ['type' => 'float'],
|
||||||
|
'tax_name3' => ['type' => 'keyword'],
|
||||||
|
'tax_rate3' => ['type' => 'float'],
|
||||||
|
'date' => ['type' => 'date'],
|
||||||
|
'payment_date' => ['type' => 'date'],
|
||||||
|
|
||||||
|
// Custom fields
|
||||||
|
'custom_value1' => ['type' => 'keyword'],
|
||||||
|
'custom_value2' => ['type' => 'keyword'],
|
||||||
|
'custom_value3' => ['type' => 'keyword'],
|
||||||
|
'custom_value4' => ['type' => 'keyword'],
|
||||||
|
|
||||||
|
// Additional fields
|
||||||
|
'company_key' => ['type' => 'keyword'],
|
||||||
|
'category_id' => ['type' => 'keyword'],
|
||||||
|
'vendor_id' => ['type' => 'keyword'],
|
||||||
|
'client_id' => ['type' => 'keyword'],
|
||||||
|
'project_id' => ['type' => 'keyword'],
|
||||||
|
'private_notes' => [
|
||||||
|
'type' => 'text',
|
||||||
|
'analyzer' => 'standard'
|
||||||
|
],
|
||||||
|
'public_notes' => [
|
||||||
|
'type' => 'text',
|
||||||
|
'analyzer' => 'standard'
|
||||||
|
],
|
||||||
|
]
|
||||||
|
];
|
||||||
|
|
||||||
|
Index::createRaw('expenses_v2', $mapping);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Reverse the migration.
|
||||||
|
*/
|
||||||
|
public function down(): void
|
||||||
|
{
|
||||||
|
Index::dropIfExists('expenses_v2');
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
@ -0,0 +1,67 @@
|
||||||
|
<?php
|
||||||
|
declare(strict_types=1);
|
||||||
|
|
||||||
|
use Elastic\Adapter\Indices\Mapping;
|
||||||
|
use Elastic\Adapter\Indices\Settings;
|
||||||
|
use Elastic\Migrations\Facades\Index;
|
||||||
|
use Elastic\Migrations\MigrationInterface;
|
||||||
|
|
||||||
|
final class CreateProjectsIndex implements MigrationInterface
|
||||||
|
{
|
||||||
|
/**
|
||||||
|
* Run the migration.
|
||||||
|
*/
|
||||||
|
public function up(): void
|
||||||
|
{
|
||||||
|
$mapping = [
|
||||||
|
'properties' => [
|
||||||
|
// Core project fields
|
||||||
|
'id' => ['type' => 'keyword'],
|
||||||
|
'name' => [
|
||||||
|
'type' => 'text',
|
||||||
|
'analyzer' => 'standard'
|
||||||
|
],
|
||||||
|
'is_deleted' => ['type' => 'boolean'],
|
||||||
|
'hashed_id' => ['type' => 'keyword'],
|
||||||
|
'number' => ['type' => 'keyword'],
|
||||||
|
'description' => [
|
||||||
|
'type' => 'text',
|
||||||
|
'analyzer' => 'standard'
|
||||||
|
],
|
||||||
|
'budgeted_hours' => ['type' => 'float'],
|
||||||
|
'task_rate' => ['type' => 'float'],
|
||||||
|
'due_date' => ['type' => 'date'],
|
||||||
|
'start_date' => ['type' => 'date'],
|
||||||
|
|
||||||
|
// Custom fields
|
||||||
|
'custom_value1' => ['type' => 'keyword'],
|
||||||
|
'custom_value2' => ['type' => 'keyword'],
|
||||||
|
'custom_value3' => ['type' => 'keyword'],
|
||||||
|
'custom_value4' => ['type' => 'keyword'],
|
||||||
|
|
||||||
|
// Additional fields
|
||||||
|
'company_key' => ['type' => 'keyword'],
|
||||||
|
'client_id' => ['type' => 'keyword'],
|
||||||
|
'assigned_user_id' => ['type' => 'keyword'],
|
||||||
|
'private_notes' => [
|
||||||
|
'type' => 'text',
|
||||||
|
'analyzer' => 'standard'
|
||||||
|
],
|
||||||
|
'public_notes' => [
|
||||||
|
'type' => 'text',
|
||||||
|
'analyzer' => 'standard'
|
||||||
|
],
|
||||||
|
]
|
||||||
|
];
|
||||||
|
|
||||||
|
Index::createRaw('projects_v2', $mapping);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Reverse the migration.
|
||||||
|
*/
|
||||||
|
public function down(): void
|
||||||
|
{
|
||||||
|
Index::dropIfExists('projects_v2');
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
@ -0,0 +1,71 @@
|
||||||
|
<?php
|
||||||
|
declare(strict_types=1);
|
||||||
|
|
||||||
|
use Elastic\Adapter\Indices\Mapping;
|
||||||
|
use Elastic\Adapter\Indices\Settings;
|
||||||
|
use Elastic\Migrations\Facades\Index;
|
||||||
|
use Elastic\Migrations\MigrationInterface;
|
||||||
|
|
||||||
|
final class CreateTasksIndex implements MigrationInterface
|
||||||
|
{
|
||||||
|
/**
|
||||||
|
* Run the migration.
|
||||||
|
*/
|
||||||
|
public function up(): void
|
||||||
|
{
|
||||||
|
$mapping = [
|
||||||
|
'properties' => [
|
||||||
|
// Core task fields
|
||||||
|
'id' => ['type' => 'keyword'],
|
||||||
|
'name' => [
|
||||||
|
'type' => 'text',
|
||||||
|
'analyzer' => 'standard'
|
||||||
|
],
|
||||||
|
'is_deleted' => ['type' => 'boolean'],
|
||||||
|
'hashed_id' => ['type' => 'keyword'],
|
||||||
|
'number' => ['type' => 'keyword'],
|
||||||
|
'description' => [
|
||||||
|
'type' => 'text',
|
||||||
|
'analyzer' => 'standard'
|
||||||
|
],
|
||||||
|
'rate' => ['type' => 'float'],
|
||||||
|
'hours' => ['type' => 'float'],
|
||||||
|
'due_date' => ['type' => 'date'],
|
||||||
|
'start_date' => ['type' => 'date'],
|
||||||
|
|
||||||
|
// Custom fields
|
||||||
|
'custom_value1' => ['type' => 'keyword'],
|
||||||
|
'custom_value2' => ['type' => 'keyword'],
|
||||||
|
'custom_value3' => ['type' => 'keyword'],
|
||||||
|
'custom_value4' => ['type' => 'keyword'],
|
||||||
|
|
||||||
|
// Additional fields
|
||||||
|
'company_key' => ['type' => 'keyword'],
|
||||||
|
'client_id' => ['type' => 'keyword'],
|
||||||
|
'project_id' => ['type' => 'keyword'],
|
||||||
|
'assigned_user_id' => ['type' => 'keyword'],
|
||||||
|
'status_id' => ['type' => 'keyword'],
|
||||||
|
'private_notes' => [
|
||||||
|
'type' => 'text',
|
||||||
|
'analyzer' => 'standard'
|
||||||
|
],
|
||||||
|
'public_notes' => [
|
||||||
|
'type' => 'text',
|
||||||
|
'analyzer' => 'standard'
|
||||||
|
],
|
||||||
|
]
|
||||||
|
];
|
||||||
|
|
||||||
|
Index::createRaw('tasks_v2', $mapping);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Reverse the migration.
|
||||||
|
*/
|
||||||
|
public function down(): void
|
||||||
|
{
|
||||||
|
Index::dropIfExists('tasks_v2');
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
@ -0,0 +1,56 @@
|
||||||
|
<?php
|
||||||
|
declare(strict_types=1);
|
||||||
|
|
||||||
|
use Elastic\Adapter\Indices\Mapping;
|
||||||
|
use Elastic\Adapter\Indices\Settings;
|
||||||
|
use Elastic\Migrations\Facades\Index;
|
||||||
|
use Elastic\Migrations\MigrationInterface;
|
||||||
|
|
||||||
|
final class CreateClientContactsIndex implements MigrationInterface
|
||||||
|
{
|
||||||
|
/**
|
||||||
|
* Run the migration.
|
||||||
|
*/
|
||||||
|
public function up(): void
|
||||||
|
{
|
||||||
|
$mapping = [
|
||||||
|
'properties' => [
|
||||||
|
// Core client contact fields
|
||||||
|
'id' => ['type' => 'keyword'],
|
||||||
|
'name' => [
|
||||||
|
'type' => 'text',
|
||||||
|
'analyzer' => 'standard'
|
||||||
|
],
|
||||||
|
'is_deleted' => ['type' => 'boolean'],
|
||||||
|
'hashed_id' => ['type' => 'keyword'],
|
||||||
|
'first_name' => ['type' => 'keyword'],
|
||||||
|
'last_name' => ['type' => 'keyword'],
|
||||||
|
'email' => ['type' => 'keyword'],
|
||||||
|
'phone' => ['type' => 'keyword'],
|
||||||
|
'is_primary' => ['type' => 'boolean'],
|
||||||
|
|
||||||
|
// Custom fields
|
||||||
|
'custom_value1' => ['type' => 'keyword'],
|
||||||
|
'custom_value2' => ['type' => 'keyword'],
|
||||||
|
'custom_value3' => ['type' => 'keyword'],
|
||||||
|
'custom_value4' => ['type' => 'keyword'],
|
||||||
|
|
||||||
|
// Additional fields
|
||||||
|
'company_key' => ['type' => 'keyword'],
|
||||||
|
'client_id' => ['type' => 'keyword'],
|
||||||
|
'send_email' => ['type' => 'boolean'],
|
||||||
|
'last_login' => ['type' => 'date'],
|
||||||
|
]
|
||||||
|
];
|
||||||
|
|
||||||
|
Index::createRaw('client_contacts_v2', $mapping);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Reverse the migration.
|
||||||
|
*/
|
||||||
|
public function down(): void
|
||||||
|
{
|
||||||
|
Index::dropIfExists('client_contacts_v2');
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
@ -0,0 +1,56 @@
|
||||||
|
<?php
|
||||||
|
declare(strict_types=1);
|
||||||
|
|
||||||
|
use Elastic\Adapter\Indices\Mapping;
|
||||||
|
use Elastic\Adapter\Indices\Settings;
|
||||||
|
use Elastic\Migrations\Facades\Index;
|
||||||
|
use Elastic\Migrations\MigrationInterface;
|
||||||
|
|
||||||
|
final class CreateVendorContactsIndex implements MigrationInterface
|
||||||
|
{
|
||||||
|
/**
|
||||||
|
* Run the migration.
|
||||||
|
*/
|
||||||
|
public function up(): void
|
||||||
|
{
|
||||||
|
$mapping = [
|
||||||
|
'properties' => [
|
||||||
|
// Core vendor contact fields
|
||||||
|
'id' => ['type' => 'keyword'],
|
||||||
|
'name' => [
|
||||||
|
'type' => 'text',
|
||||||
|
'analyzer' => 'standard'
|
||||||
|
],
|
||||||
|
'is_deleted' => ['type' => 'boolean'],
|
||||||
|
'hashed_id' => ['type' => 'keyword'],
|
||||||
|
'first_name' => ['type' => 'keyword'],
|
||||||
|
'last_name' => ['type' => 'keyword'],
|
||||||
|
'email' => ['type' => 'keyword'],
|
||||||
|
'phone' => ['type' => 'keyword'],
|
||||||
|
'is_primary' => ['type' => 'boolean'],
|
||||||
|
|
||||||
|
// Custom fields
|
||||||
|
'custom_value1' => ['type' => 'keyword'],
|
||||||
|
'custom_value2' => ['type' => 'keyword'],
|
||||||
|
'custom_value3' => ['type' => 'keyword'],
|
||||||
|
'custom_value4' => ['type' => 'keyword'],
|
||||||
|
|
||||||
|
// Additional fields
|
||||||
|
'company_key' => ['type' => 'keyword'],
|
||||||
|
'vendor_id' => ['type' => 'keyword'],
|
||||||
|
'send_email' => ['type' => 'boolean'],
|
||||||
|
'last_login' => ['type' => 'date'],
|
||||||
|
]
|
||||||
|
];
|
||||||
|
|
||||||
|
Index::createRaw('vendor_contacts_v2', $mapping);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Reverse the migration.
|
||||||
|
*/
|
||||||
|
public function down(): void
|
||||||
|
{
|
||||||
|
Index::dropIfExists('vendor_contacts_v2');
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
@ -0,0 +1,146 @@
|
||||||
|
<?php
|
||||||
|
declare(strict_types=1);
|
||||||
|
|
||||||
|
use Elastic\Adapter\Indices\Mapping;
|
||||||
|
use Elastic\Adapter\Indices\Settings;
|
||||||
|
use Elastic\Migrations\Facades\Index;
|
||||||
|
use Elastic\Migrations\MigrationInterface;
|
||||||
|
|
||||||
|
final class CreateClientsIndex implements MigrationInterface
|
||||||
|
{
|
||||||
|
/**
|
||||||
|
* Run the migration.
|
||||||
|
*/
|
||||||
|
public function up(): void
|
||||||
|
{
|
||||||
|
$mapping = [
|
||||||
|
'properties' => [
|
||||||
|
// Core client fields
|
||||||
|
'id' => ['type' => 'keyword'],
|
||||||
|
'name' => [
|
||||||
|
'type' => 'text',
|
||||||
|
'analyzer' => 'standard'
|
||||||
|
],
|
||||||
|
'hashed_id' => ['type' => 'keyword'],
|
||||||
|
'number' => ['type' => 'keyword'],
|
||||||
|
'is_deleted' => ['type' => 'boolean'],
|
||||||
|
'user_id' => ['type' => 'keyword'],
|
||||||
|
'assigned_user_id' => ['type' => 'keyword'],
|
||||||
|
'company_id' => ['type' => 'keyword'],
|
||||||
|
|
||||||
|
// Contact and business information
|
||||||
|
'website' => ['type' => 'keyword'],
|
||||||
|
'phone' => ['type' => 'keyword'],
|
||||||
|
'client_hash' => ['type' => 'keyword'],
|
||||||
|
'routing_id' => ['type' => 'keyword'],
|
||||||
|
'vat_number' => ['type' => 'keyword'],
|
||||||
|
'id_number' => ['type' => 'keyword'],
|
||||||
|
'classification' => ['type' => 'keyword'],
|
||||||
|
|
||||||
|
// Financial information
|
||||||
|
'balance' => ['type' => 'float'],
|
||||||
|
'paid_to_date' => ['type' => 'float'],
|
||||||
|
'credit_balance' => ['type' => 'float'],
|
||||||
|
'payment_balance' => ['type' => 'float'],
|
||||||
|
|
||||||
|
// Address information
|
||||||
|
'address1' => [
|
||||||
|
'type' => 'text',
|
||||||
|
'analyzer' => 'standard'
|
||||||
|
],
|
||||||
|
'address2' => [
|
||||||
|
'type' => 'text',
|
||||||
|
'analyzer' => 'standard'
|
||||||
|
],
|
||||||
|
'city' => ['type' => 'keyword'],
|
||||||
|
'state' => ['type' => 'keyword'],
|
||||||
|
'postal_code' => ['type' => 'keyword'],
|
||||||
|
'country_id' => ['type' => 'keyword'],
|
||||||
|
|
||||||
|
// Shipping address
|
||||||
|
'shipping_address1' => [
|
||||||
|
'type' => 'text',
|
||||||
|
'analyzer' => 'standard'
|
||||||
|
],
|
||||||
|
'shipping_address2' => [
|
||||||
|
'type' => 'text',
|
||||||
|
'analyzer' => 'standard'
|
||||||
|
],
|
||||||
|
'shipping_city' => ['type' => 'keyword'],
|
||||||
|
'shipping_state' => ['type' => 'keyword'],
|
||||||
|
'shipping_postal_code' => ['type' => 'keyword'],
|
||||||
|
'shipping_country_id' => ['type' => 'keyword'],
|
||||||
|
|
||||||
|
// Classification and industry
|
||||||
|
'industry_id' => ['type' => 'keyword'],
|
||||||
|
'size_id' => ['type' => 'keyword'],
|
||||||
|
'group_settings_id' => ['type' => 'keyword'],
|
||||||
|
|
||||||
|
// Custom fields
|
||||||
|
'custom_value1' => [
|
||||||
|
'type' => 'text',
|
||||||
|
'analyzer' => 'standard'
|
||||||
|
],
|
||||||
|
'custom_value2' => [
|
||||||
|
'type' => 'text',
|
||||||
|
'analyzer' => 'standard'
|
||||||
|
],
|
||||||
|
'custom_value3' => [
|
||||||
|
'type' => 'text',
|
||||||
|
'analyzer' => 'standard'
|
||||||
|
],
|
||||||
|
'custom_value4' => [
|
||||||
|
'type' => 'text',
|
||||||
|
'analyzer' => 'standard'
|
||||||
|
],
|
||||||
|
|
||||||
|
// Notes and content
|
||||||
|
'private_notes' => [
|
||||||
|
'type' => 'text',
|
||||||
|
'analyzer' => 'standard'
|
||||||
|
],
|
||||||
|
'public_notes' => [
|
||||||
|
'type' => 'text',
|
||||||
|
'analyzer' => 'standard'
|
||||||
|
],
|
||||||
|
'display_name' => [
|
||||||
|
'type' => 'text',
|
||||||
|
'analyzer' => 'standard'
|
||||||
|
],
|
||||||
|
|
||||||
|
// Tax and invoice settings
|
||||||
|
'is_tax_exempt' => ['type' => 'boolean'],
|
||||||
|
'has_valid_vat_number' => ['type' => 'boolean'],
|
||||||
|
'tax_info' => ['type' => 'object'],
|
||||||
|
'e_invoice' => ['type' => 'object'],
|
||||||
|
|
||||||
|
// Settings and configuration
|
||||||
|
'settings' => ['type' => 'object'],
|
||||||
|
'sync' => ['type' => 'object'],
|
||||||
|
|
||||||
|
// Timestamps
|
||||||
|
'last_login' => ['type' => 'date'],
|
||||||
|
'created_at' => ['type' => 'date'],
|
||||||
|
'updated_at' => ['type' => 'date'],
|
||||||
|
'archived_at' => ['type' => 'date'],
|
||||||
|
|
||||||
|
// Company key for multi-tenancy
|
||||||
|
'company_key' => ['type' => 'keyword'],
|
||||||
|
]
|
||||||
|
];
|
||||||
|
|
||||||
|
Index::createRaw('clients_v2', $mapping);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Reverse the migration.
|
||||||
|
*/
|
||||||
|
public function down(): void
|
||||||
|
{
|
||||||
|
Index::dropIfExists('clients_v2');
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
Loading…
Reference in New Issue