Browse Source

try to fix the CI and migration

pull/1/head
Dashie der otter 1 year ago
parent
commit
ae6596cd35

+ 14
- 0
.drone.yml View File

@@ -28,6 +28,20 @@ pipeline:
- flake8 .
- python setup.py test

migrations:
image: python:3-alpine
commands:
- apk -U add sox sox-dev taglib taglib-dev libmagic file-dev libffi libffi-dev
- apk add cmake gcc g++ make pkgconfig git boost-dev gd-dev libmad-dev libsndfile-dev libid3tag-dev wget postgresql-dev
- pip install --upgrade pip setuptools
- pip install --cache-dir=/cache flake8
- pip install --cache-dir=/cache black
- pip install --cache-dir=/cache -r requirements.txt
- python setup.py install
- psql -U postgres -h database -w -c 'CREATE DATABASE reel2bits'
- cp config.py.sample config.py
- flask db migrate

rebuild-cache:
image: drillster/drone-volume-cache
rebuild: true

+ 1
- 1
config.py.sample View File

@@ -25,7 +25,7 @@ SERVER_NAME = AP_DOMAIN
BASE_URL = "https://" + AP_DOMAIN

SQLALCHEMY_DATABASE_URI = \
'postgresql+psycopg2://user:password@localhost/reel2bits'
'postgresql+psycopg2://postgres@database/reel2bits'

# Should users confirm theire email address ?
SECURITY_CONFIRMABLE = True

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

@@ -14,7 +14,7 @@ from models import db, User # noqa: E402


def upgrade():
for user in User.query.all():
for user in db.session.query(User.id, User.slug, User.name).all():
# no need to slugify, the user name is restricted to a-Z0-9_
user.slug = user.name
db.session.commit()

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

@@ -1,4 +1,4 @@
"""Generate Actor for every User
"""Generate Actor for every User [SKIPPED]

Revision ID: d3c41a9e2688
Revises: 32f48de123f3
@@ -10,16 +10,9 @@ Create Date: 2018-08-05 10:47:58.540699
revision = "d3c41a9e2688"
down_revision = "32f48de123f3"

from models import db, User, create_actor # noqa: E402


def upgrade():
for user in User.query.all():
a = create_actor(user)
a.user = user
a.user_id = user.id
db.session.add(a)
db.session.commit()
pass


def downgrade():

+ 1
- 1
requirements.txt View File

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

Loading…
Cancel
Save