Base migration script from the old database

This commit is contained in:
Felipe M 2016-12-19 10:52:43 +01:00
parent 352985a13f
commit 1204a70cb5

21
scripts/migrate.py Normal file
View file

@ -0,0 +1,21 @@
# -*- coding: utf-8 -*-
"""
Script to perform the migration from the old blog database
to the lektor file format.
"""
import os.path
import dataset
SQLITE = os.path.expanduser('~/NextCloud/Backups/blog/v2/database.sqlite')
LEKTOR = os.path.expanduser('~/Developer/fmartingr-lektor/content')
db = dataset.connect('sqlite:///' + SQLITE)
posts = db['blog_entry']
projects = db['projects_project']
project_images = lambda x: db['projects_projectimage'].filter(project_id=x)
get_project_group = lambda x: db['projects_group'].filter(id=x)