Przeglądaj źródła

priority migration

Gamaliel Espinoza 8 lat temu
rodzic
commit
39e05fee9d
4 zmienionych plików z 15 dodań i 4 usunięć
  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
 
             cursor = conn.cursor()
-            for v, qrs in versions:
+            for item in versions:
+                v, qrs = item
                 if v > min_version:
                     try:
                         for q in qrs:
                             cursor.execute(q)
-                        cursor.execute()
                     except Exception as ex:
                         print('failed: {}'.format(ex))
                         conn.rollback()

+ 7 - 1
tools/fourier/migrations.py

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