Skip to content

Commit b9ed9db

Browse files
committed
update env.py, models.py
1 parent 53332c1 commit b9ed9db

5 files changed

Lines changed: 19 additions & 15 deletions

File tree

lib/freebies.db

0 Bytes
Binary file not shown.

lib/migrations/env.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -66,7 +66,7 @@ def run_migrations_online() -> None:
6666

6767
with connectable.connect() as connection:
6868
context.configure(
69-
connection=connection, target_metadata=target_metadata
69+
connection=connection, target_metadata=target_metadata, render_as_batch=True,
7070
)
7171

7272
with context.begin_transaction():

lib/migrations/versions/ee905476242e_add_companies_devs_tables.py renamed to lib/migrations/versions/5f72c58bf48c_create_companies_devs.py

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,17 +1,17 @@
1-
"""add companies, devs tables
1+
"""create companies, devs
22
3-
Revision ID: ee905476242e
4-
Revises: c4d7867d81f5
5-
Create Date: 2022-11-02 14:15:14.386683
3+
Revision ID: 5f72c58bf48c
4+
Revises: 7a71dbf71c64
5+
Create Date: 2023-03-15 15:06:20.944586
66
77
"""
88
from alembic import op
99
import sqlalchemy as sa
1010

1111

1212
# revision identifiers, used by Alembic.
13-
revision = 'ee905476242e'
14-
down_revision = 'c4d7867d81f5'
13+
revision = '5f72c58bf48c'
14+
down_revision = '7a71dbf71c64'
1515
branch_labels = None
1616
depends_on = None
1717

lib/migrations/versions/c4d7867d81f5_create_freebies_db.py renamed to lib/migrations/versions/7a71dbf71c64_create_db.py

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,16 +1,16 @@
1-
"""create freebies.db
1+
"""create db
22
3-
Revision ID: c4d7867d81f5
3+
Revision ID: 7a71dbf71c64
44
Revises:
5-
Create Date: 2022-11-02 14:14:44.979104
5+
Create Date: 2023-03-15 15:05:55.516631
66
77
"""
88
from alembic import op
99
import sqlalchemy as sa
1010

1111

1212
# revision identifiers, used by Alembic.
13-
revision = 'c4d7867d81f5'
13+
revision = '7a71dbf71c64'
1414
down_revision = None
1515
branch_labels = None
1616
depends_on = None

lib/models.py

Lines changed: 8 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,13 @@
1-
#!/usr/bin/env python3
2-
3-
from sqlalchemy import (Column, String, Integer)
1+
from sqlalchemy import ForeignKey, Column, Integer, String, MetaData
2+
from sqlalchemy.orm import relationship, backref
43
from sqlalchemy.ext.declarative import declarative_base
54

6-
Base = declarative_base()
5+
convention = {
6+
"fk": "fk_%(table_name)s_%(column_0_name)s_%(referred_table_name)s",
7+
}
8+
metadata = MetaData(naming_convention=convention)
9+
10+
Base = declarative_base(metadata=metadata)
711

812
class Company(Base):
913
__tablename__ = 'companies'

0 commit comments

Comments
 (0)