Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
14 changes: 14 additions & 0 deletions .env
Original file line number Diff line number Diff line change
@@ -1,3 +1,17 @@

APP_TITLE="My App"
APP_ENV="development"

# Database driver: mysql | sqlite
#DB_CONNECTION="sqlite"
#DB_DATABASE="database.sqlite"

# MySQL
#DB_DATABASE="my_database"
#DB_HOST="127.0.0.1"
#DB_PORT="3306"
#DB_USERNAME="root"
#DB_PASSWORD="secret"
# Optional but recommended
#DB_CHARSET="utf8mb4"
#DB_COLLATION="utf8mb4_unicode_ci"
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
._*
.DS_Store
.sass-cache
*.sqlite
composer.lock
composer.local.json
composer.local.lock
Expand Down
3 changes: 2 additions & 1 deletion composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,8 @@
"autoload": {
"psr-4": {
"App\\": "app/",
"Configs\\": "configs/"
"Configs\\": "configs/",
"Migrations\\": "database/migrations"
}
},
"extra": {
Expand Down
25 changes: 25 additions & 0 deletions configs/database.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
<?php


return [
'default' => env('DB_CONNECTION'),
'connections' => [
'mysql' => [
'driver' => 'pdo_mysql',
'host' => env('DB_HOST', '127.0.0.1'),
'port' => env('DB_PORT', 3306),
'dbname' => env('DB_DATABASE', ''),
'user' => env('DB_USERNAME', ''),
'password' => env('DB_PASSWORD', ''),
'charset' => 'utf8mb4',
],
'sqlite' => [
'driver' => 'pdo_sqlite',
'file' => env('DB_DATABASE', "database.sqlite"),
],
'test' => [
'driver' => 'pdo_sqlite',
'memory' => true,
],
],
];
2 changes: 1 addition & 1 deletion configs/providers.php
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
<?php

return [
// MaplePHP\Core\Providers\TestServiceProvider::class,
\MaplePHP\Core\Providers\DatabaseProvider::class,
];
22 changes: 22 additions & 0 deletions database/migrations/Test.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
<?php

namespace Migrations;

use Doctrine\DBAL\Schema\Schema;
use MaplePHP\Core\Support\Database\Migrations;

class Test extends Migrations
{
public function up(Schema $schema): void
{
$table = $schema->createTable('tests');
$table->addColumn('id', 'integer', ['autoincrement' => true]);
$table->addColumn('name', 'string', ['length' => 255]);
$table->setPrimaryKey(['id']);
}

public function down(Schema $schema): void
{
$schema->dropTable('tests');
}
}