-
Notifications
You must be signed in to change notification settings - Fork 13
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #60 from turb0c0w/tyler/registrations_pagination
Tyler/registrations pagination
- Loading branch information
Showing
16 changed files
with
1,285 additions
and
56 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,36 @@ | ||
"""empty message | ||
Revision ID: 269514c7d861 | ||
Revises: ed33e07431ea | ||
Create Date: 2024-07-14 22:20:59.662520 | ||
""" | ||
from alembic import op | ||
import sqlalchemy as sa | ||
from sqlalchemy.dialects import postgresql | ||
|
||
# revision identifiers, used by Alembic. | ||
revision = '269514c7d861' | ||
down_revision = 'ed33e07431ea' | ||
branch_labels = None | ||
depends_on = None | ||
|
||
|
||
def upgrade(): | ||
op.create_table('certificates', | ||
sa.Column('id', sa.INTEGER(), autoincrement=True, nullable=False), | ||
sa.Column('registration_id', sa.INTEGER(), nullable=False), | ||
sa.Column('registration_number', sa.VARCHAR(), nullable=False, unique=True), | ||
sa.Column('creation_date', postgresql.TIMESTAMP( | ||
), nullable=False, server_default=sa.text('(NOW())')), | ||
sa.Column('expiry_date', postgresql.TIMESTAMP( | ||
), nullable=False, server_default=sa.text("(NOW() + interval '1 year')")), | ||
sa.Column('certificate', postgresql.BYTEA(), nullable=False), | ||
sa.PrimaryKeyConstraint('id'), | ||
sa.ForeignKeyConstraint(['registration_id'], [ | ||
'registrations.id'], name='certificates_registration_id_fkey') | ||
) | ||
|
||
|
||
def downgrade(): | ||
op.drop_table('certificates') |
Large diffs are not rendered by default.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,21 @@ | ||
""" | ||
ORM Mapping for Certificate Records | ||
""" | ||
from __future__ import annotations | ||
|
||
from sqlalchemy.sql import text | ||
|
||
from .db import db | ||
|
||
|
||
class Certificate(db.Model): | ||
"""Certificate Record""" | ||
|
||
__tablename__ = "certificates" | ||
|
||
id = db.Column(db.Integer, primary_key=True, autoincrement=True) | ||
registration_id = db.Column(db.Integer, db.ForeignKey("registrations.id"), nullable=False) | ||
registration_number = db.Column(db.String, nullable=False) | ||
creation_date = db.Column(db.DateTime, nullable=False, server_default=text("(NOW())")) | ||
expiry_date = db.Column(db.DateTime, nullable=False, server_default=text("(NOW() + interval '1 year')")) | ||
certificate = db.Column(db.LargeBinary, nullable=False) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.