markadell / laravel-postgresql-inherit
Add inheritance in postgresql tables
v2.3.1
2021-10-26 13:30 UTC
Requires
- php: >=5.4.0
- illuminate/database: ~6.0
- illuminate/support: ~6.0
Requires (Dev)
- mockery/mockery: ~0.9
- phpunit/phpunit: ^6.0
This package is not auto-updated.
Last update: 2024-05-09 00:34:18 UTC
README
Add inheritance in postgresql tables
Installation
PHP 5.4+ and Laravel 5.2+ are required.
For Laravel Versions 5.2.* & 5.3.*, run the following command to install this package via composer
composer require "rishi-ramawat/laravel-postgresql-inherit ~2.1.0"
For Laravel Versions ^5.4, run the following command to install this package via composer
composer require "rishi-ramawat/laravel-postgresql-inherit ~2.2"
For Laravel Versions ^6.0, run the following command to install this package via composer
composer require "markadell/laravel-postgresql-inherit ~2.3"
Once PostgreSQL Schema is installed, you need to register the service provider. Open up config/app.php
and add the following to the providers
array.
RishiRamawat\PostgresSchema\PostgresqlSchemaServiceProvider::class,
Usage
In migration file when using a postgresql database, you can use the new method inherits()
:
Schema::create('cities', function(Blueprint $table) { $table->increments('id'); $table->string('name'); $table->double('population'); $table->integer('altitude')->comment('In Feet'); }); Schema::create('capitals', function(Blueprint $table) { $table->string('state'); // Make capitals table inherits all the columns of its parent table, cities $table->inherits('cities'); });