Skip to content

Commit

Permalink
fix install scripts
Browse files Browse the repository at this point in the history
  • Loading branch information
inikoo committed Jun 28, 2024
1 parent 5d4816c commit 420efcb
Show file tree
Hide file tree
Showing 13 changed files with 24 additions and 17 deletions.
6 changes: 5 additions & 1 deletion app/Transfers/Aurora/FetchAuroraShop.php
Original file line number Diff line number Diff line change
Expand Up @@ -21,10 +21,14 @@ public function fetch(int $id): ?array
{
$this->auroraModelData = $this->fetchData($id);

if (!$this->auroraModelData) {
return null;
}

$code = strtoupper($this->auroraModelData->{'Store Code'});
$sourceId = $this->organisation->id.':'.$this->auroraModelData->{'Store Key'};
if (Shop::where('code', $code)->whereNot('source_id', $sourceId)->exists()) {
$code = $code.strtolower(Abbreviate::run(string: $this->organisation->slug, maximumLength: 2));
$code = $code.strtoupper(Abbreviate::run(string: $this->organisation->slug, maximumLength: 2));
}
$this->auroraModelData->code = $code;
$this->parseModel();
Expand Down
2 changes: 1 addition & 1 deletion aurora_accounting_migration.sh
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
#

PHP=php
DB_SUFFIX=
DB_SUFFIX=_base

PHP="${1:-$PHP}"
DB_SUFFIX="${2:-$DB_SUFFIX}"
Expand Down
4 changes: 3 additions & 1 deletion aurora_catalogue_migration.sh
Original file line number Diff line number Diff line change
Expand Up @@ -5,15 +5,17 @@
#

PHP=php
DB_SUFFIX=
DB_SUFFIX=_base

PHP="${1:-$PHP}"
DB_SUFFIX="${2:-$DB_SUFFIX}"

echo -e "🧼 Migrating catalogue models"

${PHP} artisan fetch:shops -d "${DB_SUFFIX}"
pg_dump -Fc -f "devops/devel/snapshots/cat-shops.dump" ${DB}
${PHP} artisan fetch:websites -d "${DB_SUFFIX}"
pg_dump -Fc -f "devops/devel/snapshots/cat-websites.dump" ${DB}
${PHP} artisan fetch:webpages -d "${DB_SUFFIX}"
${PHP} artisan fetch:departments -d "${DB_SUFFIX}"
${PHP} artisan fetch:families -d "${DB_SUFFIX}"
Expand Down
2 changes: 1 addition & 1 deletion aurora_crm_migration.sh
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
#

PHP=php
DB_SUFFIX=
DB_SUFFIX=_base

PHP="${1:-$PHP}"
DB_SUFFIX="${2:-$DB_SUFFIX}"
Expand Down
2 changes: 1 addition & 1 deletion aurora_ds_migration.sh
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
#

PHP=php
DB_SUFFIX=
DB_SUFFIX=_base

PHP="${1:-$PHP}"
DB_SUFFIX="${2:-$DB_SUFFIX}"
Expand Down
2 changes: 1 addition & 1 deletion aurora_fulfilment_migration.sh
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
#

PHP=php
DB_SUFFIX=
DB_SUFFIX=_base

PHP="${1:-$PHP}"
DB_SUFFIX="${2:-$DB_SUFFIX}"
Expand Down
2 changes: 1 addition & 1 deletion aurora_helpers_migration.sh
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
#

PHP=php
DB_SUFFIX=
DB_SUFFIX=_base

PHP="${1:-$PHP}"
DB_SUFFIX="${2:-$DB_SUFFIX}"
Expand Down
2 changes: 1 addition & 1 deletion aurora_hr_migration.sh
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@


PHP=php
DB_SUFFIX=
DB_SUFFIX=_base

PHP="${1:-$PHP}"
DB_SUFFIX="${2:-$DB_SUFFIX}"
Expand Down
2 changes: 1 addition & 1 deletion aurora_inventory_migration.sh
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
#

PHP=php
DB_SUFFIX=
DB_SUFFIX=_base

PHP="${1:-$PHP}"
DB_SUFFIX="${2:-$DB_SUFFIX}"
Expand Down
2 changes: 1 addition & 1 deletion aurora_procurement_migration.sh
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
#

PHP=php
DB_SUFFIX=
DB_SUFFIX=_base

PHP="${1:-$PHP}"
DB_SUFFIX="${2:-$DB_SUFFIX}"
Expand Down
2 changes: 1 addition & 1 deletion aurora_sales_migration.sh
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
#

PHP=php
DB_SUFFIX=
DB_SUFFIX=_base

PHP="${1:-$PHP}"
DB_SUFFIX="${2:-$DB_SUFFIX}"
Expand Down
2 changes: 1 addition & 1 deletion aurora_warehouse_migration.sh
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
#

PHP=php
DB_SUFFIX=
DB_SUFFIX=_base

PHP="${1:-$PHP}"
DB_SUFFIX="${2:-$DB_SUFFIX}"
Expand Down
11 changes: 6 additions & 5 deletions install.sh
Original file line number Diff line number Diff line change
Expand Up @@ -8,14 +8,15 @@
DB_PORT=5432
DB_COLLATE=C.UTF-8
PHP=php
DB_SUFFIX=_base

DB_PORT="${1:-$DB_PORT}"
DB_COLLATE="${2:-$DB_COLLATE}"
PHP="${3:-$PHP}"
DB_SUFFIX="${4:-$DB_SUFFIX}"

DB=aiku
BACKUP_DB=aiku_elasticserch_backup
DB_SUFFIX=_base

echo -e "🧼 Cleaning storage"
rm -rf storage/app/media
Expand Down Expand Up @@ -69,14 +70,14 @@ ${PHP} artisan org:attach-agent aroma indo

pg_dump -Fc -f "devops/devel/snapshots/installed.dump" ${DB}

./aurora_procurement_migration.sh
./aurora_procurement_migration.sh "${PHP}" "${DB_SUFFIX}"
pg_dump -Fc -f "devops/devel/snapshots/procurement.dump" ${DB}

./aurora_warehouse_migration.sh
./aurora_warehouse_migration.sh "${PHP}" "${DB_SUFFIX}"
pg_dump -Fc -f "devops/devel/snapshots/warehouses.dump" ${DB}

./aurora_inventory_migration.sh
./aurora_inventory_migration.sh "${PHP}" "${DB_SUFFIX}"
pg_dump -Fc -f "devops/devel/snapshots/inventory.dump" ${DB}

./aurora_catalogue_migration.sh
./aurora_catalogue_migration.sh "${PHP}" "${DB_SUFFIX}"
pg_dump -Fc -f "devops/devel/snapshots/catalogue.dump" ${DB}

0 comments on commit 420efcb

Please sign in to comment.