mirror of
https://github.com/yzernik/squeaknode.git
synced 2026-08-13 12:33:25 +02:00
Use new squeaklib with 32 byte pub key (#1970)
* Update squeaklib version * Clear database migrations
This commit is contained in:
parent
da891baf7f
commit
3ae9b84641
8 changed files with 19 additions and 125 deletions
|
|
@ -3,4 +3,4 @@ grpcio==1.39.0
|
|||
grpcio-tools==1.39.0
|
||||
importlib_resources==1.4.0
|
||||
pytest==6.2.5
|
||||
squeaklib==0.10.4
|
||||
squeaklib==0.11.0
|
||||
|
|
|
|||
|
|
@ -12,5 +12,5 @@ python-bitcoinlib==0.11.0
|
|||
pyzmq==22.3.0
|
||||
requests==2.26.0
|
||||
SQLAlchemy==1.4.25
|
||||
squeaklib==0.10.4
|
||||
squeaklib==0.11.0
|
||||
typed-config==0.2.5
|
||||
|
|
|
|||
|
|
@ -37,7 +37,7 @@ version_locations = %(here)s/alembic/versions
|
|||
# are written from script.py.mako
|
||||
# output_encoding = utf-8
|
||||
|
||||
sqlalchemy.url = sqlite://///home/yzernik/.sqk/data/testnet/data-v3.db
|
||||
sqlalchemy.url = sqlite://///home/yzernik/.sqk/data/testnet/data-v4.db
|
||||
|
||||
|
||||
[post_write_hooks]
|
||||
|
|
|
|||
|
|
@ -19,11 +19,11 @@
|
|||
# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||
# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
||||
# SOFTWARE.
|
||||
"""Initialize all v2.
|
||||
"""Initial migration
|
||||
|
||||
Revision ID: b6cf462aaf7c
|
||||
Revision ID: 691c8a25cda5
|
||||
Revises:
|
||||
Create Date: 2021-12-19 08:29:47.515179
|
||||
Create Date: 2022-02-27 21:10:50.785638
|
||||
|
||||
"""
|
||||
import sqlalchemy as sa
|
||||
|
|
@ -33,18 +33,15 @@ import squeaknode.db.models
|
|||
|
||||
|
||||
# revision identifiers, used by Alembic.
|
||||
revision = 'b6cf462aaf7c'
|
||||
revision = '691c8a25cda5'
|
||||
down_revision = None
|
||||
branch_labels = None
|
||||
depends_on = None
|
||||
|
||||
|
||||
def upgrade():
|
||||
# ### commands auto generated by Alembic - please adjust! ###
|
||||
op.create_table('config',
|
||||
sa.Column('username', sa.String(), nullable=False),
|
||||
sa.Column('twitter_bearer_token',
|
||||
sa.String(), nullable=True),
|
||||
sa.Column('sell_price_msat', sa.Integer(), nullable=True),
|
||||
sa.PrimaryKeyConstraint('username', name=op.f('pk_config'))
|
||||
)
|
||||
|
|
@ -70,7 +67,7 @@ def upgrade():
|
|||
sa.Column('profile_name', sa.String(), nullable=False),
|
||||
sa.Column('private_key', sa.LargeBinary(), nullable=True),
|
||||
sa.Column('public_key', sa.LargeBinary(
|
||||
length=33), nullable=False),
|
||||
length=32), nullable=False),
|
||||
sa.Column('following', sa.Boolean(), nullable=False),
|
||||
sa.Column('profile_image',
|
||||
sa.LargeBinary(), nullable=True),
|
||||
|
|
@ -202,7 +199,9 @@ def upgrade():
|
|||
sa.Column('block_height', sa.Integer(), nullable=False),
|
||||
sa.Column('time_s', sa.Integer(), nullable=False),
|
||||
sa.Column('author_public_key', sa.LargeBinary(
|
||||
length=33), nullable=False),
|
||||
length=32), nullable=False),
|
||||
sa.Column('recipient_public_key', sa.LargeBinary(
|
||||
length=32), nullable=True),
|
||||
sa.Column('secret_key', sa.LargeBinary(
|
||||
length=32), nullable=True),
|
||||
sa.Column('block_time_s', sa.Integer(), nullable=False),
|
||||
|
|
@ -214,24 +213,26 @@ def upgrade():
|
|||
with op.batch_alter_table('squeak', schema=None) as batch_op:
|
||||
batch_op.create_index(batch_op.f('ix_squeak_author_public_key'), [
|
||||
'author_public_key'], unique=False)
|
||||
batch_op.create_index(batch_op.f('ix_squeak_recipient_public_key'), [
|
||||
'recipient_public_key'], unique=False)
|
||||
|
||||
op.create_table('twitter_account',
|
||||
sa.Column('twitter_account_id',
|
||||
sa.Integer(), nullable=False),
|
||||
sa.Column('handle', sa.String(), nullable=False),
|
||||
sa.Column('profile_id', sa.Integer(), nullable=False),
|
||||
sa.Column('bearer_token', sa.String(), nullable=False),
|
||||
sa.PrimaryKeyConstraint('twitter_account_id',
|
||||
name=op.f('pk_twitter_account')),
|
||||
sa.UniqueConstraint('handle', name=op.f(
|
||||
'uq_twitter_account_handle'))
|
||||
)
|
||||
# ### end Alembic commands ###
|
||||
|
||||
|
||||
def downgrade():
|
||||
# ### commands auto generated by Alembic - please adjust! ###
|
||||
op.drop_table('twitter_account')
|
||||
with op.batch_alter_table('squeak', schema=None) as batch_op:
|
||||
batch_op.drop_index(batch_op.f('ix_squeak_recipient_public_key'))
|
||||
batch_op.drop_index(batch_op.f('ix_squeak_author_public_key'))
|
||||
|
||||
op.drop_table('squeak')
|
||||
|
|
@ -242,4 +243,3 @@ def downgrade():
|
|||
op.drop_table('profile')
|
||||
op.drop_table('peer')
|
||||
op.drop_table('config')
|
||||
# ### end Alembic commands ###
|
||||
|
|
@ -1,55 +0,0 @@
|
|||
# MIT License
|
||||
#
|
||||
# Copyright (c) 2020 Jonathan Zernik
|
||||
#
|
||||
# Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
# of this software and associated documentation files (the "Software"), to deal
|
||||
# in the Software without restriction, including without limitation the rights
|
||||
# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||
# copies of the Software, and to permit persons to whom the Software is
|
||||
# furnished to do so, subject to the following conditions:
|
||||
#
|
||||
# The above copyright notice and this permission notice shall be included in all
|
||||
# copies or substantial portions of the Software.
|
||||
#
|
||||
# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||
# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||
# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
||||
# SOFTWARE.
|
||||
"""Include bearer token in twitter account.
|
||||
|
||||
Revision ID: b78f8169d063
|
||||
Revises: b6cf462aaf7c
|
||||
Create Date: 2021-12-22 13:49:11.692654
|
||||
|
||||
"""
|
||||
import sqlalchemy as sa
|
||||
from alembic import op
|
||||
|
||||
|
||||
# revision identifiers, used by Alembic.
|
||||
revision = 'b78f8169d063'
|
||||
down_revision = 'b6cf462aaf7c'
|
||||
branch_labels = None
|
||||
depends_on = None
|
||||
|
||||
|
||||
def upgrade():
|
||||
with op.batch_alter_table('config', schema=None) as batch_op:
|
||||
batch_op.drop_column('twitter_bearer_token')
|
||||
|
||||
with op.batch_alter_table('twitter_account', schema=None) as batch_op:
|
||||
batch_op.add_column(sa.Column('bearer_token', sa.String(
|
||||
), nullable=False, server_default=sa.text("''")))
|
||||
|
||||
|
||||
def downgrade():
|
||||
with op.batch_alter_table('twitter_account', schema=None) as batch_op:
|
||||
batch_op.drop_column('bearer_token')
|
||||
|
||||
with op.batch_alter_table('config', schema=None) as batch_op:
|
||||
batch_op.add_column(
|
||||
sa.Column('twitter_bearer_token', sa.VARCHAR(), nullable=True))
|
||||
|
|
@ -1,51 +0,0 @@
|
|||
# MIT License
|
||||
#
|
||||
# Copyright (c) 2020 Jonathan Zernik
|
||||
#
|
||||
# Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
# of this software and associated documentation files (the "Software"), to deal
|
||||
# in the Software without restriction, including without limitation the rights
|
||||
# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||
# copies of the Software, and to permit persons to whom the Software is
|
||||
# furnished to do so, subject to the following conditions:
|
||||
#
|
||||
# The above copyright notice and this permission notice shall be included in all
|
||||
# copies or substantial portions of the Software.
|
||||
#
|
||||
# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||
# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||
# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
||||
# SOFTWARE.
|
||||
"""Add recipient public key column to squeaks table.
|
||||
|
||||
Revision ID: c0760e8ce4ba
|
||||
Revises: b78f8169d063
|
||||
Create Date: 2021-12-26 14:13:00.159229
|
||||
|
||||
"""
|
||||
import sqlalchemy as sa
|
||||
from alembic import op
|
||||
|
||||
|
||||
# revision identifiers, used by Alembic.
|
||||
revision = 'c0760e8ce4ba'
|
||||
down_revision = 'b78f8169d063'
|
||||
branch_labels = None
|
||||
depends_on = None
|
||||
|
||||
|
||||
def upgrade():
|
||||
with op.batch_alter_table('squeak', schema=None) as batch_op:
|
||||
batch_op.add_column(sa.Column('recipient_public_key',
|
||||
sa.LargeBinary(length=33), nullable=True))
|
||||
batch_op.create_index(batch_op.f('ix_squeak_recipient_public_key'), [
|
||||
'recipient_public_key'], unique=False)
|
||||
|
||||
|
||||
def downgrade():
|
||||
with op.batch_alter_table('squeak', schema=None) as batch_op:
|
||||
batch_op.drop_index(batch_op.f('ix_squeak_recipient_public_key'))
|
||||
batch_op.drop_column('recipient_public_key')
|
||||
|
|
@ -24,7 +24,7 @@ from pathlib import Path
|
|||
from sqlalchemy import create_engine
|
||||
|
||||
|
||||
DB_FILE = "data-v3.db"
|
||||
DB_FILE = "data-v4.db"
|
||||
|
||||
|
||||
def get_engine(connection_string):
|
||||
|
|
|
|||
|
|
@ -75,9 +75,9 @@ class Models:
|
|||
Column("block_height", Integer, nullable=False),
|
||||
Column("time_s", Integer, nullable=False),
|
||||
Column("author_public_key", LargeBinary(
|
||||
33), index=True, nullable=False),
|
||||
32), index=True, nullable=False),
|
||||
Column("recipient_public_key", LargeBinary(
|
||||
33), index=True, nullable=True),
|
||||
32), index=True, nullable=True),
|
||||
Column("secret_key", LargeBinary(32), nullable=True),
|
||||
Column("block_time_s", Integer, nullable=False),
|
||||
Column("liked_time_ms", SLBigInteger, default=None, nullable=True),
|
||||
|
|
@ -91,7 +91,7 @@ class Models:
|
|||
Column("created_time_ms", SLBigInteger, nullable=False),
|
||||
Column("profile_name", String, unique=True, nullable=False),
|
||||
Column("private_key", LargeBinary, nullable=True),
|
||||
Column("public_key", LargeBinary(33), unique=True, nullable=False),
|
||||
Column("public_key", LargeBinary(32), unique=True, nullable=False),
|
||||
Column("following", Boolean, nullable=False),
|
||||
Column("profile_image", LargeBinary, nullable=True),
|
||||
sqlite_autoincrement=True,
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue