R
Railway3mo ago
theo

Delete tables/databases on railway

How can I delete a table or reset my database on railway? I want to re-migrate all my data.
29 Replies
Percy
Percy3mo ago
Project ID: 75f448f4-88c9-4d82-b428-61740d90e40c
theo
theoOP3mo ago
75f448f4-88c9-4d82-b428-61740d90e40c I can create new tables, but i dont know how to delete existing ones
Brody
Brody3mo ago
you want to wipe your entire database?
theo
theoOP3mo ago
yes, delete all tables to migrate them again
Brody
Brody3mo ago
wipe the volume then
theo
theoOP3mo ago
but i dont want to remove the service because of the envs i dont want to re-create the mysql image cant I just drop the database?
Brody
Brody3mo ago
yep, wipe the volume, this will give you a brand new database
theo
theoOP3mo ago
how?
theo
theoOP3mo ago
oh that helps tks OH I LOST MY DATA just kidding lmao thanks, Brody
Brody
Brody3mo ago
in preparation of you saying something like this i had edited my above message to be clearer haha
theo
theoOP3mo ago
hahaha im facing a new issue my healthcheck is not working for any reason
Brody
Brody3mo ago
for the record we wouldnt have been able to do anything anyway
theo
theoOP3mo ago
locally my route is working perfectly the /health app route is working fine, returns a 200 oh I can mind what is happening probably the service is not starting because I didnt set up a redis service on railway yet imma try to fix this to see if this is the problem
Brody
Brody3mo ago
yeah connect ECONNREFUSED ::1:6379 this deploy hasnt started its web server so its not going to answer the health check
theo
theoOP3mo ago
yeah, ive imagined, forgot about the redis tks hmmm redis connection still refused but now ive configured the variables yeah, econnrefused ::1.6379 looks like it cant connect to db is this possible to connect via internal host? redis.railway.internal i've set my envs REDIS_HOST REDIS_PORT REDIS_PASSWORD is there anything I can do to connect redis in this cases?
Brody
Brody3mo ago
you set the variables, but are you consuming them in code?
theo
theoOP3mo ago
yes, sure
export const RedisOptions: CacheModuleAsyncOptions = {
isGlobal: true,
imports: [ConfigModule],
useFactory: async (configService: ConfigService) => {
return {
store: redisStore,
host: configService.get('REDIS_HOST'),
port: Number(configService.get('REDIS_PORT')!),
password: configService.get('REDIS_PASSWORD'),
};
},
inject: [ConfigService],
};
export const RedisOptions: CacheModuleAsyncOptions = {
isGlobal: true,
imports: [ConfigModule],
useFactory: async (configService: ConfigService) => {
return {
store: redisStore,
host: configService.get('REDIS_HOST'),
port: Number(configService.get('REDIS_PORT')!),
password: configService.get('REDIS_PASSWORD'),
};
},
inject: [ConfigService],
};
i saw this topic https://docs.railway.app/guides/private-networking#known-configuration-requirements-for-ipv6 can this be the problem?
i managed to fixed it by adding family: 0 in my redis config. it seems needs when connecting to private network
i managed to fixed it by adding family: 0 in my redis config. it seems needs when connecting to private network
is this needed?
Brody
Brody3mo ago
i dont know if that would be valid syntax, but given you are getting econnrefused ::1.6379 im going to say no, that is not valid syntax
theo
theoOP3mo ago
it is a valid syntax, locally it works with my redis
Brody
Brody3mo ago
not necessarily, if it was valid your app would not be attempting to connect to ::1 thats a fallback hostname that indicates that the redis client is using its default values to attempt a redis connection, instead of using the REDIS_HOST no its has nothing to do with the current error
theo
theoOP3mo ago
k got it solved the problem here all done
Brody
Brody3mo ago
awsome, what was the issue
theo
theoOP3mo ago
actually the lib's doc was wrong
Brody
Brody3mo ago
you'll have that
theo
theoOP3mo ago
the lib that integrates redis on nest well, the last update was in 2022, its expected haha
Brody
Brody3mo ago
makes sense, glad you got it fixed
theo
theoOP3mo ago
tks for the help, Brody
Brody
Brody3mo ago
no problem!
Want results from more Discord servers?
Add your server