We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent 2df0517 commit 343e0a9Copy full SHA for 343e0a9
Dockerfile
@@ -5,7 +5,7 @@ WORKDIR /app
5
6
COPY . .
7
8
-RUN apk add build-base libffi-dev
+RUN apk add build-base libffi-dev postgresql-dev
9
10
RUN \
11
cd /app && \
README.md
@@ -58,6 +58,14 @@ The recommended way of running is to pull the image from [Docker Hub](https://hu
58
|---|---|
59
| /app/config | Used to store DB and environment variables. This is not needed if you pass in all of the above environment variables. |
60
61
+#### Database setup
62
+**MySQL**
63
+Set DATABASE_URI connect string as `mysql+pymysql://user:pass@some_mariadb/dbname?charset=utf8mb4`
64
+
65
66
+**PostgreSQL**
67
+Set DATABASE_URI connect string as `postgresql+psycopg2://user:pass@host/dbname?client_encoding=utf8`
68
69
70
#### Docker Run
71
By default, the easiest way to get running is:
app/models.py
@@ -62,9 +62,9 @@ class Meta(db.Model):
uuid = db.Column(GUID, primary_key=True, index=True, unique=True, default=lambda: uuid.uuid4())
user_id = db.Column(GUID, db.ForeignKey('user.uuid'), nullable=False)
note_id = db.Column(GUID, db.ForeignKey('note.uuid'), nullable=False)
- name_encrypted = db.Column('name', db.String)
- name_compare = db.Column(db.String)
- kind = db.Column(db.String)
+ name_encrypted = db.Column('name', db.String(512))
+ name_compare = db.Column(db.String(512))
+ kind = db.Column(db.String(128))
@hybrid_property
def name(self):
@@ -90,7 +90,7 @@ def serialize(self):
90
class Note(db.Model):
91
92
93
- data = db.Column(db.String)
+ data = db.Column(db.Text())
94
title = db.Column(db.String(128), nullable=False)
95
date = db.Column(db.DateTime(timezone=True), server_default=func.now())
96
is_date = db.Column(db.Boolean, default=False)
docker-compose.yml
@@ -10,4 +10,5 @@ services:
- ./dailynotes-volume:/app/config
environment:
12
API_SECRET_KEY: CHANGE_THIS_WITH_SECURE_PASSWORD
13
- DB_ENCRYPTION_KEY: CHANGE_THIS_WITH_SECURE_PASSWORD
+ DB_ENCRYPTION_KEY: CHANGE_THIS_WITH_SECURE_PASSWORD
14
+ DATABASE_URI: CHANGE_THIS_WITH_YOUR_DATABASE_URL, OR REMOVE IT IF YOU USE SQLITE
migrations/versions/7bd1ee1840ca_meta_table.py
@@ -23,9 +23,9 @@ def upgrade():
23
sa.Column('uuid', app.model_types.GUID(), nullable=False),
24
sa.Column('user_id', app.model_types.GUID(), nullable=False),
25
sa.Column('note_id', app.model_types.GUID(), nullable=False),
26
- sa.Column('name', sa.String(), nullable=True),
27
- sa.Column('name_compare', sa.String(), nullable=True),
28
- sa.Column('kind', sa.String(), nullable=True),
+ sa.Column('name', sa.String(128), nullable=True),
+ sa.Column('name_compare', sa.String(512), nullable=True),
+ sa.Column('kind', sa.String(128), nullable=True),
29
sa.ForeignKeyConstraint(['note_id'], ['note.uuid'], ),
30
sa.ForeignKeyConstraint(['user_id'], ['user.uuid'], ),
31
sa.PrimaryKeyConstraint('uuid')
migrations/versions/9ca5901af374_cleanup.py
@@ -29,7 +29,7 @@ def upgrade():
def downgrade():
# ### commands auto generated by Alembic - please adjust! ###
with op.batch_alter_table('note', schema=None) as batch_op:
32
- batch_op.add_column(sa.Column('tags', sa.VARCHAR(), nullable=True))
33
- batch_op.add_column(sa.Column('projects', sa.VARCHAR(), nullable=True))
+ batch_op.add_column(sa.Column('tags', sa.VARCHAR(128), nullable=True))
+ batch_op.add_column(sa.Column('projects', sa.VARCHAR(128), nullable=True))
34
35
# ### end Alembic commands ###
migrations/versions/a477f34dbaa4_initial_config.py
@@ -29,10 +29,10 @@ def upgrade():
op.create_index(op.f('ix_user_uuid'), 'user', ['uuid'], unique=True)
op.create_table('note',
- sa.Column('tags', sa.String(), nullable=True),
- sa.Column('projects', sa.String(), nullable=True),
+ sa.Column('tags', sa.String(128), nullable=True),
+ sa.Column('projects', sa.String(128), nullable=True),
- sa.Column('data', sa.String(), nullable=True),
+ sa.Column('data', sa.Text(), nullable=True),
36
sa.Column('title', sa.String(length=128), nullable=False),
37
sa.Column('date', sa.DateTime(timezone=True), server_default=sa.text(u'(CURRENT_TIMESTAMP)'), nullable=True),
38
sa.Column('is_date', sa.Boolean(), nullable=True),
requirements.txt
@@ -4,4 +4,6 @@ flask-migrate
4
flask-jwt-extended
flask-argon2
python-frontmatter
-pycrypto
+pycrypto
+PyMySQL
+psycopg2-binary
0 commit comments