Parcourir la source

priority migration

Gamaliel Espinoza il y a 8 ans
Parent
commit
39e05fee9d
4 fichiers modifiés avec 15 ajouts et 4 suppressions
  1. 5 0
      .gitignore
  2. 1 1
      tools/fourier/__init__.py
  3. 2 2
      tools/fourier/cli.py
  4. 7 1
      tools/fourier/migrations.py

+ 5 - 0
.gitignore

@@ -0,0 +1,5 @@
+*.pyc
+tools/build/*
+tools/dist/*
+fourier.egg-info/*
+tools/fourier.egg-info/*

+ 1 - 1
tools/fourier/__init__.py

@@ -1 +1 @@
-__version__ = '1.0.7'
+__version__ = '1.0.9'

+ 2 - 2
tools/fourier/cli.py

@@ -228,12 +228,12 @@ def main():
             from fourier.migrations import versions
             from fourier.migrations import versions
 
 
             cursor = conn.cursor()
             cursor = conn.cursor()
-            for v, qrs in versions:
+            for item in versions:
+                v, qrs = item
                 if v > min_version:
                 if v > min_version:
                     try:
                     try:
                         for q in qrs:
                         for q in qrs:
                             cursor.execute(q)
                             cursor.execute(q)
-                        cursor.execute()
                     except Exception as ex:
                     except Exception as ex:
                         print('failed: {}'.format(ex))
                         print('failed: {}'.format(ex))
                         conn.rollback()
                         conn.rollback()

+ 7 - 1
tools/fourier/migrations.py

@@ -5,6 +5,12 @@ versions = [
             "create table config(name text primary key, value text)",
             "create table config(name text primary key, value text)",
             "insert into config (name, value) values ('version', '1')",
             "insert into config (name, value) values ('version', '1')",
             'create table "station"(remote_id text, indice int, status int)'
             'create table "station"(remote_id text, indice int, status int)'
-        ]
+        ],
     ),
     ),
+    (
+    	'2',
+        [
+        	'alter table "file" add column "priority" int not null default 0',
+        ]
+    )
 ]
 ]