A
A
Alexey Chertok2015-11-10 14:22:14
Yii
Alexey Chertok, 2015-11-10 14:22:14

How to create a base in yii2?

Good afternoon. In general, I decided to slowly start working with YII2. Before that, I just worked with other engines, but I decided to try myself in a new one.
Found a good thing to start with: yii2-starter-kit .
I set up the server, installed everything through composer, set up all the configs, but here's the problem. I did not find how to create a database. It’s somehow not much of a hunt to score manually, I don’t know everything about the tables that are there.
Please tell me how to set up the database. And how does this thing happen in general, so that in the future I already understand this. Maybe there is some command to create a database?
Thank you very much in advance!

Answer the question

In order to leave comments, you need to log in

2 answer(s)
A
Alexander, 2015-11-10
@BarnyBroken

https://github.com/trntv/yii2-starter-kit/blob/mas...
Manual installation -> Setup application
1. Copy the settings file
2. Write your settings in it
3. Run the command in the console: php console/ yii app/setup

S
shamyyl, 2015-11-10
@shamyyl

I understand that you need to set up a connection to an existing database.
This is done in the config file (here is an example of how to connect postgres):

'components' => [
        'db' => [
              'class' => 'yii\db\Connection',
              'dsn' => 'pgsql:host=127.0.0.1;dbname=dbname',
              'username' => 'username',
              'password' => 'pass',
              'charset' => 'utf8',
              'enableSchemaCache' => YII_DEBUG ? false : true,
        ]
]

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question