1010class Database extends Config
1111{
1212 /**
13- * The directory that holds the Migrations
14- * and Seeds directories.
13+ * The directory that holds the Migrations and Seeds directories.
1514 */
1615 public string $ filesPath = APPPATH . 'Database ' . DIRECTORY_SEPARATOR ;
1716
1817 /**
19- * Lets you choose which connection group to
20- * use if no other is specified.
18+ * Lets you choose which connection group to use if no other is specified.
2119 */
2220 public string $ defaultGroup = 'default ' ;
2321
@@ -36,20 +34,129 @@ class Database extends Config
3634 'DBPrefix ' => '' ,
3735 'pConnect ' => false ,
3836 'DBDebug ' => true ,
39- 'charset ' => 'utf8 ' ,
40- 'DBCollat ' => 'utf8_general_ci ' ,
37+ 'charset ' => 'utf8mb4 ' ,
38+ 'DBCollat ' => 'utf8mb4_general_ci ' ,
4139 'swapPre ' => '' ,
4240 'encrypt ' => false ,
4341 'compress ' => false ,
4442 'strictOn ' => false ,
4543 'failover ' => [],
4644 'port ' => 3306 ,
4745 'numberNative ' => false ,
46+ 'dateFormat ' => [
47+ 'date ' => 'Y-m-d ' ,
48+ 'datetime ' => 'Y-m-d H:i:s ' ,
49+ 'time ' => 'H:i:s ' ,
50+ ],
4851 ];
4952
53+ // /**
54+ // * Sample database connection for SQLite3.
55+ // *
56+ // * @var array<string, mixed>
57+ // */
58+ // public array $default = [
59+ // 'database' => 'database.db',
60+ // 'DBDriver' => 'SQLite3',
61+ // 'DBPrefix' => '',
62+ // 'DBDebug' => true,
63+ // 'swapPre' => '',
64+ // 'failover' => [],
65+ // 'foreignKeys' => true,
66+ // 'busyTimeout' => 1000,
67+ // 'dateFormat' => [
68+ // 'date' => 'Y-m-d',
69+ // 'datetime' => 'Y-m-d H:i:s',
70+ // 'time' => 'H:i:s',
71+ // ],
72+ // ];
73+
74+ // /**
75+ // * Sample database connection for Postgre.
76+ // *
77+ // * @var array<string, mixed>
78+ // */
79+ // public array $default = [
80+ // 'DSN' => '',
81+ // 'hostname' => 'localhost',
82+ // 'username' => 'root',
83+ // 'password' => 'root',
84+ // 'database' => 'ci4',
85+ // 'schema' => 'public',
86+ // 'DBDriver' => 'Postgre',
87+ // 'DBPrefix' => '',
88+ // 'pConnect' => false,
89+ // 'DBDebug' => true,
90+ // 'charset' => 'utf8',
91+ // 'swapPre' => '',
92+ // 'failover' => [],
93+ // 'port' => 5432,
94+ // 'dateFormat' => [
95+ // 'date' => 'Y-m-d',
96+ // 'datetime' => 'Y-m-d H:i:s',
97+ // 'time' => 'H:i:s',
98+ // ],
99+ // ];
100+
101+ // /**
102+ // * Sample database connection for SQLSRV.
103+ // *
104+ // * @var array<string, mixed>
105+ // */
106+ // public array $default = [
107+ // 'DSN' => '',
108+ // 'hostname' => 'localhost',
109+ // 'username' => 'root',
110+ // 'password' => 'root',
111+ // 'database' => 'ci4',
112+ // 'schema' => 'dbo',
113+ // 'DBDriver' => 'SQLSRV',
114+ // 'DBPrefix' => '',
115+ // 'pConnect' => false,
116+ // 'DBDebug' => true,
117+ // 'charset' => 'utf8',
118+ // 'swapPre' => '',
119+ // 'encrypt' => false,
120+ // 'failover' => [],
121+ // 'port' => 1433,
122+ // 'dateFormat' => [
123+ // 'date' => 'Y-m-d',
124+ // 'datetime' => 'Y-m-d H:i:s',
125+ // 'time' => 'H:i:s',
126+ // ],
127+ // ];
128+
129+ // /**
130+ // * Sample database connection for OCI8.
131+ // *
132+ // * You may need the following environment variables:
133+ // * NLS_LANG = 'AMERICAN_AMERICA.UTF8'
134+ // * NLS_DATE_FORMAT = 'YYYY-MM-DD HH24:MI:SS'
135+ // * NLS_TIMESTAMP_FORMAT = 'YYYY-MM-DD HH24:MI:SS'
136+ // * NLS_TIMESTAMP_TZ_FORMAT = 'YYYY-MM-DD HH24:MI:SS'
137+ // *
138+ // * @var array<string, mixed>
139+ // */
140+ // public array $default = [
141+ // 'DSN' => 'localhost:1521/XEPDB1',
142+ // 'username' => 'root',
143+ // 'password' => 'root',
144+ // 'DBDriver' => 'OCI8',
145+ // 'DBPrefix' => '',
146+ // 'pConnect' => false,
147+ // 'DBDebug' => true,
148+ // 'charset' => 'AL32UTF8',
149+ // 'swapPre' => '',
150+ // 'failover' => [],
151+ // 'dateFormat' => [
152+ // 'date' => 'Y-m-d',
153+ // 'datetime' => 'Y-m-d H:i:s',
154+ // 'time' => 'H:i:s',
155+ // ],
156+ // ];
157+
50158 /**
51- * This database connection is used when
52- * running PHPUnit database tests.
159+ * This database connection is used when running PHPUnit database tests.
53160 *
54161 * @var array<string, mixed>
55162 */
@@ -64,7 +171,7 @@ class Database extends Config
64171 'pConnect ' => false ,
65172 'DBDebug ' => true ,
66173 'charset ' => 'utf8 ' ,
67- 'DBCollat ' => 'utf8_general_ci ' ,
174+ 'DBCollat ' => '' ,
68175 'swapPre ' => '' ,
69176 'encrypt ' => false ,
70177 'compress ' => false ,
@@ -73,6 +180,11 @@ class Database extends Config
73180 'port ' => 3306 ,
74181 'foreignKeys ' => true ,
75182 'busyTimeout ' => 1000 ,
183+ 'dateFormat ' => [
184+ 'date ' => 'Y-m-d ' ,
185+ 'datetime ' => 'Y-m-d H:i:s ' ,
186+ 'time ' => 'H:i:s ' ,
187+ ],
76188 ];
77189
78190 public function __construct ()
0 commit comments