mirror of
https://github.com/nullthoughts/laravel-data-sync.git
synced 2026-02-10 20:51:48 +00:00
Compare commits
3 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
8a987b89c5 | ||
|
|
552bc8fba8 | ||
|
|
7b89add86e |
@@ -1,11 +1,11 @@
|
|||||||
{
|
{
|
||||||
"name": "distinctm/laravel-data-sync",
|
"name": "nullthoughts/laravel-data-sync",
|
||||||
"description": "Laravel utility to keep records synced between environments through source control",
|
"description": "Laravel utility to keep records synced between environments through source control",
|
||||||
"license": "MIT",
|
"license": "MIT",
|
||||||
"authors": [
|
"authors": [
|
||||||
{
|
{
|
||||||
"name": "distinctm",
|
"name": "nullthoughts",
|
||||||
"email": "jani@marketdistinctly.com"
|
"email": "jani@nullincorporated.com"
|
||||||
}
|
}
|
||||||
],
|
],
|
||||||
"require": {
|
"require": {
|
||||||
@@ -16,18 +16,18 @@
|
|||||||
},
|
},
|
||||||
"autoload": {
|
"autoload": {
|
||||||
"psr-4" : {
|
"psr-4" : {
|
||||||
"distinctm\\LaravelDataSync\\": "src/"
|
"nullthoughts\\LaravelDataSync\\": "src/"
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
"autoload-dev": {
|
"autoload-dev": {
|
||||||
"psr-4" : {
|
"psr-4" : {
|
||||||
"distinctm\\LaravelDataSync\\Tests\\": "tests/"
|
"nullthoughts\\LaravelDataSync\\Tests\\": "tests/"
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
"extra": {
|
"extra": {
|
||||||
"laravel": {
|
"laravel": {
|
||||||
"providers": [
|
"providers": [
|
||||||
"distinctm\\LaravelDataSync\\DataSyncBaseServiceProvider"
|
"nullthoughts\\LaravelDataSync\\DataSyncBaseServiceProvider"
|
||||||
]
|
]
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
10
readme.md
10
readme.md
@@ -1,6 +1,6 @@
|
|||||||
<p align="center">
|
<p align="center">
|
||||||
<a href="https://packagist.org/packages/distinctm/laravel-data-sync" target="_blank"><img src="https://poser.pugx.org/distinctm/laravel-data-sync/d/total.svg" alt="Total Downloads"></a>
|
<a href="https://packagist.org/packages/nullthoughts/laravel-data-sync" target="_blank"><img src="https://poser.pugx.org/nullthoughts/laravel-data-sync/d/total.svg" alt="Total Downloads"></a>
|
||||||
<a href="https://packagist.org/packages/distinctm/laravel-data-sync" target="_blank"><img src="https://poser.pugx.org/distinctm/laravel-data-sync/v/stable.svg" alt="Latest Stable Version"></a>
|
<a href="https://packagist.org/packages/nullthoughts/laravel-data-sync" target="_blank"><img src="https://poser.pugx.org/nullthoughts/laravel-data-sync/v/stable.svg" alt="Latest Stable Version"></a>
|
||||||
<a href="https://travis-ci.com/nullthoughts/laravel-data-sync"><img src="https://api.travis-ci.com/nullthoughts/laravel-data-sync.svg?branch=master" alt="Travis CI Build Status: Master"></a>
|
<a href="https://travis-ci.com/nullthoughts/laravel-data-sync"><img src="https://api.travis-ci.com/nullthoughts/laravel-data-sync.svg?branch=master" alt="Travis CI Build Status: Master"></a>
|
||||||
</p>
|
</p>
|
||||||
|
|
||||||
@@ -11,7 +11,7 @@ Laravel utility to keep records synchronized between environments through source
|
|||||||
## Installation
|
## Installation
|
||||||
You can install this package via composer:
|
You can install this package via composer:
|
||||||
```bash
|
```bash
|
||||||
composer require distinctm/laravel-data-sync
|
composer require nullthoughts/laravel-data-sync
|
||||||
```
|
```
|
||||||
|
|
||||||
Or add this line in your `composer.json`, inside of the `require` section:
|
Or add this line in your `composer.json`, inside of the `require` section:
|
||||||
@@ -19,14 +19,14 @@ Or add this line in your `composer.json`, inside of the `require` section:
|
|||||||
``` json
|
``` json
|
||||||
{
|
{
|
||||||
"require": {
|
"require": {
|
||||||
"distinctm/laravel-data-sync": "^1.0",
|
"nullthoughts/laravel-data-sync": "^1.0",
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
```
|
```
|
||||||
then run ` composer install `
|
then run ` composer install `
|
||||||
|
|
||||||
## Usage
|
## Usage
|
||||||
- Run `php artisan vendor:publish --provider="distinctm\LaravelDataSync\DataSyncBaseServiceProvider" --tag="data-sync-config"` to publish config file. Specify directory for sync data files (default is a new sync directory in the project root)
|
- Run `php artisan vendor:publish --provider="nullthoughts\LaravelDataSync\DataSyncBaseServiceProvider" --tag="data-sync-config"` to publish config file. Specify directory for sync data files (default is a new sync directory in the project root)
|
||||||
- Create a JSON file for each model, using the model name as the filename. Example: Product.json would update the Product model
|
- Create a JSON file for each model, using the model name as the filename. Example: Product.json would update the Product model
|
||||||
- Use nested arrays in place of hardcoded IDs for relationships
|
- Use nested arrays in place of hardcoded IDs for relationships
|
||||||
- Run `php artisan data:sync` (or `php artisan data:sync --model={model}` with the model flag to specify a model)
|
- Run `php artisan data:sync` (or `php artisan data:sync --model={model}` with the model flag to specify a model)
|
||||||
|
|||||||
@@ -1,8 +1,8 @@
|
|||||||
<?php
|
<?php
|
||||||
|
|
||||||
namespace distinctm\LaravelDataSync\Console\Commands;
|
namespace nullthoughts\LaravelDataSync\Console\Commands;
|
||||||
|
|
||||||
use distinctm\LaravelDataSync\Updater;
|
use nullthoughts\LaravelDataSync\Updater;
|
||||||
use Illuminate\Console\Command;
|
use Illuminate\Console\Command;
|
||||||
|
|
||||||
class Sync extends Command
|
class Sync extends Command
|
||||||
|
|||||||
@@ -1,6 +1,6 @@
|
|||||||
<?php
|
<?php
|
||||||
|
|
||||||
namespace distinctm\LaravelDataSync;
|
namespace nullthoughts\LaravelDataSync;
|
||||||
|
|
||||||
use Illuminate\Support\ServiceProvider;
|
use Illuminate\Support\ServiceProvider;
|
||||||
|
|
||||||
|
|||||||
@@ -1,6 +1,6 @@
|
|||||||
<?php
|
<?php
|
||||||
|
|
||||||
namespace distinctm\LaravelDataSync\Exceptions;
|
namespace nullthoughts\LaravelDataSync\Exceptions;
|
||||||
|
|
||||||
use Exception;
|
use Exception;
|
||||||
use Throwable;
|
use Throwable;
|
||||||
|
|||||||
@@ -1,6 +1,6 @@
|
|||||||
<?php
|
<?php
|
||||||
|
|
||||||
namespace distinctm\LaravelDataSync\Exceptions;
|
namespace nullthoughts\LaravelDataSync\Exceptions;
|
||||||
|
|
||||||
use Exception;
|
use Exception;
|
||||||
|
|
||||||
|
|||||||
@@ -1,6 +1,6 @@
|
|||||||
<?php
|
<?php
|
||||||
|
|
||||||
namespace distinctm\LaravelDataSync\Exceptions;
|
namespace nullthoughts\LaravelDataSync\Exceptions;
|
||||||
|
|
||||||
use Exception;
|
use Exception;
|
||||||
|
|
||||||
|
|||||||
@@ -1,6 +1,6 @@
|
|||||||
<?php
|
<?php
|
||||||
|
|
||||||
namespace distinctm\LaravelDataSync\Exceptions;
|
namespace nullthoughts\LaravelDataSync\Exceptions;
|
||||||
|
|
||||||
use Exception;
|
use Exception;
|
||||||
use Throwable;
|
use Throwable;
|
||||||
|
|||||||
@@ -1,11 +1,11 @@
|
|||||||
<?php
|
<?php
|
||||||
|
|
||||||
namespace distinctm\LaravelDataSync;
|
namespace nullthoughts\LaravelDataSync;
|
||||||
|
|
||||||
use distinctm\LaravelDataSync\Exceptions\ErrorUpdatingModelException;
|
use nullthoughts\LaravelDataSync\Exceptions\ErrorUpdatingModelException;
|
||||||
use distinctm\LaravelDataSync\Exceptions\FileDirectoryNotFoundException;
|
use nullthoughts\LaravelDataSync\Exceptions\FileDirectoryNotFoundException;
|
||||||
use distinctm\LaravelDataSync\Exceptions\NoCriteriaException;
|
use nullthoughts\LaravelDataSync\Exceptions\NoCriteriaException;
|
||||||
use distinctm\LaravelDataSync\Exceptions\NoRecordsInvalidJSONException;
|
use nullthoughts\LaravelDataSync\Exceptions\NoRecordsInvalidJSONException;
|
||||||
use Illuminate\Support\Collection;
|
use Illuminate\Support\Collection;
|
||||||
use Illuminate\Support\Facades\File;
|
use Illuminate\Support\Facades\File;
|
||||||
use Illuminate\Support\Str;
|
use Illuminate\Support\Str;
|
||||||
@@ -19,7 +19,7 @@ class Updater
|
|||||||
* @param string|null $path
|
* @param string|null $path
|
||||||
* @param string|null $model
|
* @param string|null $model
|
||||||
*
|
*
|
||||||
* @throws \distinctm\LaravelDataSync\Exceptions\FileDirectoryNotFoundException
|
* @throws \nullthoughts\LaravelDataSync\Exceptions\FileDirectoryNotFoundException
|
||||||
*/
|
*/
|
||||||
public function __construct($path = null, $model = null)
|
public function __construct($path = null, $model = null)
|
||||||
{
|
{
|
||||||
@@ -52,7 +52,7 @@ class Updater
|
|||||||
*
|
*
|
||||||
* @param string $file
|
* @param string $file
|
||||||
*
|
*
|
||||||
* @throws \distinctm\LaravelDataSync\Exceptions\NoRecordsInvalidJSONException
|
* @throws \nullthoughts\LaravelDataSync\Exceptions\NoRecordsInvalidJSONException
|
||||||
*
|
*
|
||||||
* @return \Illuminate\Support\Collection
|
* @return \Illuminate\Support\Collection
|
||||||
*/
|
*/
|
||||||
@@ -81,7 +81,7 @@ class Updater
|
|||||||
*
|
*
|
||||||
* @param $path
|
* @param $path
|
||||||
*
|
*
|
||||||
* @throws \distinctm\LaravelDataSync\Exceptions\FileDirectoryNotFoundException
|
* @throws \nullthoughts\LaravelDataSync\Exceptions\FileDirectoryNotFoundException
|
||||||
*
|
*
|
||||||
* @return string
|
* @return string
|
||||||
*/
|
*/
|
||||||
@@ -148,7 +148,7 @@ class Updater
|
|||||||
*
|
*
|
||||||
* @param stdClass $record
|
* @param stdClass $record
|
||||||
*
|
*
|
||||||
* @throws \distinctm\LaravelDataSync\Exceptions\NoCriteriaException
|
* @throws \nullthoughts\LaravelDataSync\Exceptions\NoCriteriaException
|
||||||
*
|
*
|
||||||
* @return \Illuminate\Support\Collection
|
* @return \Illuminate\Support\Collection
|
||||||
*/
|
*/
|
||||||
@@ -206,7 +206,7 @@ class Updater
|
|||||||
*
|
*
|
||||||
* @param string $file
|
* @param string $file
|
||||||
*
|
*
|
||||||
* @throws \distinctm\LaravelDataSync\Exceptions\NoRecordsInvalidJSONException
|
* @throws \nullthoughts\LaravelDataSync\Exceptions\NoRecordsInvalidJSONException
|
||||||
*
|
*
|
||||||
* @return \Illuminate\Support\Collection
|
* @return \Illuminate\Support\Collection
|
||||||
*/
|
*/
|
||||||
|
|||||||
@@ -1,6 +1,6 @@
|
|||||||
<?php
|
<?php
|
||||||
|
|
||||||
namespace distinctm\LaravelDataSync\Tests;
|
namespace nullthoughts\LaravelDataSync\Tests;
|
||||||
|
|
||||||
use Illuminate\Database\Eloquent\Model;
|
use Illuminate\Database\Eloquent\Model;
|
||||||
|
|
||||||
|
|||||||
@@ -1,6 +1,6 @@
|
|||||||
<?php
|
<?php
|
||||||
|
|
||||||
namespace distinctm\LaravelDataSync\Tests;
|
namespace nullthoughts\LaravelDataSync\Tests;
|
||||||
|
|
||||||
use Illuminate\Database\Eloquent\Model;
|
use Illuminate\Database\Eloquent\Model;
|
||||||
|
|
||||||
|
|||||||
@@ -1,6 +1,6 @@
|
|||||||
<?php
|
<?php
|
||||||
|
|
||||||
namespace distinctm\LaravelDataSync\Tests;
|
namespace nullthoughts\LaravelDataSync\Tests;
|
||||||
|
|
||||||
use Illuminate\Database\Schema\Blueprint;
|
use Illuminate\Database\Schema\Blueprint;
|
||||||
use Illuminate\Support\Facades\Schema;
|
use Illuminate\Support\Facades\Schema;
|
||||||
|
|||||||
@@ -1,9 +1,9 @@
|
|||||||
<?php
|
<?php
|
||||||
|
|
||||||
namespace distinctm\LaravelDataSync\Tests;
|
namespace nullthoughts\LaravelDataSync\Tests;
|
||||||
|
|
||||||
use distinctm\LaravelDataSync\Exceptions\ErrorUpdatingModelException;
|
use nullthoughts\LaravelDataSync\Exceptions\ErrorUpdatingModelException;
|
||||||
use distinctm\LaravelDataSync\Tests\fakes\UpdaterFake;
|
use nullthoughts\LaravelDataSync\Tests\fakes\UpdaterFake;
|
||||||
use Exception;
|
use Exception;
|
||||||
|
|
||||||
class UpdaterTest extends TestCase
|
class UpdaterTest extends TestCase
|
||||||
|
|||||||
@@ -1,15 +1,15 @@
|
|||||||
<?php
|
<?php
|
||||||
|
|
||||||
namespace distinctm\LaravelDataSync\Tests\Fakes;
|
namespace nullthoughts\LaravelDataSync\Tests\Fakes;
|
||||||
|
|
||||||
use distinctm\LaravelDataSync\Updater;
|
use nullthoughts\LaravelDataSync\Updater;
|
||||||
use Illuminate\Support\Str;
|
use Illuminate\Support\Str;
|
||||||
|
|
||||||
class UpdaterFake extends Updater
|
class UpdaterFake extends Updater
|
||||||
{
|
{
|
||||||
protected function getModel(string $name)
|
protected function getModel(string $name)
|
||||||
{
|
{
|
||||||
return '\\distinctm\\LaravelDataSync\\Tests\\'.Str::studly(
|
return '\\nullthoughts\\LaravelDataSync\\Tests\\'.Str::studly(
|
||||||
pathinfo($name, PATHINFO_FILENAME)
|
pathinfo($name, PATHINFO_FILENAME)
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user