Skip to content

A Laravel package which adds functionality in Laravel Migrations to leverage Table Inheritance feature in PostgreSQL.

Notifications You must be signed in to change notification settings

matte97p/laravel-postgresql-inherit

 
 

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

38 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

PostgresqlSchema

Software License

Add inheritance in postgresql tables

Installation

PHP 8.0+ and Laravel 10.x are required.

For latest Laravel Versions see the previous fork.

For Laravel Versions 10.x, run the following command to install this package via composer

composer require "matte97p/laravel-postgresql-inherit ~2.7"

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

About

A Laravel package which adds functionality in Laravel Migrations to leverage Table Inheritance feature in PostgreSQL.

Resources

Stars

Watchers

Forks

Packages

No packages published

Languages

  • PHP 100.0%