Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/virdiggg/seeder-ci3
Migration and Seeder from Existing Database for CodeIgniter 3
https://github.com/virdiggg/seeder-ci3
Last synced: 2 months ago
JSON representation
Migration and Seeder from Existing Database for CodeIgniter 3
- Host: GitHub
- URL: https://github.com/virdiggg/seeder-ci3
- Owner: virdiggg
- License: mit
- Created: 2023-09-06T06:24:59.000Z (over 1 year ago)
- Default Branch: master
- Last Pushed: 2024-02-23T02:17:27.000Z (11 months ago)
- Last Synced: 2024-04-25T18:22:26.405Z (9 months ago)
- Language: PHP
- Homepage:
- Size: 55.7 KB
- Stars: 1
- Watchers: 1
- Forks: 1
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# A Simple Library Seeder from Existing Database for CodeIgniter 3
## Inspired from Laravel Artisan and [orangehill/iseed](https://github.com/orangehill/iseed) for Laravel.
### HOW TO USE
- Install this library with composer
```bash
composer require virdiggg/seeder-ci3 --dev
```
- Create a controller to host all the function from this library. Example is `application/controller/App.php`
```php
migrateCalled = true;
}// If you don't wish to have rollback function
public function rollback() {
return;
}public function __destruct()
{
if ($this->migrateCalled) {
// $this->db->query("GRANT SELECT, INSERT, UPDATE, DELETE ON ALL TABLES IN SCHEMA public TO myrole");
// $this->db->query("GRANT ALL PRIVILEGES ON ALL SEQUENCES IN SCHEMA public TO myrole");
// log_message('error', 'PREVILEGES GRANTED');
}
}
}
```#### Help options: `php index.php help`.
```bash
cd c:/xampp/htdocs/codeigniter && php index.php app help
```
#### How to run migration: `php index.php migrate`.
```bash
cd c:/xampp/htdocs/codeigniter && php index.php app migrate
```
#### How to run rollback migration: `php index.php rollback [--args]`.
- Add `--to=1` to run migration number . Optional. Default is the latest number in your database min 1.
```bash
cd c:/xampp/htdocs/codeigniter && php index.php app rollback --to=1
```
#### How to create Seeder file: `php index.php seed [--args]`.
- Add `--limit=5` to limit the query result. Optional.
```bash
cd c:/xampp/htdocs/codeigniter && php index.php app seed users --limit=10
```
#### How to create Migration file: `php index.php migration [--args]`.
- Add `--soft-delete` to add soft delete parameter. Optional.
```bash
cd c:/xampp/htdocs/codeigniter && php index.php app migration users --soft-delete
```
#### How to create Controller file: `php index.php controller [--args]`.
- Add `--r` to generate resources. Optional.
```bash
cd c:/xampp/htdocs/codeigniter && php index.php app controller Admin/Dashboard/Table --r
```
#### How to create Model file: `php index.php model [--args]`.
- Add `--r` to generate resources. Optional.
- Add `--c` to generate its controller file as well. Optional.
- Add `--m` to generate its migration file as well. Optional.
- Add `--soft-delete` if your model using soft delete. Optional.
```bash
cd c:/xampp/htdocs/codeigniter && php index.php app model Admin/Users --r --c --m --soft-delete
```