Você não pode selecionar mais de 25 tópicos Os tópicos devem começar com uma letra ou um número, podem incluir traços ('-') e podem ter até 35 caracteres.

Database.php 2.3KB

2 anos atrás
2 anos atrás
2 anos atrás
12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091
  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
  11. * and Seeds directories.
  12. *
  13. * @var string
  14. */
  15. public $filesPath = APPPATH . 'Database' . DIRECTORY_SEPARATOR;
  16. /**
  17. * Lets you choose which connection group to
  18. * use if no other is specified.
  19. *
  20. * @var string
  21. */
  22. public $defaultGroup = 'default';
  23. /**
  24. * The default database connection.
  25. *
  26. * @var array
  27. */
  28. public $default = [
  29. 'DSN' => '',
  30. 'hostname' => 'localhost',
  31. 'username' => 'root',
  32. 'password' => '',
  33. 'database' => 'epic',
  34. 'DBDriver' => 'MySQLi',
  35. 'DBPrefix' => '',
  36. 'pConnect' => false,
  37. 'DBDebug' => (ENVIRONMENT !== 'production'),
  38. 'charset' => 'utf8',
  39. 'DBCollat' => 'utf8_general_ci',
  40. 'swapPre' => '',
  41. 'encrypt' => false,
  42. 'compress' => false,
  43. 'strictOn' => false,
  44. 'failover' => [],
  45. 'port' => 3306,
  46. ];
  47. /**
  48. * This database connection is used when
  49. * running PHPUnit database tests.
  50. *
  51. * @var array
  52. */
  53. public $tests = [
  54. 'DSN' => '',
  55. 'hostname' => '127.0.0.1',
  56. 'username' => '',
  57. 'password' => '',
  58. 'database' => ':memory:',
  59. 'DBDriver' => 'SQLite3',
  60. 'DBPrefix' => 'db_', // Needed to ensure we're working correctly with prefixes live. DO NOT REMOVE FOR CI DEVS
  61. 'pConnect' => false,
  62. 'DBDebug' => (ENVIRONMENT !== 'production'),
  63. 'charset' => 'utf8',
  64. 'DBCollat' => 'utf8_general_ci',
  65. 'swapPre' => '',
  66. 'encrypt' => false,
  67. 'compress' => false,
  68. 'strictOn' => false,
  69. 'failover' => [],
  70. 'port' => 3306,
  71. 'foreignKeys' => true,
  72. ];
  73. public function __construct()
  74. {
  75. parent::__construct();
  76. // Ensure that we always set the database group to 'tests' if
  77. // we are currently running an automated test suite, so that
  78. // we don't overwrite live data on accident.
  79. if (ENVIRONMENT === 'testing') {
  80. $this->defaultGroup = 'tests';
  81. }
  82. }
  83. }