rishi-ramawat / laravel-postgresql-inherit by rishi-ramawat
forked from jumper423/laravel-postgresql-inherit

Add inheritance in postgresql tables
26,102
6
0
Package Data
Maintainer Username: rishi-ramawat
Maintainer Contact: thibaud@dauce.fr (Thibaud Dauce)
Package Create Date: 2017-03-02
Package Last Update: 2021-05-13
Home Page:
Language: PHP
License: MIT
Last Refreshed: 2024-11-21 15:00:09
Package Statistics
Total Downloads: 26,102
Monthly Downloads: 54
Daily Downloads: 7
Total Stars: 6
Total Watchers: 0
Total Forks: 6
Total Open Issues: 2

PostgresqlSchema

Software License

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"

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');
});