Skip to content

Commit b283148

Browse files
committed
change readme.md file
1 parent c0e208e commit b283148

File tree

1 file changed

+89
-22
lines changed

1 file changed

+89
-22
lines changed

README.md

Lines changed: 89 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -5,46 +5,113 @@
55
[![GitHub Code Style Action Status](https://img.shields.io/github/workflow/status/furkifor/sql_dumper/Check%20&%20fix%20styling?label=code%20style)](https://github.com/furkifor/sql_dumper/actions?query=workflow%3A"Check+%26+fix+styling"+branch%3Amaster)
66
[![Total Downloads](https://img.shields.io/packagist/dt/furkifor/sql_dumper.svg?style=flat-square)](https://packagist.org/packages/furkifor/sql_dumper)
77

8+
SQL query builder and database migration tool.
9+
10+
## Installation
11+
812
```bash
913
composer require furkifor/sql_dumper
1014
```
1115

12-
## Kullanımı
16+
## SQL Query Builder Usage
1317

1418
```php
15-
$sql_dumper = new Furkifor\SqlDumper("TABLE_NAME");
19+
$sql_dumper = new Furkifor\SqlDumper("users");
20+
21+
// Simple query
1622
echo $sql_dumper->select('*')->get();
17-
// select * from TABLE_NAME
23+
// SELECT * FROM users
24+
25+
// Query with conditions
26+
echo $sql_dumper->select('name, email')
27+
->where('age > ?', [18])
28+
->orderBy('name', 'DESC')
29+
->limit(10)
30+
->get();
31+
// SELECT name, email FROM users WHERE age > ? ORDER BY name DESC LIMIT 10
32+
33+
// JOIN operations
34+
echo $sql_dumper->select('users.*, roles.name as role_name')
35+
->join('INNER', 'roles', 'users.role_id = roles.id')
36+
->where('users.active = ?', [1])
37+
->get();
38+
// SELECT users.*, roles.name as role_name FROM users
39+
// INNER JOIN roles ON users.role_id = roles.id WHERE users.active = ?
40+
41+
// Grouping and HAVING
42+
echo $sql_dumper->select('country, COUNT(*) as user_count')
43+
->groupBy('country')
44+
->having('user_count > 100')
45+
->get();
46+
// SELECT country, COUNT(*) as user_count FROM users
47+
// GROUP BY country HAVING user_count > 100
1848
```
19-
## Migrate Kullanımı
49+
50+
## Migration Tool Usage
2051

2152
```php
2253
$table = new MigrateClass("mysql");
54+
55+
// Simple table creation
2356
$table->name("users")
24-
->string('username',255)->unique()->notnull()
25-
->string('email',255)->unique()->notnull()
26-
->string('password',255)->notnull()
57+
->string('username', 255)->unique()->notnull()
58+
->string('email', 255)->unique()->notnull()
59+
->string('password', 255)->notnull()
2760
->datetime('created_at')->default("CURRENT_TIMESTAMP")
28-
->int('role_id')->notnull()->foreignKey('roles','id')->check("role_id>0")
2961
->createTable();
30-
/*
31-
CREATE TABLE users (
32-
id INT(11) AUTO_INCREMENT PRIMARY KEY NOT NULL,
33-
username VARCHAR(255) NOT NULL UNIQUE,
34-
email VARCHAR(255) NOT NULL UNIQUE,
35-
password VARCHAR(255) NOT NULL,
36-
created_at DATETIME DEFAULT CURRENT_TIMESTAMP,
37-
role_id INT NOT NULL,
38-
FOREIGN KEY (role_id) REFERENCES roles(id),
39-
CHECK (role_id > 0)
40-
)
41-
*/
62+
63+
// Table with relationships
64+
$table->name("posts")
65+
->string('title', 255)->notnull()
66+
->text('content')
67+
->int('user_id')->notnull()
68+
->foreignKey('user_id', 'users', 'id')
69+
->datetime('published_at')->nullable()
70+
->boolean('is_published')->default(0)
71+
->createTable();
72+
73+
// Table with custom constraints
74+
$table->name("products")
75+
->string('name', 100)->notnull()
76+
->decimal('price', 10, 2)->notnull()
77+
->int('stock')->notnull()->default(0)
78+
->check('price > 0')
79+
->check('stock >= 0')
80+
->createTable();
4281
```
4382

83+
## Features
4484

45-
- [furkan](https://github.com/FurkiFor)
46-
- [All Contributors](../../contributors)
85+
### SQL Query Builder
86+
- CREATE SELECT queries
87+
- WHERE conditions
88+
- JOIN operations (INNER, LEFT, RIGHT)
89+
- ORDER BY sorting
90+
- GROUP BY grouping
91+
- HAVING filtering
92+
- LIMIT clause
93+
- Parameter binding support
94+
- DISTINCT queries
95+
96+
### Migration Tool
97+
- Multiple database system support (MySQL, MongoDB, SQL Server)
98+
- Support for all common data types
99+
- Automatic ID/Primary Key generation
100+
- Foreign Key relationships
101+
- Unique constraints
102+
- NOT NULL constraints
103+
- DEFAULT values
104+
- CHECK constraints
105+
106+
## Contributing
107+
108+
Pull requests are welcome. For major changes, please open an issue first to discuss what you would like to change.
47109

48110
## License
49111

50112
The MIT License (MIT). Please see [License File](LICENSE.md) for more information.
113+
114+
## Credits
115+
116+
- [Furkan Ünsal](https://github.com/FurkiFor)
117+
- [All Contributors](../../contributors)

0 commit comments

Comments
 (0)