mirror of
https://github.com/goharbor/harbor.git
synced 2024-09-06 11:08:11 +02:00
fix bugs
This commit is contained in:
parent
e7e23240f0
commit
919f11cec8
@ -27,9 +27,10 @@ branch_labels = None
|
|||||||
depends_on = None
|
depends_on = None
|
||||||
|
|
||||||
from alembic import op
|
from alembic import op
|
||||||
from datetime import datetime
|
|
||||||
from db_meta import *
|
from db_meta import *
|
||||||
|
|
||||||
|
from sqlalchemy.dialects import mysql
|
||||||
|
|
||||||
Session = sessionmaker()
|
Session = sessionmaker()
|
||||||
|
|
||||||
def upgrade():
|
def upgrade():
|
||||||
@ -44,12 +45,9 @@ def upgrade():
|
|||||||
session.add(Properties(k='schema_version', v='0.1.1'))
|
session.add(Properties(k='schema_version', v='0.1.1'))
|
||||||
|
|
||||||
#add column to table user
|
#add column to table user
|
||||||
op.add_column('user', sa.Column('creation_time', sa.DateTime(), nullable=True))
|
op.add_column('user', sa.Column('creation_time', mysql.TIMESTAMP, nullable=True))
|
||||||
op.add_column('user', sa.Column('sysadmin_flag', sa.Integer(), nullable=True))
|
op.add_column('user', sa.Column('sysadmin_flag', sa.Integer(), nullable=True))
|
||||||
op.add_column('user', sa.Column('update_time', sa.DateTime(), nullable=True))
|
op.add_column('user', sa.Column('update_time', mysql.TIMESTAMP, nullable=True))
|
||||||
|
|
||||||
#fill update_time data into table user
|
|
||||||
session.query(User).update({User.update_time: datetime.now()})
|
|
||||||
|
|
||||||
#init all sysadmin_flag = 0
|
#init all sysadmin_flag = 0
|
||||||
session.query(User).update({User.sysadmin_flag: 0})
|
session.query(User).update({User.sysadmin_flag: 0})
|
||||||
@ -88,11 +86,6 @@ def upgrade():
|
|||||||
session.delete(acc)
|
session.delete(acc)
|
||||||
session.query(Access).update({Access.access_id: Access.access_id - 1})
|
session.query(Access).update({Access.access_id: Access.access_id - 1})
|
||||||
|
|
||||||
#add column to table project
|
|
||||||
op.add_column('project', sa.Column('update_time', sa.DateTime(), nullable=True))
|
|
||||||
|
|
||||||
#fill update_time data into table project
|
|
||||||
session.query(Project).update({Project.update_time: datetime.now()})
|
|
||||||
session.commit()
|
session.commit()
|
||||||
|
|
||||||
def downgrade():
|
def downgrade():
|
||||||
|
Loading…
Reference in New Issue
Block a user