Database.php 6.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203
  1. <?php
  2. namespace Config;
  3. use CodeIgniter\Database\Config;
  4. /**
  5. * Database Configuration
  6. */
  7. class Database extends Config
  8. {
  9. /**
  10. * The directory that holds the Migrations and Seeds directories.
  11. */
  12. public string $filesPath = APPPATH . 'Database' . DIRECTORY_SEPARATOR;
  13. /**
  14. * Lets you choose which connection group to use if no other is specified.
  15. */
  16. public string $defaultGroup = 'default';
  17. /**
  18. * The default database connection.
  19. *
  20. * @var array<string, mixed>
  21. */
  22. public array $default = [
  23. 'DSN' => '',
  24. 'hostname' => 'localhost',
  25. 'username' => 'shopdeli',
  26. 'password' => 'min010206',
  27. 'database' => 'shopdeli',
  28. 'DBDriver' => 'MySQLi',
  29. 'DBPrefix' => '',
  30. 'pConnect' => false,
  31. 'DBDebug' => true,
  32. 'charset' => 'utf8mb4',
  33. 'DBCollat' => 'utf8mb4_general_ci',
  34. 'swapPre' => '',
  35. 'encrypt' => false,
  36. 'compress' => false,
  37. 'strictOn' => false,
  38. 'failover' => [],
  39. 'port' => 3306,
  40. 'numberNative' => false,
  41. 'foundRows' => false,
  42. 'dateFormat' => [
  43. 'date' => 'Y-m-d',
  44. 'datetime' => 'Y-m-d H:i:s',
  45. 'time' => 'H:i:s',
  46. ],
  47. ];
  48. // /**
  49. // * Sample database connection for SQLite3.
  50. // *
  51. // * @var array<string, mixed>
  52. // */
  53. // public array $default = [
  54. // 'database' => 'database.db',
  55. // 'DBDriver' => 'SQLite3',
  56. // 'DBPrefix' => '',
  57. // 'DBDebug' => true,
  58. // 'swapPre' => '',
  59. // 'failover' => [],
  60. // 'foreignKeys' => true,
  61. // 'busyTimeout' => 1000,
  62. // 'synchronous' => null,
  63. // 'dateFormat' => [
  64. // 'date' => 'Y-m-d',
  65. // 'datetime' => 'Y-m-d H:i:s',
  66. // 'time' => 'H:i:s',
  67. // ],
  68. // ];
  69. // /**
  70. // * Sample database connection for Postgre.
  71. // *
  72. // * @var array<string, mixed>
  73. // */
  74. // public array $default = [
  75. // 'DSN' => '',
  76. // 'hostname' => 'localhost',
  77. // 'username' => 'root',
  78. // 'password' => 'root',
  79. // 'database' => 'ci4',
  80. // 'schema' => 'public',
  81. // 'DBDriver' => 'Postgre',
  82. // 'DBPrefix' => '',
  83. // 'pConnect' => false,
  84. // 'DBDebug' => true,
  85. // 'charset' => 'utf8',
  86. // 'swapPre' => '',
  87. // 'failover' => [],
  88. // 'port' => 5432,
  89. // 'dateFormat' => [
  90. // 'date' => 'Y-m-d',
  91. // 'datetime' => 'Y-m-d H:i:s',
  92. // 'time' => 'H:i:s',
  93. // ],
  94. // ];
  95. // /**
  96. // * Sample database connection for SQLSRV.
  97. // *
  98. // * @var array<string, mixed>
  99. // */
  100. // public array $default = [
  101. // 'DSN' => '',
  102. // 'hostname' => 'localhost',
  103. // 'username' => 'root',
  104. // 'password' => 'root',
  105. // 'database' => 'ci4',
  106. // 'schema' => 'dbo',
  107. // 'DBDriver' => 'SQLSRV',
  108. // 'DBPrefix' => '',
  109. // 'pConnect' => false,
  110. // 'DBDebug' => true,
  111. // 'charset' => 'utf8',
  112. // 'swapPre' => '',
  113. // 'encrypt' => false,
  114. // 'failover' => [],
  115. // 'port' => 1433,
  116. // 'dateFormat' => [
  117. // 'date' => 'Y-m-d',
  118. // 'datetime' => 'Y-m-d H:i:s',
  119. // 'time' => 'H:i:s',
  120. // ],
  121. // ];
  122. // /**
  123. // * Sample database connection for OCI8.
  124. // *
  125. // * You may need the following environment variables:
  126. // * NLS_LANG = 'AMERICAN_AMERICA.UTF8'
  127. // * NLS_DATE_FORMAT = 'YYYY-MM-DD HH24:MI:SS'
  128. // * NLS_TIMESTAMP_FORMAT = 'YYYY-MM-DD HH24:MI:SS'
  129. // * NLS_TIMESTAMP_TZ_FORMAT = 'YYYY-MM-DD HH24:MI:SS'
  130. // *
  131. // * @var array<string, mixed>
  132. // */
  133. // public array $default = [
  134. // 'DSN' => 'localhost:1521/XEPDB1',
  135. // 'username' => 'root',
  136. // 'password' => 'root',
  137. // 'DBDriver' => 'OCI8',
  138. // 'DBPrefix' => '',
  139. // 'pConnect' => false,
  140. // 'DBDebug' => true,
  141. // 'charset' => 'AL32UTF8',
  142. // 'swapPre' => '',
  143. // 'failover' => [],
  144. // 'dateFormat' => [
  145. // 'date' => 'Y-m-d',
  146. // 'datetime' => 'Y-m-d H:i:s',
  147. // 'time' => 'H:i:s',
  148. // ],
  149. // ];
  150. /**
  151. * This database connection is used when running PHPUnit database tests.
  152. *
  153. * @var array<string, mixed>
  154. */
  155. public array $tests = [
  156. 'DSN' => '',
  157. 'hostname' => '127.0.0.1',
  158. 'username' => 'eventinter',
  159. 'password' => 'min010206!',
  160. 'database' => 'eventinter', //:memory:
  161. 'DBDriver' => 'SQLite3',
  162. 'DBPrefix' => 'db_', // Needed to ensure we're working correctly with prefixes live. DO NOT REMOVE FOR CI DEVS
  163. 'pConnect' => false,
  164. 'DBDebug' => true,
  165. 'charset' => 'utf8',
  166. 'DBCollat' => '',
  167. 'swapPre' => '',
  168. 'encrypt' => false,
  169. 'compress' => false,
  170. 'strictOn' => false,
  171. 'failover' => [],
  172. 'port' => 3306,
  173. 'foreignKeys' => true,
  174. 'busyTimeout' => 1000,
  175. 'dateFormat' => [
  176. 'date' => 'Y-m-d',
  177. 'datetime' => 'Y-m-d H:i:s',
  178. 'time' => 'H:i:s',
  179. ],
  180. ];
  181. public function __construct()
  182. {
  183. parent::__construct();
  184. // Ensure that we always set the database group to 'tests' if
  185. // we are currently running an automated test suite, so that
  186. // we don't overwrite live data on accident.
  187. if (ENVIRONMENT === 'testing') {
  188. $this->defaultGroup = 'tests';
  189. }
  190. }
  191. }