matte97p / laravel-postgresql-inherit
为postgresql表添加继承功能
2.7
2023-04-24 13:37 UTC
Requires
- php: >=8.0.0
- illuminate/database: >=10.0
- illuminate/support: >=10.0
Requires (Dev)
- mockery/mockery: ~0.9
- phpunit/phpunit: ^10.0
This package is not auto-updated.
Last update: 2024-09-24 19:20:30 UTC
README
为postgresql表添加继承功能
安装
关于最新Laravel版本,请参阅之前的分支。
对于Laravel版本 10.x,运行以下命令通过composer安装此包:
composer require "matte97p/laravel-postgresql-inherit ~2.7"
一旦安装了PostgreSQL模式,您需要注册服务提供者。打开 config/app.php
文件,并在 providers
数组中添加以下内容。
RishiRamawat\PostgresSchema\PostgresqlSchemaServiceProvider::class,
用法
在使用postgresql数据库的迁移文件中,您可以使用新的方法 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'); });