Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
R
Resource Manager
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
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
This is an archived project. Repository and other project resources are read-only.
Show more breadcrumbs
GÉANT Orchestration and Automation Team
GAP
Resource Manager
Commits
6e703fb5
Commit
6e703fb5
authored
2 years ago
by
Erik Reid
Browse files
Options
Downloads
Patches
Plain Diff
migration for initial tables
parent
5e80096d
Branches
Branches containing commit
No related tags found
No related merge requests found
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
resource_management/alembic.ini
+3
-2
3 additions, 2 deletions
resource_management/alembic.ini
resource_management/migrations/versions/1ec562888fd6_initial_tables.py
+75
-0
75 additions, 0 deletions
...gement/migrations/versions/1ec562888fd6_initial_tables.py
with
78 additions
and
2 deletions
resource_management/alembic.ini
+
3
−
2
View file @
6e703fb5
...
...
@@ -3,5 +3,6 @@
# make sure the right line is un / commented depending on which schema you want
# a migration for
script_location
=
migrations
# change this to run migrations from the command line
sqlalchemy.url
=
mysql://dummy:dummy-pass@localhost/resources_test
sqlalchemy.url
=
sqlite:////absolute/path/to/foo.db
# or here is an example of a mysql dsn
# sqlalchemy.url = mysql://dummy:dummy-pass@localhost/resources_db_name
This diff is collapsed.
Click to expand it.
resource_management/migrations/versions/1
983660b3e64_create
_initial_tables.py
→
resource_management/migrations/versions/1
ec562888fd6
_initial_tables.py
+
75
−
0
View file @
6e703fb5
"""
create
initial tables
"""
initial tables
Revision ID: 1
983660b3e64
Revises:
Create Date: 202
2-12-18 14:16:34.695912
Revision ID: 1
ec562888fd6
Revises:
Create Date: 202
3-03-20 07:05:18.984767
"""
from
alembic
import
op
...
...
@@ -10,58 +10,66 @@ import sqlalchemy as sa
# revision identifiers, used by Alembic.
revision
=
'
1
983660b3e64
'
revision
=
'
1
ec562888fd6
'
down_revision
=
None
branch_labels
=
None
depends_on
=
None
def
upgrade
()
->
None
:
op
.
create_table
(
'
node
s
'
,
'
router
s
'
,
sa
.
Column
(
'
id
'
,
sa
.
Integer
,
primary_key
=
True
),
sa
.
Column
(
'
fqdn
'
,
sa
.
String
(
256
),
nullable
=
False
))
op
.
create_table
(
'
l
ine_card
s
'
,
'
l
ag
s
'
,
sa
.
Column
(
'
id
'
,
sa
.
Integer
,
primary_key
=
True
),
sa
.
Column
(
'
slot
'
,
sa
.
Integer
,
nullable
=
False
),
sa
.
Column
(
'
model
'
,
sa
.
String
(
256
),
nullable
=
False
),
sa
.
Column
(
'
serial
'
,
sa
.
String
(
256
),
nullable
=
False
),
sa
.
Column
(
'
description
'
,
sa
.
String
(
256
),
nullable
=
False
),
sa
.
Column
(
'
name
'
,
sa
.
String
,
nullable
=
False
),
sa
.
Column
(
'
availability
'
,
sa
.
Enum
(
'
AVAILABLE
'
,
'
USED
'
,
'
RESERVED
'
,
name
=
'
lag_availability
'
),
nullable
=
False
),
sa
.
Column
(
'
node
_id
'
,
'
router
_id
'
,
sa
.
Integer
,
sa
.
ForeignKey
(
'
node
s.id
'
),
sa
.
ForeignKey
(
'
router
s.id
'
),
nullable
=
False
))
op
.
create_table
(
'
p
ort
s
'
,
'
p
hysical_interface
s
'
,
sa
.
Column
(
'
id
'
,
sa
.
Integer
,
primary_key
=
True
),
sa
.
Column
(
'
pic
'
,
sa
.
Integer
,
nullable
=
False
),
sa
.
Column
(
'
position
'
,
sa
.
Integer
,
nullable
=
False
),
sa
.
Column
(
'
interface
'
,
sa
.
String
(
256
),
nullable
=
True
),
sa
.
Column
(
'
cable
'
,
sa
.
String
(
256
),
nullable
=
True
),
sa
.
Column
(
'
cable
'
,
sa
.
String
(
256
),
nullable
=
True
),
sa
.
Column
(
'
name
'
,
sa
.
String
,
nullable
=
False
),
sa
.
Column
(
'
line_card_id
'
,
'
availability
'
,
sa
.
Enum
(
'
AVAILABLE
'
,
'
USED
'
,
'
RESERVED
'
,
name
=
'
lag_availability
'
),
nullable
=
False
),
sa
.
Column
(
'
router_id
'
,
sa
.
Integer
,
sa
.
ForeignKey
(
'
line_cards.id
'
),
nullable
=
False
))
sa
.
ForeignKey
(
'
routers.id
'
),
nullable
=
False
),
sa
.
Column
(
'
lag_id
'
,
sa
.
Integer
,
sa
.
ForeignKey
(
'
lags.id
'
),
nullable
=
True
))
op
.
create_table
(
'
port_speed_capabiliti
es
'
,
'
logical_interfac
es
'
,
sa
.
Column
(
'
id
'
,
sa
.
Integer
,
primary_key
=
True
),
sa
.
Column
(
'
speed
'
,
sa
.
String
(
256
)
,
nullable
=
Tru
e
),
sa
.
Column
(
'
name
'
,
sa
.
String
,
nullable
=
Fals
e
),
sa
.
Column
(
'
p
ort
_id
'
,
'
p
hysical
_id
'
,
sa
.
Integer
,
sa
.
ForeignKey
(
'
p
ort
s.id
'
),
sa
.
ForeignKey
(
'
p
hysical_interface
s.id
'
),
nullable
=
False
))
def
downgrade
()
->
None
:
op
.
drop_table
(
'
port_speed_capabilities
'
)
op
.
drop_table
(
'
ports
'
)
op
.
drop_table
(
'
line_cards
'
)
op
.
drop_table
(
'
nodes
'
)
op
.
drop_table
(
'
logical_interfaces
'
)
op
.
drop_table
(
'
physical_interfaces
'
)
op
.
drop_table
(
'
lags
'
)
op
.
drop_table
(
'
routers
'
)
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