mirror of
https://github.com/goharbor/harbor.git
synced 2024-11-23 10:45:45 +01:00
commit
7bf39537f1
@ -12,8 +12,8 @@ class User(Base):
|
||||
__tablename__ = 'user'
|
||||
|
||||
user_id = sa.Column(sa.Integer, primary_key=True)
|
||||
username = sa.Column(sa.String(15), unique=True)
|
||||
email = sa.Column(sa.String(30), unique=True)
|
||||
username = sa.Column(sa.String(255), unique=True)
|
||||
email = sa.Column(sa.String(255), unique=True)
|
||||
password = sa.Column(sa.String(40), nullable=False)
|
||||
realname = sa.Column(sa.String(255), nullable=False)
|
||||
comment = sa.Column(sa.String(30))
|
||||
@ -106,7 +106,7 @@ class ReplicationTarget(Base):
|
||||
id = sa.Column(sa.Integer, primary_key=True)
|
||||
name = sa.Column(sa.String(64))
|
||||
url = sa.Column(sa.String(64))
|
||||
username = sa.Column(sa.String(40))
|
||||
username = sa.Column(sa.String(255))
|
||||
password = sa.Column(sa.String(40))
|
||||
target_type = sa.Column(mysql.TINYINT(1), nullable=False, server_default=sa.text("'0'"))
|
||||
creation_time = sa.Column(mysql.TIMESTAMP, server_default = sa.text("CURRENT_TIMESTAMP"))
|
||||
@ -144,7 +144,7 @@ class AccessLog(Base):
|
||||
|
||||
user_id = sa.Column(sa.Integer, nullable=False)
|
||||
log_id = sa.Column(sa.Integer, primary_key=True)
|
||||
username = sa.Column(sa.String(32), nullable=False)
|
||||
username = sa.Column(sa.String(255), nullable=False)
|
||||
project_id = sa.Column(sa.Integer, nullable=False)
|
||||
repo_name = sa.Column(sa.String(256))
|
||||
repo_tag = sa.Column(sa.String(128))
|
||||
|
@ -46,7 +46,7 @@ def upgrade():
|
||||
op.drop_constraint('access_log_ibfk_2', 'access_log', type_='foreignkey')
|
||||
|
||||
#add colume username to access_log
|
||||
op.add_column('access_log', sa.Column('username', mysql.VARCHAR(32), nullable=False))
|
||||
op.add_column('access_log', sa.Column('username', mysql.VARCHAR(255), nullable=False))
|
||||
|
||||
#init username
|
||||
session.query(AccessLog).update({AccessLog.username: ""})
|
||||
@ -56,6 +56,12 @@ def upgrade():
|
||||
for user in user_all:
|
||||
session.query(AccessLog).filter(AccessLog.user_id == user.user_id).update({AccessLog.username: user.username}, synchronize_session='fetch')
|
||||
|
||||
#update user.username length to 255
|
||||
op.alter_column('user', 'username', type_=sa.String(255), existing_type=sa.String(32))
|
||||
|
||||
#update replication_target.username length to 255
|
||||
op.alter_column('replication_target', 'username', type_=sa.String(255), existing_type=sa.String(40))
|
||||
|
||||
op.drop_column("access_log", "user_id")
|
||||
op.drop_column("repository", "owner_id")
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user