Skip to content
GitLab
Projects
Groups
Snippets
/
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Sign in / Register
Toggle navigation
Menu
Open sidebar
noc
noc
Commits
6ce8bf0b
Verified
Commit
6ce8bf0b
authored
Aug 19, 2019
by
Dmitry Volodin
Browse files
Ensure User.last_login is nullable
parent
983eef3d
Pipeline
#15366
failed with stages
in 1 minute and 4 seconds
Changes
1
Pipelines
2
Hide whitespace changes
Inline
Side-by-side
aaa/migrations/0008_user_last_login_null.py
0 → 100644
View file @
6ce8bf0b
# -*- coding: utf-8 -*-
# ----------------------------------------------------------------------
# Set auth_user.last_login to NULLable
# ----------------------------------------------------------------------
# Copyright (C) 2007-2019 The NOC Project
# See LICENSE for details
# ----------------------------------------------------------------------
# NOC modules
from
noc.core.migration.base
import
BaseMigration
class
Migration
(
BaseMigration
):
def
migrate
(
self
):
is_nullable
=
self
.
db
.
execute
(
"""
SELECT is_nullable = 'YES'
FROM information_schema.columns
WHERE
table_name = 'auth_user'
AND column_name = 'last_login'
"""
)[
0
][
0
]
if
is_nullable
:
return
self
.
db
.
execute
(
"""
ALTER TABLE auth_user
ALTER last_login
DROP NOT NULL
"""
)
Andrey Vertiprahov
@aversant
mentioned in commit
1f7f74d5
·
Aug 19, 2019
mentioned in commit
1f7f74d5
mentioned in commit 1f7f74d59e2ce21cc31bb062f1520107a7235ee9
Toggle commit list
Andrey Vertiprahov
@aversant
mentioned in merge request
!2512 (merged)
·
Aug 19, 2019
mentioned in merge request
!2512 (merged)
mentioned in merge request !2512
Toggle commit list
Write
Preview
Supports
Markdown
0%
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment