Skip to content

Commit

Permalink
updating creation of table for user credentials
Browse files Browse the repository at this point in the history
  • Loading branch information
arash77 committed Dec 16, 2024
1 parent 2c4b62d commit b6ccdcb
Showing 1 changed file with 26 additions and 8 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -24,31 +24,49 @@
branch_labels = None
depends_on = None

table_name_1 = "user_credentials"
table_name_2 = "credentials"
user_credentials_table = "user_credentials"
user_credentials_group_table = "user_credentials_group"
credential_table = "credential"
user_credentials_group_association_table = "user_credentials_group_association"


def upgrade():
create_table(
table_name_1,
user_credentials_table,
Column("id", Integer, primary_key=True),
Column("user_id", Integer, index=True),
Column("service_reference", TrimmedString(255)),
Column("reference", TrimmedString(255)),
Column("source_type", TrimmedString(255)),
Column("source_id", TrimmedString(255)),
Column("current_group_id", Integer, index=True),
Column("create_time", DateTime),
Column("update_time", DateTime),
)
create_table(
table_name_2,
user_credentials_group_table,
Column("id", Integer, primary_key=True),
Column("name", TrimmedString(255)),
Column("create_time", DateTime),
Column("update_time", DateTime),
)
create_table(
credential_table,
Column("id", Integer, primary_key=True),
Column("user_credentials_id", Integer, index=True),
Column("name", TrimmedString(255)),
Column("type", TrimmedString(255)),
Column("value", TrimmedString(255)),
Column("create_time", DateTime),
Column("update_time", DateTime),
)
create_table(
user_credentials_group_association_table,
Column("user_credentials_id", Integer, index=True),
Column("user_credentials_group_id", Integer, index=True),
)


def downgrade():
drop_table(table_name_1)
drop_table(table_name_2)
drop_table(user_credentials_table)
drop_table(user_credentials_group_table)
drop_table(credential_table)
drop_table(user_credentials_group_association_table)

0 comments on commit b6ccdcb

Please sign in to comment.