-
Notifications
You must be signed in to change notification settings - Fork 9
/
test.hs
1361 lines (1183 loc) · 78.1 KB
/
test.hs
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
931
932
933
934
935
936
937
938
939
940
941
942
943
944
945
946
947
948
949
950
951
952
953
954
955
956
957
958
959
960
961
962
963
964
965
966
967
968
969
970
971
972
973
974
975
976
977
978
979
980
981
982
983
984
985
986
987
988
989
990
991
992
993
994
995
996
997
998
999
1000
{-# LANGUAGE TemplateHaskell #-}
{-# LANGUAGE MultiParamTypeClasses #-}
{-# LANGUAGE FlexibleInstances #-}
module Database where
import qualified Data.Aeson as JSON
import Data.Profunctor.Product.TH (makeAdaptorAndInstance)
import Data.Scientific
import Data.Text
import Data.Time
import Data.UUID
import GHC.Int
import Opaleye
---- TYPES FOR TABLE accounts ----
data Account' c1 c2 c3 c4 c5 c6 c7 c8 c9 c10 c11 c12 c13 c14 c15 c16 c17 c18 c19 c20 c21 c22 c23 c24 c25 c26 c27 c28 c29 c30 c31 c32 c33 c34 c35 c36 c37 c38 =
Account
{ accountId :: c1
, accountName :: c2
, accountDescription :: c3
, accountDomain :: c4
, accountWebsite :: c5
, accountLogo :: c6
, accountAddress1 :: c7
, accountAddress2 :: c8
, accountCity :: c9
, accountRegion :: c10
, accountPostalCode :: c11
, accountCountryCode :: c12
, accountPhone :: c13
, accountLegalName :: c14
, accountFounded :: c15
, accountEmployees :: c16
, accountRaised :: c17
, accountCreatedAt :: c18
, accountUpdatedAt :: c19
, accountTimeZone :: c20
, accountUuid :: c21
, accountApiKey :: c22
, accountSetupCompletedAt :: c23
, accountStripeId :: c24
, accountStripeSubscriptionId :: c25
, accountCreditCardLastFour :: c26
, accountCreditCardExpirationMonth :: c27
, accountCreditCardExpirationYear :: c28
, accountCreditCardType :: c29
, accountPlan :: c30
, accountTrialStartAt :: c31
, accountTrialEndAt :: c32
, accountSubscriptionStartAt :: c33
, accountSubscriptionEndAt :: c34
, accountCoupon :: c35
, accountChurnSlackChannel :: c36
, accountSignupSlackChannel :: c37
, accountBrightjsId :: c38
}
type Account = Account' Int32 (Maybe Text) (Maybe Text) (Maybe Text) (Maybe Text) (Maybe Text) (Maybe Text) (Maybe Text) (Maybe Text) (Maybe Text) (Maybe Text) (Maybe Text) (Maybe Text) (Maybe Text) (Maybe Text) (Maybe Int32) (Maybe Int32) LocalTime LocalTime (Maybe Text) (Maybe UUID) (Maybe Text) (Maybe LocalTime) (Maybe Text) (Maybe Text) (Maybe Text) (Maybe Int32) (Maybe Int32) (Maybe Text) (Maybe Text) (Maybe LocalTime) (Maybe LocalTime) (Maybe LocalTime) (Maybe LocalTime) (Maybe Text) (Maybe Text) (Maybe Text) (Maybe Text)
type AccountReadColumns = Account' (Column PGInt4) (Column (Nullable PGText)) (Column (Nullable PGText)) (Column (Nullable PGText)) (Column (Nullable PGText)) (Column (Nullable PGText)) (Column (Nullable PGText)) (Column (Nullable PGText)) (Column (Nullable PGText)) (Column (Nullable PGText)) (Column (Nullable PGText)) (Column (Nullable PGText)) (Column (Nullable PGText)) (Column (Nullable PGText)) (Column (Nullable PGText)) (Column (Nullable PGInt4)) (Column (Nullable PGInt4)) (Column PGTimestamp) (Column PGTimestamp) (Column (Nullable PGText)) (Column (Nullable PGUuid)) (Column (Nullable PGText)) (Column (Nullable PGTimestamp)) (Column (Nullable PGText)) (Column (Nullable PGText)) (Column (Nullable PGText)) (Column (Nullable PGInt4)) (Column (Nullable PGInt4)) (Column (Nullable PGText)) (Column (Nullable PGText)) (Column (Nullable PGTimestamp)) (Column (Nullable PGTimestamp)) (Column (Nullable PGTimestamp)) (Column (Nullable PGTimestamp)) (Column (Nullable PGText)) (Column (Nullable PGText)) (Column (Nullable PGText)) (Column (Nullable PGText))
type AccountWriteColumns = Account' (Maybe (Column PGInt4)) (Maybe (Column (Nullable PGText))) (Maybe (Column (Nullable PGText))) (Maybe (Column (Nullable PGText))) (Maybe (Column (Nullable PGText))) (Maybe (Column (Nullable PGText))) (Maybe (Column (Nullable PGText))) (Maybe (Column (Nullable PGText))) (Maybe (Column (Nullable PGText))) (Maybe (Column (Nullable PGText))) (Maybe (Column (Nullable PGText))) (Maybe (Column (Nullable PGText))) (Maybe (Column (Nullable PGText))) (Maybe (Column (Nullable PGText))) (Maybe (Column (Nullable PGText))) (Maybe (Column (Nullable PGInt4))) (Maybe (Column (Nullable PGInt4))) (Column PGTimestamp) (Column PGTimestamp) (Maybe (Column (Nullable PGText))) (Maybe (Column (Nullable PGUuid))) (Maybe (Column (Nullable PGText))) (Maybe (Column (Nullable PGTimestamp))) (Maybe (Column (Nullable PGText))) (Maybe (Column (Nullable PGText))) (Maybe (Column (Nullable PGText))) (Maybe (Column (Nullable PGInt4))) (Maybe (Column (Nullable PGInt4))) (Maybe (Column (Nullable PGText))) (Maybe (Column (Nullable PGText))) (Maybe (Column (Nullable PGTimestamp))) (Maybe (Column (Nullable PGTimestamp))) (Maybe (Column (Nullable PGTimestamp))) (Maybe (Column (Nullable PGTimestamp))) (Maybe (Column (Nullable PGText))) (Maybe (Column (Nullable PGText))) (Maybe (Column (Nullable PGText))) (Maybe (Column (Nullable PGText)))
$(makeAdaptorAndInstance "pAccount" ''Account')
accountTable :: Table AccountWriteColumns AccountReadColumns
accountTable = Table "accounts" (pAccount
Account
{ accountId = optional "id"
, accountName = optional "name"
, accountDescription = optional "description"
, accountDomain = optional "domain"
, accountWebsite = optional "website"
, accountLogo = optional "logo"
, accountAddress1 = optional "address1"
, accountAddress2 = optional "address2"
, accountCity = optional "city"
, accountRegion = optional "region"
, accountPostalCode = optional "postal_code"
, accountCountryCode = optional "country_code"
, accountPhone = optional "phone"
, accountLegalName = optional "legal_name"
, accountFounded = optional "founded"
, accountEmployees = optional "employees"
, accountRaised = optional "raised"
, accountCreatedAt = required "created_at"
, accountUpdatedAt = required "updated_at"
, accountTimeZone = optional "time_zone"
, accountUuid = optional "uuid"
, accountApiKey = optional "api_key"
, accountSetupCompletedAt = optional "setup_completed_at"
, accountStripeId = optional "stripe_id"
, accountStripeSubscriptionId = optional "stripe_subscription_id"
, accountCreditCardLastFour = optional "credit_card_last_four"
, accountCreditCardExpirationMonth = optional "credit_card_expiration_month"
, accountCreditCardExpirationYear = optional "credit_card_expiration_year"
, accountCreditCardType = optional "credit_card_type"
, accountPlan = optional "plan"
, accountTrialStartAt = optional "trial_start_at"
, accountTrialEndAt = optional "trial_end_at"
, accountSubscriptionStartAt = optional "subscription_start_at"
, accountSubscriptionEndAt = optional "subscription_end_at"
, accountCoupon = optional "coupon"
, accountChurnSlackChannel = optional "churn_slack_channel"
, accountSignupSlackChannel = optional "signup_slack_channel"
, accountBrightjsId = optional "brightjs_id"
}
)
---- TYPES FOR TABLE authorizations ----
data Authorization' c1 c2 c3 c4 c5 c6 c7 c8 c9 c10 c11 c12 =
Authorization
{ authorizationId :: c1
, authorizationApiKey :: c2
, authorizationBaseUri :: c3
, authorizationService :: c4
, authorizationAccountId :: c5
, authorizationCreatedAt :: c6
, authorizationUpdatedAt :: c7
, authorizationSetupByUserId :: c8
, authorizationToken :: c9
, authorizationSecret :: c10
, authorizationUid :: c11
, authorizationBillingProvider :: c12
}
type Authorization = Authorization' Int32 (Maybe Text) (Maybe Text) (Maybe Int32) (Maybe Int32) (Maybe LocalTime) (Maybe LocalTime) (Maybe Int32) (Maybe Text) (Maybe Text) (Maybe Text) (Maybe Bool)
type AuthorizationReadColumns = Authorization' (Column PGInt4) (Column (Nullable PGText)) (Column (Nullable PGText)) (Column (Nullable PGInt4)) (Column (Nullable PGInt4)) (Column (Nullable PGTimestamp)) (Column (Nullable PGTimestamp)) (Column (Nullable PGInt4)) (Column (Nullable PGText)) (Column (Nullable PGText)) (Column (Nullable PGText)) (Column (Nullable PGBool))
type AuthorizationWriteColumns = Authorization' (Maybe (Column PGInt4)) (Maybe (Column (Nullable PGText))) (Maybe (Column (Nullable PGText))) (Maybe (Column (Nullable PGInt4))) (Maybe (Column (Nullable PGInt4))) (Maybe (Column (Nullable PGTimestamp))) (Maybe (Column (Nullable PGTimestamp))) (Maybe (Column (Nullable PGInt4))) (Maybe (Column (Nullable PGText))) (Maybe (Column (Nullable PGText))) (Maybe (Column (Nullable PGText))) (Maybe (Column (Nullable PGBool)))
$(makeAdaptorAndInstance "pAuthorization" ''Authorization')
authorizationTable :: Table AuthorizationWriteColumns AuthorizationReadColumns
authorizationTable = Table "authorizations" (pAuthorization
Authorization
{ authorizationId = optional "id"
, authorizationApiKey = optional "api_key"
, authorizationBaseUri = optional "base_uri"
, authorizationService = optional "service"
, authorizationAccountId = optional "account_id"
, authorizationCreatedAt = optional "created_at"
, authorizationUpdatedAt = optional "updated_at"
, authorizationSetupByUserId = optional "setup_by_user_id"
, authorizationToken = optional "token"
, authorizationSecret = optional "secret"
, authorizationUid = optional "uid"
, authorizationBillingProvider = optional "billing_provider"
}
)
---- TYPES FOR TABLE brightjs_referrers ----
data BrightjsReferrer' c1 c2 c3 c4 c5 c6 c7 c8 c9 c10 c11 c12 c13 c14 c15 =
BrightjsReferrer
{ brightjsReferrerId :: c1
, brightjsReferrerBrightjsUserIdId :: c2
, brightjsReferrerReferrerUrl :: c3
, brightjsReferrerReferrerHost :: c4
, brightjsReferrerReferredAt :: c5
, brightjsReferrerCreatedAt :: c6
, brightjsReferrerUpdatedAt :: c7
, brightjsReferrerReferrerType :: c8
, brightjsReferrerReferrerFrom :: c9
, brightjsReferrerCampaignName :: c10
, brightjsReferrerCampaignSource :: c11
, brightjsReferrerCampaignTerm :: c12
, brightjsReferrerCampaignMedium :: c13
, brightjsReferrerCampaignContent :: c14
, brightjsReferrerUrl :: c15
}
type BrightjsReferrer = BrightjsReferrer' Int32 (Maybe Int32) (Maybe Text) (Maybe Text) (Maybe LocalTime) LocalTime LocalTime (Maybe Text) (Maybe Text) (Maybe Text) (Maybe Text) (Maybe Text) (Maybe Text) (Maybe Text) (Maybe Text)
type BrightjsReferrerReadColumns = BrightjsReferrer' (Column PGInt4) (Column (Nullable PGInt4)) (Column (Nullable PGText)) (Column (Nullable PGText)) (Column (Nullable PGTimestamp)) (Column PGTimestamp) (Column PGTimestamp) (Column (Nullable PGText)) (Column (Nullable PGText)) (Column (Nullable PGText)) (Column (Nullable PGText)) (Column (Nullable PGText)) (Column (Nullable PGText)) (Column (Nullable PGText)) (Column (Nullable PGText))
type BrightjsReferrerWriteColumns = BrightjsReferrer' (Maybe (Column PGInt4)) (Maybe (Column (Nullable PGInt4))) (Maybe (Column (Nullable PGText))) (Maybe (Column (Nullable PGText))) (Maybe (Column (Nullable PGTimestamp))) (Column PGTimestamp) (Column PGTimestamp) (Maybe (Column (Nullable PGText))) (Maybe (Column (Nullable PGText))) (Maybe (Column (Nullable PGText))) (Maybe (Column (Nullable PGText))) (Maybe (Column (Nullable PGText))) (Maybe (Column (Nullable PGText))) (Maybe (Column (Nullable PGText))) (Maybe (Column (Nullable PGText)))
$(makeAdaptorAndInstance "pBrightjsReferrer" ''BrightjsReferrer')
brightjsReferrerTable :: Table BrightjsReferrerWriteColumns BrightjsReferrerReadColumns
brightjsReferrerTable = Table "brightjs_referrers" (pBrightjsReferrer
BrightjsReferrer
{ brightjsReferrerId = optional "id"
, brightjsReferrerBrightjsUserIdId = optional "brightjs_user_id_id"
, brightjsReferrerReferrerUrl = optional "referrer_url"
, brightjsReferrerReferrerHost = optional "referrer_host"
, brightjsReferrerReferredAt = optional "referred_at"
, brightjsReferrerCreatedAt = required "created_at"
, brightjsReferrerUpdatedAt = required "updated_at"
, brightjsReferrerReferrerType = optional "referrer_type"
, brightjsReferrerReferrerFrom = optional "referrer_from"
, brightjsReferrerCampaignName = optional "campaign_name"
, brightjsReferrerCampaignSource = optional "campaign_source"
, brightjsReferrerCampaignTerm = optional "campaign_term"
, brightjsReferrerCampaignMedium = optional "campaign_medium"
, brightjsReferrerCampaignContent = optional "campaign_content"
, brightjsReferrerUrl = optional "url"
}
)
---- TYPES FOR TABLE brightjs_user_ids ----
data BrightjsUserId' c1 c2 c3 c4 c5 =
BrightjsUserId
{ brightjsUserIdId :: c1
, brightjsUserIdOrganizationId :: c2
, brightjsUserIdBrightjsUserId :: c3
, brightjsUserIdCreatedAt :: c4
, brightjsUserIdUpdatedAt :: c5
}
type BrightjsUserId = BrightjsUserId' Int32 (Maybe Int32) (Maybe Text) LocalTime LocalTime
type BrightjsUserIdReadColumns = BrightjsUserId' (Column PGInt4) (Column (Nullable PGInt4)) (Column (Nullable PGText)) (Column PGTimestamp) (Column PGTimestamp)
type BrightjsUserIdWriteColumns = BrightjsUserId' (Maybe (Column PGInt4)) (Maybe (Column (Nullable PGInt4))) (Maybe (Column (Nullable PGText))) (Column PGTimestamp) (Column PGTimestamp)
$(makeAdaptorAndInstance "pBrightjsUserId" ''BrightjsUserId')
brightjsUserIdTable :: Table BrightjsUserIdWriteColumns BrightjsUserIdReadColumns
brightjsUserIdTable = Table "brightjs_user_ids" (pBrightjsUserId
BrightjsUserId
{ brightjsUserIdId = optional "id"
, brightjsUserIdOrganizationId = optional "organization_id"
, brightjsUserIdBrightjsUserId = optional "brightjs_user_id"
, brightjsUserIdCreatedAt = required "created_at"
, brightjsUserIdUpdatedAt = required "updated_at"
}
)
---- TYPES FOR TABLE chargify_events ----
data ChargifyEvent' c1 c2 c3 c4 c5 c6 c7 c8 c9 c10 c11 c12 c13 =
ChargifyEvent
{ chargifyEventId :: c1
, chargifyEventBillingSystemId :: c2
, chargifyEventOccurredAt :: c3
, chargifyEventKey :: c4
, chargifyEventMessage :: c5
, chargifyEventMetadata :: c6
, chargifyEventSubscriptionId :: c7
, chargifyEventCreatedAt :: c8
, chargifyEventUpdatedAt :: c9
, chargifyEventProcessedAt :: c10
, chargifyEventAccountId :: c11
, chargifyEventDeferredAt :: c12
, chargifyEventErrantAt :: c13
}
type ChargifyEvent = ChargifyEvent' Int32 (Maybe Text) (Maybe LocalTime) (Maybe Text) (Maybe Text) (Maybe JSON.Value) (Maybe Int32) LocalTime LocalTime (Maybe LocalTime) (Maybe Int32) (Maybe LocalTime) (Maybe LocalTime)
type ChargifyEventReadColumns = ChargifyEvent' (Column PGInt4) (Column (Nullable PGText)) (Column (Nullable PGTimestamp)) (Column (Nullable PGText)) (Column (Nullable PGText)) (Column (Nullable PGJson)) (Column (Nullable PGInt4)) (Column PGTimestamp) (Column PGTimestamp) (Column (Nullable PGTimestamp)) (Column (Nullable PGInt4)) (Column (Nullable PGTimestamp)) (Column (Nullable PGTimestamp))
type ChargifyEventWriteColumns = ChargifyEvent' (Maybe (Column PGInt4)) (Maybe (Column (Nullable PGText))) (Maybe (Column (Nullable PGTimestamp))) (Maybe (Column (Nullable PGText))) (Maybe (Column (Nullable PGText))) (Maybe (Column (Nullable PGJson))) (Maybe (Column (Nullable PGInt4))) (Column PGTimestamp) (Column PGTimestamp) (Maybe (Column (Nullable PGTimestamp))) (Maybe (Column (Nullable PGInt4))) (Maybe (Column (Nullable PGTimestamp))) (Maybe (Column (Nullable PGTimestamp)))
$(makeAdaptorAndInstance "pChargifyEvent" ''ChargifyEvent')
chargifyEventTable :: Table ChargifyEventWriteColumns ChargifyEventReadColumns
chargifyEventTable = Table "chargify_events" (pChargifyEvent
ChargifyEvent
{ chargifyEventId = optional "id"
, chargifyEventBillingSystemId = optional "billing_system_id"
, chargifyEventOccurredAt = optional "occurred_at"
, chargifyEventKey = optional "key"
, chargifyEventMessage = optional "message"
, chargifyEventMetadata = optional "metadata"
, chargifyEventSubscriptionId = optional "subscription_id"
, chargifyEventCreatedAt = required "created_at"
, chargifyEventUpdatedAt = required "updated_at"
, chargifyEventProcessedAt = optional "processed_at"
, chargifyEventAccountId = optional "account_id"
, chargifyEventDeferredAt = optional "deferred_at"
, chargifyEventErrantAt = optional "errant_at"
}
)
---- TYPES FOR TABLE components ----
data Component' c1 c2 c3 c4 c5 c6 c7 c8 c9 c10 c11 c12 c13 c14 =
Component
{ componentId :: c1
, componentBillingSystemId :: c2
, componentBillingSystemGroupId :: c3
, componentName :: c4
, componentPricingMethod :: c5
, componentUnitName :: c6
, componentUnitPrice :: c7
, componentKind :: c8
, componentPrices :: c9
, componentArchived :: c10
, componentCreatedAt :: c11
, componentUpdatedAt :: c12
, componentService :: c13
, componentAccountId :: c14
}
type Component = Component' Int32 (Maybe Text) (Maybe Text) (Maybe Text) (Maybe Text) (Maybe Text) (Maybe Scientific) (Maybe Text) (Maybe JSON.Value) (Maybe Bool) LocalTime LocalTime (Maybe Int32) (Maybe Int32)
type ComponentReadColumns = Component' (Column PGInt4) (Column (Nullable PGText)) (Column (Nullable PGText)) (Column (Nullable PGText)) (Column (Nullable PGText)) (Column (Nullable PGText)) (Column (Nullable PGNumeric)) (Column (Nullable PGText)) (Column (Nullable PGJson)) (Column (Nullable PGBool)) (Column PGTimestamp) (Column PGTimestamp) (Column (Nullable PGInt4)) (Column (Nullable PGInt4))
type ComponentWriteColumns = Component' (Maybe (Column PGInt4)) (Maybe (Column (Nullable PGText))) (Maybe (Column (Nullable PGText))) (Maybe (Column (Nullable PGText))) (Maybe (Column (Nullable PGText))) (Maybe (Column (Nullable PGText))) (Maybe (Column (Nullable PGNumeric))) (Maybe (Column (Nullable PGText))) (Maybe (Column (Nullable PGJson))) (Maybe (Column (Nullable PGBool))) (Column PGTimestamp) (Column PGTimestamp) (Maybe (Column (Nullable PGInt4))) (Maybe (Column (Nullable PGInt4)))
$(makeAdaptorAndInstance "pComponent" ''Component')
componentTable :: Table ComponentWriteColumns ComponentReadColumns
componentTable = Table "components" (pComponent
Component
{ componentId = optional "id"
, componentBillingSystemId = optional "billing_system_id"
, componentBillingSystemGroupId = optional "billing_system_group_id"
, componentName = optional "name"
, componentPricingMethod = optional "pricing_method"
, componentUnitName = optional "unit_name"
, componentUnitPrice = optional "unit_price"
, componentKind = optional "kind"
, componentPrices = optional "prices"
, componentArchived = optional "archived"
, componentCreatedAt = required "created_at"
, componentUpdatedAt = required "updated_at"
, componentService = optional "service"
, componentAccountId = optional "account_id"
}
)
---- TYPES FOR TABLE coupons ----
data Coupon' c1 c2 c3 c4 c5 c6 c7 c8 c9 c10 c11 c12 c13 c14 c15 c16 c17 c18 c19 c20 c21 c22 c23 =
Coupon
{ couponId :: c1
, couponBillingSystemId :: c2
, couponName :: c3
, couponDescription :: c4
, couponCode :: c5
, couponDuration :: c6
, couponDurationInMonths :: c7
, couponAmountOff :: c8
, couponPercentOff :: c9
, couponStartAt :: c10
, couponEndAt :: c11
, couponRedemptionLimit :: c12
, couponCreatedAt :: c13
, couponUpdatedAt :: c14
, couponNumberOfRedemptions :: c15
, couponRevenueGenerated :: c16
, couponCurrentMrr :: c17
, couponCurrentCustomers :: c18
, couponService :: c19
, couponSubcodes :: c20
, couponAccountId :: c21
, couponDeletedAt :: c22
, couponCurrency :: c23
}
type Coupon = Coupon' Int32 (Maybe Text) (Maybe Text) (Maybe Text) (Maybe Text) (Maybe Text) (Maybe Int32) (Maybe Scientific) (Maybe Int32) (Maybe LocalTime) (Maybe LocalTime) (Maybe Int32) LocalTime LocalTime (Maybe Int32) (Maybe Scientific) (Maybe Scientific) (Maybe Int32) (Maybe Int32) ([Text]) (Maybe Int32) (Maybe LocalTime) (Maybe Text)
type CouponReadColumns = Coupon' (Column PGInt4) (Column (Nullable PGText)) (Column (Nullable PGText)) (Column (Nullable PGText)) (Column (Nullable PGText)) (Column (Nullable PGText)) (Column (Nullable PGInt4)) (Column (Nullable PGNumeric)) (Column (Nullable PGInt4)) (Column (Nullable PGTimestamp)) (Column (Nullable PGTimestamp)) (Column (Nullable PGInt4)) (Column PGTimestamp) (Column PGTimestamp) (Column (Nullable PGInt4)) (Column (Nullable PGNumeric)) (Column (Nullable PGNumeric)) (Column (Nullable PGInt4)) (Column (Nullable PGInt4)) (Column (Nullable (PGArray Text))) (Column (Nullable PGInt4)) (Column (Nullable PGTimestamp)) (Column (Nullable PGText))
type CouponWriteColumns = Coupon' (Maybe (Column PGInt4)) (Maybe (Column (Nullable PGText))) (Maybe (Column (Nullable PGText))) (Maybe (Column (Nullable PGText))) (Maybe (Column (Nullable PGText))) (Maybe (Column (Nullable PGText))) (Maybe (Column (Nullable PGInt4))) (Maybe (Column (Nullable PGNumeric))) (Maybe (Column (Nullable PGInt4))) (Maybe (Column (Nullable PGTimestamp))) (Maybe (Column (Nullable PGTimestamp))) (Maybe (Column (Nullable PGInt4))) (Column PGTimestamp) (Column PGTimestamp) (Maybe (Column (Nullable PGInt4))) (Maybe (Column (Nullable PGNumeric))) (Maybe (Column (Nullable PGNumeric))) (Maybe (Column (Nullable PGInt4))) (Maybe (Column (Nullable PGInt4))) (Maybe (Column (Nullable (PGArray Text)))) (Maybe (Column (Nullable PGInt4))) (Maybe (Column (Nullable PGTimestamp))) (Maybe (Column (Nullable PGText)))
$(makeAdaptorAndInstance "pCoupon" ''Coupon')
couponTable :: Table CouponWriteColumns CouponReadColumns
couponTable = Table "coupons" (pCoupon
Coupon
{ couponId = optional "id"
, couponBillingSystemId = optional "billing_system_id"
, couponName = optional "name"
, couponDescription = optional "description"
, couponCode = optional "code"
, couponDuration = optional "duration"
, couponDurationInMonths = optional "duration_in_months"
, couponAmountOff = optional "amount_off"
, couponPercentOff = optional "percent_off"
, couponStartAt = optional "start_at"
, couponEndAt = optional "end_at"
, couponRedemptionLimit = optional "redemption_limit"
, couponCreatedAt = required "created_at"
, couponUpdatedAt = required "updated_at"
, couponNumberOfRedemptions = optional "number_of_redemptions"
, couponRevenueGenerated = optional "revenue_generated"
, couponCurrentMrr = optional "current_mrr"
, couponCurrentCustomers = optional "current_customers"
, couponService = optional "service"
, couponSubcodes = optional "subcodes"
, couponAccountId = optional "account_id"
, couponDeletedAt = optional "deleted_at"
, couponCurrency = optional "currency"
}
)
---- TYPES FOR TABLE events ----
data Event' c1 c2 c3 c4 c5 c6 c7 c8 c9 c10 c11 c12 c13 c14 c15 =
Event
{ eventId :: c1
, eventType :: c2
, eventOccurredAt :: c3
, eventAmount :: c4
, eventMetadata :: c5
, eventService :: c6
, eventAccountId :: c7
, eventOrganizationId :: c8
, eventSubscriptionId :: c9
, eventPlanId :: c10
, eventComponentId :: c11
, eventCouponId :: c12
, eventCreatedAt :: c13
, eventUpdatedAt :: c14
, eventValidatedAt :: c15
}
type Event = Event' Int32 (Maybe Text) (Maybe LocalTime) (Maybe Scientific) (Maybe JSON.Value) (Maybe Int32) (Maybe Int32) (Maybe Int32) (Maybe Int32) (Maybe Int32) (Maybe Int32) (Maybe Int32) LocalTime LocalTime (Maybe LocalTime)
type EventReadColumns = Event' (Column PGInt4) (Column (Nullable PGText)) (Column (Nullable PGTimestamp)) (Column (Nullable PGNumeric)) (Column (Nullable PGJson)) (Column (Nullable PGInt4)) (Column (Nullable PGInt4)) (Column (Nullable PGInt4)) (Column (Nullable PGInt4)) (Column (Nullable PGInt4)) (Column (Nullable PGInt4)) (Column (Nullable PGInt4)) (Column PGTimestamp) (Column PGTimestamp) (Column (Nullable PGTimestamp))
type EventWriteColumns = Event' (Maybe (Column PGInt4)) (Maybe (Column (Nullable PGText))) (Maybe (Column (Nullable PGTimestamp))) (Maybe (Column (Nullable PGNumeric))) (Maybe (Column (Nullable PGJson))) (Maybe (Column (Nullable PGInt4))) (Maybe (Column (Nullable PGInt4))) (Maybe (Column (Nullable PGInt4))) (Maybe (Column (Nullable PGInt4))) (Maybe (Column (Nullable PGInt4))) (Maybe (Column (Nullable PGInt4))) (Maybe (Column (Nullable PGInt4))) (Column PGTimestamp) (Column PGTimestamp) (Maybe (Column (Nullable PGTimestamp)))
$(makeAdaptorAndInstance "pEvent" ''Event')
eventTable :: Table EventWriteColumns EventReadColumns
eventTable = Table "events" (pEvent
Event
{ eventId = optional "id"
, eventType = optional "type"
, eventOccurredAt = optional "occurred_at"
, eventAmount = optional "amount"
, eventMetadata = optional "metadata"
, eventService = optional "service"
, eventAccountId = optional "account_id"
, eventOrganizationId = optional "organization_id"
, eventSubscriptionId = optional "subscription_id"
, eventPlanId = optional "plan_id"
, eventComponentId = optional "component_id"
, eventCouponId = optional "coupon_id"
, eventCreatedAt = required "created_at"
, eventUpdatedAt = required "updated_at"
, eventValidatedAt = optional "validated_at"
}
)
---- TYPES FOR TABLE imports ----
data Import' c1 c2 c3 c4 c5 c6 c7 c8 c9 c10 c11 c12 =
Import
{ importId :: c1
, importAccountId :: c2
, importUserId :: c3
, importService :: c4
, importJobIdentifier :: c5
, importStartedAt :: c6
, importFinishedAt :: c7
, importRecordsToImport :: c8
, importRecordsImported :: c9
, importCreatedAt :: c10
, importUpdatedAt :: c11
, importTimePerRecord :: c12
}
type Import = Import' Int32 (Maybe Int32) (Maybe Int32) (Maybe Int32) (Maybe Text) (Maybe LocalTime) (Maybe LocalTime) (Maybe Int32) (Maybe Int32) LocalTime LocalTime (Maybe Double)
type ImportReadColumns = Import' (Column PGInt4) (Column (Nullable PGInt4)) (Column (Nullable PGInt4)) (Column (Nullable PGInt4)) (Column (Nullable PGText)) (Column (Nullable PGTimestamp)) (Column (Nullable PGTimestamp)) (Column (Nullable PGInt4)) (Column (Nullable PGInt4)) (Column PGTimestamp) (Column PGTimestamp) (Column (Nullable PGFloat8))
type ImportWriteColumns = Import' (Maybe (Column PGInt4)) (Maybe (Column (Nullable PGInt4))) (Maybe (Column (Nullable PGInt4))) (Maybe (Column (Nullable PGInt4))) (Maybe (Column (Nullable PGText))) (Maybe (Column (Nullable PGTimestamp))) (Maybe (Column (Nullable PGTimestamp))) (Maybe (Column (Nullable PGInt4))) (Maybe (Column (Nullable PGInt4))) (Column PGTimestamp) (Column PGTimestamp) (Maybe (Column (Nullable PGFloat8)))
$(makeAdaptorAndInstance "pImport" ''Import')
importTable :: Table ImportWriteColumns ImportReadColumns
importTable = Table "imports" (pImport
Import
{ importId = optional "id"
, importAccountId = optional "account_id"
, importUserId = optional "user_id"
, importService = optional "service"
, importJobIdentifier = optional "job_identifier"
, importStartedAt = optional "started_at"
, importFinishedAt = optional "finished_at"
, importRecordsToImport = optional "records_to_import"
, importRecordsImported = optional "records_imported"
, importCreatedAt = required "created_at"
, importUpdatedAt = required "updated_at"
, importTimePerRecord = optional "time_per_record"
}
)
---- TYPES FOR TABLE invoice_line_items ----
data InvoiceLineItem' c1 c2 c3 c4 c5 c6 c7 c8 c9 c10 c11 c12 c13 c14 c15 c16 c17 c18 c19 c20 =
InvoiceLineItem
{ invoiceLineItemId :: c1
, invoiceLineItemService :: c2
, invoiceLineItemBillingSystemId :: c3
, invoiceLineItemAccountId :: c4
, invoiceLineItemOrganizationId :: c5
, invoiceLineItemSubscriptionId :: c6
, invoiceLineItemInvoiceId :: c7
, invoiceLineItemPlanId :: c8
, invoiceLineItemAmount :: c9
, invoiceLineItemCurrency :: c10
, invoiceLineItemDescription :: c11
, invoiceLineItemDiscountable :: c12
, invoiceLineItemMetadata :: c13
, invoiceLineItemPeriodStartAt :: c14
, invoiceLineItemPeriodEndAt :: c15
, invoiceLineItemProration :: c16
, invoiceLineItemQuantity :: c17
, invoiceLineItemType :: c18
, invoiceLineItemCreatedAt :: c19
, invoiceLineItemUpdatedAt :: c20
}
type InvoiceLineItem = InvoiceLineItem' Int32 (Maybe Int32) (Maybe Text) (Maybe Int32) (Maybe Int32) (Maybe Int32) (Maybe Int32) (Maybe Int32) (Maybe Scientific) (Maybe Text) (Maybe Text) (Maybe Bool) (Maybe JSON.Value) (Maybe LocalTime) (Maybe LocalTime) (Maybe Bool) (Maybe Int32) (Maybe Text) LocalTime LocalTime
type InvoiceLineItemReadColumns = InvoiceLineItem' (Column PGInt4) (Column (Nullable PGInt4)) (Column (Nullable PGText)) (Column (Nullable PGInt4)) (Column (Nullable PGInt4)) (Column (Nullable PGInt4)) (Column (Nullable PGInt4)) (Column (Nullable PGInt4)) (Column (Nullable PGNumeric)) (Column (Nullable PGText)) (Column (Nullable PGText)) (Column (Nullable PGBool)) (Column (Nullable PGJson)) (Column (Nullable PGTimestamp)) (Column (Nullable PGTimestamp)) (Column (Nullable PGBool)) (Column (Nullable PGInt4)) (Column (Nullable PGText)) (Column PGTimestamp) (Column PGTimestamp)
type InvoiceLineItemWriteColumns = InvoiceLineItem' (Maybe (Column PGInt4)) (Maybe (Column (Nullable PGInt4))) (Maybe (Column (Nullable PGText))) (Maybe (Column (Nullable PGInt4))) (Maybe (Column (Nullable PGInt4))) (Maybe (Column (Nullable PGInt4))) (Maybe (Column (Nullable PGInt4))) (Maybe (Column (Nullable PGInt4))) (Maybe (Column (Nullable PGNumeric))) (Maybe (Column (Nullable PGText))) (Maybe (Column (Nullable PGText))) (Maybe (Column (Nullable PGBool))) (Maybe (Column (Nullable PGJson))) (Maybe (Column (Nullable PGTimestamp))) (Maybe (Column (Nullable PGTimestamp))) (Maybe (Column (Nullable PGBool))) (Maybe (Column (Nullable PGInt4))) (Maybe (Column (Nullable PGText))) (Column PGTimestamp) (Column PGTimestamp)
$(makeAdaptorAndInstance "pInvoiceLineItem" ''InvoiceLineItem')
invoiceLineItemTable :: Table InvoiceLineItemWriteColumns InvoiceLineItemReadColumns
invoiceLineItemTable = Table "invoice_line_items" (pInvoiceLineItem
InvoiceLineItem
{ invoiceLineItemId = optional "id"
, invoiceLineItemService = optional "service"
, invoiceLineItemBillingSystemId = optional "billing_system_id"
, invoiceLineItemAccountId = optional "account_id"
, invoiceLineItemOrganizationId = optional "organization_id"
, invoiceLineItemSubscriptionId = optional "subscription_id"
, invoiceLineItemInvoiceId = optional "invoice_id"
, invoiceLineItemPlanId = optional "plan_id"
, invoiceLineItemAmount = optional "amount"
, invoiceLineItemCurrency = optional "currency"
, invoiceLineItemDescription = optional "description"
, invoiceLineItemDiscountable = optional "discountable"
, invoiceLineItemMetadata = optional "metadata"
, invoiceLineItemPeriodStartAt = optional "period_start_at"
, invoiceLineItemPeriodEndAt = optional "period_end_at"
, invoiceLineItemProration = optional "proration"
, invoiceLineItemQuantity = optional "quantity"
, invoiceLineItemType = optional "type"
, invoiceLineItemCreatedAt = required "created_at"
, invoiceLineItemUpdatedAt = required "updated_at"
}
)
---- TYPES FOR TABLE invoices ----
data Invoice' c1 c2 c3 c4 c5 c6 c7 c8 c9 c10 c11 c12 c13 c14 c15 c16 c17 c18 c19 c20 c21 =
Invoice
{ invoiceId :: c1
, invoiceBillingSystemId :: c2
, invoiceAccountId :: c3
, invoiceOrganizationId :: c4
, invoiceSubscriptionId :: c5
, invoiceOpenedAt :: c6
, invoiceClosedAt :: c7
, invoiceSettledAt :: c8
, invoiceStartingBalance :: c9
, invoiceEndingBalance :: c10
, invoiceTotal :: c11
, invoiceBillingSystemCreatedAt :: c12
, invoiceCreatedAt :: c13
, invoiceUpdatedAt :: c14
, invoiceService :: c15
, invoiceCurrency :: c16
, invoiceAmountDue :: c17
, invoiceCouponId :: c18
, invoiceDiscountPercentOff :: c19
, invoiceDiscountAmountOff :: c20
, invoiceSubtotal :: c21
}
type Invoice = Invoice' Int32 (Maybe Text) (Maybe Int32) (Maybe Int32) (Maybe Int32) (Maybe LocalTime) (Maybe LocalTime) (Maybe LocalTime) (Maybe Scientific) (Maybe Scientific) (Maybe Scientific) (Maybe LocalTime) LocalTime LocalTime (Maybe Int32) (Maybe Text) (Maybe Scientific) (Maybe Int32) (Maybe Int32) (Maybe Scientific) (Maybe Scientific)
type InvoiceReadColumns = Invoice' (Column PGInt4) (Column (Nullable PGText)) (Column (Nullable PGInt4)) (Column (Nullable PGInt4)) (Column (Nullable PGInt4)) (Column (Nullable PGTimestamp)) (Column (Nullable PGTimestamp)) (Column (Nullable PGTimestamp)) (Column (Nullable PGNumeric)) (Column (Nullable PGNumeric)) (Column (Nullable PGNumeric)) (Column (Nullable PGTimestamp)) (Column PGTimestamp) (Column PGTimestamp) (Column (Nullable PGInt4)) (Column (Nullable PGText)) (Column (Nullable PGNumeric)) (Column (Nullable PGInt4)) (Column (Nullable PGInt4)) (Column (Nullable PGNumeric)) (Column (Nullable PGNumeric))
type InvoiceWriteColumns = Invoice' (Maybe (Column PGInt4)) (Maybe (Column (Nullable PGText))) (Maybe (Column (Nullable PGInt4))) (Maybe (Column (Nullable PGInt4))) (Maybe (Column (Nullable PGInt4))) (Maybe (Column (Nullable PGTimestamp))) (Maybe (Column (Nullable PGTimestamp))) (Maybe (Column (Nullable PGTimestamp))) (Maybe (Column (Nullable PGNumeric))) (Maybe (Column (Nullable PGNumeric))) (Maybe (Column (Nullable PGNumeric))) (Maybe (Column (Nullable PGTimestamp))) (Column PGTimestamp) (Column PGTimestamp) (Maybe (Column (Nullable PGInt4))) (Maybe (Column (Nullable PGText))) (Maybe (Column (Nullable PGNumeric))) (Maybe (Column (Nullable PGInt4))) (Maybe (Column (Nullable PGInt4))) (Maybe (Column (Nullable PGNumeric))) (Maybe (Column (Nullable PGNumeric)))
$(makeAdaptorAndInstance "pInvoice" ''Invoice')
invoiceTable :: Table InvoiceWriteColumns InvoiceReadColumns
invoiceTable = Table "invoices" (pInvoice
Invoice
{ invoiceId = optional "id"
, invoiceBillingSystemId = optional "billing_system_id"
, invoiceAccountId = optional "account_id"
, invoiceOrganizationId = optional "organization_id"
, invoiceSubscriptionId = optional "subscription_id"
, invoiceOpenedAt = optional "opened_at"
, invoiceClosedAt = optional "closed_at"
, invoiceSettledAt = optional "settled_at"
, invoiceStartingBalance = optional "starting_balance"
, invoiceEndingBalance = optional "ending_balance"
, invoiceTotal = optional "total"
, invoiceBillingSystemCreatedAt = optional "billing_system_created_at"
, invoiceCreatedAt = required "created_at"
, invoiceUpdatedAt = required "updated_at"
, invoiceService = optional "service"
, invoiceCurrency = optional "currency"
, invoiceAmountDue = optional "amount_due"
, invoiceCouponId = optional "coupon_id"
, invoiceDiscountPercentOff = optional "discount_percent_off"
, invoiceDiscountAmountOff = optional "discount_amount_off"
, invoiceSubtotal = optional "subtotal"
}
)
---- TYPES FOR TABLE metrics ----
data Metric' c1 c2 c3 c4 c5 c6 c7 c8 c9 c10 c11 c12 c13 c14 c15 c16 c17 =
Metric
{ metricId :: c1
, metricAccountId :: c2
, metricDate :: c3
, metricNewMrr :: c4
, metricDiscountRollOffMrr :: c5
, metricExpansionMrr :: c6
, metricReactivationMrr :: c7
, metricContractionMrr :: c8
, metricChurnMrr :: c9
, metricNetMrrChange :: c10
, metricTotalMrr :: c11
, metricNewCustomers :: c12
, metricLostCustomers :: c13
, metricCreatedAt :: c14
, metricUpdatedAt :: c15
, metricTotalCustomers :: c16
, metricReactivatedCustomers :: c17
}
type Metric = Metric' Int32 (Maybe Int32) (Maybe Day) (Maybe Scientific) (Maybe Scientific) (Maybe Scientific) (Maybe Scientific) (Maybe Scientific) (Maybe Scientific) (Maybe Scientific) (Maybe Scientific) (Maybe Int32) (Maybe Int32) LocalTime LocalTime (Maybe Int32) (Maybe Int32)
type MetricReadColumns = Metric' (Column PGInt4) (Column (Nullable PGInt4)) (Column (Nullable PGDate)) (Column (Nullable PGNumeric)) (Column (Nullable PGNumeric)) (Column (Nullable PGNumeric)) (Column (Nullable PGNumeric)) (Column (Nullable PGNumeric)) (Column (Nullable PGNumeric)) (Column (Nullable PGNumeric)) (Column (Nullable PGNumeric)) (Column (Nullable PGInt4)) (Column (Nullable PGInt4)) (Column PGTimestamp) (Column PGTimestamp) (Column (Nullable PGInt4)) (Column (Nullable PGInt4))
type MetricWriteColumns = Metric' (Maybe (Column PGInt4)) (Maybe (Column (Nullable PGInt4))) (Maybe (Column (Nullable PGDate))) (Maybe (Column (Nullable PGNumeric))) (Maybe (Column (Nullable PGNumeric))) (Maybe (Column (Nullable PGNumeric))) (Maybe (Column (Nullable PGNumeric))) (Maybe (Column (Nullable PGNumeric))) (Maybe (Column (Nullable PGNumeric))) (Maybe (Column (Nullable PGNumeric))) (Maybe (Column (Nullable PGNumeric))) (Maybe (Column (Nullable PGInt4))) (Maybe (Column (Nullable PGInt4))) (Column PGTimestamp) (Column PGTimestamp) (Maybe (Column (Nullable PGInt4))) (Maybe (Column (Nullable PGInt4)))
$(makeAdaptorAndInstance "pMetric" ''Metric')
metricTable :: Table MetricWriteColumns MetricReadColumns
metricTable = Table "metrics" (pMetric
Metric
{ metricId = optional "id"
, metricAccountId = optional "account_id"
, metricDate = optional "date"
, metricNewMrr = optional "new_mrr"
, metricDiscountRollOffMrr = optional "discount_roll_off_mrr"
, metricExpansionMrr = optional "expansion_mrr"
, metricReactivationMrr = optional "reactivation_mrr"
, metricContractionMrr = optional "contraction_mrr"
, metricChurnMrr = optional "churn_mrr"
, metricNetMrrChange = optional "net_mrr_change"
, metricTotalMrr = optional "total_mrr"
, metricNewCustomers = optional "new_customers"
, metricLostCustomers = optional "lost_customers"
, metricCreatedAt = required "created_at"
, metricUpdatedAt = required "updated_at"
, metricTotalCustomers = optional "total_customers"
, metricReactivatedCustomers = optional "reactivated_customers"
}
)
---- TYPES FOR TABLE organizations ----
data Organization' c1 c2 c3 c4 c5 c6 c7 c8 c9 c10 c11 c12 c13 c14 c15 c16 c17 c18 c19 c20 c21 c22 c23 c24 =
Organization
{ organizationId :: c1
, organizationName :: c2
, organizationFirstName :: c3
, organizationLastName :: c4
, organizationEmail :: c5
, organizationCustomerId :: c6
, organizationBillingSystemId :: c7
, organizationBillingSystemCreatedAt :: c8
, organizationBillingSystemUpdatedAt :: c9
, organizationAddress1 :: c10
, organizationAddress2 :: c11
, organizationCity :: c12
, organizationRegion :: c13
, organizationPostalCode :: c14
, organizationCountryCode :: c15
, organizationVatNumber :: c16
, organizationPhone :: c17
, organizationWebsite :: c18
, organizationCreatedAt :: c19
, organizationUpdatedAt :: c20
, organizationAccountId :: c21
, organizationService :: c22
, organizationTotalRevenue :: c23
, organizationLastSubscriptionActivatedAt :: c24
}
type Organization = Organization' Int32 (Maybe Text) (Maybe Text) (Maybe Text) (Maybe Text) (Maybe Text) (Maybe Text) (Maybe LocalTime) (Maybe LocalTime) (Maybe Text) (Maybe Text) (Maybe Text) (Maybe Text) (Maybe Text) (Maybe Text) (Maybe Text) (Maybe Text) (Maybe Text) LocalTime LocalTime (Maybe Int32) (Maybe Int32) (Maybe Scientific) (Maybe LocalTime)
type OrganizationReadColumns = Organization' (Column PGInt4) (Column (Nullable PGText)) (Column (Nullable PGText)) (Column (Nullable PGText)) (Column (Nullable PGText)) (Column (Nullable PGText)) (Column (Nullable PGText)) (Column (Nullable PGTimestamp)) (Column (Nullable PGTimestamp)) (Column (Nullable PGText)) (Column (Nullable PGText)) (Column (Nullable PGText)) (Column (Nullable PGText)) (Column (Nullable PGText)) (Column (Nullable PGText)) (Column (Nullable PGText)) (Column (Nullable PGText)) (Column (Nullable PGText)) (Column PGTimestamp) (Column PGTimestamp) (Column (Nullable PGInt4)) (Column (Nullable PGInt4)) (Column (Nullable PGNumeric)) (Column (Nullable PGTimestamp))
type OrganizationWriteColumns = Organization' (Maybe (Column PGInt4)) (Maybe (Column (Nullable PGText))) (Maybe (Column (Nullable PGText))) (Maybe (Column (Nullable PGText))) (Maybe (Column (Nullable PGText))) (Maybe (Column (Nullable PGText))) (Maybe (Column (Nullable PGText))) (Maybe (Column (Nullable PGTimestamp))) (Maybe (Column (Nullable PGTimestamp))) (Maybe (Column (Nullable PGText))) (Maybe (Column (Nullable PGText))) (Maybe (Column (Nullable PGText))) (Maybe (Column (Nullable PGText))) (Maybe (Column (Nullable PGText))) (Maybe (Column (Nullable PGText))) (Maybe (Column (Nullable PGText))) (Maybe (Column (Nullable PGText))) (Maybe (Column (Nullable PGText))) (Column PGTimestamp) (Column PGTimestamp) (Maybe (Column (Nullable PGInt4))) (Maybe (Column (Nullable PGInt4))) (Maybe (Column (Nullable PGNumeric))) (Maybe (Column (Nullable PGTimestamp)))
$(makeAdaptorAndInstance "pOrganization" ''Organization')
organizationTable :: Table OrganizationWriteColumns OrganizationReadColumns
organizationTable = Table "organizations" (pOrganization
Organization
{ organizationId = optional "id"
, organizationName = optional "name"
, organizationFirstName = optional "first_name"
, organizationLastName = optional "last_name"
, organizationEmail = optional "email"
, organizationCustomerId = optional "customer_id"
, organizationBillingSystemId = optional "billing_system_id"
, organizationBillingSystemCreatedAt = optional "billing_system_created_at"
, organizationBillingSystemUpdatedAt = optional "billing_system_updated_at"
, organizationAddress1 = optional "address1"
, organizationAddress2 = optional "address2"
, organizationCity = optional "city"
, organizationRegion = optional "region"
, organizationPostalCode = optional "postal_code"
, organizationCountryCode = optional "country_code"
, organizationVatNumber = optional "vat_number"
, organizationPhone = optional "phone"
, organizationWebsite = optional "website"
, organizationCreatedAt = required "created_at"
, organizationUpdatedAt = required "updated_at"
, organizationAccountId = optional "account_id"
, organizationService = optional "service"
, organizationTotalRevenue = optional "total_revenue"
, organizationLastSubscriptionActivatedAt = optional "last_subscription_activated_at"
}
)
---- TYPES FOR TABLE pending_invoice_items ----
data PendingInvoiceItem' c1 c2 c3 c4 c5 c6 c7 c8 c9 c10 c11 c12 c13 c14 c15 c16 c17 c18 c19 c20 =
PendingInvoiceItem
{ pendingInvoiceItemId :: c1
, pendingInvoiceItemService :: c2
, pendingInvoiceItemBillingSystemId :: c3
, pendingInvoiceItemAccountId :: c4
, pendingInvoiceItemOrganizationId :: c5
, pendingInvoiceItemSubscriptionId :: c6
, pendingInvoiceItemPlanId :: c7
, pendingInvoiceItemInvoiceId :: c8
, pendingInvoiceItemAmount :: c9
, pendingInvoiceItemCurrency :: c10
, pendingInvoiceItemRecordedAt :: c11
, pendingInvoiceItemPeriodStartAt :: c12
, pendingInvoiceItemPeriodEndAt :: c13
, pendingInvoiceItemDescription :: c14
, pendingInvoiceItemDiscountable :: c15
, pendingInvoiceItemProration :: c16
, pendingInvoiceItemQuantity :: c17
, pendingInvoiceItemMetadata :: c18
, pendingInvoiceItemCreatedAt :: c19
, pendingInvoiceItemUpdatedAt :: c20
}
type PendingInvoiceItem = PendingInvoiceItem' Int32 (Maybe Int32) (Maybe Text) (Maybe Int32) (Maybe Int32) (Maybe Int32) (Maybe Int32) (Maybe Int32) (Maybe Scientific) (Maybe Text) (Maybe LocalTime) (Maybe LocalTime) (Maybe LocalTime) (Maybe Text) (Maybe Bool) (Maybe Bool) (Maybe Int32) (Maybe JSON.Value) LocalTime LocalTime
type PendingInvoiceItemReadColumns = PendingInvoiceItem' (Column PGInt4) (Column (Nullable PGInt4)) (Column (Nullable PGText)) (Column (Nullable PGInt4)) (Column (Nullable PGInt4)) (Column (Nullable PGInt4)) (Column (Nullable PGInt4)) (Column (Nullable PGInt4)) (Column (Nullable PGNumeric)) (Column (Nullable PGText)) (Column (Nullable PGTimestamp)) (Column (Nullable PGTimestamp)) (Column (Nullable PGTimestamp)) (Column (Nullable PGText)) (Column (Nullable PGBool)) (Column (Nullable PGBool)) (Column (Nullable PGInt4)) (Column (Nullable PGJson)) (Column PGTimestamp) (Column PGTimestamp)
type PendingInvoiceItemWriteColumns = PendingInvoiceItem' (Maybe (Column PGInt4)) (Maybe (Column (Nullable PGInt4))) (Maybe (Column (Nullable PGText))) (Maybe (Column (Nullable PGInt4))) (Maybe (Column (Nullable PGInt4))) (Maybe (Column (Nullable PGInt4))) (Maybe (Column (Nullable PGInt4))) (Maybe (Column (Nullable PGInt4))) (Maybe (Column (Nullable PGNumeric))) (Maybe (Column (Nullable PGText))) (Maybe (Column (Nullable PGTimestamp))) (Maybe (Column (Nullable PGTimestamp))) (Maybe (Column (Nullable PGTimestamp))) (Maybe (Column (Nullable PGText))) (Maybe (Column (Nullable PGBool))) (Maybe (Column (Nullable PGBool))) (Maybe (Column (Nullable PGInt4))) (Maybe (Column (Nullable PGJson))) (Column PGTimestamp) (Column PGTimestamp)
$(makeAdaptorAndInstance "pPendingInvoiceItem" ''PendingInvoiceItem')
pendingInvoiceItemTable :: Table PendingInvoiceItemWriteColumns PendingInvoiceItemReadColumns
pendingInvoiceItemTable = Table "pending_invoice_items" (pPendingInvoiceItem
PendingInvoiceItem
{ pendingInvoiceItemId = optional "id"
, pendingInvoiceItemService = optional "service"
, pendingInvoiceItemBillingSystemId = optional "billing_system_id"
, pendingInvoiceItemAccountId = optional "account_id"
, pendingInvoiceItemOrganizationId = optional "organization_id"
, pendingInvoiceItemSubscriptionId = optional "subscription_id"
, pendingInvoiceItemPlanId = optional "plan_id"
, pendingInvoiceItemInvoiceId = optional "invoice_id"
, pendingInvoiceItemAmount = optional "amount"
, pendingInvoiceItemCurrency = optional "currency"
, pendingInvoiceItemRecordedAt = optional "recorded_at"
, pendingInvoiceItemPeriodStartAt = optional "period_start_at"
, pendingInvoiceItemPeriodEndAt = optional "period_end_at"
, pendingInvoiceItemDescription = optional "description"
, pendingInvoiceItemDiscountable = optional "discountable"
, pendingInvoiceItemProration = optional "proration"
, pendingInvoiceItemQuantity = optional "quantity"
, pendingInvoiceItemMetadata = optional "metadata"
, pendingInvoiceItemCreatedAt = required "created_at"
, pendingInvoiceItemUpdatedAt = required "updated_at"
}
)
---- TYPES FOR TABLE pg_stat_statements ----
data PgStatStatement' c1 c2 c3 c4 c5 c6 c7 c8 c9 c10 c11 c12 c13 c14 c15 c16 c17 c18 c19 c20 c21 c22 c23 =
PgStatStatement
{ pgStatStatementUserid :: c1
, pgStatStatementDbid :: c2
, pgStatStatementQueryid :: c3
, pgStatStatementQuery :: c4
, pgStatStatementCalls :: c5
, pgStatStatementTotalTime :: c6
, pgStatStatementMinTime :: c7
, pgStatStatementMaxTime :: c8
, pgStatStatementMeanTime :: c9
, pgStatStatementStddevTime :: c10
, pgStatStatementRows :: c11
, pgStatStatementSharedBlksHit :: c12
, pgStatStatementSharedBlksRead :: c13
, pgStatStatementSharedBlksDirtied :: c14
, pgStatStatementSharedBlksWritten :: c15
, pgStatStatementLocalBlksHit :: c16
, pgStatStatementLocalBlksRead :: c17
, pgStatStatementLocalBlksDirtied :: c18
, pgStatStatementLocalBlksWritten :: c19
, pgStatStatementTempBlksRead :: c20
, pgStatStatementTempBlksWritten :: c21
, pgStatStatementBlkReadTime :: c22
, pgStatStatementBlkWriteTime :: c23
}
type PgStatStatement = PgStatStatement' (Maybe Int64) (Maybe Int64) (Maybe Int64) (Maybe Text) (Maybe Int64) (Maybe Double) (Maybe Double) (Maybe Double) (Maybe Double) (Maybe Double) (Maybe Int64) (Maybe Int64) (Maybe Int64) (Maybe Int64) (Maybe Int64) (Maybe Int64) (Maybe Int64) (Maybe Int64) (Maybe Int64) (Maybe Int64) (Maybe Int64) (Maybe Double) (Maybe Double)
type PgStatStatementReadColumns = PgStatStatement' (Column (Nullable PGInt8)) (Column (Nullable PGInt8)) (Column (Nullable PGInt8)) (Column (Nullable PGText)) (Column (Nullable PGInt8)) (Column (Nullable PGFloat8)) (Column (Nullable PGFloat8)) (Column (Nullable PGFloat8)) (Column (Nullable PGFloat8)) (Column (Nullable PGFloat8)) (Column (Nullable PGInt8)) (Column (Nullable PGInt8)) (Column (Nullable PGInt8)) (Column (Nullable PGInt8)) (Column (Nullable PGInt8)) (Column (Nullable PGInt8)) (Column (Nullable PGInt8)) (Column (Nullable PGInt8)) (Column (Nullable PGInt8)) (Column (Nullable PGInt8)) (Column (Nullable PGInt8)) (Column (Nullable PGFloat8)) (Column (Nullable PGFloat8))
type PgStatStatementWriteColumns = PgStatStatement' (Maybe (Column (Nullable PGInt8))) (Maybe (Column (Nullable PGInt8))) (Maybe (Column (Nullable PGInt8))) (Maybe (Column (Nullable PGText))) (Maybe (Column (Nullable PGInt8))) (Maybe (Column (Nullable PGFloat8))) (Maybe (Column (Nullable PGFloat8))) (Maybe (Column (Nullable PGFloat8))) (Maybe (Column (Nullable PGFloat8))) (Maybe (Column (Nullable PGFloat8))) (Maybe (Column (Nullable PGInt8))) (Maybe (Column (Nullable PGInt8))) (Maybe (Column (Nullable PGInt8))) (Maybe (Column (Nullable PGInt8))) (Maybe (Column (Nullable PGInt8))) (Maybe (Column (Nullable PGInt8))) (Maybe (Column (Nullable PGInt8))) (Maybe (Column (Nullable PGInt8))) (Maybe (Column (Nullable PGInt8))) (Maybe (Column (Nullable PGInt8))) (Maybe (Column (Nullable PGInt8))) (Maybe (Column (Nullable PGFloat8))) (Maybe (Column (Nullable PGFloat8)))
$(makeAdaptorAndInstance "pPgStatStatement" ''PgStatStatement')
pgStatStatementTable :: Table PgStatStatementWriteColumns PgStatStatementReadColumns
pgStatStatementTable = Table "pg_stat_statements" (pPgStatStatement
PgStatStatement
{ pgStatStatementUserid = optional "userid"
, pgStatStatementDbid = optional "dbid"
, pgStatStatementQueryid = optional "queryid"
, pgStatStatementQuery = optional "query"
, pgStatStatementCalls = optional "calls"
, pgStatStatementTotalTime = optional "total_time"
, pgStatStatementMinTime = optional "min_time"
, pgStatStatementMaxTime = optional "max_time"
, pgStatStatementMeanTime = optional "mean_time"
, pgStatStatementStddevTime = optional "stddev_time"
, pgStatStatementRows = optional "rows"
, pgStatStatementSharedBlksHit = optional "shared_blks_hit"
, pgStatStatementSharedBlksRead = optional "shared_blks_read"
, pgStatStatementSharedBlksDirtied = optional "shared_blks_dirtied"
, pgStatStatementSharedBlksWritten = optional "shared_blks_written"
, pgStatStatementLocalBlksHit = optional "local_blks_hit"
, pgStatStatementLocalBlksRead = optional "local_blks_read"
, pgStatStatementLocalBlksDirtied = optional "local_blks_dirtied"
, pgStatStatementLocalBlksWritten = optional "local_blks_written"
, pgStatStatementTempBlksRead = optional "temp_blks_read"
, pgStatStatementTempBlksWritten = optional "temp_blks_written"
, pgStatStatementBlkReadTime = optional "blk_read_time"
, pgStatStatementBlkWriteTime = optional "blk_write_time"
}
)
---- TYPES FOR TABLE pghero_query_stats ----
data PgheroQueryStat' c1 c2 c3 c4 c5 c6 =
PgheroQueryStat
{ pgheroQueryStatId :: c1
, pgheroQueryStatDatabase :: c2
, pgheroQueryStatQuery :: c3
, pgheroQueryStatTotalTime :: c4
, pgheroQueryStatCalls :: c5
, pgheroQueryStatCapturedAt :: c6
}
type PgheroQueryStat = PgheroQueryStat' Int32 (Maybe Text) (Maybe Text) (Maybe Double) (Maybe Int64) (Maybe LocalTime)
type PgheroQueryStatReadColumns = PgheroQueryStat' (Column PGInt4) (Column (Nullable PGText)) (Column (Nullable PGText)) (Column (Nullable PGFloat8)) (Column (Nullable PGInt8)) (Column (Nullable PGTimestamp))
type PgheroQueryStatWriteColumns = PgheroQueryStat' (Maybe (Column PGInt4)) (Maybe (Column (Nullable PGText))) (Maybe (Column (Nullable PGText))) (Maybe (Column (Nullable PGFloat8))) (Maybe (Column (Nullable PGInt8))) (Maybe (Column (Nullable PGTimestamp)))
$(makeAdaptorAndInstance "pPgheroQueryStat" ''PgheroQueryStat')
pgheroQueryStatTable :: Table PgheroQueryStatWriteColumns PgheroQueryStatReadColumns
pgheroQueryStatTable = Table "pghero_query_stats" (pPgheroQueryStat
PgheroQueryStat
{ pgheroQueryStatId = optional "id"
, pgheroQueryStatDatabase = optional "database"
, pgheroQueryStatQuery = optional "query"
, pgheroQueryStatTotalTime = optional "total_time"
, pgheroQueryStatCalls = optional "calls"
, pgheroQueryStatCapturedAt = optional "captured_at"
}
)
---- TYPES FOR TABLE plans ----
data Plan' c1 c2 c3 c4 c5 c6 c7 c8 c9 c10 c11 c12 c13 c14 c15 c16 c17 =
Plan
{ planId :: c1
, planBillingSystemId :: c2
, planName :: c3
, planDescription :: c4
, planHandle :: c5
, planSetupFee :: c6
, planAmount :: c7
, planCreatedAt :: c8
, planUpdatedAt :: c9
, planBillingSystemGroupId :: c10
, planService :: c11
, planAccountId :: c12
, planIntervalUnit :: c13
, planIntervalCount :: c14
, planTrialPeriodDays :: c15
, planDeletedAt :: c16
, planCurrency :: c17
}
type Plan = Plan' Int32 (Maybe Text) (Maybe Text) (Maybe Text) (Maybe Text) (Maybe Scientific) (Maybe Scientific) LocalTime LocalTime (Maybe Text) (Maybe Int32) (Maybe Int32) (Maybe Text) (Maybe Int32) (Maybe Int32) (Maybe LocalTime) (Maybe Text)
type PlanReadColumns = Plan' (Column PGInt4) (Column (Nullable PGText)) (Column (Nullable PGText)) (Column (Nullable PGText)) (Column (Nullable PGText)) (Column (Nullable PGNumeric)) (Column (Nullable PGNumeric)) (Column PGTimestamp) (Column PGTimestamp) (Column (Nullable PGText)) (Column (Nullable PGInt4)) (Column (Nullable PGInt4)) (Column (Nullable PGText)) (Column (Nullable PGInt4)) (Column (Nullable PGInt4)) (Column (Nullable PGTimestamp)) (Column (Nullable PGText))
type PlanWriteColumns = Plan' (Maybe (Column PGInt4)) (Maybe (Column (Nullable PGText))) (Maybe (Column (Nullable PGText))) (Maybe (Column (Nullable PGText))) (Maybe (Column (Nullable PGText))) (Maybe (Column (Nullable PGNumeric))) (Maybe (Column (Nullable PGNumeric))) (Column PGTimestamp) (Column PGTimestamp) (Maybe (Column (Nullable PGText))) (Maybe (Column (Nullable PGInt4))) (Maybe (Column (Nullable PGInt4))) (Maybe (Column (Nullable PGText))) (Maybe (Column (Nullable PGInt4))) (Maybe (Column (Nullable PGInt4))) (Maybe (Column (Nullable PGTimestamp))) (Maybe (Column (Nullable PGText)))
$(makeAdaptorAndInstance "pPlan" ''Plan')
planTable :: Table PlanWriteColumns PlanReadColumns
planTable = Table "plans" (pPlan
Plan
{ planId = optional "id"
, planBillingSystemId = optional "billing_system_id"
, planName = optional "name"
, planDescription = optional "description"
, planHandle = optional "handle"
, planSetupFee = optional "setup_fee"
, planAmount = optional "amount"
, planCreatedAt = required "created_at"
, planUpdatedAt = required "updated_at"
, planBillingSystemGroupId = optional "billing_system_group_id"
, planService = optional "service"
, planAccountId = optional "account_id"
, planIntervalUnit = optional "interval_unit"
, planIntervalCount = optional "interval_count"
, planTrialPeriodDays = optional "trial_period_days"
, planDeletedAt = optional "deleted_at"
, planCurrency = optional "currency"
}
)
---- TYPES FOR TABLE schema_migrations ----
data SchemaMigration' c1 =
SchemaMigration
{ schemaMigrationVersion :: c1
}
type SchemaMigration = SchemaMigration' Text
type SchemaMigrationReadColumns = SchemaMigration' (Column PGText)
type SchemaMigrationWriteColumns = SchemaMigration' (Column PGText)
$(makeAdaptorAndInstance "pSchemaMigration" ''SchemaMigration')
schemaMigrationTable :: Table SchemaMigrationWriteColumns SchemaMigrationReadColumns
schemaMigrationTable = Table "schema_migrations" (pSchemaMigration
SchemaMigration
{ schemaMigrationVersion = required "version"
}
)
---- TYPES FOR TABLE sessions ----
data Session' c1 c2 c3 c4 c5 =
Session
{ sessionId :: c1
, sessionSessionId :: c2
, sessionData :: c3
, sessionCreatedAt :: c4
, sessionUpdatedAt :: c5
}
type Session = Session' Int32 Text (Maybe Text) (Maybe LocalTime) (Maybe LocalTime)
type SessionReadColumns = Session' (Column PGInt4) (Column PGText) (Column (Nullable PGText)) (Column (Nullable PGTimestamp)) (Column (Nullable PGTimestamp))
type SessionWriteColumns = Session' (Maybe (Column PGInt4)) (Column PGText) (Maybe (Column (Nullable PGText))) (Maybe (Column (Nullable PGTimestamp))) (Maybe (Column (Nullable PGTimestamp)))
$(makeAdaptorAndInstance "pSession" ''Session')
sessionTable :: Table SessionWriteColumns SessionReadColumns
sessionTable = Table "sessions" (pSession
Session
{ sessionId = optional "id"
, sessionSessionId = required "session_id"
, sessionData = optional "data"
, sessionCreatedAt = optional "created_at"
, sessionUpdatedAt = optional "updated_at"
}
)
---- TYPES FOR TABLE subscription_components ----
data SubscriptionComponent' c1 c2 c3 c4 c5 c6 =