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

Pulling instead of Pushing database #482

Open
westcoastdigital opened this issue Jun 26, 2018 · 6 comments
Open

Pulling instead of Pushing database #482

westcoastdigital opened this issue Jun 26, 2018 · 6 comments

Comments

@westcoastdigital
Copy link

westcoastdigital commented Jun 26, 2018

I have an issue where when I push my database, it actually changes the local version wp_options to the live site values rather than the live version.

I can push themes, uploads and plugins with zero issues, it appears to be just the database

Wordmove version 3.1.2

This is my movefile

global:
  sql_adapter: wpcli

local:
  vhost: https://digipress-new.dev
  wordpress_path: /Users/jon/Sites/digipress-new # use an absolute path here

  database:
    name: wp_digipress-new
    user: root
    password: "" # could be blank, so always use quotes around
    host: localhost

production:
  vhost: http://wordpress-176745-540845.cloudwaysapps.com
  wordpress_path: /home/176745.cloudwaysapps.com/kmxyeshgsb/public_html/ # use an absolute path here

  database:
    name: database_name # changed just for sharing
    user: database_username # changed just for sharing
    password: 123456789 # changed just for sharing
    host: localhost
    # port: 3308 # Use just in case you have exotic server config
    # mysqldump_options: '--max_allowed_packet=1G' # Only available if using SSH
    # mysql_options: '--protocol=TCP' # mysql command is used to import db

  exclude:
    - '.git/'
    - '.gitignore'
    - '.gitmodules'
    - '.env'
    - 'node_modules/'
    - 'bin/'
    - 'tmp/*'
    - 'Gemfile*'
    - 'Movefile'
    - 'movefile'
    - 'movefile.yml'
    - 'movefile.yaml'
    - 'wp-config.php'
    - 'wp-content/*.sql.gz'
    - '*.orig'

  # paths: # you can customize wordpress internal paths
  #   wp_content: wp-content
  #   uploads: wp-content/uploads
  #   plugins: wp-content/plugins
  #   mu_plugins: wp-content/mu-plugins
  #   themes: wp-content/themes
  #   languages: wp-content/languages

  ssh:
    host: 149.00.000.000 # changed just for sharing
    user: master_username # changed just for sharing
  #   password: password # password is optional, will use public keys if available.
  #   port: 22 # Port is optional
    rsync_options: '--verbose --itemize-changes' # Additional rsync options, optional
  #   gateway: # Gateway is optional
  #     host: host
  #     user: user
  #     password: password # password is optional, will use public keys if available.

  # ftp:
  #   user: user
  #   password: password
  #   host: host
  #   passive: true
  #   scheme: ftps # default ftp

  # hooks: # Remote hooks won't work with FTP
  #   push:
  #     before:
  #       local:
  #         - 'echo "Do something locally before push"'
  #       remote:
  #         - 'echo "Do something remotely before push"'
  #     after:
  #       local:
  #         - 'echo "Do something locally after push"'
  #       remote:
  #         - 'echo "Do something remotely after push"'
  #   pull:
  #     before:
  #       local:
  #         - 'echo "Do something locally before pull"'
  #       remote:
  #         - 'echo "Do something remotely before pull"'
  #     after:
  #       local:
  #         - 'echo "Do something locally after pull"'
  #       remote:
  #         - 'echo "Do something remotely after pull"'
  # forbid:
  #   push:
  #     db: false
  #     plugins: false
  #     themes: false
  #     languages: false
  #     uploads: false
  #     mu-plugins: false
  #   pull:
  #     db: false
  #     plugins: false
  #     themes: false
  #     languages: false
  #     uploads: false
  #     mu-plugins: false

# staging: # multiple environments can be specified
#   [...]
@DylanDunlop
Copy link

DylanDunlop commented Aug 2, 2018

I am having this same issue and it seems to be related to sql_adapter: wpcli. Try to change the sql_adapter to sql_adapter: default. Everything works as expected when default is chosen over wpcli (which was recently made the default option when running wordmove init.)

@chrilleferna
Copy link

I have the same issue and I think Dylan is right that it is related to the use of wpcli. I use the mysqldump option to exclude some tables, in particular wp_options. When using wpcli I THINK that wordmove makes a dump (excluding the ignored tables), then does a wp search-replace on ALL tables before making a new dump and pushing this to the remote. After that it imports the dump to the local database. This means that the ignored tables that have been altered with the wp search-replace will now contain values adapted for the remote and not the local environment. Also I'm not even sure that it is the correct dump file which is imported (i.e. the first one).

So it seems that the initial dump must contain all tables and also be the dump file to use when restoring the local database at the end.

@alessandro-fazzi
Copy link
Member

I hope to spot on this one soon, reformatting the original post 😛 and resuming what's happening. Sorry for the long summer stop, but it was inevitable.

@chrilleferna
Copy link

Hi Alessandro,
Thanks for picking this up. I have made some patches in the Gem code (in my local copy) in line with what I said above, and it seems to work. The thing is to make the FIRST dump without the mysqldump options (at least the --ignore-table) from the Movefile

@alessandro-fazzi
Copy link
Member

This should extend the feature blueprinted at #468 passing obtained tables not only to mysqldump but also to wp search-replace command

@stale
Copy link

stale bot commented Apr 16, 2022

This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

4 participants