Coder Social home page Coder Social logo

wordpress-db-migration's Introduction

WordPress DB migration

It can be a pain to migrate your WordPress website from your dev environment to another one, or to change your domain name.

This little script's goal is to make it easy: just export the DB to a SQL file, then run

./wp-db-migrate.py --from '<OLD_URL>' --to '<NEW_URL>' --in '<path/to/old_db.sql>' --out '<path/to/new_db.sql>'

For example to deploy your dev copy on localhost/my_site to your live site at my_site.com, assuming you have a dumb of your dev DB at ~/my_site/dump.sql:

./wp-db-migrate.py --from 'http://localhost/my_site' --to 'http://my_site.com' --in '~/my_site/dump.sql' --out '/tmp/migrated_dump.sql'

will create /tmp/migrated_dump.sql with the migrated DB you then just need to import into your live server(s).

Note that the input file (old DB file) won't be modified in any way, but the output file (new DB) will be overwritten if it exists.

It's a very simple script, but I always welcome feedback, pull requests, bug reports...

A few details

Migrates both string data and 'serialized' (in the WordPress sense) data.

Processes the input file in linear time and constant memory.

Note that I'm aware that WordPress offers a functionality to do just that, but you do need to have access to the running site to do it, which is not always the case (old dev copy, or else long-lost domain name...) And even if you do have access to a running instance, this allows to script it!

wordpress-db-migration's People

Contributors

wk8 avatar

Stargazers

 avatar

Watchers

James Cloos avatar  avatar  avatar

Forkers

bjornw

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.