-
Notifications
You must be signed in to change notification settings - Fork 90
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
7 changed files
with
193 additions
and
36 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
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
84 changes: 84 additions & 0 deletions
84
tests/example_apps/music/piccolo_migrations/music_2024_05_28t23_15_41_018844.py
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,84 @@ | ||
from piccolo.apps.migrations.auto.migration_manager import MigrationManager | ||
from piccolo.columns.base import OnDelete, OnUpdate | ||
from piccolo.columns.column_types import ForeignKey, Serial, Varchar | ||
from piccolo.columns.indexes import IndexMethod | ||
from piccolo.table import Table | ||
|
||
|
||
class RecordingStudio(Table, tablename="recording_studio", schema=None): | ||
id = Serial( | ||
null=False, | ||
primary_key=True, | ||
unique=False, | ||
index=False, | ||
index_method=IndexMethod.btree, | ||
choices=None, | ||
db_column_name="id", | ||
secret=False, | ||
) | ||
|
||
|
||
ID = "2024-05-28T23:15:41:018844" | ||
VERSION = "1.5.1" | ||
DESCRIPTION = "" | ||
|
||
|
||
async def forwards(): | ||
manager = MigrationManager( | ||
migration_id=ID, app_name="music", description=DESCRIPTION | ||
) | ||
|
||
manager.add_table( | ||
class_name="Instrument", | ||
tablename="instrument", | ||
schema=None, | ||
columns=None, | ||
) | ||
|
||
manager.add_column( | ||
table_class_name="Instrument", | ||
tablename="instrument", | ||
column_name="name", | ||
db_column_name="name", | ||
column_class_name="Varchar", | ||
column_class=Varchar, | ||
params={ | ||
"length": 255, | ||
"default": "", | ||
"null": False, | ||
"primary_key": False, | ||
"unique": False, | ||
"index": False, | ||
"index_method": IndexMethod.btree, | ||
"choices": None, | ||
"db_column_name": None, | ||
"secret": False, | ||
}, | ||
schema=None, | ||
) | ||
|
||
manager.add_column( | ||
table_class_name="Instrument", | ||
tablename="instrument", | ||
column_name="recording_studio", | ||
db_column_name="recording_studio", | ||
column_class_name="ForeignKey", | ||
column_class=ForeignKey, | ||
params={ | ||
"references": RecordingStudio, | ||
"on_delete": OnDelete.cascade, | ||
"on_update": OnUpdate.cascade, | ||
"target_column": None, | ||
"null": True, | ||
"primary_key": False, | ||
"unique": False, | ||
"index": False, | ||
"index_method": IndexMethod.btree, | ||
"choices": None, | ||
"db_column_name": None, | ||
"secret": False, | ||
}, | ||
schema=None, | ||
) | ||
|
||
return manager |
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