OpenBazaar / OpenBazaar-Server

(Deprecated) OpenBazaar 1.0 Server daemon for communication with OpenBazaar-Client
MIT License
608 stars 173 forks source link

Migration to db2 has failed #361

Open mariodian opened 8 years ago

mariodian commented 8 years ago

I get this error when I start OB server on my linux machine (pulled from git)

OpenBazaar Server v0.1 starting...
migrating to db version 2
Traceback (most recent call last):
  File "openbazaard.py", line 304, in <module>
    Parser(OpenBazaard('/tmp/openbazaard.pid'))
  File "openbazaard.py", line 228, in __init__
    getattr(self, args.command)()
  File "openbazaard.py", line 266, in start
    int(args.heartbeatport), time.time())
  File "openbazaard.py", line 177, in run
    db = Database(TESTNET)
  File "/home/ubuntu/OpenBazaar-Server/db/datastore.py", line 42, in __init__
    self._initialize_database(self.PATH)
  File "/home/ubuntu/OpenBazaar-Server/db/datastore.py", line 60, in _initialize_database
    self._run_migrations()
  File "/home/ubuntu/OpenBazaar-Server/db/datastore.py", line 186, in _run_migrations
    migration2.migrate(self.PATH)
  File "/home/ubuntu/OpenBazaar-Server/db/migrations/migration2.py", line 17, in migrate
    raise Exception("To complete migration 2 please run openbazaard at least once using the original "
Exception: To complete migration 2 please run openbazaard at least once using the original data folder location before moving it to a different location.

I haven't moved the data folder. It sits in ~/.openbazaar

insanity54 commented 8 years ago

I also had this issue when trying to restore a backed up store. I copied an old ~/.openbazaar folder to ~/.openbazaar on a new computer.

Old computer was ubuntu 14.04 New computer is ubuntu 12.04

cpacia commented 8 years ago

I write it to skip the migration is people prematurely moved the data folder. That will likely cause not to work right for those who moved it however.

mariodian commented 8 years ago

@cpacia ok, so what's the solution? Currently I'm on git checkout 65e6618

mariodian commented 8 years ago

Ok, so if someone else has this issue, this is what you have to do:

1) get your current OB data folder (where the OB-mainnet.db file is) and move it back to the system where you originally ran it from 2) make sure ob.cfg doesn't have any fancy DATA folder set, it needs to be the default one 3) get some kind of sqlite editor and open the file OB-mainnet.db 4) go to the table "hashmap" and change all the paths to those of your original system. For example if you originally moved your data from OSX to Linux, change all the paths from /home/<your user>/.openbazaar back to /Users/<your user>/Library/Application Support/OpenBazaar (maybe someone can write an SQL command for it, I'm not familiar with sqlite) 5) run the openbazaar server python openbazaard.py start and wait until it migrates your database to the new version 6) you can move your migrated OB-mainnet.db back to your linux system

Only do the step 4 if you don't have the current backup of your store available.