Commit 3ec21bc6 authored by abkrim's avatar abkrim 😀
Browse files

Add stub for table db-schemas

parent 8c83ef00
Pipeline #197 passed with stages
in 1 minute and 16 seconds
......@@ -15,6 +15,16 @@ You can install the package via composer:
composer require --dev abkrim/db-schema
```
### Publish config
```bash
php artisan vendor:publish
```
Or use tag for install
```bash
php artisan vendor:publish --tag=config-db-schema
```
## Usage
**Show Schema information in tabular form**
......
<?php
/*
* You can place your custom package configuration in here.
/**
* table is name of table for save data of schemas for unique version
*/
return [
];
\ No newline at end of file
'table' => 'db_schema'
];
<?php
use Illuminate\Support\Facades\Schema;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Database\Migrations\Migration;
class CreateDbSchemasTable extends Migration
{
/**
* Run the migrations.
*
* @return void
*/
public function up()
{
Schema::create('db_schemas', function (Blueprint $table) {
$table->increments('id');
$table->string('version', 25)->unique();
$table->text('schema');
$table->timestamps();
});
}
/**
* Reverse the migrations.
*
* @return void
*/
public function down()
{
Schema::dropIfExists('db_schemas');
}
}
......@@ -18,14 +18,6 @@ class DbSchemaServiceProvider extends ServiceProvider
*/
public function boot()
{
/*
* Optional methods to load your package assets
*/
// $this->loadTranslationsFrom(__DIR__.'/../resources/lang', 'db-schema');
// $this->loadViewsFrom(__DIR__.'/../resources/views', 'db-schema');
// $this->loadMigrationsFrom(__DIR__.'/../database/migrations');
// $this->loadRoutesFrom(__DIR__.'/routes.php');
if ($this->app->runningInConsole()) {
$this->commands([
ShowSchema::class,
......@@ -34,24 +26,12 @@ class DbSchemaServiceProvider extends ServiceProvider
$this->publishes([
__DIR__.'/../config/config.php' => config_path('db-schema.php'),
], 'config');
// Publishing the views.
/*$this->publishes([
__DIR__.'/../resources/views' => resource_path('views/vendor/db-schema'),
], 'views');*/
], 'db-schema-config');
// Publishing assets.
/*$this->publishes([
__DIR__.'/../resources/assets' => public_path('vendor/db-schema'),
], 'assets');*/
// Publishing the translation files.
/*$this->publishes([
__DIR__.'/../resources/lang' => resource_path('lang/vendor/db-schema'),
], 'lang');*/
$this->publishes([
__DIR__.'/../database/migrations' => database_path('migrations'),
], 'db-schema-migrations');
// Registering package commands.
$this->commands([
HelpSchema::class,
ListSchema::class,
......
......@@ -27,7 +27,7 @@ class DbSchemaTest extends TestCase
protected function getEnvironmentSetUp($app)
{
include_once __DIR__ . '/../database/migrations/create_users_table.php.stub';
include_once __DIR__ . '/../database/migrations_test/create_users_table.php.stub';
(new \CreateUsersTable)->up();
}
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment