-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathsetup_db_table.php
More file actions
26 lines (23 loc) · 874 Bytes
/
setup_db_table.php
File metadata and controls
26 lines (23 loc) · 874 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
<?php
require_once 'config/config.php';
try {
$dsn = "mysql:host=" . BD_HOST . ";dbname=" . BD_NAME . ";charset=utf8";
$pdo = new PDO($dsn, BD_USER, BD_PASSWORD);
$pdo->setAttribute(PDO::ATTR_ERRMODE, PDO::ERRMODE_EXCEPTION);
$sql = "CREATE TABLE IF NOT EXISTS tbl_movimientos_banco (
id INT(11) AUTO_INCREMENT PRIMARY KEY,
id_cliente INT(11) NOT NULL,
id_banco VARCHAR(50) NOT NULL,
fecha DATE,
glosa TEXT,
i_s CHAR(1),
importe DECIMAL(10,2),
created_at TIMESTAMP DEFAULT CURRENT_TIMESTAMP,
INDEX idx_cliente (id_cliente),
INDEX idx_fecha (fecha)
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;";
$pdo->exec($sql);
echo "Table tbl_movimientos_banco created successfully.";
} catch (PDOException $e) {
echo "Error: " . $e->getMessage();
}