Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
25 changes: 25 additions & 0 deletions .push
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
1. Confirma y sube tus cambios a tu repositorio de GitHub:

bash
git add .
git commit -m "Descripción de los cambios"
git push origin master
(Asegúrate de estar en la rama principal/master o la rama que uses como estable).

2. Actualiza la versión en tu archivo composer.json:

Cambia el valor de "version" (si lo tienes) o agrega una nueva etiqueta/tag de versión en GitHub (recomendado).
3. Crea un nuevo tag de versión:

bash
git tag v1.0.1
git push origin v1.0.1
(Reemplaza v1.0.1 por la versión correspondiente según tu ciclo de versiones.)

4. Verifica que tu repositorio es público y tiene un composer.json válido.

5. Si aún no lo has hecho, publica tu paquete en Packagist:

Ve a https://packagist.org/packages/submit
Ingresa la URL de tu repositorio de GitHub y sigue los pasos.
Para actualizaciones futuras, Packagist detecta automáticamente los nuevos tags y actualiza tu paquete. Si no lo hace, puedes forzar la actualización desde la página de tu paquete en Packagist.
17 changes: 5 additions & 12 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,11 +1,4 @@
# Reliese Laravel

[![StyleCI](https://styleci.io/repos/71080508/shield?style=flat)](https://styleci.io/repos/71080508)
[![Build Status](https://travis-ci.org/reliese/laravel.svg?branch=master)](https://travis-ci.org/reliese/laravel)
[![Latest Stable Version](https://poser.pugx.org/reliese/laravel/v/stable)](https://packagist.org/packages/reliese/laravel)
[![Total Downloads](https://poser.pugx.org/reliese/laravel/downloads)](https://packagist.org/packages/reliese/laravel)
[![Latest Unstable Version](https://poser.pugx.org/reliese/laravel/v/unstable)](https://packagist.org/packages/reliese/laravel)
[![License](https://poser.pugx.org/reliese/laravel/license)](https://packagist.org/packages/reliese/laravel)
# AJULCAB Reliese Laravel

Reliese Laravel is a collection of Laravel Components which aim is
to help the development process of Laravel applications by
Expand All @@ -14,10 +7,10 @@ providing some convenient code-generation capabilities.
## How does it work?

This package expects that you are using Laravel 5.1 or above.
You will need to import the `reliese/laravel` package via composer:
You will need to import the `ajulcab/laravel-generate-model` package via composer:

```shell
composer require reliese/laravel
composer require ajulcab/laravel-generate-model
```

### Configuration
Expand All @@ -40,7 +33,7 @@ Add the service provider to your `config/app.php` file within the `providers` ke
If you wish to enable generators only for your local environment, you should install it via composer using the --dev option like this:

```shell
composer require reliese/laravel --dev
composer require ajulcab/laravel-generate-model --dev
```

Then you'll need to register the provider in `app/Providers/AppServiceProvider.php` file.
Expand Down Expand Up @@ -115,4 +108,4 @@ to decide whether this approach gives value to your project :-)

#### Support

For the time being, this package only supports MySQL databases. Support for other databases will be added soon.
For the time being, this package supports MySQL, SqlSrv, Postgress and SQLite databases.
1 change: 1 addition & 0 deletions _config.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
theme: jekyll-theme-leap-day
14 changes: 7 additions & 7 deletions composer.json
Original file line number Diff line number Diff line change
@@ -1,17 +1,17 @@
{
"name": "reliese/laravel",
"name": "ajulcab/laravel-generate-model",
"description": "Reliese Components for Laravel Framework code generation.",
"keywords": ["reliese", "laravel"],
"homepage": "http://cristianllanos.com",
"keywords": ["reliese", "laravel","generate","model","ajulcab"],
"homepage": "http://infotiks.com",
"support": {
"issues": "https://github.com/reliese/laravel/issues",
"source": "https://github.com/reliese/laravel"
"issues": "https://github.com/AJULCAB/generate-model/issues",
"source": "https://github.com/AJULCAB/generate-model"
},
"license": "MIT",
"authors": [
{
"name": "Cristian Llanos",
"email": "cristianllanos@outlook.com"
"name": "Ahiezer Julca Blas",
"email": "julca.blas@gmail.com"
}
],
"require": {
Expand Down
9 changes: 8 additions & 1 deletion config/models.php
Original file line number Diff line number Diff line change
Expand Up @@ -280,7 +280,14 @@
*/

'except' => [
'cache',
'cache_locks',
'failed_jobs',
'jobs',
'job_batches',
'migrations',
'password_reset_tokens',
'sessions',
],

/*
Expand Down Expand Up @@ -374,7 +381,7 @@
| You can disable pluralization tables and relations
|
*/
'pluralize' => true,
'pluralize' => false,

/*
|--------------------------------------------------------------------------
Expand Down
5 changes: 4 additions & 1 deletion src/Meta/MySql/Schema.php
Original file line number Diff line number Diff line change
Expand Up @@ -270,8 +270,11 @@ protected function resolveForeignTable($table, Blueprint $blueprint)
*/
public static function schemas(Connection $connection)
{
$schemas = $connection->getDoctrineSchemaManager()->listDatabases();
//$schemas = $connection->getDoctrineSchemaManager()->listDatabases();

$pdo = $connection->getPdo();
$query = $pdo->query("SHOW DATABASES");
$schemas = $query->fetchAll(\PDO::FETCH_COLUMN);
return array_diff($schemas, [
'information_schema',
'sys',
Expand Down
4 changes: 3 additions & 1 deletion src/Meta/SchemaManager.php
Original file line number Diff line number Diff line change
Expand Up @@ -13,11 +13,12 @@
use Illuminate\Database\MySqlConnection;
use Illuminate\Database\SQLiteConnection;
use Illuminate\Database\PostgresConnection;
use Illuminate\Database\SqlServerConnection;
use Illuminate\Database\ConnectionInterface;
use Reliese\Meta\MySql\Schema as MySqlSchema;
use Reliese\Meta\Sqlite\Schema as SqliteSchema;
use Reliese\Meta\Postgres\Schema as PostgresSchema;

use Reliese\Meta\SqlSrv\Schema as SqlSrvSchema;
class SchemaManager implements IteratorAggregate
{
/**
Expand All @@ -28,6 +29,7 @@ class SchemaManager implements IteratorAggregate
SQLiteConnection::class => SqliteSchema::class,
PostgresConnection::class => PostgresSchema::class,
\Larapack\DoctrineSupport\Connections\MySqlConnection::class => MySqlSchema::class,
SqlServerConnection::class=>SqlSrvSchema::class,
];

/**
Expand Down
122 changes: 122 additions & 0 deletions src/Meta/SqlSrv/Column.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,122 @@
<?php

/**
* Created by Cristian.
* Date: 18/09/16 08:36 PM.
*/

namespace Reliese\Meta\SqlSrv;

use Illuminate\Support\Fluent;

class Column implements \Reliese\Meta\Column
{
/**
* @var \Doctrine\DBAL\Schema\Column
*/
protected $metadata;

/**
* @var array
*/
protected $metas = [
'type', 'name', 'autoincrement', 'nullable', 'default', 'comment',
];

/**
* @var array
*/
public static $mappings = [
'string' => ['varchar','char','nvarchar','nchar','string','varchar(MAX)'],
'date' => ['datetime', 'datetime2', 'date'],
'int' => ['bigint', 'int', 'tinyint', 'smallint','integer'],
'float' => ['float', 'decimal','money','smallmoney'],
'real' =>['real'],
'boolean' => ['bit','bool','boolean'],
];

/**
* MysqlColumn constructor.
*
* @param array $metadata
*/
public function __construct($metadata = [])
{
$this->metadata = $metadata;
}

/**
* @return \Illuminate\Support\Fluent
*/
public function normalize()
{
$attributes = new Fluent();

foreach ($this->metas as $meta) {
$this->{'parse'.ucfirst($meta)}($attributes);
}

return $attributes;
}

/**
* @param \Illuminate\Support\Fluent $attributes
*/
protected function parseType(Fluent $attributes)
{


$dataType = $this->metadata->getType()->getName();

foreach (static::$mappings as $phpType => $database) {
if (in_array($dataType, $database)) {
$attributes['type'] = $phpType;
}
}

/*
if ($attributes['type'] == 'int') {
$attributes['unsigned'] = $this->metadata->getUnsigned();
}*/
}

/**
* @param \Illuminate\Support\Fluent $attributes
*/
protected function parseName(Fluent $attributes)
{
$attributes['name'] = $this->metadata->getName();
}

/**
* @param \Illuminate\Support\Fluent $attributes
*/
protected function parseAutoincrement(Fluent $attributes)
{
$attributes['autoincrement'] = $this->metadata->getAutoincrement();
}

/**
* @param \Illuminate\Support\Fluent $attributes
*/
protected function parseNullable(Fluent $attributes)
{
$attributes['nullable'] = $this->metadata->getNotnull();
}

/**
* @param \Illuminate\Support\Fluent $attributes
*/
protected function parseDefault(Fluent $attributes)
{
$attributes['default'] = $this->metadata->getDefault();
}

/**
* @param \Illuminate\Support\Fluent $attributes
*/
protected function parseComment(Fluent $attributes)
{
$attributes['comment'] = $this->metadata->getComment();
}
}
Loading