Skip to content

Faild to run migrations after adding new columns to Table #594

Answered by dantownsend
Tar8117 asked this question in Q&A
Discussion options

You must be logged in to vote

What you've done should work OK.

Your first migration file should look something like this (note how there's an add_table and several add_column):

from piccolo.apps.migrations.auto.migration_manager import MigrationManager
from piccolo.columns.column_types import Integer
from piccolo.columns.column_types import Varchar
from piccolo.columns.indexes import IndexMethod


ID = "2022-08-19T23:36:27:820870"
VERSION = "0.85.1"
DESCRIPTION = ""


async def forwards():
    manager = MigrationManager(
        migration_id=ID, app_name="home", description=DESCRIPTION
    )

    manager.add_table("Student", tablename="student")

    manager.add_column(
        table_class_name="Student",
        tabl…

Replies: 1 comment 2 replies

Comment options

You must be logged in to vote
2 replies
@Tar8117
Comment options

@dantownsend
Comment options

Answer selected by Tar8117
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
2 participants