Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
Hiboo
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Package Registry
Container Registry
Model registry
Operate
Terraform modules
Monitor
Service Desk
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
Terms and privacy
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
cyrinux
Hiboo
Commits
667c88aa
Commit
667c88aa
authored
5 years ago
by
kaiyou
Browse files
Options
Downloads
Patches
Plain Diff
Add a proper initial database creation script
parent
70895636
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
migrations/versions/fa59f288c9f2_initial_database_creation.py
+100
-0
100 additions, 0 deletions
...ations/versions/fa59f288c9f2_initial_database_creation.py
with
100 additions
and
0 deletions
migrations/versions/fa59f288c9f2_initial_database_creation.py
0 → 100644
+
100
−
0
View file @
667c88aa
"""
Initial database creation
Revision ID: fa59f288c9f2
Revises:
Create Date: 2019-11-13 17:55:19.026431
"""
from
alembic
import
op
import
sqlalchemy
as
sa
import
hiboo
revision
=
'
fa59f288c9f2
'
down_revision
=
None
branch_labels
=
None
depends_on
=
None
def
upgrade
():
# ### commands auto generated by Alembic - please adjust! ###
op
.
create_table
(
'
service
'
,
sa
.
Column
(
'
protocol
'
,
sa
.
String
(
length
=
25
),
nullable
=
True
),
sa
.
Column
(
'
name
'
,
sa
.
String
(
length
=
255
),
nullable
=
True
),
sa
.
Column
(
'
provider
'
,
sa
.
String
(
length
=
255
),
nullable
=
True
),
sa
.
Column
(
'
application
'
,
sa
.
String
(
length
=
255
),
nullable
=
True
),
sa
.
Column
(
'
description
'
,
sa
.
String
(),
nullable
=
True
),
sa
.
Column
(
'
policy
'
,
sa
.
String
(
length
=
255
),
nullable
=
True
),
sa
.
Column
(
'
max_profiles
'
,
sa
.
Integer
(),
nullable
=
False
),
sa
.
Column
(
'
same_username
'
,
sa
.
Boolean
(),
nullable
=
False
),
sa
.
Column
(
'
config
'
,
hiboo
.
models
.
JSONEncoded
(),
nullable
=
True
),
sa
.
Column
(
'
uuid
'
,
sa
.
String
(
length
=
36
),
nullable
=
False
),
sa
.
Column
(
'
created_at
'
,
sa
.
DateTime
(),
nullable
=
False
),
sa
.
Column
(
'
updated_at
'
,
sa
.
DateTime
(),
nullable
=
True
),
sa
.
Column
(
'
comment
'
,
sa
.
String
(
length
=
255
),
nullable
=
True
),
sa
.
PrimaryKeyConstraint
(
'
uuid
'
)
)
op
.
create_table
(
'
user
'
,
sa
.
Column
(
'
username
'
,
sa
.
String
(
length
=
255
),
nullable
=
False
),
sa
.
Column
(
'
is_admin
'
,
sa
.
Boolean
(),
nullable
=
False
),
sa
.
Column
(
'
uuid
'
,
sa
.
String
(
length
=
36
),
nullable
=
False
),
sa
.
Column
(
'
created_at
'
,
sa
.
DateTime
(),
nullable
=
False
),
sa
.
Column
(
'
updated_at
'
,
sa
.
DateTime
(),
nullable
=
True
),
sa
.
Column
(
'
comment
'
,
sa
.
String
(
length
=
255
),
nullable
=
True
),
sa
.
PrimaryKeyConstraint
(
'
uuid
'
),
sa
.
UniqueConstraint
(
'
username
'
)
)
op
.
create_table
(
'
auth
'
,
sa
.
Column
(
'
user_uuid
'
,
sa
.
String
(
length
=
36
),
nullable
=
True
),
sa
.
Column
(
'
value
'
,
sa
.
String
(),
nullable
=
True
),
sa
.
Column
(
'
extra
'
,
hiboo
.
models
.
JSONEncoded
(),
nullable
=
True
),
sa
.
Column
(
'
uuid
'
,
sa
.
String
(
length
=
36
),
nullable
=
False
),
sa
.
Column
(
'
created_at
'
,
sa
.
DateTime
(),
nullable
=
False
),
sa
.
Column
(
'
updated_at
'
,
sa
.
DateTime
(),
nullable
=
True
),
sa
.
Column
(
'
comment
'
,
sa
.
String
(
length
=
255
),
nullable
=
True
),
sa
.
ForeignKeyConstraint
([
'
user_uuid
'
],
[
'
user.uuid
'
],
),
sa
.
PrimaryKeyConstraint
(
'
uuid
'
)
)
op
.
create_table
(
'
profile
'
,
sa
.
Column
(
'
user_uuid
'
,
sa
.
String
(
length
=
36
),
nullable
=
True
),
sa
.
Column
(
'
service_uuid
'
,
sa
.
String
(
length
=
36
),
nullable
=
True
),
sa
.
Column
(
'
username
'
,
sa
.
String
(
length
=
255
),
nullable
=
False
),
sa
.
Column
(
'
status
'
,
sa
.
String
(
length
=
25
),
nullable
=
False
),
sa
.
Column
(
'
extra
'
,
hiboo
.
models
.
JSONEncoded
(),
nullable
=
True
),
sa
.
Column
(
'
uuid
'
,
sa
.
String
(
length
=
36
),
nullable
=
False
),
sa
.
Column
(
'
created_at
'
,
sa
.
DateTime
(),
nullable
=
False
),
sa
.
Column
(
'
updated_at
'
,
sa
.
DateTime
(),
nullable
=
True
),
sa
.
Column
(
'
comment
'
,
sa
.
String
(
length
=
255
),
nullable
=
True
),
sa
.
ForeignKeyConstraint
([
'
service_uuid
'
],
[
'
service.uuid
'
],
),
sa
.
ForeignKeyConstraint
([
'
user_uuid
'
],
[
'
user.uuid
'
],
),
sa
.
PrimaryKeyConstraint
(
'
uuid
'
)
)
op
.
create_table
(
'
history
'
,
sa
.
Column
(
'
user_uuid
'
,
sa
.
String
(
length
=
36
),
nullable
=
True
),
sa
.
Column
(
'
profile_uuid
'
,
sa
.
String
(
length
=
36
),
nullable
=
True
),
sa
.
Column
(
'
service_uuid
'
,
sa
.
String
(
length
=
36
),
nullable
=
True
),
sa
.
Column
(
'
actor_uuid
'
,
sa
.
String
(
length
=
36
),
nullable
=
True
),
sa
.
Column
(
'
public
'
,
sa
.
Boolean
(),
nullable
=
True
),
sa
.
Column
(
'
category
'
,
sa
.
String
(
length
=
25
),
nullable
=
True
),
sa
.
Column
(
'
value
'
,
sa
.
String
(),
nullable
=
True
),
sa
.
Column
(
'
uuid
'
,
sa
.
String
(
length
=
36
),
nullable
=
False
),
sa
.
Column
(
'
created_at
'
,
sa
.
DateTime
(),
nullable
=
False
),
sa
.
Column
(
'
updated_at
'
,
sa
.
DateTime
(),
nullable
=
True
),
sa
.
Column
(
'
comment
'
,
sa
.
String
(
length
=
255
),
nullable
=
True
),
sa
.
ForeignKeyConstraint
([
'
actor_uuid
'
],
[
'
user.uuid
'
],
),
sa
.
ForeignKeyConstraint
([
'
profile_uuid
'
],
[
'
profile.uuid
'
],
),
sa
.
ForeignKeyConstraint
([
'
service_uuid
'
],
[
'
service.uuid
'
],
),
sa
.
ForeignKeyConstraint
([
'
user_uuid
'
],
[
'
user.uuid
'
],
),
sa
.
PrimaryKeyConstraint
(
'
uuid
'
)
)
# ### end Alembic commands ###
def
downgrade
():
# ### commands auto generated by Alembic - please adjust! ###
op
.
drop_table
(
'
history
'
)
op
.
drop_table
(
'
profile
'
)
op
.
drop_table
(
'
auth
'
)
op
.
drop_table
(
'
user
'
)
op
.
drop_table
(
'
service
'
)
# ### end Alembic commands ###
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