Skip to content

Commit

Permalink
fix(db): switch blockId and groupId on old answers
Browse files Browse the repository at this point in the history
  • Loading branch information
baptisteArno committed Jul 14, 2022
1 parent c2ff1ff commit b62b955
Show file tree
Hide file tree
Showing 4 changed files with 25 additions and 1 deletion.
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@ build
firebaseServiceAccount.json

.env.production
.env.staging

# Wordpress
.svn
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
-- Update old answers
UPDATE "Answer" a
SET "blockId" = a."groupId",
"groupId" = a."blockId"
WHERE "createdAt" < '2022-06-10 22:00:00 UTC'
AND NOT EXISTS (
SELECT 1
FROM "Answer"
WHERE "resultId" = a."resultId"
AND "blockId" = a."groupId"
AND "groupId" = a."blockId"
);
12 changes: 11 additions & 1 deletion packages/scripts/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,11 @@ const prisma = new PrismaClient({
require('dotenv').config({
path: path.join(
__dirname,
process.env.NODE_ENV === 'production' ? '.env.production' : '.env.local'
process.env.NODE_ENV === 'production'
? '.env.production'
: process.env.NODE_ENV === 'staging'
? '.env.staging'
: '.env.local'
),
})

Expand All @@ -34,6 +38,12 @@ const main = async () => {
console.log('Params: ' + e.params)
console.log('Duration: ' + e.duration + 'ms')
})
const date = new Date()
const lastMonth = new Date(date.getFullYear(), date.getMonth() - 1, 10)
const answers = await prisma.answer.findMany({
where: { createdAt: { lt: lastMonth } },
take: 100,
})
}

main().then()
1 change: 1 addition & 0 deletions packages/scripts/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@
"private": true,
"scripts": {
"start:local": "ts-node index.ts",
"start:staging": "NODE_ENV=staging ts-node index.ts",
"start:prod": "NODE_ENV=production ts-node index.ts",
"start:workspaces:migration": "ts-node workspaceMigration.ts",
"start:workspaces:migration:recover": "ts-node workspaceMigrationRecover.ts"
Expand Down

4 comments on commit b62b955

@vercel
Copy link

@vercel vercel bot commented on b62b955 Jul 14, 2022

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Successfully deployed to the following URLs:

viewer-v2-alpha – ./apps/viewer

8jours.top
am.nigerias.io
finplex.be
ar.nigerias.io
sat.cr8.ai
bot.aipr.kr
bt.id8rs.com
an.nigerias.io
vhpage.cr8.ai
bot.aws.bj
apo.nigerias.io
chat.sureb4.com
apr.nigerias.io
bot.lalmon.com
aso.nigerias.io
games.klujo.com
sakuranembro.it
eventhub.com.au
bot.upfunnel.art
bot.piccinato.co
clo.closeer.work
feedback.ofx.one
stan.vselise.com
faqs.nigerias.io
voicehelp.cr8.ai
app.chatforms.net
bot.maitempah.com
gentleman-shop.fr
bot.agfunnel.tech
k1.kandabrand.com
goalsettingbot.com
ov2.wpwakanda.com
ov1.wpwakanda.com
ov3.wpwakanda.com
zap.techadviser.in
this-is-a-test.com
bot.eventhub.com.au
bot.digitalbled.com
carsalesenquiry.com
forms.webisharp.com
bot.cotemeuplano.com
bot.ansuraniphone.my
order.maitempah.com
typebot.stillio.com
chat.hayurihijab.com
bbutton.wpwakanda.com
aidigitalmarketing.kr
abutton.wpwakanda.com
get.freebotoffer.xyz
bot.incusservices.com
bot.meuesocial.com.br
cdd.searchcube.com.sg
chat.missarkansas.org
apply.ansuraniphone.my
sbutton.wpwakanda.com
bbutton.wpwwakanda.com
felipewelington.com.br
c23111azqw.nigerias.io
gcase.barrettamario.it
form.searchcube.com.sg
info.clickasuransi.com
kodawariab736.skeep.it
report.gratirabbit.com
resume.gratirabbit.com
83242573.actualizar.xyz
view.onlinebotdemo.xyz
mainmenu.diddancing.com
survey.hypemarketing.in
bot.upgradesolutions.eu
subfooter.wpwakanda.com
91181264.your-access.one
form.sergiolimajr.com.br
type.opaulovieira.com.br
hunterbot.saleshunter.ai
aibot.angrybranding.co.uk
bot.aidigitalmarketing.kr
bot.cabinrentalagency.com
chat.thisiscrushhouse.com
sellmyharleylouisiana.com
boyfriend-breakup.riku.ai
type.dericsoncalari.com.br
designguide.techyscouts.com
piazzatorre.barrettamario.it
presente.empresarias.com.mx
agendamento.sergiolimajr.com.br
type.talitasouzamarques.com.br
onboarding.libertydreamcare.ie
personal-trainer.barrettamario.it
bot.comercializadoraomicron.com
bookings.littlepartymonkeys.com
preagendamento.sergiolimajr.com.br
studiotecnicoimmobiliaremerelli.it
viewer-v2-alpha-typebot-io.vercel.app
viewer-v2-alpha-git-main-typebot-io.vercel.app

@vercel
Copy link

@vercel vercel bot commented on b62b955 Jul 14, 2022

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Successfully deployed to the following URLs:

docs – ./apps/docs

docs-typebot-io.vercel.app
docs-git-main-typebot-io.vercel.app
docs.typebot.io

@vercel
Copy link

@vercel vercel bot commented on b62b955 Jul 14, 2022

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@vercel
Copy link

@vercel vercel bot commented on b62b955 Jul 14, 2022

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Successfully deployed to the following URLs:

builder-v2 – ./apps/builder

builder-v2-git-main-typebot-io.vercel.app
builder-v2-typebot-io.vercel.app
app.typebot.io

Please sign in to comment.