Skip to content

Commit aa5704d

Browse files
(fix) migration and add a deployment tool
Previously, the syntax of the migration file was wrong. This commit fixes the syntax. Also add a deployment tool that automates all the shipments
1 parent 5f373c1 commit aa5704d

File tree

5 files changed

+23
-7
lines changed

5 files changed

+23
-7
lines changed

alembic.ini

+1-1
Original file line numberDiff line numberDiff line change
@@ -50,7 +50,7 @@ version_path_separator = os # default: use os.pathsep
5050
# are written from script.py.mako
5151
# output_encoding = utf-8
5252

53-
sqlalchemy.url = driver://user:pass@localhost/dbname
53+
sqlalchemy.url = mysql+pymysql://root:password@mysql-clusterip/taskmanager
5454

5555

5656
[post_write_hooks]

alembic/versions/fb82c06d1fa2_create_lists_subsystem.py

+7-5
Original file line numberDiff line numberDiff line change
@@ -17,11 +17,13 @@
1717

1818

1919
def upgrade():
20-
op.create_table("lists")
21-
op.add_column("lists", sa.Column("name", sa.Text))
22-
op.add_column("lists", sa.Column("recurring_deadline", sa.Time)
23-
op.add_column("lists", sa.Column("created_at", sa.DateTime))
24-
op.add_column("lists", sa.Column("modified_at", sa.DateTime))
20+
op.create_table("lists",
21+
sa.Column("id", sa.BIGINT, primary_key=True),
22+
sa.Column("name", sa.Text, nullable=False),
23+
sa.Column("recurring_deadline", sa.Time, nullable=False),
24+
sa.Column("created_at", sa.DateTime, nullable=False),
25+
sa.Column("modified_at", sa.DateTime, nullable=False)
26+
)
2527

2628

2729
def downgrade():

config.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
SQLALCHEMY_DATABASE_URI = 'mysql+pymysql:////root:password@mysql/taskmanager'
1+
SQLALCHEMY_DATABASE_URI = 'mysql+pymysql:////root:password@mysql-clusterip/taskmanager'

deploy.sh

+13
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
kubectl delete deployments taskmanager-deployment mysql-deployment
2+
3+
minikube image rm taskmanager
4+
5+
sudo docker build . -t taskmanager
6+
7+
minikube image load taskmanager
8+
9+
kubectl apply -f mysql-deployment.yaml
10+
11+
sleep 25
12+
13+
kubectl apply -f taskmanager-deployment.yaml

requirements.txt

+1
Original file line numberDiff line numberDiff line change
@@ -2,3 +2,4 @@ Flask == 2.0.1
22
Flask_SQLAlchemy == 2.5.1
33
PyMySQL == 1.0.2
44
alembic == 1.7.4
5+
cryptography == 35.0.0

0 commit comments

Comments
 (0)