|
|
# Migrate from SQLite to PostgreSQL
|
|
|
|
|
|
Shutdown Lutim to avoid URL creation while migrating.
|
|
|
|
|
|
Install some dependencies:
|
|
|
```shell
|
|
|
apt-get install sqlite3 libsqlite3-mod-impexp
|
|
|
sqlite3 /var/www/lutim/lutim.db
|
|
|
```
|
|
|
|
|
|
In SQLite prompt, do this to export data:
|
|
|
```
|
|
|
.load libsqlite3_mod_impexp
|
|
|
SELECT export_sql('/tmp/lutim.sql','1');
|
|
|
.exit
|
|
|
```
|
|
|
|
|
|
Modify the exported file (the export format is close to PostgreSQL's SQL but not quite):
|
|
|
```shell
|
|
|
sed -e "s@^INSERT OR REPLACE @INSERT @" -e 's@INSERT INTO "mojo_migrations".*@@' -i /tmp/lutim.sql
|
|
|
```
|
|
|
|
|
|
Create PostgreSQL database:
|
|
|
```shell
|
|
|
su - postgres
|
|
|
createuser lutim_user -P
|
|
|
createdb -O lutim_user lutim_db
|
|
|
```
|
|
|
|
|
|
Configure Lutim to use PostgreSQL and start it to create the database structure.
|
|
|
|
|
|
Then import the data:
|
|
|
```shell
|
|
|
su postgres
|
|
|
psql lutim_db < /tmp/lutim.sql
|
|
|
```
|
|
|
|
|
|
-------
|
|
|
|
|
|
Go back to [wiki's homepage](home). |
|
|
\ No newline at end of file |