-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathdb.php
32 lines (25 loc) · 748 Bytes
/
db.php
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
<?php
if (PHP_SAPI == 'cli') {
exit('This application needs to run via CLI');
}
require __DIR__ . '/vendor/autoload.php';
$settings = require __DIR__ . '/src/settings.php';
$app = new \Slim\App($settings);
require __DIR__ . '/src/dependencies.php';
$db = $container->get('db');
$schema = $db->schema();
if (!$schema->hasTable('categories')) {
$schema->create('categories', function($table){
$table->increments('id');
$table->string('name', 60);
$table->text('description');
$table->timestamps();
});
echo shell_exec('echo categories table generated!');
}
$schema->create($tableName, function($tabke){
$table->increments('id');
$table->string('name', 60);
$table->text('description');
$table->timestamps();
});