FlaskApp not Recognizing updated mysql schema
clopez527launcher
HOBBYOP

a year ago

I tried troubleshooting this on my own for hours but it appears railway is cashing an old sql database despite me deleting it and recreating it multiple times. Everything I implement works locally but not when hosted on railway.

Solved

7 Replies

a year ago

Hello,

We do not have any such caching, those tables simply do not exist in that database, have you ran the migrations on that specific database?


Status changed to Awaiting User Response Railway about 1 year ago


clopez527launcher
HOBBYOP

a year ago

mysql> USE railway;

Database changed

mysql> SHOW COLUMNS FROM activity_log;

+-----------------+----------+------+-----+-------------------+-------------------+

| Field | Type | Null | Key | Default | Extra |

+-----------------+----------+------+-----+-------------------+-------------------+

| id | int | NO | PRI | NULL | auto_increment |

| user_id | int | NO | | NULL |

|

| timestamp | datetime | NO | | CURRENT_TIMESTAMP | DEFAULT_GENERATED |

| mouse_distance | float | YES | | NULL | |

| keystrokes | int | YES | | NULL | |

| mouse_clicks | int | YES | | NULL |

|

| idle_count | float | YES | | NULL | |

| page_time | json | YES | | NULL | |

| page_percentage | json | YES | | NULL | |

+-----------------+----------+------+-----+-------------------+-------------------+

9 rows in set (0.00 sec)

mysql>


Status changed to Awaiting Railway Response Railway about 1 year ago


clopez527launcher
HOBBYOP

a year ago

I see it in mysql but railway is not pulling the two new columns "page_time" and "Page percentage"


clopez527launcher
HOBBYOP

a year ago

try:

db = pymysql.connect(

host=DB_HOST,

user=DB_USER,

password=DB_PASSWORD,

database="railway", # rocket emoji FORCE SELECTION

cursorclass=pymysql.cursors.DictCursor,

autocommit=True


a year ago

You have likely ran the migrations on the wrong database name.


Status changed to Awaiting User Response Railway about 1 year ago


clopez527launcher
HOBBYOP

a year ago

I see your note about running migrations on the wrong database. However, I have manually verified that my MySQL instance has the correct schema, yet Flask still sees the wrong version.


Status changed to Awaiting Railway Response Railway about 1 year ago


a year ago

I'm not sure what to tell you at this point, the page_time and page_percentage tables simply do not exist in the database, you can see for yourself -

https://railway.com/project/dfaa0ddf-a0e0-48f8-8ff1-b9ad7db934bc/service/3bae0b4c-6c6a-4083-8adc-21e96526e846/data?environmentId=8ffcc3b7-f7b7-4bab-adaf-a8acebb4cc57


Status changed to Awaiting User Response Railway about 1 year ago


Railway
BOT

7 months ago

This thread has been marked as solved automatically due to a lack of recent activity. Please re-open this thread or create a new one if you require further assistance. Thank you!

Status changed to Solved Railway 7 months ago


Loading...