Compare commits
2 Commits
500ab56be0
...
d76d1afd9d
| Author | SHA1 | Date | |
|---|---|---|---|
| d76d1afd9d | |||
| 7c895c8191 |
5
.gitignore
vendored
5
.gitignore
vendored
@@ -16,3 +16,8 @@ target/
|
|||||||
# and can be added to the global gitignore or merged into this file. For a more nuclear
|
# and can be added to the global gitignore or merged into this file. For a more nuclear
|
||||||
# option (not recommended) you can uncomment the following to ignore the entire idea folder.
|
# option (not recommended) you can uncomment the following to ignore the entire idea folder.
|
||||||
#.idea/
|
#.idea/
|
||||||
|
|
||||||
|
# ignorable files in migrations/
|
||||||
|
**/__pycache__
|
||||||
|
migrations/env/
|
||||||
|
migrations/test_db.sqlite
|
||||||
|
|||||||
@@ -86,7 +86,7 @@ path_separator = os
|
|||||||
# database URL. This is consumed by the user-maintained env.py script only.
|
# database URL. This is consumed by the user-maintained env.py script only.
|
||||||
# other means of configuring database URLs may be customized within the env.py
|
# other means of configuring database URLs may be customized within the env.py
|
||||||
# file.
|
# file.
|
||||||
sqlalchemy.url = driver://user:pass@localhost/dbname
|
sqlalchemy.url = sqlite+pysqlite:///test_db.sqlite
|
||||||
|
|
||||||
|
|
||||||
[post_write_hooks]
|
[post_write_hooks]
|
||||||
|
|||||||
@@ -0,0 +1,48 @@
|
|||||||
|
"""initial outline-rs schema
|
||||||
|
|
||||||
|
Revision ID: 040713502ba4
|
||||||
|
Revises:
|
||||||
|
Create Date: 2026-03-30 10:47:36.255978
|
||||||
|
|
||||||
|
"""
|
||||||
|
from typing import Sequence, Union
|
||||||
|
|
||||||
|
from alembic import op
|
||||||
|
import sqlalchemy as sa
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
# revision identifiers, used by Alembic.
|
||||||
|
revision: str = '040713502ba4'
|
||||||
|
down_revision: Union[str, Sequence[str], None] = None
|
||||||
|
branch_labels: Union[str, Sequence[str], None] = None
|
||||||
|
depends_on: Union[str, Sequence[str], None] = None
|
||||||
|
|
||||||
|
|
||||||
|
def upgrade() -> None:
|
||||||
|
"""Upgrade schema."""
|
||||||
|
|
||||||
|
# block table holds individual bullet points in the outline
|
||||||
|
op.create_table(
|
||||||
|
"blocks",
|
||||||
|
sa.Column("id", sa.INTEGER, primary_key=True),
|
||||||
|
sa.Column("first_child_id", sa.INTEGER, sa.schema.ForeignKey("blocks.id")),
|
||||||
|
sa.Column("next_sibling_id", sa.INTEGER, sa.schema.ForeignKey("blocks.id")),
|
||||||
|
sa.Column("page_id", sa.INTEGER, sa.schema.ForeignKey("pages.id"), index=True),
|
||||||
|
sa.Column("content", sa.types.UnicodeText)
|
||||||
|
)
|
||||||
|
|
||||||
|
op.create_table(
|
||||||
|
"pages",
|
||||||
|
sa.Column("id", sa.INTEGER, primary_key=True),
|
||||||
|
sa.Column("root_block_id", sa.INTEGER, sa.schema.ForeignKey("blocks.id")),
|
||||||
|
sa.Column("title", sa.types.UnicodeText)
|
||||||
|
)
|
||||||
|
pass
|
||||||
|
|
||||||
|
|
||||||
|
def downgrade() -> None:
|
||||||
|
"""Downgrade schema."""
|
||||||
|
op.drop_table("blocks")
|
||||||
|
op.drop_table("pages")
|
||||||
|
pass
|
||||||
Reference in New Issue
Block a user