Skip to content

Commit cce5b7d

Browse files
committed
Uploaded files
0 parents  commit cce5b7d

22 files changed

+2233
-0
lines changed

.env.example

+6
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
DB_HOST=localhost
2+
DB_NAME=migration_exam
3+
DB_USER=root
4+
DB_PASSWORD=root
5+
DB_PORT=3306
6+
DB_TYPE=mysql

.gitignore

+2
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
.idea
2+
vendor
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,24 @@
1+
<?php
2+
3+
#Migration dosyası
4+
5+
namespace SimpleMigration\Database\Migrations;
6+
7+
use SimpleMigration\Migration;
8+
9+
class category_2022_04_05 extends Migration
10+
{
11+
public function up()
12+
{
13+
$this->create('category',[
14+
$this->id(),
15+
$this->timestamp()
16+
]);
17+
}
18+
19+
public function down()
20+
{
21+
$this->drop('category');
22+
}
23+
24+
}
+28
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,28 @@
1+
<?php
2+
3+
#Migration dosyası
4+
5+
namespace SimpleMigration\Database\Migrations;
6+
7+
use SimpleMigration\Migration;
8+
9+
class users_2022_04_03 extends Migration
10+
{
11+
public function up()
12+
{
13+
$this->create('users',[
14+
$this->id(),
15+
$this->string('name'),
16+
$this->string('surname'),
17+
$this->string('username'),
18+
$this->int('number'),
19+
$this->timestamp()
20+
]);
21+
}
22+
23+
public function down()
24+
{
25+
$this->drop('users');
26+
}
27+
28+
}

README.md

+39
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,39 @@
1+
# Simple Migration Example
2+
3+
4+
### Installation
5+
#### `composer require migration/app`
6+
7+
8+
#### Edit ENV
9+
10+
- DB_HOST
11+
- DB_NAME
12+
- DB_USER
13+
- DB_PASSWORD
14+
- DB_PORT
15+
16+
| Command | Description |
17+
| ------------- | ------------------------------ |
18+
| `php migrate` | Sends all migrations to the database. |
19+
| `php migrate create <migration name>` | Create a migration file. |
20+
| `php migrate down` | Deletes inserted databases |
21+
22+
23+
> ### php migrate
24+
25+
![Migrate](https://i.ibb.co/n8Lgv6s/migrate.png)
26+
27+
> ### php migrate create <migration name>
28+
29+
![Create](https://i.ibb.co/28pydQd/create2.png)
30+
31+
> ### php migrate down
32+
33+
![Down](https://i.ibb.co/XXyv8JK/down.png)
34+
35+
36+
#### Displays a warning if the migration name is left break.
37+
38+
![Empty](https://i.ibb.co/ZSmdDfy/empty.png)
39+

composer.json

+24
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,24 @@
1+
{
2+
"name": "migration/app",
3+
"description": "Simple Migration Application",
4+
"type": "simple",
5+
"require": {
6+
"vlucas/phpdotenv": "^5.4",
7+
"ext-pdo": "*"
8+
},
9+
"require-dev": {
10+
"roave/security-advisories": "dev-latest"
11+
},
12+
"autoload": {
13+
"psr-4": {
14+
"SimpleMigration\\": "src/",
15+
"SimpleMigration\\Database\\Migrations\\": "Database/Migrations/"
16+
}
17+
},
18+
"authors": [
19+
{
20+
"name": "Atakan Senturk",
21+
"email": "[email protected]"
22+
}
23+
]
24+
}

0 commit comments

Comments
 (0)