This forum has moved to a new location and is in read-only mode. Please visit talk.octobercms.com to access the new location.

dion17018
dion17018

Hi all,

I'm pretty new to October. As I started to work with October, I really liked it untill I had to cover the following issue.

The problem The basis for the website is done, and now I want my collegues to also work on the website. But we don't want to work on 1 remote database. Instead, we want to migrate/seed/push (still not clear what I really need) the database everytime we pull/push to site to Git.

Possible solution In Laravel, my collegue uses Flynsarms CSV seeder to do this. But I can't understand how I get this to work in October.

What have I tried?

  • try to run some commands like october:up, october:down (respons is that the user 'root' has not access, but the website it selfs works perfectly.. don't understand why)
  • try to install Phinx (couldn't get it to work, so searched for different solution)
  • install the flynsarms/csv-seeder package
  • create a plugin that uses this package and automatically seeds our databases or something like that.

My question: Is this the right way to solve my problem? Or should I do it differently?

Note: I don't have much xp with Laravel, October or database migrations. Aren't there built-in command (artisan october:up /:down etc) to accomplish what I want?

In sum, I really have no clue what I'm doing and just need someone to point me in the right direction.

Thanks in advance, Dion

Last updated

DMeganoski
DMeganoski

This is essentially the idea behind migrations and seeds. Why would you want to sync the databases? The information stored in there is intended to be dynamic, and although I can't think of an example off the top of my head, this may end up in a headache when data is relative to the environment. Not to mention maintaining versions of data to match structure would be a pain.

If you want some of the data to be persistent, just use seeders. They are there to feed data into the database. You hard-code in php the data you want it to fill in, and then you would only have to run a php command after pulling from git to execute the code.

php artisan db:seed --class="ContentSeeder"

The package you mention is just so that you can create more data-oriented csv files to migrate instead of hard-coding a ton of php arrays. You could essentially use this to keep the entire database in csv files in the version control, but I wouldn't suggest that. I'm pretty sure this would take some modification to get to work with October's plugin seeders, too.

Here is the october documentation on seeds https://octobercms.com/docs/database/structure#seeder-structure

I suggest creating a seeder that checks for existing records and adds new (non-existent) ones. Then, it can be ran after the source is pulled from version control.

dion17018
dion17018

@DMeganoski, thanks for your reply! I am getting somewhere now!!

1-3 of 3

You cannot edit posts or make replies: the forum has moved to talk.octobercms.com.