-
Notifications
You must be signed in to change notification settings - Fork 0
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 #68 from boris/fix-db-migrations
Reset DB migrations
- Loading branch information
Showing
5 changed files
with
96 additions
and
35 deletions.
There are no files selected for viewing
Binary file not shown.
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,96 @@ | ||
"""empty message | ||
Revision ID: 7579ecdfb08c | ||
Revises: | ||
Create Date: 2024-01-24 10:20:05.764648 | ||
""" | ||
from alembic import op | ||
import sqlalchemy as sa | ||
|
||
|
||
# revision identifiers, used by Alembic. | ||
revision = '7579ecdfb08c' | ||
down_revision = None | ||
branch_labels = None | ||
depends_on = None | ||
|
||
|
||
def upgrade(): | ||
# ### commands auto generated by Alembic - please adjust! ### | ||
op.create_table('author', | ||
sa.Column('id', sa.Integer(), autoincrement=True, nullable=False), | ||
sa.Column('name', sa.String(length=255), nullable=False), | ||
sa.Column('country', sa.String(length=255), nullable=True), | ||
sa.PrimaryKeyConstraint('id') | ||
) | ||
op.create_table('editorial', | ||
sa.Column('id', sa.Integer(), autoincrement=True, nullable=False), | ||
sa.Column('name', sa.String(length=255), nullable=False), | ||
sa.PrimaryKeyConstraint('id') | ||
) | ||
op.create_table('genre', | ||
sa.Column('id', sa.Integer(), autoincrement=True, nullable=False), | ||
sa.Column('name', sa.String(length=255), nullable=False), | ||
sa.PrimaryKeyConstraint('id', 'name') | ||
) | ||
op.create_table('quotes', | ||
sa.Column('id', sa.Integer(), autoincrement=True, nullable=False), | ||
sa.Column('quote', sa.Text(), nullable=False), | ||
sa.Column('owner', sa.String(length=255), nullable=False), | ||
sa.PrimaryKeyConstraint('id') | ||
) | ||
op.create_table('tag', | ||
sa.Column('id', sa.Integer(), autoincrement=True, nullable=False), | ||
sa.Column('name', sa.String(length=255), nullable=False), | ||
sa.PrimaryKeyConstraint('id', 'name') | ||
) | ||
op.create_table('user', | ||
sa.Column('id', sa.Integer(), autoincrement=True, nullable=False), | ||
sa.Column('email', sa.String(length=100), nullable=False), | ||
sa.Column('name', sa.String(length=100), nullable=False), | ||
sa.Column('password_hash', sa.String(length=120), nullable=True), | ||
sa.PrimaryKeyConstraint('id'), | ||
sa.UniqueConstraint('email') | ||
) | ||
op.create_table('book', | ||
sa.Column('id', sa.Integer(), autoincrement=True, nullable=False), | ||
sa.Column('title', sa.String(length=255), nullable=False), | ||
sa.Column('year', sa.Integer(), nullable=True), | ||
sa.Column('pages', sa.Integer(), nullable=True), | ||
sa.Column('read', sa.Boolean(), nullable=True), | ||
sa.Column('shared', sa.Boolean(), nullable=True), | ||
sa.Column('rating', sa.Integer(), nullable=True), | ||
sa.Column('review', sa.Text(), nullable=True), | ||
sa.Column('isbn', sa.String(length=255), nullable=True), | ||
sa.Column('id_user', sa.Integer(), nullable=False), | ||
sa.Column('id_author', sa.Integer(), nullable=False), | ||
sa.Column('id_editorial', sa.Integer(), nullable=False), | ||
sa.Column('id_genre', sa.Integer(), nullable=False), | ||
sa.ForeignKeyConstraint(['id_author'], ['author.id'], ), | ||
sa.ForeignKeyConstraint(['id_editorial'], ['editorial.id'], ), | ||
sa.ForeignKeyConstraint(['id_genre'], ['genre.id'], ), | ||
sa.ForeignKeyConstraint(['id_user'], ['user.id'], ), | ||
sa.PrimaryKeyConstraint('id') | ||
) | ||
op.create_table('books_tags', | ||
sa.Column('id_tag', sa.Integer(), nullable=False), | ||
sa.Column('id_book', sa.Integer(), nullable=False), | ||
sa.ForeignKeyConstraint(['id_book'], ['book.id'], ), | ||
sa.ForeignKeyConstraint(['id_tag'], ['tag.id'], ), | ||
sa.PrimaryKeyConstraint('id_tag', 'id_book') | ||
) | ||
# ### end Alembic commands ### | ||
|
||
|
||
def downgrade(): | ||
# ### commands auto generated by Alembic - please adjust! ### | ||
op.drop_table('books_tags') | ||
op.drop_table('book') | ||
op.drop_table('user') | ||
op.drop_table('tag') | ||
op.drop_table('quotes') | ||
op.drop_table('genre') | ||
op.drop_table('editorial') | ||
op.drop_table('author') | ||
# ### end Alembic commands ### |
Binary file not shown.
Binary file not shown.
This file was deleted.
Oops, something went wrong.