承接 gsferro/database-schema-easy 相关项目开发

从需求分析到上线部署,全程专人跟进,保证项目质量与交付效率

邮箱:yvsm@zunyunkeji.com | QQ:316430983 | 微信:yvsm316

gsferro/database-schema-easy

最新稳定版本:v1.1.1

Composer 安装命令:

composer require gsferro/database-schema-easy

包简介

Simple and efficient way to manipulate your database connection scheme, whatever it may be.

README 文档

README

Logo

Simple and efficient way to manipulate your database connection scheme, whatever it may be.

Instalação:

composer require gsferro/database-schema-easy

Dependências:

Package Versão
PHP ^8
Laravel ^8
Doctrine/orm ^2.14

Uso:

  • Instancie o serviço

    $schema = new DatabaseSchemaEasy(string $table, string $connection = null);
    
  • Facade

    $schema = dbschemaeasy(string $table)
    

Métodos:

  • hasTable(): bool: Verifica se a table exists

    $schema->hasTable();
    # true
  • getColumnListing(bool $includePrimaryKeys = true, bool $includeTimestamps = false): array : Retorna todas as colunas da table

    $schema->getColumnListing();
    /*
    [
      "id",
      "uuid",
      "pedido_status_id",
    ]
    */
  • hasColumn(string $column): bool: Verifica se a coluna exists

    $schema->hasColumn('id');
    # true
    
  • hasColumns(array $columns): bool:Verifica se as colunas exists

    $schema->hasColumns(['id', 'uuid']);
    # true
  • hasColumnsTimestamps(): bool: Verifica se a coluna exists

    $schema->hasColumnsTimestamps();
    # true
  • getTypeFromColumns(array $columns): array: Pega todos os tipos das colunas

    $schema->getTypeFromColumns(['id', 'uuid']);
    /*
    [
      "id" => "integer",
      "uuid" => "guid",
    ]
    */
  • getColumnType(string $column): string:Retorna o type da colunas

    $schema->getColumnType('id');
    # "integer"
  • getDoctrineColumn(string $column): array:Retorna todas as informações da colunas

    $schema->getDoctrineColumn('id');
    /*
    [
      "name" => "id",
      "type" => Doctrine\DBAL\Types\IntegerType {#4751},
      "default" => null,
      "notnull" => true,
      "length" => null,
      "precision" => 10,
      "scale" => 0,
      "fixed" => false,
      "unsigned" => false,
      "autoincrement" => true,
      "columnDefinition" => null,
      "comment" => null,
      "primary_key" => true,
    ]
    */
  • isPrimaryKey(string $column): bool:Verifica se a coluna é pk

    $schema->isPrimaryKey('id');
    # true
  • primaryKeys(): array:Retorna as chaves pks

    $schema->primaryKeys();
    /*
    [
      "id",
    ]
    */
  • hasModelWithTableName(string $table = null): bool|string:Verifica se a table já existe model eloquent criada

    $schema->hasModelWithTableName();
    # "App\Models\Pedidos"
    
    $schema->hasModelWithTableName('abc');
    # false
  • getAllTables(): array: Todas as tabelas da conexão

    $schema->getAllTables();
    /*
    [
      'pedidos',
      'pedido_status,
      ...
    ]
    */
  • hasForeinsKey(string $column, bool $fromStubReplace = false): bool|array: Verifica se a coluna é uma foreing key e devolve os dados do relacionamento

     $schema->hasForeinsKey('pedido_status_id');
    /*
      [
      "table" => "pedido_status",
      "tableCamel" => Illuminate\Support\Stringable {#5069
      value: "pedidoStatus",
      },
      "related" => Illuminate\Support\Stringable {#5068
      value: "",
      },
      "relatedInstance" => false,
      "foreignKey" => "pedido_status_id",
      "ownerKey" => "id",
    ]
    */

统计信息

  • 总下载量: 441
  • 月度下载量: 0
  • 日度下载量: 0
  • 收藏数: 0
  • 点击次数: 2
  • 依赖项目数: 1
  • 推荐数: 0

GitHub 信息

  • Stars: 0
  • Watchers: 1
  • Forks: 0
  • 开发语言: PHP

其他信息

  • 授权协议: MIT
  • 更新时间: 2023-03-16

承接程序开发

PHP开发

VUE

Vue开发

前端开发

小程序开发

公众号开发

系统定制

数据库设计

云部署

网站建设

安全加固