-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathlite.php
More file actions
41 lines (36 loc) · 992 Bytes
/
lite.php
File metadata and controls
41 lines (36 loc) · 992 Bytes
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
33
34
35
36
37
38
39
40
41
<?php
use Database\Migration\Migration;
use Database\Seeder\Seeder;
const BASEPATH = __DIR__ . DIRECTORY_SEPARATOR;
require 'vendor/autoload.php'; // Load Composer's Autoloader
// Setup environment variable
$dotenv = \Dotenv\Dotenv::createImmutable(BASEPATH);
$dotenv->load();
// Check for command-line arguments
if ($argc < 2) {
// No arguments provided, display usage instructions
echo "Usage: php lite.php <command>\n";
echo "Available commands:\n";
echo " migrate - Run database migrations\n";
echo " seed - Seed the database\n";
exit(1);
}
// Get the command from the first argument
$command = $argv[1];
// Process the command
switch ($command) {
case 'migrate':
Migration::run();
break;
case 'migrate:fresh':
Migration::reset();
break;
case 'seed':
Seeder::run();
break;
default:
// Invalid command
echo "Invalid command: $command\n";
exit(1);
break;
}