Skip to content
GitLab
Explore
Sign in
Register
Primary navigation
Search or go to…
Project
R
rabbitmq_agents
Manage
Activity
Members
Labels
Plan
Issues
0
Issue boards
Milestones
Wiki
Code
Merge requests
0
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Package Registry
Container Registry
Model registry
Operate
Environments
Terraform modules
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
Bo-Chun Chen
rabbitmq_agents
Commits
9fd69c5c
Commit
9fd69c5c
authored
1 year ago
by
Bo-Chun Chen
Browse files
Options
Downloads
Patches
Plain Diff
Rename columns for date and source
parent
6a23c120
No related branches found
No related tags found
No related merge requests found
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
migrations/20240327_add_created_table.py
+6
-6
6 additions, 6 deletions
migrations/20240327_add_created_table.py
with
6 additions
and
6 deletions
migrations/20240327_add_created_table.py
+
6
−
6
View file @
9fd69c5c
...
...
@@ -34,22 +34,22 @@ def upgrade():
next
(
reader
)
for
row
in
reader
:
if
row
[
0
]
in
users
:
users
[
row
[
0
]][
"
cre
ate
d
"
]
=
fromisoformat
(
row
[
1
]
[:
-
3
]
)
users
[
row
[
0
]][
"
origin
"
]
=
row
[
2
]
users
[
row
[
0
]][
"
d
ate
"
]
=
fromisoformat
(
row
[
1
])
users
[
row
[
0
]][
"
source
"
]
=
row
[
2
]
# Add copy created column from last_update if they are not in csv file
for
username
in
users
:
if
"
created
"
not
in
users
[
username
]:
users
[
username
][
"
cre
ate
d
"
]
=
fromisoformat
(
users
[
username
][
"
d
ate
"
]
=
fromisoformat
(
users
[
username
][
"
last_update
"
]
)
users
[
username
][
"
origin
"
]
=
"
last_update
"
users
[
username
][
"
source
"
]
=
"
account-web
"
# No need to update this column back to the db
del
users
[
username
][
"
last_update
"
]
# Create new columns
table
.
create_column
(
"
cre
ate
d
"
,
db
.
types
.
datetime
)
table
.
create_column
(
"
origin
"
,
db
.
types
.
text
)
table
.
create_column
(
"
d
ate
"
,
db
.
types
.
datetime
)
table
.
create_column
(
"
source
"
,
db
.
types
.
text
)
# Update database in chunk
table
.
update_many
(
list
(
users
.
values
()),
[
"
username
"
],
ensure
=
True
)
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
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!
Save comment
Cancel
Please
register
or
sign in
to comment