-
Notifications
You must be signed in to change notification settings - Fork 5
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
11 changed files
with
253 additions
and
110 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,23 @@ | ||
filter: | ||
excluded_paths: [tests/*] | ||
|
||
checks: | ||
php: | ||
remove_extra_empty_lines: true | ||
remove_php_closing_tag: true | ||
remove_trailing_whitespace: true | ||
fix_use_statements: | ||
remove_unused: true | ||
preserve_multiple: false | ||
preserve_blanklines: true | ||
order_alphabetically: true | ||
fix_php_opening_tag: true | ||
fix_linefeed: true | ||
fix_line_ending: true | ||
fix_identation_4spaces: true | ||
fix_doc_comments: true | ||
|
||
tools: | ||
external_code_coverage: | ||
timeout: 600 | ||
runs: 3 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,29 @@ | ||
language: php | ||
|
||
php: | ||
- 5.4 | ||
- 5.5 | ||
- 5.6 | ||
- 7.0 | ||
- hhvm | ||
|
||
# This triggers builds to run on the new TravisCI infrastructure. | ||
# See: http://docs.travis-ci.com/user/workers/container-based-infrastructure/ | ||
sudo: false | ||
|
||
matrix: | ||
allow_failures: | ||
- php: 7.0 | ||
include: | ||
- php: 5.4 | ||
env: 'COMPOSER_FLAGS="--prefer-stable --prefer-lowest"' | ||
|
||
before_script: | ||
- travis_retry composer self-update | ||
- travis_retry composer update ${COMPOSER_FLAGS} --no-interaction --prefer-source | ||
|
||
script: | ||
- vendor/bin/phpunit --coverage-text --coverage-clover=coverage.clover | ||
|
||
after_script: | ||
- if [[ $TRAVIS_PHP_VERSION != 'hhvm' && $TRAVIS_PHP_VERSION != '7.0' ]]; then php vendor/bin/ocular code-coverage:upload --format=php-clover coverage.clover; fi |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,30 @@ | ||
# Changelog | ||
|
||
All Notable changes to `Refinery` will be documented in this file | ||
|
||
## [0.1.3](https://github.com/rougin/refinery/compare/v0.1.2...v0.1.3) - 2015-09-18 | ||
|
||
### Added | ||
- Migration to [`rougin/blueprint`](https://github.com/rougin/blueprint) | ||
|
||
### Fixed | ||
- Commands | ||
- Simplified code structure | ||
|
||
## [0.1.2](https://github.com/rougin/refinery/compare/v0.1.0...v0.1.2) - 2015-09-18 | ||
|
||
### Added | ||
- [`rougin/spark-plug`](https://github.com/rougin/spark-plug) as a dependency | ||
|
||
### Fixed | ||
- Based functions from [`rougin/describe`](https://github.com/rougin/describe)' | ||
|
||
## [0.1.1](https://github.com/rougin/refinery/compare/v0.1.0...v0.1.1) - 2015-06-07 | ||
|
||
### Fixed | ||
- Include [`symfony/console`](http://symfony.com/doc/current/components/console/introduction.html) as a dependency | ||
|
||
## 0.1.0 - 2015-06-25 | ||
|
||
### Added | ||
- `Refinery` library |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,29 @@ | ||
# Contributing | ||
|
||
Contributions are **welcome** and will be fully **credited**. | ||
|
||
We accept contributions via Pull Requests on [Github](https://github.com/rougin/refinery). | ||
|
||
## Pull Requests | ||
|
||
- **[PSR-2 Coding Standard](https://github.com/php-fig/fig-standards/blob/master/accepted/PSR-2-coding-style-guide.md)** - The easiest way to apply the conventions is to install [PHP Code Sniffer](http://pear.php.net/package/PHP_CodeSniffer). | ||
|
||
- **Add tests!** - Your patch won't be accepted if it doesn't have tests. | ||
|
||
- **Document any change in behaviour** - Make sure the `README.md` and any other relevant documentation are kept up-to-date. | ||
|
||
- **Consider our release cycle** - We try to follow [SemVer v2.0.0](http://semver.org/). Randomly breaking public APIs is not an option. | ||
|
||
- **Create feature branches** - Don't ask us to pull from your master branch. | ||
|
||
- **One pull request per feature** - If you want to do more than one thing, send multiple pull requests. | ||
|
||
- **Send coherent history** - Make sure each individual commit in your pull request is meaningful. If you had to make multiple intermediate commits while developing, please [squash them](http://www.git-scm.com/book/en/v2/Git-Tools-Rewriting-History#Changing-Multiple-Commit-Messages) before submitting. | ||
|
||
## Running Tests | ||
|
||
``` bash | ||
$ composer test | ||
``` | ||
|
||
**Happy coding**! |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,21 @@ | ||
# The MIT License (MIT) | ||
|
||
Copyright (c) 2015 Rougin Royce Gutib <[email protected]> | ||
|
||
> Permission is hereby granted, free of charge, to any person obtaining a copy | ||
> of this software and associated documentation files (the "Software"), to deal | ||
> in the Software without restriction, including without limitation the rights | ||
> to use, copy, modify, merge, publish, distribute, sublicense, and/or sell | ||
> copies of the Software, and to permit persons to whom the Software is | ||
> furnished to do so, subject to the following conditions: | ||
> | ||
> The above copyright notice and this permission notice shall be included in | ||
> all copies or substantial portions of the Software. | ||
> | ||
> THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR | ||
> IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, | ||
> FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE | ||
> AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER | ||
> LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, | ||
> OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN | ||
> THE SOFTWARE. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,35 +1,29 @@ | ||
# Refinery | ||
|
||
[![Latest Stable Version](https://poser.pugx.org/rougin/refinery/v/stable)](https://packagist.org/packages/rougin/refinery) [![Total Downloads](https://poser.pugx.org/rougin/refinery/downloads)](https://packagist.org/packages/rougin/refinery) [![Latest Unstable Version](https://poser.pugx.org/rougin/refinery/v/unstable)](https://packagist.org/packages/rougin/refinery) [![License](https://poser.pugx.org/rougin/refinery/license)](https://packagist.org/packages/rougin/refinery) [![endorse](https://api.coderwall.com/rougin/endorsecount.png)](https://coderwall.com/rougin) | ||
[![Latest Version on Packagist][ico-version]][link-packagist] | ||
[![Software License][ico-license]](LICENSE.md) | ||
[![Build Status][ico-travis]][link-travis] | ||
[![Coverage Status][ico-scrutinizer]][link-scrutinizer] | ||
[![Quality Score][ico-code-quality]][link-code-quality] | ||
[![Total Downloads][ico-downloads]][link-downloads] | ||
|
||
A command line interface for [Migrations Class](http://www.codeigniter.com/user_guide/libraries/migration.html) in [CodeIgniter](http://www.codeigniter.com/) | ||
Generates "ready-to-eat" migrations for [CodeIgniter](http://www.codeigniter.com/). An extension and a command line interface for [Migrations Class](http://www.codeigniter.com/user_guide/libraries/migration.html). | ||
|
||
# Installation | ||
## Install | ||
|
||
Install ```Refinery``` via [Composer](https://getcomposer.org): | ||
Via Composer | ||
|
||
```$ composer require rougin/refinery``` | ||
|
||
# Examples | ||
|
||
### Keywords | ||
|
||
```Refinery``` also provides a *ready-to-eat* migration based on the following keywords below: | ||
|
||
* ```create_(table)_table``` | ||
* ```add_(column)_in_(table)_table``` | ||
* ```modify_(column)_in_(table)_table``` | ||
* ```delete_(column)_in_(table)_table``` | ||
``` bash | ||
$ composer require rougin/refinery | ||
``` | ||
|
||
### Creating a table named "user" | ||
## Usage | ||
|
||
```bash | ||
``` bash | ||
$ php vendor/bin/refinery create create_user_table | ||
"20150607123241_create_user_table.php" has been created. | ||
``` | ||
|
||
**20150607123241_create_user_table.php** | ||
|
||
```php | ||
class Migration_create_user_table extends CI_Migration { | ||
|
||
|
@@ -47,15 +41,11 @@ class Migration_create_user_table extends CI_Migration { | |
} | ||
``` | ||
|
||
### Adding column named "name" in "user" table | ||
|
||
```bash | ||
$ php vendor/bin/refinery create add_name_in_user_table | ||
"20150607123510_add_name_in_user_table.php" has been created. | ||
``` | ||
|
||
**20150607123510_add_name_in_user_table.php** | ||
|
||
```php | ||
class Migration_add_name_in_user_table extends CI_Migration { | ||
|
||
|
@@ -80,82 +70,60 @@ class Migration_add_name_in_user_table extends CI_Migration { | |
} | ||
``` | ||
|
||
### Migrating all files in ```application/migrations``` directory | ||
|
||
```bash | ||
$ php vendor/bin/refinery migrate | ||
"20150607123241_create_user_table" has been migrated to the database. | ||
"20150607123510_add_name_in_user_table" has been migrated to the database. | ||
``` | ||
|
||
### You can also revert back if you want | ||
|
||
```bash | ||
$ php vendor/bin/refinery rollback | ||
Database is reverted back to version 20150607123241. (20150607123241_create_user_table) | ||
``` | ||
|
||
### Or reset them back | ||
|
||
```bash | ||
$ php vendor/bin/refinery reset | ||
Database has been resetted. | ||
``` | ||
|
||
# Commands | ||
|
||
#### ```migrate``` | ||
|
||
#### Description: | ||
## Change Log | ||
|
||
Migrates the database | ||
Please see [CHANGELOG](CHANGELOG.md) for more information what has changed recently. | ||
|
||
#### ```rollback``` | ||
## Testing | ||
|
||
#### Description: | ||
|
||
Returns to a previous/specified migration | ||
|
||
#### Arguments: | ||
|
||
* ```version``` - Specified version of the migration | ||
|
||
#### ```reset``` | ||
|
||
#### Description: | ||
|
||
Resets all migrations | ||
|
||
#### ```create``` | ||
|
||
#### Description: | ||
|
||
Creates a new migration file | ||
|
||
#### Arguments: | ||
|
||
* ```name``` - Name of the migration file | ||
|
||
#### Options: | ||
|
||
**NOTE**: The following options below are only available when you use the ```add_```, ```delete_```, or ```modify_``` keywords | ||
``` bash | ||
$ composer test | ||
``` | ||
|
||
* ```--from-database``` - Generates a migration file that is based from the database | ||
## Contributing | ||
|
||
* ```--sequential``` - Generates a migration file with a sequential identifier | ||
Please see [CONTRIBUTING](CONTRIBUTING.md) for details. | ||
|
||
**NOTE**: If you really want to use the sequential identifier, just change your ```$config['migration_type']``` in ```application/config/migration.php``` | ||
## Security | ||
|
||
* ```--type=[LENGTH]``` - Data type of the column | ||
If you discover any security related issues, please email [email protected] instead of using the issue tracker. | ||
|
||
* ```--length=[LENGTH]``` - Length of the column | ||
## Credits | ||
|
||
* ```--auto_increment``` - Generates an "AUTO_INCREMENT" flag on the column | ||
- [Rougin Royce Gutib][link-author] | ||
- [All Contributors][link-contributors] | ||
|
||
* ```--default``` - Generates a default value in the column definition | ||
## License | ||
|
||
* ```--null``` - Generates a "NULL" value in the column definition | ||
The MIT License (MIT). Please see [License File](LICENSE.md) for more information. | ||
|
||
* ```--primary``` - Generates a "PRIMARY" value in the column definition | ||
[ico-version]: https://img.shields.io/packagist/v/rougin/refinery.svg?style=flat-square | ||
[ico-license]: https://img.shields.io/badge/license-MIT-brightgreen.svg?style=flat-square | ||
[ico-travis]: https://img.shields.io/travis/rougin/refinery/master.svg?style=flat-square | ||
[ico-scrutinizer]: https://img.shields.io/scrutinizer/coverage/g/rougin/refinery.svg?style=flat-square | ||
[ico-code-quality]: https://img.shields.io/scrutinizer/g/rougin/refinery.svg?style=flat-square | ||
[ico-downloads]: https://img.shields.io/packagist/dt/rougin/refinery.svg?style=flat-square | ||
|
||
* ```--unsigned``` - Generates an "UNSIGNED" value in the column definition | ||
[link-packagist]: https://packagist.org/packages/rougin/refinery | ||
[link-travis]: https://travis-ci.org/rougin/refinery | ||
[link-scrutinizer]: https://scrutinizer-ci.com/g/rougin/refinery/code-structure | ||
[link-code-quality]: https://scrutinizer-ci.com/g/rougin/refinery | ||
[link-downloads]: https://packagist.org/packages/rougin/refinery | ||
[link-author]: https://github.com/rougin | ||
[link-contributors]: ../../contributors |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,26 +1,51 @@ | ||
{ | ||
"name": "rougin/refinery", | ||
"description": "A command line interface for Migrations Class in CodeIgniter", | ||
"keywords": ["refinery", "database", "migrations", "php"], | ||
"description": "'Ready-to-eat' migrations for Codeigniter", | ||
"keywords": [ | ||
"refinery", | ||
"database", | ||
"migrations", | ||
"php" | ||
], | ||
"homepage": "https://github.com/rougin/spark-plug", | ||
"license": "MIT", | ||
"authors": [ | ||
{ | ||
"name": "Rougin Royce Gutib", | ||
"email": "[email protected]", | ||
"homepage": "http://rougin.github.io", | ||
"role": "Developer" | ||
} | ||
], | ||
"require": { | ||
"php": ">=5.3.0", | ||
"rougin/blueprint": "*", | ||
"rougin/describe": "*", | ||
"rougin/spark-plug": "*" | ||
}, | ||
"license": "MIT", | ||
"authors": [ | ||
{ | ||
"name": "Rougin Gutib", | ||
"email": "[email protected]" | ||
} | ||
], | ||
"require-dev": { | ||
"phpunit/phpunit" : "4.*", | ||
"scrutinizer/ocular": "~1.1" | ||
}, | ||
"bin": ["bin/refinery", "bin/refinery.php"], | ||
"autoload": { | ||
"psr-4": { | ||
"Rougin\\Refinery\\": "src/" | ||
} | ||
}, | ||
"autoload-dev": { | ||
"psr-4": { | ||
"Rougin\\Refinery\\Test\\": "tests" | ||
} | ||
}, | ||
"scripts": { | ||
"test": "phpunit" | ||
}, | ||
"extra": { | ||
"branch-alias": { | ||
"dev-master": "0.2-dev" | ||
} | ||
}, | ||
"suggest": { | ||
"rougin/codeigniter": "Yet another way to install CodeIgniter via Composer", | ||
"rougin/combustor": "A tool for speeding up web development in CodeIgniter" | ||
|
Oops, something went wrong.