Browse Source

try to fix the CI and migration

Dashie der otter 3 months ago
parent
commit
ae6596cd35

+ 14
- 0
.drone.yml View File

@@ -28,6 +28,20 @@ pipeline:
28 28
       - flake8 .
29 29
       - python setup.py test
30 30
 
31
+  migrations:
32
+    image: python:3-alpine
33
+    commands:
34
+      - apk -U add sox sox-dev taglib taglib-dev libmagic file-dev libffi libffi-dev
35
+      - apk add cmake gcc g++ make pkgconfig git boost-dev gd-dev libmad-dev libsndfile-dev libid3tag-dev wget postgresql-dev
36
+      - pip install --upgrade pip setuptools
37
+      - pip install --cache-dir=/cache flake8
38
+      - pip install --cache-dir=/cache black
39
+      - pip install --cache-dir=/cache -r requirements.txt
40
+      - python setup.py install
41
+      - psql -U postgres -h database -w -c 'CREATE DATABASE reel2bits'
42
+      - cp config.py.sample config.py
43
+      - flask db migrate
44
+
31 45
   rebuild-cache:
32 46
       image: drillster/drone-volume-cache
33 47
       rebuild: true

+ 1
- 1
config.py.sample View File

@@ -25,7 +25,7 @@ SERVER_NAME = AP_DOMAIN
25 25
 BASE_URL = "https://" + AP_DOMAIN
26 26
 
27 27
 SQLALCHEMY_DATABASE_URI = \
28
-    'postgresql+psycopg2://user:password@localhost/reel2bits'
28
+    'postgresql+psycopg2://postgres@database/reel2bits'
29 29
 
30 30
 # Should users confirm theire email address ?
31 31
 SECURITY_CONFIRMABLE = True

+ 1
- 1
migrations/versions/24_be5369fae219_.py View File

@@ -14,7 +14,7 @@ from models import db, User  # noqa: E402
14 14
 
15 15
 
16 16
 def upgrade():
17
-    for user in User.query.all():
17
+    for user in db.session.query(User.id, User.slug, User.name).all():
18 18
         # no need to slugify, the user name is restricted to a-Z0-9_
19 19
         user.slug = user.name
20 20
     db.session.commit()

+ 2
- 9
migrations/versions/26_d3c41a9e2688_.py View File

@@ -1,4 +1,4 @@
1
-"""Generate Actor for every User
1
+"""Generate Actor for every User [SKIPPED]
2 2
 
3 3
 Revision ID: d3c41a9e2688
4 4
 Revises: 32f48de123f3
@@ -10,16 +10,9 @@ Create Date: 2018-08-05 10:47:58.540699
10 10
 revision = "d3c41a9e2688"
11 11
 down_revision = "32f48de123f3"
12 12
 
13
-from models import db, User, create_actor  # noqa: E402
14
-
15 13
 
16 14
 def upgrade():
17
-    for user in User.query.all():
18
-        a = create_actor(user)
19
-        a.user = user
20
-        a.user_id = user.id
21
-        db.session.add(a)
22
-    db.session.commit()
15
+    pass
23 16
 
24 17
 
25 18
 def downgrade():

+ 1
- 1
requirements.txt View File

@@ -24,4 +24,4 @@ sqlalchemy_searchable
24 24
 flask_debugtoolbar
25 25
 redis
26 26
 flask-accept
27
-git+https://github.com/tsileo/little-boxes/
27
+git+https://github.com/tsileo/little-boxes/#egg=little-boxes

Loading…
Cancel
Save