Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
M
mutalyzer
Manage
Activity
Members
Code
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Model registry
Operate
Environments
Analyze
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
Mirrors
mutalyzer
Commits
f80d50e2
Commit
f80d50e2
authored
9 years ago
by
Vermaat
Browse files
Options
Downloads
Plain Diff
Merge pull request #69 from mutalyzer/db-setup-fix
Only create database tables once
parents
7732538c
a13524c8
No related branches found
Branches containing commit
No related tags found
Tags containing commit
No related merge requests found
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
mutalyzer/entrypoints/admin.py
+8
-2
8 additions, 2 deletions
mutalyzer/entrypoints/admin.py
with
8 additions
and
2 deletions
mutalyzer/entrypoints/admin.py
+
8
−
2
View file @
f80d50e2
...
...
@@ -173,9 +173,15 @@ def setup_database(alembic_config_path=None, destructive=False):
raise
UserError
(
'
Cannot find Alembic configuration: %s
'
%
alembic_config_path
)
bind
=
db
.
session
.
get_bind
()
if
destructive
:
db
.
Base
.
metadata
.
drop_all
(
db
.
session
.
get_bind
())
db
.
Base
.
metadata
.
create_all
(
db
.
session
.
get_bind
())
db
.
Base
.
metadata
.
drop_all
(
bind
)
if
destructive
or
not
bind
.
has_table
(
Assembly
.
__tablename__
):
# We assume our migrations will take care of everything if at least
# the Assembly table exists.
db
.
Base
.
metadata
.
create_all
(
bind
)
if
alembic_config_path
:
context
=
MigrationContext
.
configure
(
db
.
session
.
connection
())
...
...
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