Skip to content
This repository was archived by the owner on Jan 16, 2023. It is now read-only.

Commit f9e231f

Browse files
committed
Added DB Reset functionality
1 parent 0055d3f commit f9e231f

File tree

4 files changed

+23
-4
lines changed

4 files changed

+23
-4
lines changed
0 Bytes
Binary file not shown.

PDO Without AJAX/database/migrations.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@
55
* Date: 13/12/2016
66
* Time: 16:43
77
*/
8-
require('../functions.php');
8+
require_once('../functions.php');
99

1010
$pdo = getDBConnection();
1111

@@ -29,4 +29,4 @@
2929
)"
3030
);
3131

32-
echo "Database migration completed.";
32+
echo "Database migration completed.<br/>";

PDO Without AJAX/database/reset.php

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
<?php
2+
/**
3+
* Created by IntelliJ IDEA.
4+
* User: samuel
5+
* Date: 14/12/2016
6+
* Time: 10:43
7+
*/
8+
require_once("../functions.php");
9+
10+
$pdo = getDBConnection();
11+
12+
$pdo->exec("DROP TABLE IF EXISTS 'users'");
13+
$pdo->exec("DROP TABLE IF EXISTS 'registrations'");
14+
echo "Tables dropped.<br/>";
15+
16+
require("migrations.php");
17+
require("seeds.php");
18+
19+
echo "Database has been reset<br/>";

PDO Without AJAX/database/seeds.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@
55
* Date: 13/12/2016
66
* Time: 16:57
77
*/
8-
require("../functions.php");
8+
require_once("../functions.php");
99

1010
$pdo = getDBConnection();
1111

@@ -16,4 +16,4 @@
1616
INSERT INTO `users` VALUES (3,'shrek');
1717
");
1818

19-
echo "Your database is seeded.";
19+
echo "Your database is seeded.<br/>";

0 commit comments

Comments
 (0)