https://github.com/devgaucho/mig
Sistema básico de migrations em plain text
https://github.com/devgaucho/mig
mariadb migration mysql php sqlite
Last synced: 2 months ago
JSON representation
Sistema básico de migrations em plain text
- Host: GitHub
- URL: https://github.com/devgaucho/mig
- Owner: devgaucho
- Created: 2023-04-17T19:09:46.000Z (about 2 years ago)
- Default Branch: main
- Last Pushed: 2024-08-16T13:43:22.000Z (11 months ago)
- Last Synced: 2025-05-03T09:51:54.854Z (2 months ago)
- Topics: mariadb, migration, mysql, php, sqlite
- Language: PHP
- Homepage: https://packagist.org/packages/gaucho/mig
- Size: 15.6 KB
- Stars: 1
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
# mig
Sistema básico de migrations em plain text
## Instalação
```bash
composer require gaucho/mig
```## Utilização
### Formato das migrations:
Cada tabela é representada através de um arquivo TXT com as colunas.
#### Exemplo:
Arquivo plant text "table/users"
```
id
name_32
email_32
```Colunas "id" são automaticamente convertidas para AUTO_INCREMENT
Os prefixos numéricos opcionais são convertidos para VARCHAR
### Para apenas um diretório:
```php
$table_dir=__DIR__.'/table';
```### Para vários diretórios:
```php
$table_dir=[
__DIR__.'/dir1',
__DIR__.'/dir2'
];
```### Corre Forrest! Corre! 🏃♂️
```php
use gaucho\mig;$pdo=/* instância do pdo */;
$db_type='mysql';//sqlite
$mig=new mig($pdo,$table_dir,$db_type);
$mig->mig();
```