Start having useful defaults for SQL
[mediagoblin.git] / mediagoblin / db / sql / convert.py
index 88614fd41ff9cdeb7266ffd2d014e8a940ad3990..36d6fc7f6a442c44f3e2d2eeff6dcbdb8ef27eec 100644 (file)
@@ -1,3 +1,20 @@
+# GNU MediaGoblin -- federated, autonomous media hosting
+# Copyright (C) 2011, 2012 MediaGoblin contributors.  See AUTHORS.
+#
+# This program is free software: you can redistribute it and/or modify
+# it under the terms of the GNU Affero General Public License as published by
+# the Free Software Foundation, either version 3 of the License, or
+# (at your option) any later version.
+#
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+# GNU Affero General Public License for more details.
+#
+# You should have received a copy of the GNU Affero General Public License
+# along with this program.  If not, see <http://www.gnu.org/licenses/>.
+
+
 from mediagoblin.init import setup_global_and_app_config, setup_database
 from mediagoblin.db.mongo.util import ObjectId
 
@@ -39,7 +56,7 @@ def convert_users(mk_db):
         copy_attrs(entry, new_entry,
             ('username', 'email', 'created', 'pw_hash', 'email_verified',
              'status', 'verification_key', 'is_admin', 'url',
-             'bio', 'bio_html',
+             'bio',
              'fp_verification_key', 'fp_token_expire',))
         # new_entry.fp_verification_expire = entry.fp_token_expire
 
@@ -60,9 +77,9 @@ def convert_media_entries(mk_db):
         new_entry = MediaEntry()
         copy_attrs(entry, new_entry,
             ('title', 'slug', 'created',
-             'description', 'description_html',
-             'media_type', 'state',
-             'fail_error',
+             'description',
+             'media_type', 'state', 'license',
+             'fail_error', 'fail_metadata',
              'queued_task_id',))
         copy_reference_attr(entry, new_entry, "uploader")
 
@@ -116,7 +133,7 @@ def convert_media_comments(mk_db):
         new_entry = MediaComment()
         copy_attrs(entry, new_entry,
             ('created',
-             'content', 'content_html',))
+             'content',))
         copy_reference_attr(entry, new_entry, "media_entry")
         copy_reference_attr(entry, new_entry, "author")
 
@@ -131,8 +148,7 @@ def convert_media_comments(mk_db):
 def main():
     global_config, app_config = setup_global_and_app_config("mediagoblin.ini")
 
-    sql_conn, sql_db = sql_connect({'sql_engine': 'sqlite:///mediagoblin.db'})
-
+    sql_conn, sql_db = sql_connect(app_config)
     mk_conn, mk_db = mongo_connect(app_config)
 
     Base.metadata.create_all(sql_db.engine)