An unofficial, mostly Bitwarden-compatible API server written in Ruby (Sinatra and ActiveRecord)
1## Rubywarden
2
3### Migrating From `bitwarden-ruby` to Rubywarden and ActiveRecord
4
5If you've used this application before it switched to using ActiveRecord
6(when it was called `bitwarden-ruby`), you need to do the following steps to
7migrate the data and generate the new table structures.
8
9Even though the migration script will import to a new database file at a
10different path, it is probably best to create a backup yourself.
11You can also copy the `db/production.sqlite3` to your local machine and do the
12migration there.
13After a successful migration you'd have to copy the updated database file back
14to the production machine.
15
16First make sure you have the latest code:
17
18 git pull
19
20Then checkout to a specific revision where the migration was made:
21
22 git checkout 40044728d
23
24Run `bundle` to add some required libraries for the migration:
25
26 bundle --with migrate
27
28Now you are ready to do the migration:
29
30 bundle exec ruby tools/migrate_to_ar.rb -e production
31
32The `-e` switch allows you to select the correct database environment from
33`db/config.yml`.
34
35The migration script will:
36
37 - dump the contents of the old database (most likely at
38 `db/production.sqlite`) to a temporary YAML file
39 - create the new database at `db/production/production.sqlite3` using
40 ActiveRecord migrations
41 - import the contents from the dump file
42 - remove the dump file
43
44Now your data is completely migrated into a new database at the new recommended
45path, and the library will now use ActiveRecord to handle anything database
46related.
47
48It is recommended to follow the
49[initial installation instructions](https://github.com/jcs/rubywarden#manual-setup)
50to create a new, unprivileged user to own the new `db/production/` database
51and run the server.
52
53Lastly, update to the current code:
54
55 git checkout master
56
57And then follow the
58[update instructions](https://github.com/jcs/rubywarden#updating)
59to bring your database up to date with the latest migrations.