Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Discuss dbcreate in userguide #4160

Merged
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Discuss dbcreate in userguide
  • Loading branch information
paulbalandan committed Jan 26, 2021
commit cba91e904746418fcc520264bbedacfd67ec2cfb
25 changes: 25 additions & 0 deletions user_guide_src/source/dbmgmt/forge.rst
Original file line number Diff line number Diff line change
Expand Up @@ -60,6 +60,31 @@ Returns TRUE/FALSE based on success or failure::
echo 'Database deleted!';
}

Creating Databases in the Command Line
======================================

CodeIgniter supports creating databases straight from your favorite terminal using the dedicated ``db:create``
command. By using this command it is assumed that the database is not yet existing. Otherwise, CodeIgniter
will complain that the database creation has failed.

To start, just type the command and the name of the database (e.g., ``foo``)::

php spark db:create foo

If everything went fine, you should expect the ``Database "foo" successfully created.`` message displayed.

If you are on a testing environment or you are using the SQLite3 driver, you may pass in the file extension
for the file where the database will be created using the ``--ext`` option. Valid values are ``db`` and
``sqlite`` and defaults to ``db``. Remember that these should not be preceded by a period.
::

php spark db:create foo --ext sqlite
// will create the db file in WRITEPATH/foo.sqlite

.. note:: When using the special SQLite3 database name ``:memory:``, expect that the command will still
produce a success message but no database file is created. This is because SQLite3 will just use
an in-memory database.

****************************
Creating and Dropping Tables
****************************
Expand Down