Change the following mongoose schema to postgres tables and relations const reportSchema…
Jump to turn (6)
- 1Change the following mongoose schema to postgres tables and relations const repo
- 2Generate a Postgres sql for the above tables
- 3Now write me a query to generate reports by joining the tables. Just like the mo
- 4I want you to redo the schema for mongoose model from above. But this time, I wa
- 5No, what I meant is generate a postgres query. But disregard the two tables I me
- 6Now generate report fetching query for this
- User
Change the following mongoose schema to postgres tables and relations
const reportSchema = new mongoose.Schema( { date: Date, trafficChannelId: String, final: Boolean, report: { details: [ { adGroups: [ { adGroupId: String, ads: [ { adId: String, adName: String, adGroupName: String, campaignName: String, date: Date, totalSpent: Number, totalClicks: Number, totalImpressions: Number, revenue: Number, estimate: Number, conversions: Number, clickDetail: [ { trackId: String, domainId: String, conversion: { estimate: Number, conversionId: String, revenue: Number, keyword: String, }, }, ], feedSource: String, }, ], }, ], campaignId: String, funnelTemplateId: String, campaignIdRT: String, }, ], domains: [ { campaigns: [String], domainId: String, name: String, weight: Number, feedSource: String, }, ], }, compressedReport: Buffer, isCompressed: Boolean, }, { timestamps: true }, );