schema.go 109 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879880881882883884885886887888889890891892893894895896897898899900901902903904905906907908909910911912913914915916917918919920921922923924925926927928929930931932933934935936937938939940941942943944945946947948949950951952953954955956957958959960961962963964965966967968969970971972973974975976977978979980981982983984985986987988989990991992993994995996997998999100010011002100310041005100610071008100910101011101210131014101510161017101810191020102110221023102410251026102710281029103010311032103310341035103610371038103910401041104210431044104510461047104810491050105110521053105410551056105710581059106010611062106310641065106610671068106910701071107210731074107510761077107810791080108110821083108410851086108710881089109010911092109310941095109610971098109911001101110211031104110511061107110811091110111111121113111411151116111711181119112011211122112311241125112611271128112911301131113211331134113511361137113811391140114111421143114411451146114711481149115011511152115311541155115611571158115911601161116211631164116511661167116811691170117111721173117411751176117711781179118011811182118311841185118611871188118911901191119211931194119511961197119811991200120112021203120412051206120712081209121012111212121312141215121612171218121912201221122212231224122512261227122812291230123112321233123412351236123712381239124012411242124312441245124612471248124912501251125212531254125512561257125812591260126112621263126412651266126712681269127012711272127312741275127612771278127912801281128212831284128512861287128812891290129112921293129412951296129712981299130013011302130313041305130613071308130913101311131213131314131513161317131813191320132113221323132413251326132713281329133013311332133313341335133613371338133913401341134213431344134513461347134813491350135113521353135413551356135713581359136013611362136313641365136613671368136913701371137213731374137513761377137813791380138113821383138413851386138713881389139013911392139313941395139613971398139914001401140214031404140514061407140814091410141114121413141414151416141714181419142014211422142314241425142614271428142914301431143214331434143514361437143814391440144114421443144414451446144714481449145014511452145314541455145614571458145914601461146214631464146514661467146814691470147114721473147414751476147714781479148014811482148314841485148614871488148914901491149214931494149514961497149814991500150115021503150415051506150715081509151015111512151315141515151615171518151915201521152215231524152515261527152815291530153115321533153415351536153715381539154015411542154315441545154615471548154915501551155215531554155515561557155815591560156115621563156415651566156715681569157015711572157315741575157615771578157915801581158215831584158515861587158815891590159115921593159415951596159715981599160016011602160316041605160616071608160916101611161216131614161516161617161816191620162116221623162416251626162716281629163016311632163316341635163616371638163916401641164216431644164516461647164816491650165116521653165416551656165716581659166016611662166316641665166616671668166916701671167216731674167516761677167816791680168116821683168416851686168716881689169016911692169316941695169616971698169917001701170217031704170517061707170817091710171117121713171417151716171717181719172017211722172317241725172617271728172917301731173217331734173517361737173817391740174117421743174417451746174717481749175017511752175317541755175617571758175917601761176217631764176517661767176817691770177117721773177417751776177717781779178017811782178317841785178617871788178917901791179217931794179517961797179817991800180118021803180418051806180718081809181018111812181318141815181618171818181918201821182218231824182518261827182818291830183118321833183418351836183718381839184018411842184318441845184618471848184918501851185218531854185518561857185818591860186118621863186418651866186718681869187018711872187318741875187618771878187918801881188218831884188518861887188818891890189118921893189418951896189718981899190019011902190319041905190619071908190919101911191219131914191519161917191819191920192119221923192419251926192719281929193019311932193319341935193619371938193919401941194219431944194519461947194819491950195119521953195419551956195719581959196019611962196319641965196619671968196919701971197219731974197519761977197819791980198119821983198419851986198719881989199019911992199319941995199619971998199920002001200220032004200520062007200820092010201120122013201420152016201720182019202020212022202320242025202620272028202920302031203220332034203520362037203820392040204120422043204420452046204720482049205020512052205320542055205620572058205920602061206220632064206520662067206820692070207120722073207420752076207720782079208020812082208320842085208620872088208920902091209220932094209520962097209820992100210121022103210421052106210721082109211021112112211321142115211621172118211921202121212221232124212521262127212821292130213121322133213421352136213721382139214021412142214321442145214621472148214921502151215221532154215521562157215821592160216121622163216421652166216721682169217021712172217321742175217621772178217921802181218221832184218521862187218821892190219121922193219421952196219721982199220022012202220322042205220622072208220922102211221222132214221522162217221822192220222122222223222422252226222722282229223022312232223322342235223622372238223922402241224222432244224522462247224822492250225122522253225422552256225722582259226022612262226322642265226622672268226922702271227222732274227522762277227822792280228122822283228422852286228722882289229022912292229322942295229622972298229923002301230223032304230523062307230823092310231123122313231423152316231723182319232023212322232323242325232623272328232923302331233223332334233523362337233823392340234123422343234423452346234723482349235023512352235323542355
  1. // Code generated by ent, DO NOT EDIT.
  2. package migrate
  3. import (
  4. "entgo.io/ent/dialect/entsql"
  5. "entgo.io/ent/dialect/sql/schema"
  6. "entgo.io/ent/schema/field"
  7. )
  8. var (
  9. // APIKeysColumns holds the columns for the "api_keys" table.
  10. APIKeysColumns = []*schema.Column{
  11. {Name: "id", Type: field.TypeInt64, Increment: true},
  12. {Name: "created_at", Type: field.TypeTime, SchemaType: map[string]string{"postgres": "timestamptz"}},
  13. {Name: "updated_at", Type: field.TypeTime, SchemaType: map[string]string{"postgres": "timestamptz"}},
  14. {Name: "deleted_at", Type: field.TypeTime, Nullable: true, SchemaType: map[string]string{"postgres": "timestamptz"}},
  15. {Name: "key", Type: field.TypeString, Unique: true, Nullable: true, Size: 128},
  16. {Name: "key_hash", Type: field.TypeString, Nullable: true, Size: 64},
  17. {Name: "key_prefix", Type: field.TypeString, Nullable: true, Size: 16},
  18. {Name: "name", Type: field.TypeString, Size: 100},
  19. {Name: "status", Type: field.TypeString, Size: 20, Default: "active"},
  20. {Name: "last_used_at", Type: field.TypeTime, Nullable: true},
  21. {Name: "ip_whitelist", Type: field.TypeJSON, Nullable: true},
  22. {Name: "ip_blacklist", Type: field.TypeJSON, Nullable: true},
  23. {Name: "quota", Type: field.TypeFloat64, Default: 0, SchemaType: map[string]string{"postgres": "decimal(20,8)"}},
  24. {Name: "quota_used", Type: field.TypeFloat64, Default: 0, SchemaType: map[string]string{"postgres": "decimal(20,8)"}},
  25. {Name: "expires_at", Type: field.TypeTime, Nullable: true},
  26. {Name: "rate_limit_5h", Type: field.TypeFloat64, Default: 0, SchemaType: map[string]string{"postgres": "decimal(20,8)"}},
  27. {Name: "rate_limit_1d", Type: field.TypeFloat64, Default: 0, SchemaType: map[string]string{"postgres": "decimal(20,8)"}},
  28. {Name: "rate_limit_7d", Type: field.TypeFloat64, Default: 0, SchemaType: map[string]string{"postgres": "decimal(20,8)"}},
  29. {Name: "usage_5h", Type: field.TypeFloat64, Default: 0, SchemaType: map[string]string{"postgres": "decimal(20,8)"}},
  30. {Name: "usage_1d", Type: field.TypeFloat64, Default: 0, SchemaType: map[string]string{"postgres": "decimal(20,8)"}},
  31. {Name: "usage_7d", Type: field.TypeFloat64, Default: 0, SchemaType: map[string]string{"postgres": "decimal(20,8)"}},
  32. {Name: "window_5h_start", Type: field.TypeTime, Nullable: true},
  33. {Name: "window_1d_start", Type: field.TypeTime, Nullable: true},
  34. {Name: "window_7d_start", Type: field.TypeTime, Nullable: true},
  35. {Name: "group_id", Type: field.TypeInt64, Nullable: true},
  36. {Name: "user_id", Type: field.TypeInt64},
  37. }
  38. // APIKeysTable holds the schema information for the "api_keys" table.
  39. APIKeysTable = &schema.Table{
  40. Name: "api_keys",
  41. Columns: APIKeysColumns,
  42. PrimaryKey: []*schema.Column{APIKeysColumns[0]},
  43. ForeignKeys: []*schema.ForeignKey{
  44. {
  45. Symbol: "api_keys_groups_api_keys",
  46. Columns: []*schema.Column{APIKeysColumns[24]},
  47. RefColumns: []*schema.Column{GroupsColumns[0]},
  48. OnDelete: schema.SetNull,
  49. },
  50. {
  51. Symbol: "api_keys_users_api_keys",
  52. Columns: []*schema.Column{APIKeysColumns[25]},
  53. RefColumns: []*schema.Column{UsersColumns[0]},
  54. OnDelete: schema.NoAction,
  55. },
  56. },
  57. Indexes: []*schema.Index{
  58. {
  59. Name: "apikey_user_id",
  60. Unique: false,
  61. Columns: []*schema.Column{APIKeysColumns[25]},
  62. },
  63. {
  64. Name: "apikey_group_id",
  65. Unique: false,
  66. Columns: []*schema.Column{APIKeysColumns[24]},
  67. },
  68. {
  69. Name: "apikey_status",
  70. Unique: false,
  71. Columns: []*schema.Column{APIKeysColumns[8]},
  72. },
  73. {
  74. Name: "apikey_deleted_at",
  75. Unique: false,
  76. Columns: []*schema.Column{APIKeysColumns[3]},
  77. },
  78. {
  79. Name: "apikey_last_used_at",
  80. Unique: false,
  81. Columns: []*schema.Column{APIKeysColumns[9]},
  82. },
  83. {
  84. Name: "apikey_quota_quota_used",
  85. Unique: false,
  86. Columns: []*schema.Column{APIKeysColumns[12], APIKeysColumns[13]},
  87. },
  88. {
  89. Name: "apikey_expires_at",
  90. Unique: false,
  91. Columns: []*schema.Column{APIKeysColumns[14]},
  92. },
  93. },
  94. }
  95. // AccountsColumns holds the columns for the "accounts" table.
  96. AccountsColumns = []*schema.Column{
  97. {Name: "id", Type: field.TypeInt64, Increment: true},
  98. {Name: "created_at", Type: field.TypeTime, SchemaType: map[string]string{"postgres": "timestamptz"}},
  99. {Name: "updated_at", Type: field.TypeTime, SchemaType: map[string]string{"postgres": "timestamptz"}},
  100. {Name: "deleted_at", Type: field.TypeTime, Nullable: true, SchemaType: map[string]string{"postgres": "timestamptz"}},
  101. {Name: "name", Type: field.TypeString, Size: 100},
  102. {Name: "notes", Type: field.TypeString, Nullable: true, SchemaType: map[string]string{"postgres": "text"}},
  103. {Name: "platform", Type: field.TypeString, Size: 50},
  104. {Name: "type", Type: field.TypeString, Size: 20},
  105. {Name: "credentials", Type: field.TypeJSON, SchemaType: map[string]string{"postgres": "jsonb"}},
  106. {Name: "extra", Type: field.TypeJSON, SchemaType: map[string]string{"postgres": "jsonb"}},
  107. {Name: "proxy_fallback_origin_id", Type: field.TypeInt64, Nullable: true},
  108. {Name: "concurrency", Type: field.TypeInt, Default: 3},
  109. {Name: "load_factor", Type: field.TypeInt, Nullable: true},
  110. {Name: "priority", Type: field.TypeInt, Default: 50},
  111. {Name: "rate_multiplier", Type: field.TypeFloat64, Default: 1, SchemaType: map[string]string{"postgres": "decimal(10,4)"}},
  112. {Name: "status", Type: field.TypeString, Size: 20, Default: "active"},
  113. {Name: "error_message", Type: field.TypeString, Nullable: true, SchemaType: map[string]string{"postgres": "text"}},
  114. {Name: "last_used_at", Type: field.TypeTime, Nullable: true, SchemaType: map[string]string{"postgres": "timestamptz"}},
  115. {Name: "expires_at", Type: field.TypeTime, Nullable: true, SchemaType: map[string]string{"postgres": "timestamptz"}},
  116. {Name: "auto_pause_on_expired", Type: field.TypeBool, Default: true},
  117. {Name: "schedulable", Type: field.TypeBool, Default: true},
  118. {Name: "rate_limited_at", Type: field.TypeTime, Nullable: true, SchemaType: map[string]string{"postgres": "timestamptz"}},
  119. {Name: "rate_limit_reset_at", Type: field.TypeTime, Nullable: true, SchemaType: map[string]string{"postgres": "timestamptz"}},
  120. {Name: "overload_until", Type: field.TypeTime, Nullable: true, SchemaType: map[string]string{"postgres": "timestamptz"}},
  121. {Name: "temp_unschedulable_until", Type: field.TypeTime, Nullable: true, SchemaType: map[string]string{"postgres": "timestamptz"}},
  122. {Name: "temp_unschedulable_reason", Type: field.TypeString, Nullable: true, SchemaType: map[string]string{"postgres": "text"}},
  123. {Name: "session_window_start", Type: field.TypeTime, Nullable: true, SchemaType: map[string]string{"postgres": "timestamptz"}},
  124. {Name: "session_window_end", Type: field.TypeTime, Nullable: true, SchemaType: map[string]string{"postgres": "timestamptz"}},
  125. {Name: "session_window_status", Type: field.TypeString, Nullable: true, Size: 20},
  126. {Name: "quota_dimension", Type: field.TypeEnum, Enums: []string{"global", "spark"}, Default: "global"},
  127. {Name: "proxy_id", Type: field.TypeInt64, Nullable: true},
  128. {Name: "parent_account_id", Type: field.TypeInt64, Nullable: true},
  129. }
  130. // AccountsTable holds the schema information for the "accounts" table.
  131. AccountsTable = &schema.Table{
  132. Name: "accounts",
  133. Columns: AccountsColumns,
  134. PrimaryKey: []*schema.Column{AccountsColumns[0]},
  135. ForeignKeys: []*schema.ForeignKey{
  136. {
  137. Symbol: "accounts_proxies_proxy",
  138. Columns: []*schema.Column{AccountsColumns[30]},
  139. RefColumns: []*schema.Column{ProxiesColumns[0]},
  140. OnDelete: schema.SetNull,
  141. },
  142. {
  143. Symbol: "accounts_accounts_children",
  144. Columns: []*schema.Column{AccountsColumns[31]},
  145. RefColumns: []*schema.Column{AccountsColumns[0]},
  146. OnDelete: schema.Restrict,
  147. },
  148. },
  149. Indexes: []*schema.Index{
  150. {
  151. Name: "account_platform",
  152. Unique: false,
  153. Columns: []*schema.Column{AccountsColumns[6]},
  154. },
  155. {
  156. Name: "account_type",
  157. Unique: false,
  158. Columns: []*schema.Column{AccountsColumns[7]},
  159. },
  160. {
  161. Name: "account_status",
  162. Unique: false,
  163. Columns: []*schema.Column{AccountsColumns[15]},
  164. },
  165. {
  166. Name: "account_proxy_id",
  167. Unique: false,
  168. Columns: []*schema.Column{AccountsColumns[30]},
  169. },
  170. {
  171. Name: "account_priority",
  172. Unique: false,
  173. Columns: []*schema.Column{AccountsColumns[13]},
  174. },
  175. {
  176. Name: "account_last_used_at",
  177. Unique: false,
  178. Columns: []*schema.Column{AccountsColumns[17]},
  179. },
  180. {
  181. Name: "account_schedulable",
  182. Unique: false,
  183. Columns: []*schema.Column{AccountsColumns[20]},
  184. },
  185. {
  186. Name: "account_rate_limited_at",
  187. Unique: false,
  188. Columns: []*schema.Column{AccountsColumns[21]},
  189. },
  190. {
  191. Name: "account_rate_limit_reset_at",
  192. Unique: false,
  193. Columns: []*schema.Column{AccountsColumns[22]},
  194. },
  195. {
  196. Name: "account_overload_until",
  197. Unique: false,
  198. Columns: []*schema.Column{AccountsColumns[23]},
  199. },
  200. {
  201. Name: "account_platform_priority",
  202. Unique: false,
  203. Columns: []*schema.Column{AccountsColumns[6], AccountsColumns[13]},
  204. },
  205. {
  206. Name: "account_priority_status",
  207. Unique: false,
  208. Columns: []*schema.Column{AccountsColumns[13], AccountsColumns[15]},
  209. },
  210. {
  211. Name: "account_deleted_at",
  212. Unique: false,
  213. Columns: []*schema.Column{AccountsColumns[3]},
  214. },
  215. {
  216. Name: "account_parent_account_id",
  217. Unique: false,
  218. Columns: []*schema.Column{AccountsColumns[31]},
  219. },
  220. },
  221. }
  222. // AccountGroupsColumns holds the columns for the "account_groups" table.
  223. AccountGroupsColumns = []*schema.Column{
  224. {Name: "priority", Type: field.TypeInt, Default: 50},
  225. {Name: "created_at", Type: field.TypeTime, SchemaType: map[string]string{"postgres": "timestamptz"}},
  226. {Name: "account_id", Type: field.TypeInt64},
  227. {Name: "group_id", Type: field.TypeInt64},
  228. }
  229. // AccountGroupsTable holds the schema information for the "account_groups" table.
  230. AccountGroupsTable = &schema.Table{
  231. Name: "account_groups",
  232. Columns: AccountGroupsColumns,
  233. PrimaryKey: []*schema.Column{AccountGroupsColumns[2], AccountGroupsColumns[3]},
  234. ForeignKeys: []*schema.ForeignKey{
  235. {
  236. Symbol: "account_groups_accounts_account",
  237. Columns: []*schema.Column{AccountGroupsColumns[2]},
  238. RefColumns: []*schema.Column{AccountsColumns[0]},
  239. OnDelete: schema.NoAction,
  240. },
  241. {
  242. Symbol: "account_groups_groups_group",
  243. Columns: []*schema.Column{AccountGroupsColumns[3]},
  244. RefColumns: []*schema.Column{GroupsColumns[0]},
  245. OnDelete: schema.NoAction,
  246. },
  247. },
  248. Indexes: []*schema.Index{
  249. {
  250. Name: "accountgroup_group_id",
  251. Unique: false,
  252. Columns: []*schema.Column{AccountGroupsColumns[3]},
  253. },
  254. {
  255. Name: "accountgroup_priority",
  256. Unique: false,
  257. Columns: []*schema.Column{AccountGroupsColumns[0]},
  258. },
  259. },
  260. }
  261. // AnnouncementsColumns holds the columns for the "announcements" table.
  262. AnnouncementsColumns = []*schema.Column{
  263. {Name: "id", Type: field.TypeInt64, Increment: true},
  264. {Name: "title", Type: field.TypeString, Size: 200},
  265. {Name: "content", Type: field.TypeString, SchemaType: map[string]string{"postgres": "text"}},
  266. {Name: "status", Type: field.TypeString, Size: 20, Default: "draft"},
  267. {Name: "notify_mode", Type: field.TypeString, Size: 20, Default: "silent"},
  268. {Name: "targeting", Type: field.TypeJSON, Nullable: true, SchemaType: map[string]string{"postgres": "jsonb"}},
  269. {Name: "starts_at", Type: field.TypeTime, Nullable: true, SchemaType: map[string]string{"postgres": "timestamptz"}},
  270. {Name: "ends_at", Type: field.TypeTime, Nullable: true, SchemaType: map[string]string{"postgres": "timestamptz"}},
  271. {Name: "created_by", Type: field.TypeInt64, Nullable: true},
  272. {Name: "updated_by", Type: field.TypeInt64, Nullable: true},
  273. {Name: "created_at", Type: field.TypeTime, SchemaType: map[string]string{"postgres": "timestamptz"}},
  274. {Name: "updated_at", Type: field.TypeTime, SchemaType: map[string]string{"postgres": "timestamptz"}},
  275. }
  276. // AnnouncementsTable holds the schema information for the "announcements" table.
  277. AnnouncementsTable = &schema.Table{
  278. Name: "announcements",
  279. Columns: AnnouncementsColumns,
  280. PrimaryKey: []*schema.Column{AnnouncementsColumns[0]},
  281. Indexes: []*schema.Index{
  282. {
  283. Name: "announcement_status",
  284. Unique: false,
  285. Columns: []*schema.Column{AnnouncementsColumns[3]},
  286. },
  287. {
  288. Name: "announcement_created_at",
  289. Unique: false,
  290. Columns: []*schema.Column{AnnouncementsColumns[10]},
  291. },
  292. {
  293. Name: "announcement_starts_at",
  294. Unique: false,
  295. Columns: []*schema.Column{AnnouncementsColumns[6]},
  296. },
  297. {
  298. Name: "announcement_ends_at",
  299. Unique: false,
  300. Columns: []*schema.Column{AnnouncementsColumns[7]},
  301. },
  302. },
  303. }
  304. // AnnouncementReadsColumns holds the columns for the "announcement_reads" table.
  305. AnnouncementReadsColumns = []*schema.Column{
  306. {Name: "id", Type: field.TypeInt64, Increment: true},
  307. {Name: "read_at", Type: field.TypeTime, SchemaType: map[string]string{"postgres": "timestamptz"}},
  308. {Name: "created_at", Type: field.TypeTime, SchemaType: map[string]string{"postgres": "timestamptz"}},
  309. {Name: "announcement_id", Type: field.TypeInt64},
  310. {Name: "user_id", Type: field.TypeInt64},
  311. }
  312. // AnnouncementReadsTable holds the schema information for the "announcement_reads" table.
  313. AnnouncementReadsTable = &schema.Table{
  314. Name: "announcement_reads",
  315. Columns: AnnouncementReadsColumns,
  316. PrimaryKey: []*schema.Column{AnnouncementReadsColumns[0]},
  317. ForeignKeys: []*schema.ForeignKey{
  318. {
  319. Symbol: "announcement_reads_announcements_reads",
  320. Columns: []*schema.Column{AnnouncementReadsColumns[3]},
  321. RefColumns: []*schema.Column{AnnouncementsColumns[0]},
  322. OnDelete: schema.NoAction,
  323. },
  324. {
  325. Symbol: "announcement_reads_users_announcement_reads",
  326. Columns: []*schema.Column{AnnouncementReadsColumns[4]},
  327. RefColumns: []*schema.Column{UsersColumns[0]},
  328. OnDelete: schema.NoAction,
  329. },
  330. },
  331. Indexes: []*schema.Index{
  332. {
  333. Name: "announcementread_announcement_id",
  334. Unique: false,
  335. Columns: []*schema.Column{AnnouncementReadsColumns[3]},
  336. },
  337. {
  338. Name: "announcementread_user_id",
  339. Unique: false,
  340. Columns: []*schema.Column{AnnouncementReadsColumns[4]},
  341. },
  342. {
  343. Name: "announcementread_read_at",
  344. Unique: false,
  345. Columns: []*schema.Column{AnnouncementReadsColumns[1]},
  346. },
  347. {
  348. Name: "announcementread_announcement_id_user_id",
  349. Unique: true,
  350. Columns: []*schema.Column{AnnouncementReadsColumns[3], AnnouncementReadsColumns[4]},
  351. },
  352. },
  353. }
  354. // AuthIdentitiesColumns holds the columns for the "auth_identities" table.
  355. AuthIdentitiesColumns = []*schema.Column{
  356. {Name: "id", Type: field.TypeInt64, Increment: true},
  357. {Name: "created_at", Type: field.TypeTime, SchemaType: map[string]string{"postgres": "timestamptz"}},
  358. {Name: "updated_at", Type: field.TypeTime, SchemaType: map[string]string{"postgres": "timestamptz"}},
  359. {Name: "provider_type", Type: field.TypeString, Size: 20},
  360. {Name: "provider_key", Type: field.TypeString, SchemaType: map[string]string{"postgres": "text"}},
  361. {Name: "provider_subject", Type: field.TypeString, SchemaType: map[string]string{"postgres": "text"}},
  362. {Name: "verified_at", Type: field.TypeTime, Nullable: true, SchemaType: map[string]string{"postgres": "timestamptz"}},
  363. {Name: "issuer", Type: field.TypeString, Nullable: true, SchemaType: map[string]string{"postgres": "text"}},
  364. {Name: "metadata", Type: field.TypeJSON, SchemaType: map[string]string{"postgres": "jsonb"}},
  365. {Name: "user_id", Type: field.TypeInt64},
  366. }
  367. // AuthIdentitiesTable holds the schema information for the "auth_identities" table.
  368. AuthIdentitiesTable = &schema.Table{
  369. Name: "auth_identities",
  370. Columns: AuthIdentitiesColumns,
  371. PrimaryKey: []*schema.Column{AuthIdentitiesColumns[0]},
  372. ForeignKeys: []*schema.ForeignKey{
  373. {
  374. Symbol: "auth_identities_users_auth_identities",
  375. Columns: []*schema.Column{AuthIdentitiesColumns[9]},
  376. RefColumns: []*schema.Column{UsersColumns[0]},
  377. OnDelete: schema.Cascade,
  378. },
  379. },
  380. Indexes: []*schema.Index{
  381. {
  382. Name: "authidentity_provider_type_provider_key_provider_subject",
  383. Unique: true,
  384. Columns: []*schema.Column{AuthIdentitiesColumns[3], AuthIdentitiesColumns[4], AuthIdentitiesColumns[5]},
  385. },
  386. {
  387. Name: "authidentity_user_id",
  388. Unique: false,
  389. Columns: []*schema.Column{AuthIdentitiesColumns[9]},
  390. },
  391. {
  392. Name: "authidentity_user_id_provider_type",
  393. Unique: false,
  394. Columns: []*schema.Column{AuthIdentitiesColumns[9], AuthIdentitiesColumns[3]},
  395. },
  396. },
  397. }
  398. // AuthIdentityChannelsColumns holds the columns for the "auth_identity_channels" table.
  399. AuthIdentityChannelsColumns = []*schema.Column{
  400. {Name: "id", Type: field.TypeInt64, Increment: true},
  401. {Name: "created_at", Type: field.TypeTime, SchemaType: map[string]string{"postgres": "timestamptz"}},
  402. {Name: "updated_at", Type: field.TypeTime, SchemaType: map[string]string{"postgres": "timestamptz"}},
  403. {Name: "provider_type", Type: field.TypeString, Size: 20},
  404. {Name: "provider_key", Type: field.TypeString, SchemaType: map[string]string{"postgres": "text"}},
  405. {Name: "channel", Type: field.TypeString, Size: 20},
  406. {Name: "channel_app_id", Type: field.TypeString, SchemaType: map[string]string{"postgres": "text"}},
  407. {Name: "channel_subject", Type: field.TypeString, SchemaType: map[string]string{"postgres": "text"}},
  408. {Name: "metadata", Type: field.TypeJSON, SchemaType: map[string]string{"postgres": "jsonb"}},
  409. {Name: "identity_id", Type: field.TypeInt64},
  410. }
  411. // AuthIdentityChannelsTable holds the schema information for the "auth_identity_channels" table.
  412. AuthIdentityChannelsTable = &schema.Table{
  413. Name: "auth_identity_channels",
  414. Columns: AuthIdentityChannelsColumns,
  415. PrimaryKey: []*schema.Column{AuthIdentityChannelsColumns[0]},
  416. ForeignKeys: []*schema.ForeignKey{
  417. {
  418. Symbol: "auth_identity_channels_auth_identities_channels",
  419. Columns: []*schema.Column{AuthIdentityChannelsColumns[9]},
  420. RefColumns: []*schema.Column{AuthIdentitiesColumns[0]},
  421. OnDelete: schema.Cascade,
  422. },
  423. },
  424. Indexes: []*schema.Index{
  425. {
  426. Name: "authidentitychannel_provider_type_provider_key_channel_channel_app_id_channel_subject",
  427. Unique: true,
  428. Columns: []*schema.Column{AuthIdentityChannelsColumns[3], AuthIdentityChannelsColumns[4], AuthIdentityChannelsColumns[5], AuthIdentityChannelsColumns[6], AuthIdentityChannelsColumns[7]},
  429. },
  430. {
  431. Name: "authidentitychannel_identity_id",
  432. Unique: false,
  433. Columns: []*schema.Column{AuthIdentityChannelsColumns[9]},
  434. },
  435. },
  436. }
  437. // BatchImageEventsColumns holds the columns for the "batch_image_events" table.
  438. BatchImageEventsColumns = []*schema.Column{
  439. {Name: "id", Type: field.TypeInt64, Increment: true},
  440. {Name: "job_id", Type: field.TypeString, Size: 64},
  441. {Name: "event_type", Type: field.TypeString, Size: 64},
  442. {Name: "payload", Type: field.TypeJSON, Nullable: true, SchemaType: map[string]string{"postgres": "jsonb"}},
  443. {Name: "event_hash", Type: field.TypeString, Nullable: true, Size: 128},
  444. {Name: "created_at", Type: field.TypeTime, SchemaType: map[string]string{"postgres": "timestamptz"}},
  445. }
  446. // BatchImageEventsTable holds the schema information for the "batch_image_events" table.
  447. BatchImageEventsTable = &schema.Table{
  448. Name: "batch_image_events",
  449. Columns: BatchImageEventsColumns,
  450. PrimaryKey: []*schema.Column{BatchImageEventsColumns[0]},
  451. Indexes: []*schema.Index{
  452. {
  453. Name: "batchimageevent_job_id_created_at",
  454. Unique: false,
  455. Columns: []*schema.Column{BatchImageEventsColumns[1], BatchImageEventsColumns[5]},
  456. },
  457. {
  458. Name: "batchimageevent_event_type",
  459. Unique: false,
  460. Columns: []*schema.Column{BatchImageEventsColumns[2]},
  461. },
  462. {
  463. Name: "batchimageevent_job_id_event_hash",
  464. Unique: true,
  465. Columns: []*schema.Column{BatchImageEventsColumns[1], BatchImageEventsColumns[4]},
  466. Annotation: &entsql.IndexAnnotation{
  467. Where: "event_hash IS NOT NULL AND event_hash <> ''",
  468. },
  469. },
  470. },
  471. }
  472. // BatchImageItemsColumns holds the columns for the "batch_image_items" table.
  473. BatchImageItemsColumns = []*schema.Column{
  474. {Name: "id", Type: field.TypeInt64, Increment: true},
  475. {Name: "job_id", Type: field.TypeString, Size: 64},
  476. {Name: "custom_id", Type: field.TypeString, Size: 255},
  477. {Name: "status", Type: field.TypeString, Size: 32},
  478. {Name: "request_hash", Type: field.TypeString, Nullable: true, Size: 128},
  479. {Name: "prompt_preview", Type: field.TypeString, Nullable: true, SchemaType: map[string]string{"postgres": "text"}},
  480. {Name: "provider_source_object", Type: field.TypeString, Nullable: true, Size: 1024},
  481. {Name: "source_line_number", Type: field.TypeInt, Nullable: true},
  482. {Name: "source_byte_offset", Type: field.TypeInt64, Nullable: true},
  483. {Name: "source_byte_length", Type: field.TypeInt64, Nullable: true},
  484. {Name: "mime_type", Type: field.TypeString, Nullable: true, Size: 128},
  485. {Name: "file_extension", Type: field.TypeString, Nullable: true, Size: 32},
  486. {Name: "image_count", Type: field.TypeInt, Default: 0},
  487. {Name: "error_code", Type: field.TypeString, Nullable: true, Size: 128},
  488. {Name: "error_message", Type: field.TypeString, Nullable: true, SchemaType: map[string]string{"postgres": "text"}},
  489. {Name: "billed_amount", Type: field.TypeFloat64, Nullable: true, SchemaType: map[string]string{"postgres": "decimal(20,10)"}},
  490. {Name: "created_at", Type: field.TypeTime, SchemaType: map[string]string{"postgres": "timestamptz"}},
  491. {Name: "indexed_at", Type: field.TypeTime, Nullable: true, SchemaType: map[string]string{"postgres": "timestamptz"}},
  492. }
  493. // BatchImageItemsTable holds the schema information for the "batch_image_items" table.
  494. BatchImageItemsTable = &schema.Table{
  495. Name: "batch_image_items",
  496. Columns: BatchImageItemsColumns,
  497. PrimaryKey: []*schema.Column{BatchImageItemsColumns[0]},
  498. Indexes: []*schema.Index{
  499. {
  500. Name: "batchimageitem_job_id_custom_id",
  501. Unique: true,
  502. Columns: []*schema.Column{BatchImageItemsColumns[1], BatchImageItemsColumns[2]},
  503. },
  504. {
  505. Name: "batchimageitem_job_id_status",
  506. Unique: false,
  507. Columns: []*schema.Column{BatchImageItemsColumns[1], BatchImageItemsColumns[3]},
  508. },
  509. {
  510. Name: "batchimageitem_provider_source_object",
  511. Unique: false,
  512. Columns: []*schema.Column{BatchImageItemsColumns[6]},
  513. },
  514. },
  515. }
  516. // BatchImageJobsColumns holds the columns for the "batch_image_jobs" table.
  517. BatchImageJobsColumns = []*schema.Column{
  518. {Name: "id", Type: field.TypeInt64, Increment: true},
  519. {Name: "batch_id", Type: field.TypeString, Size: 64},
  520. {Name: "user_id", Type: field.TypeInt64},
  521. {Name: "api_key_id", Type: field.TypeInt64, Nullable: true},
  522. {Name: "account_id", Type: field.TypeInt64, Nullable: true},
  523. {Name: "provider", Type: field.TypeString, Size: 32},
  524. {Name: "model", Type: field.TypeString, Size: 128},
  525. {Name: "task_name", Type: field.TypeString, Size: 255, Default: ""},
  526. {Name: "status", Type: field.TypeString, Size: 32, Default: "created"},
  527. {Name: "provider_job_name", Type: field.TypeString, Nullable: true, Size: 512},
  528. {Name: "provider_input_ref", Type: field.TypeString, Nullable: true, Size: 1024},
  529. {Name: "provider_output_ref", Type: field.TypeString, Nullable: true, Size: 1024},
  530. {Name: "gcs_input_uri", Type: field.TypeString, Nullable: true, Size: 1024},
  531. {Name: "gcs_output_uri", Type: field.TypeString, Nullable: true, Size: 1024},
  532. {Name: "item_count", Type: field.TypeInt},
  533. {Name: "success_count", Type: field.TypeInt, Default: 0},
  534. {Name: "fail_count", Type: field.TypeInt, Default: 0},
  535. {Name: "cancelled_count", Type: field.TypeInt, Default: 0},
  536. {Name: "estimated_cost", Type: field.TypeFloat64, Default: 0, SchemaType: map[string]string{"postgres": "decimal(20,10)"}},
  537. {Name: "hold_amount", Type: field.TypeFloat64, Nullable: true, SchemaType: map[string]string{"postgres": "decimal(20,10)"}},
  538. {Name: "actual_cost", Type: field.TypeFloat64, Nullable: true, SchemaType: map[string]string{"postgres": "decimal(20,10)"}},
  539. {Name: "currency", Type: field.TypeString, Size: 16, Default: "USD"},
  540. {Name: "hold_id", Type: field.TypeString, Nullable: true, Size: 128},
  541. {Name: "idempotency_key", Type: field.TypeString, Nullable: true, Size: 255},
  542. {Name: "request_hash", Type: field.TypeString, Nullable: true, Size: 128},
  543. {Name: "manifest_hash", Type: field.TypeString, Nullable: true, Size: 128},
  544. {Name: "retry_count", Type: field.TypeInt, Default: 0},
  545. {Name: "version", Type: field.TypeInt, Default: 0},
  546. {Name: "output_expires_at", Type: field.TypeTime, Nullable: true, SchemaType: map[string]string{"postgres": "timestamptz"}},
  547. {Name: "input_deleted_at", Type: field.TypeTime, Nullable: true, SchemaType: map[string]string{"postgres": "timestamptz"}},
  548. {Name: "output_deleted_at", Type: field.TypeTime, Nullable: true, SchemaType: map[string]string{"postgres": "timestamptz"}},
  549. {Name: "downloaded_at", Type: field.TypeTime, Nullable: true, SchemaType: map[string]string{"postgres": "timestamptz"}},
  550. {Name: "user_deleted_at", Type: field.TypeTime, Nullable: true, SchemaType: map[string]string{"postgres": "timestamptz"}},
  551. {Name: "last_error_code", Type: field.TypeString, Nullable: true, Size: 128},
  552. {Name: "last_error_message", Type: field.TypeString, Nullable: true, SchemaType: map[string]string{"postgres": "text"}},
  553. {Name: "created_at", Type: field.TypeTime, SchemaType: map[string]string{"postgres": "timestamptz"}},
  554. {Name: "updated_at", Type: field.TypeTime, SchemaType: map[string]string{"postgres": "timestamptz"}},
  555. {Name: "submitted_at", Type: field.TypeTime, Nullable: true, SchemaType: map[string]string{"postgres": "timestamptz"}},
  556. {Name: "started_at", Type: field.TypeTime, Nullable: true, SchemaType: map[string]string{"postgres": "timestamptz"}},
  557. {Name: "finished_at", Type: field.TypeTime, Nullable: true, SchemaType: map[string]string{"postgres": "timestamptz"}},
  558. {Name: "settled_at", Type: field.TypeTime, Nullable: true, SchemaType: map[string]string{"postgres": "timestamptz"}},
  559. }
  560. // BatchImageJobsTable holds the schema information for the "batch_image_jobs" table.
  561. BatchImageJobsTable = &schema.Table{
  562. Name: "batch_image_jobs",
  563. Columns: BatchImageJobsColumns,
  564. PrimaryKey: []*schema.Column{BatchImageJobsColumns[0]},
  565. Indexes: []*schema.Index{
  566. {
  567. Name: "batchimagejob_batch_id",
  568. Unique: true,
  569. Columns: []*schema.Column{BatchImageJobsColumns[1]},
  570. },
  571. {
  572. Name: "batchimagejob_user_id_created_at",
  573. Unique: false,
  574. Columns: []*schema.Column{BatchImageJobsColumns[2], BatchImageJobsColumns[35]},
  575. },
  576. {
  577. Name: "batchimagejob_status",
  578. Unique: false,
  579. Columns: []*schema.Column{BatchImageJobsColumns[8]},
  580. },
  581. {
  582. Name: "batchimagejob_provider_status",
  583. Unique: false,
  584. Columns: []*schema.Column{BatchImageJobsColumns[5], BatchImageJobsColumns[8]},
  585. },
  586. {
  587. Name: "batchimagejob_idempotency_key",
  588. Unique: false,
  589. Columns: []*schema.Column{BatchImageJobsColumns[23]},
  590. Annotation: &entsql.IndexAnnotation{
  591. Where: "idempotency_key IS NOT NULL AND idempotency_key <> ''",
  592. },
  593. },
  594. {
  595. Name: "batchimagejob_manifest_hash",
  596. Unique: true,
  597. Columns: []*schema.Column{BatchImageJobsColumns[25]},
  598. Annotation: &entsql.IndexAnnotation{
  599. Where: "manifest_hash IS NOT NULL AND manifest_hash <> ''",
  600. },
  601. },
  602. {
  603. Name: "batchimagejob_output_expires_at",
  604. Unique: false,
  605. Columns: []*schema.Column{BatchImageJobsColumns[28]},
  606. },
  607. {
  608. Name: "batchimagejob_downloaded_at",
  609. Unique: false,
  610. Columns: []*schema.Column{BatchImageJobsColumns[31]},
  611. },
  612. {
  613. Name: "batchimagejob_user_deleted_at",
  614. Unique: false,
  615. Columns: []*schema.Column{BatchImageJobsColumns[32]},
  616. },
  617. },
  618. }
  619. // ChannelMonitorsColumns holds the columns for the "channel_monitors" table.
  620. ChannelMonitorsColumns = []*schema.Column{
  621. {Name: "id", Type: field.TypeInt64, Increment: true},
  622. {Name: "created_at", Type: field.TypeTime, SchemaType: map[string]string{"postgres": "timestamptz"}},
  623. {Name: "updated_at", Type: field.TypeTime, SchemaType: map[string]string{"postgres": "timestamptz"}},
  624. {Name: "name", Type: field.TypeString, Size: 100},
  625. {Name: "provider", Type: field.TypeEnum, Enums: []string{"openai", "anthropic", "gemini", "grok", "antigravity", "kimi", "zhipu", "deepseek", "minimax"}},
  626. {Name: "check_mode", Type: field.TypeString, Size: 32, Default: "probe"},
  627. {Name: "account_id", Type: field.TypeInt64, Nullable: true},
  628. {Name: "api_mode", Type: field.TypeString, Size: 32, Default: "chat_completions"},
  629. {Name: "endpoint", Type: field.TypeString, Size: 500},
  630. {Name: "api_key_encrypted", Type: field.TypeString},
  631. {Name: "primary_model", Type: field.TypeString, Size: 200},
  632. {Name: "extra_models", Type: field.TypeJSON},
  633. {Name: "group_name", Type: field.TypeString, Nullable: true, Size: 100, Default: ""},
  634. {Name: "enabled", Type: field.TypeBool, Default: true},
  635. {Name: "interval_seconds", Type: field.TypeInt},
  636. {Name: "jitter_seconds", Type: field.TypeInt, Default: 0},
  637. {Name: "last_checked_at", Type: field.TypeTime, Nullable: true},
  638. {Name: "created_by", Type: field.TypeInt64},
  639. {Name: "extra_headers", Type: field.TypeJSON},
  640. {Name: "body_override_mode", Type: field.TypeString, Size: 10, Default: "off"},
  641. {Name: "body_override", Type: field.TypeJSON, Nullable: true},
  642. {Name: "template_id", Type: field.TypeInt64, Nullable: true},
  643. }
  644. // ChannelMonitorsTable holds the schema information for the "channel_monitors" table.
  645. ChannelMonitorsTable = &schema.Table{
  646. Name: "channel_monitors",
  647. Columns: ChannelMonitorsColumns,
  648. PrimaryKey: []*schema.Column{ChannelMonitorsColumns[0]},
  649. ForeignKeys: []*schema.ForeignKey{
  650. {
  651. Symbol: "channel_monitors_channel_monitor_request_templates_request_template",
  652. Columns: []*schema.Column{ChannelMonitorsColumns[21]},
  653. RefColumns: []*schema.Column{ChannelMonitorRequestTemplatesColumns[0]},
  654. OnDelete: schema.SetNull,
  655. },
  656. },
  657. Indexes: []*schema.Index{
  658. {
  659. Name: "channelmonitor_enabled_last_checked_at",
  660. Unique: false,
  661. Columns: []*schema.Column{ChannelMonitorsColumns[13], ChannelMonitorsColumns[16]},
  662. },
  663. {
  664. Name: "channelmonitor_provider",
  665. Unique: false,
  666. Columns: []*schema.Column{ChannelMonitorsColumns[4]},
  667. },
  668. {
  669. Name: "channelmonitor_provider_api_mode",
  670. Unique: false,
  671. Columns: []*schema.Column{ChannelMonitorsColumns[4], ChannelMonitorsColumns[7]},
  672. },
  673. {
  674. Name: "channelmonitor_group_name",
  675. Unique: false,
  676. Columns: []*schema.Column{ChannelMonitorsColumns[12]},
  677. },
  678. {
  679. Name: "channelmonitor_template_id",
  680. Unique: false,
  681. Columns: []*schema.Column{ChannelMonitorsColumns[21]},
  682. },
  683. {
  684. Name: "channelmonitor_account_id",
  685. Unique: false,
  686. Columns: []*schema.Column{ChannelMonitorsColumns[6]},
  687. },
  688. },
  689. }
  690. // ChannelMonitorDailyRollupsColumns holds the columns for the "channel_monitor_daily_rollups" table.
  691. ChannelMonitorDailyRollupsColumns = []*schema.Column{
  692. {Name: "id", Type: field.TypeInt64, Increment: true},
  693. {Name: "model", Type: field.TypeString, Size: 200},
  694. {Name: "bucket_date", Type: field.TypeTime, SchemaType: map[string]string{"postgres": "date"}},
  695. {Name: "total_checks", Type: field.TypeInt, Default: 0},
  696. {Name: "ok_count", Type: field.TypeInt, Default: 0},
  697. {Name: "operational_count", Type: field.TypeInt, Default: 0},
  698. {Name: "degraded_count", Type: field.TypeInt, Default: 0},
  699. {Name: "failed_count", Type: field.TypeInt, Default: 0},
  700. {Name: "error_count", Type: field.TypeInt, Default: 0},
  701. {Name: "sum_latency_ms", Type: field.TypeInt64, Default: 0},
  702. {Name: "count_latency", Type: field.TypeInt, Default: 0},
  703. {Name: "sum_ping_latency_ms", Type: field.TypeInt64, Default: 0},
  704. {Name: "count_ping_latency", Type: field.TypeInt, Default: 0},
  705. {Name: "computed_at", Type: field.TypeTime},
  706. {Name: "monitor_id", Type: field.TypeInt64},
  707. }
  708. // ChannelMonitorDailyRollupsTable holds the schema information for the "channel_monitor_daily_rollups" table.
  709. ChannelMonitorDailyRollupsTable = &schema.Table{
  710. Name: "channel_monitor_daily_rollups",
  711. Columns: ChannelMonitorDailyRollupsColumns,
  712. PrimaryKey: []*schema.Column{ChannelMonitorDailyRollupsColumns[0]},
  713. ForeignKeys: []*schema.ForeignKey{
  714. {
  715. Symbol: "channel_monitor_daily_rollups_channel_monitors_daily_rollups",
  716. Columns: []*schema.Column{ChannelMonitorDailyRollupsColumns[14]},
  717. RefColumns: []*schema.Column{ChannelMonitorsColumns[0]},
  718. OnDelete: schema.Cascade,
  719. },
  720. },
  721. Indexes: []*schema.Index{
  722. {
  723. Name: "channelmonitordailyrollup_monitor_id_model_bucket_date",
  724. Unique: true,
  725. Columns: []*schema.Column{ChannelMonitorDailyRollupsColumns[14], ChannelMonitorDailyRollupsColumns[1], ChannelMonitorDailyRollupsColumns[2]},
  726. },
  727. {
  728. Name: "channelmonitordailyrollup_bucket_date",
  729. Unique: false,
  730. Columns: []*schema.Column{ChannelMonitorDailyRollupsColumns[2]},
  731. },
  732. },
  733. }
  734. // ChannelMonitorHistoriesColumns holds the columns for the "channel_monitor_histories" table.
  735. ChannelMonitorHistoriesColumns = []*schema.Column{
  736. {Name: "id", Type: field.TypeInt64, Increment: true},
  737. {Name: "model", Type: field.TypeString, Size: 200},
  738. {Name: "status", Type: field.TypeEnum, Enums: []string{"operational", "degraded", "failed", "error"}},
  739. {Name: "latency_ms", Type: field.TypeInt, Nullable: true},
  740. {Name: "ping_latency_ms", Type: field.TypeInt, Nullable: true},
  741. {Name: "message", Type: field.TypeString, Nullable: true, Size: 500, Default: ""},
  742. {Name: "quota", Type: field.TypeJSON, Nullable: true},
  743. {Name: "checked_at", Type: field.TypeTime},
  744. {Name: "monitor_id", Type: field.TypeInt64},
  745. }
  746. // ChannelMonitorHistoriesTable holds the schema information for the "channel_monitor_histories" table.
  747. ChannelMonitorHistoriesTable = &schema.Table{
  748. Name: "channel_monitor_histories",
  749. Columns: ChannelMonitorHistoriesColumns,
  750. PrimaryKey: []*schema.Column{ChannelMonitorHistoriesColumns[0]},
  751. ForeignKeys: []*schema.ForeignKey{
  752. {
  753. Symbol: "channel_monitor_histories_channel_monitors_history",
  754. Columns: []*schema.Column{ChannelMonitorHistoriesColumns[8]},
  755. RefColumns: []*schema.Column{ChannelMonitorsColumns[0]},
  756. OnDelete: schema.Cascade,
  757. },
  758. },
  759. Indexes: []*schema.Index{
  760. {
  761. Name: "channelmonitorhistory_monitor_id_model_checked_at",
  762. Unique: false,
  763. Columns: []*schema.Column{ChannelMonitorHistoriesColumns[8], ChannelMonitorHistoriesColumns[1], ChannelMonitorHistoriesColumns[7]},
  764. },
  765. {
  766. Name: "channelmonitorhistory_checked_at",
  767. Unique: false,
  768. Columns: []*schema.Column{ChannelMonitorHistoriesColumns[7]},
  769. },
  770. },
  771. }
  772. // ChannelMonitorRequestTemplatesColumns holds the columns for the "channel_monitor_request_templates" table.
  773. ChannelMonitorRequestTemplatesColumns = []*schema.Column{
  774. {Name: "id", Type: field.TypeInt64, Increment: true},
  775. {Name: "created_at", Type: field.TypeTime, SchemaType: map[string]string{"postgres": "timestamptz"}},
  776. {Name: "updated_at", Type: field.TypeTime, SchemaType: map[string]string{"postgres": "timestamptz"}},
  777. {Name: "name", Type: field.TypeString, Size: 100},
  778. {Name: "provider", Type: field.TypeEnum, Enums: []string{"openai", "anthropic", "gemini", "grok", "antigravity", "kimi", "zhipu", "deepseek", "minimax"}},
  779. {Name: "api_mode", Type: field.TypeString, Size: 32, Default: "chat_completions"},
  780. {Name: "description", Type: field.TypeString, Nullable: true, Size: 500, Default: ""},
  781. {Name: "extra_headers", Type: field.TypeJSON},
  782. {Name: "body_override_mode", Type: field.TypeString, Size: 10, Default: "off"},
  783. {Name: "body_override", Type: field.TypeJSON, Nullable: true},
  784. }
  785. // ChannelMonitorRequestTemplatesTable holds the schema information for the "channel_monitor_request_templates" table.
  786. ChannelMonitorRequestTemplatesTable = &schema.Table{
  787. Name: "channel_monitor_request_templates",
  788. Columns: ChannelMonitorRequestTemplatesColumns,
  789. PrimaryKey: []*schema.Column{ChannelMonitorRequestTemplatesColumns[0]},
  790. Indexes: []*schema.Index{
  791. {
  792. Name: "channelmonitorrequesttemplate_provider_name",
  793. Unique: true,
  794. Columns: []*schema.Column{ChannelMonitorRequestTemplatesColumns[4], ChannelMonitorRequestTemplatesColumns[3]},
  795. },
  796. {
  797. Name: "channelmonitorrequesttemplate_provider_api_mode",
  798. Unique: false,
  799. Columns: []*schema.Column{ChannelMonitorRequestTemplatesColumns[4], ChannelMonitorRequestTemplatesColumns[5]},
  800. },
  801. },
  802. }
  803. // CompositeModelRoutesColumns holds the columns for the "composite_model_routes" table.
  804. CompositeModelRoutesColumns = []*schema.Column{
  805. {Name: "id", Type: field.TypeInt64, Increment: true},
  806. {Name: "created_at", Type: field.TypeTime, SchemaType: map[string]string{"postgres": "timestamptz"}},
  807. {Name: "updated_at", Type: field.TypeTime, SchemaType: map[string]string{"postgres": "timestamptz"}},
  808. {Name: "deleted_at", Type: field.TypeTime, Nullable: true, SchemaType: map[string]string{"postgres": "timestamptz"}},
  809. {Name: "public_model", Type: field.TypeString, Size: 200},
  810. {Name: "match_type", Type: field.TypeString, Size: 20, Default: "exact"},
  811. {Name: "target_platform", Type: field.TypeString, Size: 50, Default: "openai"},
  812. {Name: "upstream_model", Type: field.TypeString, Size: 200, Default: ""},
  813. {Name: "endpoint", Type: field.TypeString, Size: 50, Default: "any"},
  814. {Name: "priority", Type: field.TypeInt, Default: 100},
  815. {Name: "enabled", Type: field.TypeBool, Default: true},
  816. {Name: "notes", Type: field.TypeString, Nullable: true, SchemaType: map[string]string{"postgres": "text"}},
  817. {Name: "group_id", Type: field.TypeInt64},
  818. }
  819. // CompositeModelRoutesTable holds the schema information for the "composite_model_routes" table.
  820. CompositeModelRoutesTable = &schema.Table{
  821. Name: "composite_model_routes",
  822. Columns: CompositeModelRoutesColumns,
  823. PrimaryKey: []*schema.Column{CompositeModelRoutesColumns[0]},
  824. ForeignKeys: []*schema.ForeignKey{
  825. {
  826. Symbol: "composite_model_routes_groups_group",
  827. Columns: []*schema.Column{CompositeModelRoutesColumns[12]},
  828. RefColumns: []*schema.Column{GroupsColumns[0]},
  829. OnDelete: schema.NoAction,
  830. },
  831. },
  832. Indexes: []*schema.Index{
  833. {
  834. Name: "compositemodelroute_group_id",
  835. Unique: false,
  836. Columns: []*schema.Column{CompositeModelRoutesColumns[12]},
  837. },
  838. {
  839. Name: "compositemodelroute_group_id_enabled",
  840. Unique: false,
  841. Columns: []*schema.Column{CompositeModelRoutesColumns[12], CompositeModelRoutesColumns[10]},
  842. },
  843. {
  844. Name: "compositemodelroute_group_id_endpoint",
  845. Unique: false,
  846. Columns: []*schema.Column{CompositeModelRoutesColumns[12], CompositeModelRoutesColumns[8]},
  847. },
  848. {
  849. Name: "compositemodelroute_group_id_target_platform",
  850. Unique: false,
  851. Columns: []*schema.Column{CompositeModelRoutesColumns[12], CompositeModelRoutesColumns[6]},
  852. },
  853. {
  854. Name: "compositemodelroute_deleted_at",
  855. Unique: false,
  856. Columns: []*schema.Column{CompositeModelRoutesColumns[3]},
  857. },
  858. {
  859. Name: "compositemodelroute_priority",
  860. Unique: false,
  861. Columns: []*schema.Column{CompositeModelRoutesColumns[9]},
  862. },
  863. },
  864. }
  865. // ErrorPassthroughRulesColumns holds the columns for the "error_passthrough_rules" table.
  866. ErrorPassthroughRulesColumns = []*schema.Column{
  867. {Name: "id", Type: field.TypeInt64, Increment: true},
  868. {Name: "created_at", Type: field.TypeTime, SchemaType: map[string]string{"postgres": "timestamptz"}},
  869. {Name: "updated_at", Type: field.TypeTime, SchemaType: map[string]string{"postgres": "timestamptz"}},
  870. {Name: "name", Type: field.TypeString, Size: 100},
  871. {Name: "enabled", Type: field.TypeBool, Default: true},
  872. {Name: "priority", Type: field.TypeInt, Default: 0},
  873. {Name: "error_codes", Type: field.TypeJSON, Nullable: true, SchemaType: map[string]string{"postgres": "jsonb"}},
  874. {Name: "keywords", Type: field.TypeJSON, Nullable: true, SchemaType: map[string]string{"postgres": "jsonb"}},
  875. {Name: "match_mode", Type: field.TypeString, Size: 10, Default: "any"},
  876. {Name: "platforms", Type: field.TypeJSON, Nullable: true, SchemaType: map[string]string{"postgres": "jsonb"}},
  877. {Name: "passthrough_code", Type: field.TypeBool, Default: true},
  878. {Name: "response_code", Type: field.TypeInt, Nullable: true},
  879. {Name: "passthrough_body", Type: field.TypeBool, Default: true},
  880. {Name: "custom_message", Type: field.TypeString, Nullable: true, Size: 2147483647},
  881. {Name: "skip_monitoring", Type: field.TypeBool, Default: false},
  882. {Name: "description", Type: field.TypeString, Nullable: true, Size: 2147483647},
  883. }
  884. // ErrorPassthroughRulesTable holds the schema information for the "error_passthrough_rules" table.
  885. ErrorPassthroughRulesTable = &schema.Table{
  886. Name: "error_passthrough_rules",
  887. Columns: ErrorPassthroughRulesColumns,
  888. PrimaryKey: []*schema.Column{ErrorPassthroughRulesColumns[0]},
  889. Indexes: []*schema.Index{
  890. {
  891. Name: "errorpassthroughrule_enabled",
  892. Unique: false,
  893. Columns: []*schema.Column{ErrorPassthroughRulesColumns[4]},
  894. },
  895. {
  896. Name: "errorpassthroughrule_priority",
  897. Unique: false,
  898. Columns: []*schema.Column{ErrorPassthroughRulesColumns[5]},
  899. },
  900. },
  901. }
  902. // GroupsColumns holds the columns for the "groups" table.
  903. GroupsColumns = []*schema.Column{
  904. {Name: "id", Type: field.TypeInt64, Increment: true},
  905. {Name: "created_at", Type: field.TypeTime, SchemaType: map[string]string{"postgres": "timestamptz"}},
  906. {Name: "updated_at", Type: field.TypeTime, SchemaType: map[string]string{"postgres": "timestamptz"}},
  907. {Name: "deleted_at", Type: field.TypeTime, Nullable: true, SchemaType: map[string]string{"postgres": "timestamptz"}},
  908. {Name: "name", Type: field.TypeString, Size: 100},
  909. {Name: "description", Type: field.TypeString, Nullable: true, SchemaType: map[string]string{"postgres": "text"}},
  910. {Name: "rate_multiplier", Type: field.TypeFloat64, Default: 1, SchemaType: map[string]string{"postgres": "decimal(10,4)"}},
  911. {Name: "peak_rate_enabled", Type: field.TypeBool, Default: false},
  912. {Name: "peak_start", Type: field.TypeString, Size: 5, Default: ""},
  913. {Name: "peak_end", Type: field.TypeString, Size: 5, Default: ""},
  914. {Name: "peak_rate_multiplier", Type: field.TypeFloat64, Default: 1, SchemaType: map[string]string{"postgres": "decimal(10,4)"}},
  915. {Name: "is_exclusive", Type: field.TypeBool, Default: false},
  916. {Name: "security_policy_enabled", Type: field.TypeBool, Default: false},
  917. {Name: "security_policy_mode", Type: field.TypeString, Size: 20, Default: "block_session"},
  918. {Name: "security_policy_email_enabled", Type: field.TypeBool, Default: true},
  919. {Name: "status", Type: field.TypeString, Size: 20, Default: "active"},
  920. {Name: "duplicate_operation_id", Type: field.TypeString, Nullable: true, Size: 64},
  921. {Name: "platform", Type: field.TypeString, Size: 50, Default: "anthropic"},
  922. {Name: "subscription_type", Type: field.TypeString, Size: 20, Default: "standard"},
  923. {Name: "daily_limit_usd", Type: field.TypeFloat64, Nullable: true, SchemaType: map[string]string{"postgres": "decimal(20,8)"}},
  924. {Name: "weekly_limit_usd", Type: field.TypeFloat64, Nullable: true, SchemaType: map[string]string{"postgres": "decimal(20,8)"}},
  925. {Name: "monthly_limit_usd", Type: field.TypeFloat64, Nullable: true, SchemaType: map[string]string{"postgres": "decimal(20,8)"}},
  926. {Name: "default_validity_days", Type: field.TypeInt, Default: 30},
  927. {Name: "allow_image_generation", Type: field.TypeBool, Default: false},
  928. {Name: "allow_batch_image_generation", Type: field.TypeBool, Default: false},
  929. {Name: "image_rate_independent", Type: field.TypeBool, Default: false},
  930. {Name: "image_rate_multiplier", Type: field.TypeFloat64, Default: 1, SchemaType: map[string]string{"postgres": "decimal(10,4)"}},
  931. {Name: "image_price_1k", Type: field.TypeFloat64, Nullable: true, SchemaType: map[string]string{"postgres": "decimal(20,8)"}},
  932. {Name: "image_price_2k", Type: field.TypeFloat64, Nullable: true, SchemaType: map[string]string{"postgres": "decimal(20,8)"}},
  933. {Name: "image_price_4k", Type: field.TypeFloat64, Nullable: true, SchemaType: map[string]string{"postgres": "decimal(20,8)"}},
  934. {Name: "batch_image_discount_multiplier", Type: field.TypeFloat64, Default: 0.5, SchemaType: map[string]string{"postgres": "decimal(10,4)"}},
  935. {Name: "batch_image_hold_multiplier", Type: field.TypeFloat64, Default: 0.6, SchemaType: map[string]string{"postgres": "decimal(10,4)"}},
  936. {Name: "video_rate_independent", Type: field.TypeBool, Default: false},
  937. {Name: "video_rate_multiplier", Type: field.TypeFloat64, Default: 1, SchemaType: map[string]string{"postgres": "decimal(10,4)"}},
  938. {Name: "video_price_480p", Type: field.TypeFloat64, Nullable: true, SchemaType: map[string]string{"postgres": "decimal(20,8)"}},
  939. {Name: "video_price_720p", Type: field.TypeFloat64, Nullable: true, SchemaType: map[string]string{"postgres": "decimal(20,8)"}},
  940. {Name: "video_price_1080p", Type: field.TypeFloat64, Nullable: true, SchemaType: map[string]string{"postgres": "decimal(20,8)"}},
  941. {Name: "video_model_prices", Type: field.TypeJSON, Nullable: true, SchemaType: map[string]string{"postgres": "jsonb"}},
  942. {Name: "web_search_price_per_call", Type: field.TypeFloat64, Nullable: true, SchemaType: map[string]string{"postgres": "decimal(20,8)"}},
  943. {Name: "search_price_per_1k", Type: field.TypeFloat64, Nullable: true, SchemaType: map[string]string{"postgres": "decimal(20,8)"}},
  944. {Name: "audio_realtime_price_per_min", Type: field.TypeFloat64, Nullable: true, SchemaType: map[string]string{"postgres": "decimal(20,8)"}},
  945. {Name: "audio_tts_price_per_million_chars", Type: field.TypeFloat64, Nullable: true, SchemaType: map[string]string{"postgres": "decimal(20,8)"}},
  946. {Name: "audio_stt_price_per_hour", Type: field.TypeFloat64, Nullable: true, SchemaType: map[string]string{"postgres": "decimal(20,8)"}},
  947. {Name: "long_context_pricing_enabled", Type: field.TypeBool, Default: true},
  948. {Name: "model_pricing", Type: field.TypeJSON, Nullable: true, SchemaType: map[string]string{"postgres": "jsonb"}},
  949. {Name: "claude_code_only", Type: field.TypeBool, Default: false},
  950. {Name: "fallback_group_id", Type: field.TypeInt64, Nullable: true},
  951. {Name: "fallback_group_id_on_invalid_request", Type: field.TypeInt64, Nullable: true},
  952. {Name: "model_routing", Type: field.TypeJSON, Nullable: true, SchemaType: map[string]string{"postgres": "jsonb"}},
  953. {Name: "model_routing_enabled", Type: field.TypeBool, Default: false},
  954. {Name: "mcp_xml_inject", Type: field.TypeBool, Default: true},
  955. {Name: "supported_model_scopes", Type: field.TypeJSON, SchemaType: map[string]string{"postgres": "jsonb"}},
  956. {Name: "sort_order", Type: field.TypeInt, Default: 0},
  957. {Name: "allow_messages_dispatch", Type: field.TypeBool, Default: false},
  958. {Name: "allow_live", Type: field.TypeBool, Default: false},
  959. {Name: "force_openai_fast", Type: field.TypeBool, Default: false},
  960. {Name: "free_openai_fast", Type: field.TypeBool, Default: false},
  961. {Name: "require_oauth_only", Type: field.TypeBool, Default: false},
  962. {Name: "require_privacy_set", Type: field.TypeBool, Default: false},
  963. {Name: "default_mapped_model", Type: field.TypeString, Size: 100, Default: ""},
  964. {Name: "messages_dispatch_model_config", Type: field.TypeJSON, SchemaType: map[string]string{"postgres": "jsonb"}},
  965. {Name: "model_allowlist", Type: field.TypeJSON, SchemaType: map[string]string{"postgres": "jsonb"}},
  966. {Name: "codex_models_manifest_config", Type: field.TypeJSON, SchemaType: map[string]string{"postgres": "jsonb"}},
  967. {Name: "rpm_limit", Type: field.TypeInt, Default: 0},
  968. {Name: "max_reasoning_effort", Type: field.TypeString, Size: 20, Default: ""},
  969. {Name: "max_reasoning_effort_over_limit", Type: field.TypeString, Size: 20, Default: "downgrade"},
  970. {Name: "reasoning_effort_mappings", Type: field.TypeJSON, SchemaType: map[string]string{"postgres": "jsonb"}},
  971. {Name: "profit_control_enabled", Type: field.TypeBool, Default: false},
  972. {Name: "profit_min_margin", Type: field.TypeFloat64, Default: 0, SchemaType: map[string]string{"postgres": "decimal(10,4)"}},
  973. {Name: "profit_safety_buffer", Type: field.TypeFloat64, Default: 0, SchemaType: map[string]string{"postgres": "decimal(10,4)"}},
  974. }
  975. // GroupsTable holds the schema information for the "groups" table.
  976. GroupsTable = &schema.Table{
  977. Name: "groups",
  978. Columns: GroupsColumns,
  979. PrimaryKey: []*schema.Column{GroupsColumns[0]},
  980. Indexes: []*schema.Index{
  981. {
  982. Name: "group_status",
  983. Unique: false,
  984. Columns: []*schema.Column{GroupsColumns[15]},
  985. },
  986. {
  987. Name: "group_platform",
  988. Unique: false,
  989. Columns: []*schema.Column{GroupsColumns[17]},
  990. },
  991. {
  992. Name: "group_subscription_type",
  993. Unique: false,
  994. Columns: []*schema.Column{GroupsColumns[18]},
  995. },
  996. {
  997. Name: "group_is_exclusive",
  998. Unique: false,
  999. Columns: []*schema.Column{GroupsColumns[11]},
  1000. },
  1001. {
  1002. Name: "group_deleted_at",
  1003. Unique: false,
  1004. Columns: []*schema.Column{GroupsColumns[3]},
  1005. },
  1006. {
  1007. Name: "group_sort_order",
  1008. Unique: false,
  1009. Columns: []*schema.Column{GroupsColumns[52]},
  1010. },
  1011. {
  1012. Name: "idx_groups_duplicate_operation_id_active",
  1013. Unique: true,
  1014. Columns: []*schema.Column{GroupsColumns[16]},
  1015. Annotation: &entsql.IndexAnnotation{
  1016. Where: "duplicate_operation_id IS NOT NULL AND deleted_at IS NULL",
  1017. },
  1018. },
  1019. },
  1020. }
  1021. // IdempotencyRecordsColumns holds the columns for the "idempotency_records" table.
  1022. IdempotencyRecordsColumns = []*schema.Column{
  1023. {Name: "id", Type: field.TypeInt64, Increment: true},
  1024. {Name: "created_at", Type: field.TypeTime, SchemaType: map[string]string{"postgres": "timestamptz"}},
  1025. {Name: "updated_at", Type: field.TypeTime, SchemaType: map[string]string{"postgres": "timestamptz"}},
  1026. {Name: "scope", Type: field.TypeString, Size: 128},
  1027. {Name: "idempotency_key_hash", Type: field.TypeString, Size: 64},
  1028. {Name: "request_fingerprint", Type: field.TypeString, Size: 64},
  1029. {Name: "status", Type: field.TypeString, Size: 32},
  1030. {Name: "response_status", Type: field.TypeInt, Nullable: true},
  1031. {Name: "response_body", Type: field.TypeString, Nullable: true},
  1032. {Name: "error_reason", Type: field.TypeString, Nullable: true, Size: 128},
  1033. {Name: "locked_until", Type: field.TypeTime, Nullable: true},
  1034. {Name: "expires_at", Type: field.TypeTime},
  1035. }
  1036. // IdempotencyRecordsTable holds the schema information for the "idempotency_records" table.
  1037. IdempotencyRecordsTable = &schema.Table{
  1038. Name: "idempotency_records",
  1039. Columns: IdempotencyRecordsColumns,
  1040. PrimaryKey: []*schema.Column{IdempotencyRecordsColumns[0]},
  1041. Indexes: []*schema.Index{
  1042. {
  1043. Name: "idempotencyrecord_scope_idempotency_key_hash",
  1044. Unique: true,
  1045. Columns: []*schema.Column{IdempotencyRecordsColumns[3], IdempotencyRecordsColumns[4]},
  1046. },
  1047. {
  1048. Name: "idempotencyrecord_expires_at",
  1049. Unique: false,
  1050. Columns: []*schema.Column{IdempotencyRecordsColumns[11]},
  1051. },
  1052. {
  1053. Name: "idempotencyrecord_status_locked_until",
  1054. Unique: false,
  1055. Columns: []*schema.Column{IdempotencyRecordsColumns[6], IdempotencyRecordsColumns[10]},
  1056. },
  1057. },
  1058. }
  1059. // IdentityAdoptionDecisionsColumns holds the columns for the "identity_adoption_decisions" table.
  1060. IdentityAdoptionDecisionsColumns = []*schema.Column{
  1061. {Name: "id", Type: field.TypeInt64, Increment: true},
  1062. {Name: "created_at", Type: field.TypeTime, SchemaType: map[string]string{"postgres": "timestamptz"}},
  1063. {Name: "updated_at", Type: field.TypeTime, SchemaType: map[string]string{"postgres": "timestamptz"}},
  1064. {Name: "adopt_display_name", Type: field.TypeBool, Default: false},
  1065. {Name: "adopt_avatar", Type: field.TypeBool, Default: false},
  1066. {Name: "decided_at", Type: field.TypeTime, SchemaType: map[string]string{"postgres": "timestamptz"}},
  1067. {Name: "identity_id", Type: field.TypeInt64, Nullable: true},
  1068. {Name: "pending_auth_session_id", Type: field.TypeInt64, Unique: true},
  1069. }
  1070. // IdentityAdoptionDecisionsTable holds the schema information for the "identity_adoption_decisions" table.
  1071. IdentityAdoptionDecisionsTable = &schema.Table{
  1072. Name: "identity_adoption_decisions",
  1073. Columns: IdentityAdoptionDecisionsColumns,
  1074. PrimaryKey: []*schema.Column{IdentityAdoptionDecisionsColumns[0]},
  1075. ForeignKeys: []*schema.ForeignKey{
  1076. {
  1077. Symbol: "identity_adoption_decisions_auth_identities_adoption_decisions",
  1078. Columns: []*schema.Column{IdentityAdoptionDecisionsColumns[6]},
  1079. RefColumns: []*schema.Column{AuthIdentitiesColumns[0]},
  1080. OnDelete: schema.SetNull,
  1081. },
  1082. {
  1083. Symbol: "identity_adoption_decisions_pending_auth_sessions_adoption_decision",
  1084. Columns: []*schema.Column{IdentityAdoptionDecisionsColumns[7]},
  1085. RefColumns: []*schema.Column{PendingAuthSessionsColumns[0]},
  1086. OnDelete: schema.Cascade,
  1087. },
  1088. },
  1089. Indexes: []*schema.Index{
  1090. {
  1091. Name: "identityadoptiondecision_pending_auth_session_id",
  1092. Unique: true,
  1093. Columns: []*schema.Column{IdentityAdoptionDecisionsColumns[7]},
  1094. },
  1095. {
  1096. Name: "identityadoptiondecision_identity_id",
  1097. Unique: false,
  1098. Columns: []*schema.Column{IdentityAdoptionDecisionsColumns[6]},
  1099. },
  1100. },
  1101. }
  1102. // PaymentAuditLogsColumns holds the columns for the "payment_audit_logs" table.
  1103. PaymentAuditLogsColumns = []*schema.Column{
  1104. {Name: "id", Type: field.TypeInt64, Increment: true},
  1105. {Name: "order_id", Type: field.TypeString, Size: 64},
  1106. {Name: "action", Type: field.TypeString, Size: 50},
  1107. {Name: "detail", Type: field.TypeString, Default: "", SchemaType: map[string]string{"postgres": "text"}},
  1108. {Name: "operator", Type: field.TypeString, Size: 100, Default: "system"},
  1109. {Name: "created_at", Type: field.TypeTime, SchemaType: map[string]string{"postgres": "timestamptz"}},
  1110. }
  1111. // PaymentAuditLogsTable holds the schema information for the "payment_audit_logs" table.
  1112. PaymentAuditLogsTable = &schema.Table{
  1113. Name: "payment_audit_logs",
  1114. Columns: PaymentAuditLogsColumns,
  1115. PrimaryKey: []*schema.Column{PaymentAuditLogsColumns[0]},
  1116. Indexes: []*schema.Index{
  1117. {
  1118. Name: "paymentauditlog_order_id",
  1119. Unique: false,
  1120. Columns: []*schema.Column{PaymentAuditLogsColumns[1]},
  1121. },
  1122. },
  1123. }
  1124. // PaymentOrdersColumns holds the columns for the "payment_orders" table.
  1125. PaymentOrdersColumns = []*schema.Column{
  1126. {Name: "id", Type: field.TypeInt64, Increment: true},
  1127. {Name: "user_email", Type: field.TypeString, Size: 255},
  1128. {Name: "user_name", Type: field.TypeString, Size: 100},
  1129. {Name: "user_notes", Type: field.TypeString, Nullable: true, SchemaType: map[string]string{"postgres": "text"}},
  1130. {Name: "amount", Type: field.TypeFloat64, SchemaType: map[string]string{"postgres": "decimal(20,2)"}},
  1131. {Name: "pay_amount", Type: field.TypeFloat64, SchemaType: map[string]string{"postgres": "decimal(20,2)"}},
  1132. {Name: "fee_rate", Type: field.TypeFloat64, Default: 0, SchemaType: map[string]string{"postgres": "decimal(10,4)"}},
  1133. {Name: "recharge_code", Type: field.TypeString, Size: 64},
  1134. {Name: "out_trade_no", Type: field.TypeString, Size: 64, Default: ""},
  1135. {Name: "payment_type", Type: field.TypeString, Size: 30},
  1136. {Name: "payment_trade_no", Type: field.TypeString, Size: 128},
  1137. {Name: "pay_url", Type: field.TypeString, Nullable: true, SchemaType: map[string]string{"postgres": "text"}},
  1138. {Name: "qr_code", Type: field.TypeString, Nullable: true, SchemaType: map[string]string{"postgres": "text"}},
  1139. {Name: "qr_code_img", Type: field.TypeString, Nullable: true, SchemaType: map[string]string{"postgres": "text"}},
  1140. {Name: "order_type", Type: field.TypeString, Size: 20, Default: "balance"},
  1141. {Name: "plan_id", Type: field.TypeInt64, Nullable: true},
  1142. {Name: "subscription_group_id", Type: field.TypeInt64, Nullable: true},
  1143. {Name: "subscription_days", Type: field.TypeInt, Nullable: true},
  1144. {Name: "provider_instance_id", Type: field.TypeString, Nullable: true, Size: 64},
  1145. {Name: "provider_key", Type: field.TypeString, Nullable: true, Size: 30},
  1146. {Name: "provider_snapshot", Type: field.TypeJSON, Nullable: true, SchemaType: map[string]string{"postgres": "jsonb"}},
  1147. {Name: "status", Type: field.TypeString, Size: 30, Default: "PENDING"},
  1148. {Name: "refund_amount", Type: field.TypeFloat64, Default: 0, SchemaType: map[string]string{"postgres": "decimal(20,2)"}},
  1149. {Name: "refund_reason", Type: field.TypeString, Nullable: true, SchemaType: map[string]string{"postgres": "text"}},
  1150. {Name: "refund_at", Type: field.TypeTime, Nullable: true, SchemaType: map[string]string{"postgres": "timestamptz"}},
  1151. {Name: "force_refund", Type: field.TypeBool, Default: false},
  1152. {Name: "refund_requested_at", Type: field.TypeTime, Nullable: true, SchemaType: map[string]string{"postgres": "timestamptz"}},
  1153. {Name: "refund_request_reason", Type: field.TypeString, Nullable: true, SchemaType: map[string]string{"postgres": "text"}},
  1154. {Name: "refund_requested_by", Type: field.TypeString, Nullable: true, Size: 20},
  1155. {Name: "expires_at", Type: field.TypeTime, SchemaType: map[string]string{"postgres": "timestamptz"}},
  1156. {Name: "paid_at", Type: field.TypeTime, Nullable: true, SchemaType: map[string]string{"postgres": "timestamptz"}},
  1157. {Name: "completed_at", Type: field.TypeTime, Nullable: true, SchemaType: map[string]string{"postgres": "timestamptz"}},
  1158. {Name: "failed_at", Type: field.TypeTime, Nullable: true, SchemaType: map[string]string{"postgres": "timestamptz"}},
  1159. {Name: "failed_reason", Type: field.TypeString, Nullable: true, SchemaType: map[string]string{"postgres": "text"}},
  1160. {Name: "client_ip", Type: field.TypeString, Size: 50},
  1161. {Name: "src_host", Type: field.TypeString, Size: 255},
  1162. {Name: "src_url", Type: field.TypeString, Nullable: true, SchemaType: map[string]string{"postgres": "text"}},
  1163. {Name: "created_at", Type: field.TypeTime, SchemaType: map[string]string{"postgres": "timestamptz"}},
  1164. {Name: "updated_at", Type: field.TypeTime, SchemaType: map[string]string{"postgres": "timestamptz"}},
  1165. {Name: "user_id", Type: field.TypeInt64},
  1166. }
  1167. // PaymentOrdersTable holds the schema information for the "payment_orders" table.
  1168. PaymentOrdersTable = &schema.Table{
  1169. Name: "payment_orders",
  1170. Columns: PaymentOrdersColumns,
  1171. PrimaryKey: []*schema.Column{PaymentOrdersColumns[0]},
  1172. ForeignKeys: []*schema.ForeignKey{
  1173. {
  1174. Symbol: "payment_orders_users_payment_orders",
  1175. Columns: []*schema.Column{PaymentOrdersColumns[39]},
  1176. RefColumns: []*schema.Column{UsersColumns[0]},
  1177. OnDelete: schema.NoAction,
  1178. },
  1179. },
  1180. Indexes: []*schema.Index{
  1181. {
  1182. Name: "paymentorder_out_trade_no",
  1183. Unique: true,
  1184. Columns: []*schema.Column{PaymentOrdersColumns[8]},
  1185. Annotation: &entsql.IndexAnnotation{
  1186. Where: "out_trade_no <> ''",
  1187. },
  1188. },
  1189. {
  1190. Name: "paymentorder_user_id",
  1191. Unique: false,
  1192. Columns: []*schema.Column{PaymentOrdersColumns[39]},
  1193. },
  1194. {
  1195. Name: "paymentorder_status",
  1196. Unique: false,
  1197. Columns: []*schema.Column{PaymentOrdersColumns[21]},
  1198. },
  1199. {
  1200. Name: "paymentorder_expires_at",
  1201. Unique: false,
  1202. Columns: []*schema.Column{PaymentOrdersColumns[29]},
  1203. },
  1204. {
  1205. Name: "paymentorder_created_at",
  1206. Unique: false,
  1207. Columns: []*schema.Column{PaymentOrdersColumns[37]},
  1208. },
  1209. {
  1210. Name: "paymentorder_paid_at",
  1211. Unique: false,
  1212. Columns: []*schema.Column{PaymentOrdersColumns[30]},
  1213. },
  1214. {
  1215. Name: "paymentorder_payment_type_paid_at",
  1216. Unique: false,
  1217. Columns: []*schema.Column{PaymentOrdersColumns[9], PaymentOrdersColumns[30]},
  1218. },
  1219. {
  1220. Name: "paymentorder_order_type",
  1221. Unique: false,
  1222. Columns: []*schema.Column{PaymentOrdersColumns[14]},
  1223. },
  1224. },
  1225. }
  1226. // PaymentProviderInstancesColumns holds the columns for the "payment_provider_instances" table.
  1227. PaymentProviderInstancesColumns = []*schema.Column{
  1228. {Name: "id", Type: field.TypeInt64, Increment: true},
  1229. {Name: "provider_key", Type: field.TypeString, Size: 30},
  1230. {Name: "name", Type: field.TypeString, Size: 100, Default: ""},
  1231. {Name: "config", Type: field.TypeString, SchemaType: map[string]string{"postgres": "text"}},
  1232. {Name: "supported_types", Type: field.TypeString, Size: 200, Default: ""},
  1233. {Name: "enabled", Type: field.TypeBool, Default: true},
  1234. {Name: "payment_mode", Type: field.TypeString, Size: 20, Default: ""},
  1235. {Name: "sort_order", Type: field.TypeInt, Default: 0},
  1236. {Name: "limits", Type: field.TypeString, Default: "", SchemaType: map[string]string{"postgres": "text"}},
  1237. {Name: "refund_enabled", Type: field.TypeBool, Default: false},
  1238. {Name: "allow_user_refund", Type: field.TypeBool, Default: false},
  1239. {Name: "created_at", Type: field.TypeTime, SchemaType: map[string]string{"postgres": "timestamptz"}},
  1240. {Name: "updated_at", Type: field.TypeTime, SchemaType: map[string]string{"postgres": "timestamptz"}},
  1241. }
  1242. // PaymentProviderInstancesTable holds the schema information for the "payment_provider_instances" table.
  1243. PaymentProviderInstancesTable = &schema.Table{
  1244. Name: "payment_provider_instances",
  1245. Columns: PaymentProviderInstancesColumns,
  1246. PrimaryKey: []*schema.Column{PaymentProviderInstancesColumns[0]},
  1247. Indexes: []*schema.Index{
  1248. {
  1249. Name: "paymentproviderinstance_provider_key",
  1250. Unique: false,
  1251. Columns: []*schema.Column{PaymentProviderInstancesColumns[1]},
  1252. },
  1253. {
  1254. Name: "paymentproviderinstance_enabled",
  1255. Unique: false,
  1256. Columns: []*schema.Column{PaymentProviderInstancesColumns[5]},
  1257. },
  1258. },
  1259. }
  1260. // PendingAuthSessionsColumns holds the columns for the "pending_auth_sessions" table.
  1261. PendingAuthSessionsColumns = []*schema.Column{
  1262. {Name: "id", Type: field.TypeInt64, Increment: true},
  1263. {Name: "created_at", Type: field.TypeTime, SchemaType: map[string]string{"postgres": "timestamptz"}},
  1264. {Name: "updated_at", Type: field.TypeTime, SchemaType: map[string]string{"postgres": "timestamptz"}},
  1265. {Name: "session_token", Type: field.TypeString, Size: 255},
  1266. {Name: "intent", Type: field.TypeString, Size: 40},
  1267. {Name: "provider_type", Type: field.TypeString, Size: 20},
  1268. {Name: "provider_key", Type: field.TypeString, SchemaType: map[string]string{"postgres": "text"}},
  1269. {Name: "provider_subject", Type: field.TypeString, SchemaType: map[string]string{"postgres": "text"}},
  1270. {Name: "redirect_to", Type: field.TypeString, Default: "", SchemaType: map[string]string{"postgres": "text"}},
  1271. {Name: "resolved_email", Type: field.TypeString, Default: "", SchemaType: map[string]string{"postgres": "text"}},
  1272. {Name: "registration_password_hash", Type: field.TypeString, Default: "", SchemaType: map[string]string{"postgres": "text"}},
  1273. {Name: "upstream_identity_claims", Type: field.TypeJSON, SchemaType: map[string]string{"postgres": "jsonb"}},
  1274. {Name: "local_flow_state", Type: field.TypeJSON, SchemaType: map[string]string{"postgres": "jsonb"}},
  1275. {Name: "browser_session_key", Type: field.TypeString, Default: "", SchemaType: map[string]string{"postgres": "text"}},
  1276. {Name: "completion_code_hash", Type: field.TypeString, Default: "", SchemaType: map[string]string{"postgres": "text"}},
  1277. {Name: "completion_code_expires_at", Type: field.TypeTime, Nullable: true, SchemaType: map[string]string{"postgres": "timestamptz"}},
  1278. {Name: "email_verified_at", Type: field.TypeTime, Nullable: true, SchemaType: map[string]string{"postgres": "timestamptz"}},
  1279. {Name: "password_verified_at", Type: field.TypeTime, Nullable: true, SchemaType: map[string]string{"postgres": "timestamptz"}},
  1280. {Name: "totp_verified_at", Type: field.TypeTime, Nullable: true, SchemaType: map[string]string{"postgres": "timestamptz"}},
  1281. {Name: "expires_at", Type: field.TypeTime, SchemaType: map[string]string{"postgres": "timestamptz"}},
  1282. {Name: "consumed_at", Type: field.TypeTime, Nullable: true, SchemaType: map[string]string{"postgres": "timestamptz"}},
  1283. {Name: "target_user_id", Type: field.TypeInt64, Nullable: true},
  1284. }
  1285. // PendingAuthSessionsTable holds the schema information for the "pending_auth_sessions" table.
  1286. PendingAuthSessionsTable = &schema.Table{
  1287. Name: "pending_auth_sessions",
  1288. Columns: PendingAuthSessionsColumns,
  1289. PrimaryKey: []*schema.Column{PendingAuthSessionsColumns[0]},
  1290. ForeignKeys: []*schema.ForeignKey{
  1291. {
  1292. Symbol: "pending_auth_sessions_users_pending_auth_sessions",
  1293. Columns: []*schema.Column{PendingAuthSessionsColumns[21]},
  1294. RefColumns: []*schema.Column{UsersColumns[0]},
  1295. OnDelete: schema.SetNull,
  1296. },
  1297. },
  1298. Indexes: []*schema.Index{
  1299. {
  1300. Name: "pendingauthsession_session_token",
  1301. Unique: true,
  1302. Columns: []*schema.Column{PendingAuthSessionsColumns[3]},
  1303. },
  1304. {
  1305. Name: "pendingauthsession_target_user_id",
  1306. Unique: false,
  1307. Columns: []*schema.Column{PendingAuthSessionsColumns[21]},
  1308. },
  1309. {
  1310. Name: "pendingauthsession_expires_at",
  1311. Unique: false,
  1312. Columns: []*schema.Column{PendingAuthSessionsColumns[19]},
  1313. },
  1314. {
  1315. Name: "pendingauthsession_provider_type_provider_key_provider_subject",
  1316. Unique: false,
  1317. Columns: []*schema.Column{PendingAuthSessionsColumns[5], PendingAuthSessionsColumns[6], PendingAuthSessionsColumns[7]},
  1318. },
  1319. {
  1320. Name: "pendingauthsession_completion_code_hash",
  1321. Unique: false,
  1322. Columns: []*schema.Column{PendingAuthSessionsColumns[14]},
  1323. },
  1324. },
  1325. }
  1326. // PromoCodesColumns holds the columns for the "promo_codes" table.
  1327. PromoCodesColumns = []*schema.Column{
  1328. {Name: "id", Type: field.TypeInt64, Increment: true},
  1329. {Name: "code", Type: field.TypeString, Unique: true, Size: 32},
  1330. {Name: "bonus_amount", Type: field.TypeFloat64, Default: 0, SchemaType: map[string]string{"postgres": "decimal(20,8)"}},
  1331. {Name: "max_uses", Type: field.TypeInt, Default: 0},
  1332. {Name: "used_count", Type: field.TypeInt, Default: 0},
  1333. {Name: "status", Type: field.TypeString, Size: 20, Default: "active"},
  1334. {Name: "expires_at", Type: field.TypeTime, Nullable: true, SchemaType: map[string]string{"postgres": "timestamptz"}},
  1335. {Name: "notes", Type: field.TypeString, Nullable: true, SchemaType: map[string]string{"postgres": "text"}},
  1336. {Name: "created_at", Type: field.TypeTime, SchemaType: map[string]string{"postgres": "timestamptz"}},
  1337. {Name: "updated_at", Type: field.TypeTime, SchemaType: map[string]string{"postgres": "timestamptz"}},
  1338. }
  1339. // PromoCodesTable holds the schema information for the "promo_codes" table.
  1340. PromoCodesTable = &schema.Table{
  1341. Name: "promo_codes",
  1342. Columns: PromoCodesColumns,
  1343. PrimaryKey: []*schema.Column{PromoCodesColumns[0]},
  1344. Indexes: []*schema.Index{
  1345. {
  1346. Name: "promocode_status",
  1347. Unique: false,
  1348. Columns: []*schema.Column{PromoCodesColumns[5]},
  1349. },
  1350. {
  1351. Name: "promocode_expires_at",
  1352. Unique: false,
  1353. Columns: []*schema.Column{PromoCodesColumns[6]},
  1354. },
  1355. },
  1356. }
  1357. // PromoCodeUsagesColumns holds the columns for the "promo_code_usages" table.
  1358. PromoCodeUsagesColumns = []*schema.Column{
  1359. {Name: "id", Type: field.TypeInt64, Increment: true},
  1360. {Name: "bonus_amount", Type: field.TypeFloat64, SchemaType: map[string]string{"postgres": "decimal(20,8)"}},
  1361. {Name: "used_at", Type: field.TypeTime, SchemaType: map[string]string{"postgres": "timestamptz"}},
  1362. {Name: "promo_code_id", Type: field.TypeInt64},
  1363. {Name: "user_id", Type: field.TypeInt64},
  1364. }
  1365. // PromoCodeUsagesTable holds the schema information for the "promo_code_usages" table.
  1366. PromoCodeUsagesTable = &schema.Table{
  1367. Name: "promo_code_usages",
  1368. Columns: PromoCodeUsagesColumns,
  1369. PrimaryKey: []*schema.Column{PromoCodeUsagesColumns[0]},
  1370. ForeignKeys: []*schema.ForeignKey{
  1371. {
  1372. Symbol: "promo_code_usages_promo_codes_usage_records",
  1373. Columns: []*schema.Column{PromoCodeUsagesColumns[3]},
  1374. RefColumns: []*schema.Column{PromoCodesColumns[0]},
  1375. OnDelete: schema.NoAction,
  1376. },
  1377. {
  1378. Symbol: "promo_code_usages_users_promo_code_usages",
  1379. Columns: []*schema.Column{PromoCodeUsagesColumns[4]},
  1380. RefColumns: []*schema.Column{UsersColumns[0]},
  1381. OnDelete: schema.NoAction,
  1382. },
  1383. },
  1384. Indexes: []*schema.Index{
  1385. {
  1386. Name: "promocodeusage_promo_code_id",
  1387. Unique: false,
  1388. Columns: []*schema.Column{PromoCodeUsagesColumns[3]},
  1389. },
  1390. {
  1391. Name: "promocodeusage_user_id",
  1392. Unique: false,
  1393. Columns: []*schema.Column{PromoCodeUsagesColumns[4]},
  1394. },
  1395. {
  1396. Name: "promocodeusage_promo_code_id_user_id",
  1397. Unique: true,
  1398. Columns: []*schema.Column{PromoCodeUsagesColumns[3], PromoCodeUsagesColumns[4]},
  1399. },
  1400. },
  1401. }
  1402. // ProxiesColumns holds the columns for the "proxies" table.
  1403. ProxiesColumns = []*schema.Column{
  1404. {Name: "id", Type: field.TypeInt64, Increment: true},
  1405. {Name: "created_at", Type: field.TypeTime, SchemaType: map[string]string{"postgres": "timestamptz"}},
  1406. {Name: "updated_at", Type: field.TypeTime, SchemaType: map[string]string{"postgres": "timestamptz"}},
  1407. {Name: "deleted_at", Type: field.TypeTime, Nullable: true, SchemaType: map[string]string{"postgres": "timestamptz"}},
  1408. {Name: "name", Type: field.TypeString, Size: 100},
  1409. {Name: "protocol", Type: field.TypeString, Size: 20},
  1410. {Name: "host", Type: field.TypeString, Size: 255},
  1411. {Name: "port", Type: field.TypeInt},
  1412. {Name: "username", Type: field.TypeString, Nullable: true, Size: 100},
  1413. {Name: "password", Type: field.TypeString, Nullable: true, Size: 100},
  1414. {Name: "status", Type: field.TypeString, Size: 20, Default: "active"},
  1415. {Name: "expires_at", Type: field.TypeTime, Nullable: true},
  1416. {Name: "fallback_mode", Type: field.TypeString, Size: 20, Default: "none"},
  1417. {Name: "expiry_warn_days", Type: field.TypeInt, Default: 7},
  1418. {Name: "backup_proxy_id", Type: field.TypeInt64, Nullable: true},
  1419. }
  1420. // ProxiesTable holds the schema information for the "proxies" table.
  1421. ProxiesTable = &schema.Table{
  1422. Name: "proxies",
  1423. Columns: ProxiesColumns,
  1424. PrimaryKey: []*schema.Column{ProxiesColumns[0]},
  1425. ForeignKeys: []*schema.ForeignKey{
  1426. {
  1427. Symbol: "proxies_proxies_backup_proxy",
  1428. Columns: []*schema.Column{ProxiesColumns[14]},
  1429. RefColumns: []*schema.Column{ProxiesColumns[0]},
  1430. OnDelete: schema.SetNull,
  1431. },
  1432. },
  1433. Indexes: []*schema.Index{
  1434. {
  1435. Name: "proxy_status",
  1436. Unique: false,
  1437. Columns: []*schema.Column{ProxiesColumns[10]},
  1438. },
  1439. {
  1440. Name: "proxy_deleted_at",
  1441. Unique: false,
  1442. Columns: []*schema.Column{ProxiesColumns[3]},
  1443. },
  1444. {
  1445. Name: "proxy_expires_at",
  1446. Unique: false,
  1447. Columns: []*schema.Column{ProxiesColumns[11]},
  1448. },
  1449. {
  1450. Name: "proxy_backup_proxy_id",
  1451. Unique: false,
  1452. Columns: []*schema.Column{ProxiesColumns[14]},
  1453. },
  1454. },
  1455. }
  1456. // RedeemCodesColumns holds the columns for the "redeem_codes" table.
  1457. RedeemCodesColumns = []*schema.Column{
  1458. {Name: "id", Type: field.TypeInt64, Increment: true},
  1459. {Name: "code", Type: field.TypeString, Unique: true, Size: 32},
  1460. {Name: "type", Type: field.TypeString, Size: 20, Default: "balance"},
  1461. {Name: "value", Type: field.TypeFloat64, Default: 0, SchemaType: map[string]string{"postgres": "decimal(20,8)"}},
  1462. {Name: "status", Type: field.TypeString, Size: 20, Default: "unused"},
  1463. {Name: "used_at", Type: field.TypeTime, Nullable: true, SchemaType: map[string]string{"postgres": "timestamptz"}},
  1464. {Name: "notes", Type: field.TypeString, Nullable: true, SchemaType: map[string]string{"postgres": "text"}},
  1465. {Name: "created_at", Type: field.TypeTime, SchemaType: map[string]string{"postgres": "timestamptz"}},
  1466. {Name: "expires_at", Type: field.TypeTime, Nullable: true, SchemaType: map[string]string{"postgres": "timestamptz"}},
  1467. {Name: "validity_days", Type: field.TypeInt, Default: 30},
  1468. {Name: "group_id", Type: field.TypeInt64, Nullable: true},
  1469. {Name: "used_by", Type: field.TypeInt64, Nullable: true},
  1470. }
  1471. // RedeemCodesTable holds the schema information for the "redeem_codes" table.
  1472. RedeemCodesTable = &schema.Table{
  1473. Name: "redeem_codes",
  1474. Columns: RedeemCodesColumns,
  1475. PrimaryKey: []*schema.Column{RedeemCodesColumns[0]},
  1476. ForeignKeys: []*schema.ForeignKey{
  1477. {
  1478. Symbol: "redeem_codes_groups_redeem_codes",
  1479. Columns: []*schema.Column{RedeemCodesColumns[10]},
  1480. RefColumns: []*schema.Column{GroupsColumns[0]},
  1481. OnDelete: schema.SetNull,
  1482. },
  1483. {
  1484. Symbol: "redeem_codes_users_redeem_codes",
  1485. Columns: []*schema.Column{RedeemCodesColumns[11]},
  1486. RefColumns: []*schema.Column{UsersColumns[0]},
  1487. OnDelete: schema.SetNull,
  1488. },
  1489. },
  1490. Indexes: []*schema.Index{
  1491. {
  1492. Name: "redeemcode_status",
  1493. Unique: false,
  1494. Columns: []*schema.Column{RedeemCodesColumns[4]},
  1495. },
  1496. {
  1497. Name: "redeemcode_used_by",
  1498. Unique: false,
  1499. Columns: []*schema.Column{RedeemCodesColumns[11]},
  1500. },
  1501. {
  1502. Name: "redeemcode_group_id",
  1503. Unique: false,
  1504. Columns: []*schema.Column{RedeemCodesColumns[10]},
  1505. },
  1506. {
  1507. Name: "redeemcode_expires_at",
  1508. Unique: false,
  1509. Columns: []*schema.Column{RedeemCodesColumns[8]},
  1510. },
  1511. },
  1512. }
  1513. // SecurityPolicyKeywordsColumns holds the columns for the "security_policy_keywords" table.
  1514. SecurityPolicyKeywordsColumns = []*schema.Column{
  1515. {Name: "id", Type: field.TypeInt64, Increment: true},
  1516. {Name: "created_at", Type: field.TypeTime, SchemaType: map[string]string{"postgres": "timestamptz"}},
  1517. {Name: "updated_at", Type: field.TypeTime, SchemaType: map[string]string{"postgres": "timestamptz"}},
  1518. {Name: "deleted_at", Type: field.TypeTime, Nullable: true, SchemaType: map[string]string{"postgres": "timestamptz"}},
  1519. {Name: "keyword", Type: field.TypeString, Size: 200},
  1520. {Name: "category", Type: field.TypeString, Size: 50, Default: ""},
  1521. {Name: "enabled", Type: field.TypeBool, Default: true},
  1522. {Name: "group_id", Type: field.TypeInt64, Nullable: true},
  1523. }
  1524. // SecurityPolicyKeywordsTable holds the schema information for the "security_policy_keywords" table.
  1525. SecurityPolicyKeywordsTable = &schema.Table{
  1526. Name: "security_policy_keywords",
  1527. Columns: SecurityPolicyKeywordsColumns,
  1528. PrimaryKey: []*schema.Column{SecurityPolicyKeywordsColumns[0]},
  1529. ForeignKeys: []*schema.ForeignKey{
  1530. {
  1531. Symbol: "security_policy_keywords_groups_group",
  1532. Columns: []*schema.Column{SecurityPolicyKeywordsColumns[7]},
  1533. RefColumns: []*schema.Column{GroupsColumns[0]},
  1534. OnDelete: schema.SetNull,
  1535. },
  1536. },
  1537. Indexes: []*schema.Index{
  1538. {
  1539. Name: "idx_secpol_kw_global_unique",
  1540. Unique: true,
  1541. Columns: []*schema.Column{SecurityPolicyKeywordsColumns[4]},
  1542. Annotation: &entsql.IndexAnnotation{
  1543. Where: "group_id IS NULL AND deleted_at IS NULL",
  1544. },
  1545. },
  1546. {
  1547. Name: "idx_secpol_kw_group_unique",
  1548. Unique: true,
  1549. Columns: []*schema.Column{SecurityPolicyKeywordsColumns[7], SecurityPolicyKeywordsColumns[4]},
  1550. Annotation: &entsql.IndexAnnotation{
  1551. Where: "group_id IS NOT NULL AND deleted_at IS NULL",
  1552. },
  1553. },
  1554. {
  1555. Name: "securitypolicykeyword_group_id",
  1556. Unique: false,
  1557. Columns: []*schema.Column{SecurityPolicyKeywordsColumns[7]},
  1558. },
  1559. {
  1560. Name: "securitypolicykeyword_enabled",
  1561. Unique: false,
  1562. Columns: []*schema.Column{SecurityPolicyKeywordsColumns[6]},
  1563. },
  1564. {
  1565. Name: "securitypolicykeyword_deleted_at",
  1566. Unique: false,
  1567. Columns: []*schema.Column{SecurityPolicyKeywordsColumns[3]},
  1568. },
  1569. },
  1570. }
  1571. // SecuritySecretsColumns holds the columns for the "security_secrets" table.
  1572. SecuritySecretsColumns = []*schema.Column{
  1573. {Name: "id", Type: field.TypeInt64, Increment: true},
  1574. {Name: "created_at", Type: field.TypeTime, SchemaType: map[string]string{"postgres": "timestamptz"}},
  1575. {Name: "updated_at", Type: field.TypeTime, SchemaType: map[string]string{"postgres": "timestamptz"}},
  1576. {Name: "key", Type: field.TypeString, Unique: true, Size: 100},
  1577. {Name: "value", Type: field.TypeString, SchemaType: map[string]string{"postgres": "text"}},
  1578. }
  1579. // SecuritySecretsTable holds the schema information for the "security_secrets" table.
  1580. SecuritySecretsTable = &schema.Table{
  1581. Name: "security_secrets",
  1582. Columns: SecuritySecretsColumns,
  1583. PrimaryKey: []*schema.Column{SecuritySecretsColumns[0]},
  1584. }
  1585. // SettingsColumns holds the columns for the "settings" table.
  1586. SettingsColumns = []*schema.Column{
  1587. {Name: "id", Type: field.TypeInt64, Increment: true},
  1588. {Name: "key", Type: field.TypeString, Unique: true, Size: 100},
  1589. {Name: "value", Type: field.TypeString, SchemaType: map[string]string{"postgres": "text"}},
  1590. {Name: "updated_at", Type: field.TypeTime, SchemaType: map[string]string{"postgres": "timestamptz"}},
  1591. }
  1592. // SettingsTable holds the schema information for the "settings" table.
  1593. SettingsTable = &schema.Table{
  1594. Name: "settings",
  1595. Columns: SettingsColumns,
  1596. PrimaryKey: []*schema.Column{SettingsColumns[0]},
  1597. }
  1598. // SubscriptionPlansColumns holds the columns for the "subscription_plans" table.
  1599. SubscriptionPlansColumns = []*schema.Column{
  1600. {Name: "id", Type: field.TypeInt64, Increment: true},
  1601. {Name: "group_id", Type: field.TypeInt64},
  1602. {Name: "name", Type: field.TypeString, Size: 100},
  1603. {Name: "description", Type: field.TypeString, Default: "", SchemaType: map[string]string{"postgres": "text"}},
  1604. {Name: "price", Type: field.TypeFloat64, SchemaType: map[string]string{"postgres": "decimal(20,2)"}},
  1605. {Name: "original_price", Type: field.TypeFloat64, Nullable: true, SchemaType: map[string]string{"postgres": "decimal(20,2)"}},
  1606. {Name: "currency", Type: field.TypeString, Size: 3, Default: ""},
  1607. {Name: "validity_days", Type: field.TypeInt, Default: 30},
  1608. {Name: "validity_unit", Type: field.TypeString, Size: 10, Default: "day"},
  1609. {Name: "features", Type: field.TypeString, Default: "", SchemaType: map[string]string{"postgres": "text"}},
  1610. {Name: "product_name", Type: field.TypeString, Size: 100, Default: ""},
  1611. {Name: "for_sale", Type: field.TypeBool, Default: true},
  1612. {Name: "sort_order", Type: field.TypeInt, Default: 0},
  1613. {Name: "created_at", Type: field.TypeTime, SchemaType: map[string]string{"postgres": "timestamptz"}},
  1614. {Name: "updated_at", Type: field.TypeTime, SchemaType: map[string]string{"postgres": "timestamptz"}},
  1615. }
  1616. // SubscriptionPlansTable holds the schema information for the "subscription_plans" table.
  1617. SubscriptionPlansTable = &schema.Table{
  1618. Name: "subscription_plans",
  1619. Columns: SubscriptionPlansColumns,
  1620. PrimaryKey: []*schema.Column{SubscriptionPlansColumns[0]},
  1621. Indexes: []*schema.Index{
  1622. {
  1623. Name: "subscriptionplan_group_id",
  1624. Unique: false,
  1625. Columns: []*schema.Column{SubscriptionPlansColumns[1]},
  1626. },
  1627. {
  1628. Name: "subscriptionplan_for_sale",
  1629. Unique: false,
  1630. Columns: []*schema.Column{SubscriptionPlansColumns[11]},
  1631. },
  1632. },
  1633. }
  1634. // TLSFingerprintProfilesColumns holds the columns for the "tls_fingerprint_profiles" table.
  1635. TLSFingerprintProfilesColumns = []*schema.Column{
  1636. {Name: "id", Type: field.TypeInt64, Increment: true},
  1637. {Name: "created_at", Type: field.TypeTime, SchemaType: map[string]string{"postgres": "timestamptz"}},
  1638. {Name: "updated_at", Type: field.TypeTime, SchemaType: map[string]string{"postgres": "timestamptz"}},
  1639. {Name: "name", Type: field.TypeString, Unique: true, Size: 100},
  1640. {Name: "description", Type: field.TypeString, Nullable: true, Size: 2147483647},
  1641. {Name: "enable_grease", Type: field.TypeBool, Default: false},
  1642. {Name: "cipher_suites", Type: field.TypeJSON, Nullable: true, SchemaType: map[string]string{"postgres": "jsonb"}},
  1643. {Name: "curves", Type: field.TypeJSON, Nullable: true, SchemaType: map[string]string{"postgres": "jsonb"}},
  1644. {Name: "point_formats", Type: field.TypeJSON, Nullable: true, SchemaType: map[string]string{"postgres": "jsonb"}},
  1645. {Name: "signature_algorithms", Type: field.TypeJSON, Nullable: true, SchemaType: map[string]string{"postgres": "jsonb"}},
  1646. {Name: "alpn_protocols", Type: field.TypeJSON, Nullable: true, SchemaType: map[string]string{"postgres": "jsonb"}},
  1647. {Name: "supported_versions", Type: field.TypeJSON, Nullable: true, SchemaType: map[string]string{"postgres": "jsonb"}},
  1648. {Name: "key_share_groups", Type: field.TypeJSON, Nullable: true, SchemaType: map[string]string{"postgres": "jsonb"}},
  1649. {Name: "psk_modes", Type: field.TypeJSON, Nullable: true, SchemaType: map[string]string{"postgres": "jsonb"}},
  1650. {Name: "extensions", Type: field.TypeJSON, Nullable: true, SchemaType: map[string]string{"postgres": "jsonb"}},
  1651. }
  1652. // TLSFingerprintProfilesTable holds the schema information for the "tls_fingerprint_profiles" table.
  1653. TLSFingerprintProfilesTable = &schema.Table{
  1654. Name: "tls_fingerprint_profiles",
  1655. Columns: TLSFingerprintProfilesColumns,
  1656. PrimaryKey: []*schema.Column{TLSFingerprintProfilesColumns[0]},
  1657. }
  1658. // UsageCleanupTasksColumns holds the columns for the "usage_cleanup_tasks" table.
  1659. UsageCleanupTasksColumns = []*schema.Column{
  1660. {Name: "id", Type: field.TypeInt64, Increment: true},
  1661. {Name: "created_at", Type: field.TypeTime, SchemaType: map[string]string{"postgres": "timestamptz"}},
  1662. {Name: "updated_at", Type: field.TypeTime, SchemaType: map[string]string{"postgres": "timestamptz"}},
  1663. {Name: "status", Type: field.TypeString, Size: 20},
  1664. {Name: "filters", Type: field.TypeJSON},
  1665. {Name: "created_by", Type: field.TypeInt64},
  1666. {Name: "deleted_rows", Type: field.TypeInt64, Default: 0},
  1667. {Name: "error_message", Type: field.TypeString, Nullable: true},
  1668. {Name: "canceled_by", Type: field.TypeInt64, Nullable: true},
  1669. {Name: "canceled_at", Type: field.TypeTime, Nullable: true},
  1670. {Name: "started_at", Type: field.TypeTime, Nullable: true},
  1671. {Name: "finished_at", Type: field.TypeTime, Nullable: true},
  1672. }
  1673. // UsageCleanupTasksTable holds the schema information for the "usage_cleanup_tasks" table.
  1674. UsageCleanupTasksTable = &schema.Table{
  1675. Name: "usage_cleanup_tasks",
  1676. Columns: UsageCleanupTasksColumns,
  1677. PrimaryKey: []*schema.Column{UsageCleanupTasksColumns[0]},
  1678. Indexes: []*schema.Index{
  1679. {
  1680. Name: "usagecleanuptask_status_created_at",
  1681. Unique: false,
  1682. Columns: []*schema.Column{UsageCleanupTasksColumns[3], UsageCleanupTasksColumns[1]},
  1683. },
  1684. {
  1685. Name: "usagecleanuptask_created_at",
  1686. Unique: false,
  1687. Columns: []*schema.Column{UsageCleanupTasksColumns[1]},
  1688. },
  1689. {
  1690. Name: "usagecleanuptask_canceled_at",
  1691. Unique: false,
  1692. Columns: []*schema.Column{UsageCleanupTasksColumns[9]},
  1693. },
  1694. },
  1695. }
  1696. // UsageLogsColumns holds the columns for the "usage_logs" table.
  1697. UsageLogsColumns = []*schema.Column{
  1698. {Name: "id", Type: field.TypeInt64, Increment: true},
  1699. {Name: "request_id", Type: field.TypeString, Size: 64},
  1700. {Name: "model", Type: field.TypeString, Size: 100},
  1701. {Name: "requested_model", Type: field.TypeString, Nullable: true, Size: 100},
  1702. {Name: "upstream_model", Type: field.TypeString, Nullable: true, Size: 100},
  1703. {Name: "upstream_response_model", Type: field.TypeString, Nullable: true, Size: 200},
  1704. {Name: "upstream_model_mismatch", Type: field.TypeBool, Nullable: true},
  1705. {Name: "channel_id", Type: field.TypeInt64, Nullable: true},
  1706. {Name: "model_mapping_chain", Type: field.TypeString, Nullable: true, Size: 500},
  1707. {Name: "billing_tier", Type: field.TypeString, Nullable: true, Size: 50},
  1708. {Name: "billing_mode", Type: field.TypeString, Nullable: true, Size: 20},
  1709. {Name: "input_tokens", Type: field.TypeInt, Default: 0},
  1710. {Name: "output_tokens", Type: field.TypeInt, Default: 0},
  1711. {Name: "cache_creation_tokens", Type: field.TypeInt, Default: 0},
  1712. {Name: "cache_read_tokens", Type: field.TypeInt, Default: 0},
  1713. {Name: "cache_creation_5m_tokens", Type: field.TypeInt, Default: 0},
  1714. {Name: "cache_creation_1h_tokens", Type: field.TypeInt, Default: 0},
  1715. {Name: "input_cost", Type: field.TypeFloat64, Default: 0, SchemaType: map[string]string{"postgres": "decimal(20,10)"}},
  1716. {Name: "output_cost", Type: field.TypeFloat64, Default: 0, SchemaType: map[string]string{"postgres": "decimal(20,10)"}},
  1717. {Name: "cache_creation_cost", Type: field.TypeFloat64, Default: 0, SchemaType: map[string]string{"postgres": "decimal(20,10)"}},
  1718. {Name: "cache_read_cost", Type: field.TypeFloat64, Default: 0, SchemaType: map[string]string{"postgres": "decimal(20,10)"}},
  1719. {Name: "total_cost", Type: field.TypeFloat64, Default: 0, SchemaType: map[string]string{"postgres": "decimal(20,10)"}},
  1720. {Name: "actual_cost", Type: field.TypeFloat64, Default: 0, SchemaType: map[string]string{"postgres": "decimal(20,10)"}},
  1721. {Name: "rate_multiplier", Type: field.TypeFloat64, Default: 1, SchemaType: map[string]string{"postgres": "decimal(10,4)"}},
  1722. {Name: "long_context_billing_applied", Type: field.TypeBool, Default: false},
  1723. {Name: "account_rate_multiplier", Type: field.TypeFloat64, Nullable: true, SchemaType: map[string]string{"postgres": "decimal(10,4)"}},
  1724. {Name: "billing_type", Type: field.TypeInt8, Default: 0},
  1725. {Name: "stream", Type: field.TypeBool, Default: false},
  1726. {Name: "duration_ms", Type: field.TypeInt, Nullable: true},
  1727. {Name: "first_token_ms", Type: field.TypeInt, Nullable: true},
  1728. {Name: "user_agent", Type: field.TypeString, Nullable: true, Size: 512},
  1729. {Name: "ip_address", Type: field.TypeString, Nullable: true, Size: 45},
  1730. {Name: "image_count", Type: field.TypeInt, Default: 0},
  1731. {Name: "image_size", Type: field.TypeString, Nullable: true, Size: 10},
  1732. {Name: "image_input_size", Type: field.TypeString, Nullable: true, Size: 32},
  1733. {Name: "image_output_size", Type: field.TypeString, Nullable: true, Size: 32},
  1734. {Name: "image_size_source", Type: field.TypeString, Nullable: true, Size: 16},
  1735. {Name: "image_size_breakdown", Type: field.TypeJSON, Nullable: true, SchemaType: map[string]string{"postgres": "jsonb"}},
  1736. {Name: "video_count", Type: field.TypeInt, Default: 0},
  1737. {Name: "video_resolution", Type: field.TypeString, Nullable: true, Size: 10},
  1738. {Name: "video_duration_seconds", Type: field.TypeInt, Nullable: true},
  1739. {Name: "cache_ttl_overridden", Type: field.TypeBool, Default: false},
  1740. {Name: "created_at", Type: field.TypeTime, SchemaType: map[string]string{"postgres": "timestamptz"}},
  1741. {Name: "api_key_id", Type: field.TypeInt64},
  1742. {Name: "account_id", Type: field.TypeInt64},
  1743. {Name: "group_id", Type: field.TypeInt64, Nullable: true},
  1744. {Name: "user_id", Type: field.TypeInt64},
  1745. {Name: "subscription_id", Type: field.TypeInt64, Nullable: true},
  1746. }
  1747. // UsageLogsTable holds the schema information for the "usage_logs" table.
  1748. UsageLogsTable = &schema.Table{
  1749. Name: "usage_logs",
  1750. Columns: UsageLogsColumns,
  1751. PrimaryKey: []*schema.Column{UsageLogsColumns[0]},
  1752. ForeignKeys: []*schema.ForeignKey{
  1753. {
  1754. Symbol: "usage_logs_api_keys_usage_logs",
  1755. Columns: []*schema.Column{UsageLogsColumns[43]},
  1756. RefColumns: []*schema.Column{APIKeysColumns[0]},
  1757. OnDelete: schema.NoAction,
  1758. },
  1759. {
  1760. Symbol: "usage_logs_accounts_usage_logs",
  1761. Columns: []*schema.Column{UsageLogsColumns[44]},
  1762. RefColumns: []*schema.Column{AccountsColumns[0]},
  1763. OnDelete: schema.NoAction,
  1764. },
  1765. {
  1766. Symbol: "usage_logs_groups_usage_logs",
  1767. Columns: []*schema.Column{UsageLogsColumns[45]},
  1768. RefColumns: []*schema.Column{GroupsColumns[0]},
  1769. OnDelete: schema.SetNull,
  1770. },
  1771. {
  1772. Symbol: "usage_logs_users_usage_logs",
  1773. Columns: []*schema.Column{UsageLogsColumns[46]},
  1774. RefColumns: []*schema.Column{UsersColumns[0]},
  1775. OnDelete: schema.NoAction,
  1776. },
  1777. {
  1778. Symbol: "usage_logs_user_subscriptions_usage_logs",
  1779. Columns: []*schema.Column{UsageLogsColumns[47]},
  1780. RefColumns: []*schema.Column{UserSubscriptionsColumns[0]},
  1781. OnDelete: schema.SetNull,
  1782. },
  1783. },
  1784. Indexes: []*schema.Index{
  1785. {
  1786. Name: "usagelog_user_id",
  1787. Unique: false,
  1788. Columns: []*schema.Column{UsageLogsColumns[46]},
  1789. },
  1790. {
  1791. Name: "usagelog_api_key_id",
  1792. Unique: false,
  1793. Columns: []*schema.Column{UsageLogsColumns[43]},
  1794. },
  1795. {
  1796. Name: "usagelog_account_id",
  1797. Unique: false,
  1798. Columns: []*schema.Column{UsageLogsColumns[44]},
  1799. },
  1800. {
  1801. Name: "usagelog_group_id",
  1802. Unique: false,
  1803. Columns: []*schema.Column{UsageLogsColumns[45]},
  1804. },
  1805. {
  1806. Name: "usagelog_subscription_id",
  1807. Unique: false,
  1808. Columns: []*schema.Column{UsageLogsColumns[47]},
  1809. },
  1810. {
  1811. Name: "usagelog_created_at",
  1812. Unique: false,
  1813. Columns: []*schema.Column{UsageLogsColumns[42]},
  1814. },
  1815. {
  1816. Name: "usagelog_model",
  1817. Unique: false,
  1818. Columns: []*schema.Column{UsageLogsColumns[2]},
  1819. },
  1820. {
  1821. Name: "usagelog_requested_model",
  1822. Unique: false,
  1823. Columns: []*schema.Column{UsageLogsColumns[3]},
  1824. },
  1825. {
  1826. Name: "usagelog_request_id",
  1827. Unique: false,
  1828. Columns: []*schema.Column{UsageLogsColumns[1]},
  1829. },
  1830. {
  1831. Name: "usagelog_user_id_created_at",
  1832. Unique: false,
  1833. Columns: []*schema.Column{UsageLogsColumns[46], UsageLogsColumns[42]},
  1834. },
  1835. {
  1836. Name: "usagelog_api_key_id_created_at",
  1837. Unique: false,
  1838. Columns: []*schema.Column{UsageLogsColumns[43], UsageLogsColumns[42]},
  1839. },
  1840. {
  1841. Name: "usagelog_group_id_created_at",
  1842. Unique: false,
  1843. Columns: []*schema.Column{UsageLogsColumns[45], UsageLogsColumns[42]},
  1844. },
  1845. },
  1846. }
  1847. // UsersColumns holds the columns for the "users" table.
  1848. UsersColumns = []*schema.Column{
  1849. {Name: "id", Type: field.TypeInt64, Increment: true},
  1850. {Name: "created_at", Type: field.TypeTime, SchemaType: map[string]string{"postgres": "timestamptz"}},
  1851. {Name: "updated_at", Type: field.TypeTime, SchemaType: map[string]string{"postgres": "timestamptz"}},
  1852. {Name: "deleted_at", Type: field.TypeTime, Nullable: true, SchemaType: map[string]string{"postgres": "timestamptz"}},
  1853. {Name: "email", Type: field.TypeString, Size: 255},
  1854. {Name: "password_hash", Type: field.TypeString, Size: 255},
  1855. {Name: "role", Type: field.TypeString, Size: 20, Default: "user"},
  1856. {Name: "balance", Type: field.TypeFloat64, Default: 0, SchemaType: map[string]string{"postgres": "decimal(20,8)"}},
  1857. {Name: "frozen_balance", Type: field.TypeFloat64, Default: 0, SchemaType: map[string]string{"postgres": "decimal(20,8)"}},
  1858. {Name: "concurrency", Type: field.TypeInt, Default: 5},
  1859. {Name: "status", Type: field.TypeString, Size: 20, Default: "active"},
  1860. {Name: "username", Type: field.TypeString, Size: 100, Default: ""},
  1861. {Name: "notes", Type: field.TypeString, Default: "", SchemaType: map[string]string{"postgres": "text"}},
  1862. {Name: "totp_secret_encrypted", Type: field.TypeString, Nullable: true, SchemaType: map[string]string{"postgres": "text"}},
  1863. {Name: "totp_enabled", Type: field.TypeBool, Default: false},
  1864. {Name: "totp_enabled_at", Type: field.TypeTime, Nullable: true},
  1865. {Name: "signup_source", Type: field.TypeString, Default: "email"},
  1866. {Name: "last_login_at", Type: field.TypeTime, Nullable: true, SchemaType: map[string]string{"postgres": "timestamptz"}},
  1867. {Name: "last_active_at", Type: field.TypeTime, Nullable: true, SchemaType: map[string]string{"postgres": "timestamptz"}},
  1868. {Name: "restrict_public_groups", Type: field.TypeBool, Default: false},
  1869. {Name: "balance_notify_enabled", Type: field.TypeBool, Default: true},
  1870. {Name: "balance_notify_threshold_type", Type: field.TypeString, Default: "fixed"},
  1871. {Name: "balance_notify_threshold", Type: field.TypeFloat64, Nullable: true, SchemaType: map[string]string{"postgres": "decimal(20,8)"}},
  1872. {Name: "balance_notify_extra_emails", Type: field.TypeString, Default: "[]", SchemaType: map[string]string{"postgres": "text"}},
  1873. {Name: "total_recharged", Type: field.TypeFloat64, Default: 0, SchemaType: map[string]string{"postgres": "decimal(20,8)"}},
  1874. {Name: "rpm_limit", Type: field.TypeInt, Default: 0},
  1875. }
  1876. // UsersTable holds the schema information for the "users" table.
  1877. UsersTable = &schema.Table{
  1878. Name: "users",
  1879. Columns: UsersColumns,
  1880. PrimaryKey: []*schema.Column{UsersColumns[0]},
  1881. Indexes: []*schema.Index{
  1882. {
  1883. Name: "user_status",
  1884. Unique: false,
  1885. Columns: []*schema.Column{UsersColumns[10]},
  1886. },
  1887. {
  1888. Name: "user_deleted_at",
  1889. Unique: false,
  1890. Columns: []*schema.Column{UsersColumns[3]},
  1891. },
  1892. },
  1893. }
  1894. // UserAllowedGroupsColumns holds the columns for the "user_allowed_groups" table.
  1895. UserAllowedGroupsColumns = []*schema.Column{
  1896. {Name: "created_at", Type: field.TypeTime, SchemaType: map[string]string{"postgres": "timestamptz"}},
  1897. {Name: "user_id", Type: field.TypeInt64},
  1898. {Name: "group_id", Type: field.TypeInt64},
  1899. }
  1900. // UserAllowedGroupsTable holds the schema information for the "user_allowed_groups" table.
  1901. UserAllowedGroupsTable = &schema.Table{
  1902. Name: "user_allowed_groups",
  1903. Columns: UserAllowedGroupsColumns,
  1904. PrimaryKey: []*schema.Column{UserAllowedGroupsColumns[1], UserAllowedGroupsColumns[2]},
  1905. ForeignKeys: []*schema.ForeignKey{
  1906. {
  1907. Symbol: "user_allowed_groups_users_user",
  1908. Columns: []*schema.Column{UserAllowedGroupsColumns[1]},
  1909. RefColumns: []*schema.Column{UsersColumns[0]},
  1910. OnDelete: schema.NoAction,
  1911. },
  1912. {
  1913. Symbol: "user_allowed_groups_groups_group",
  1914. Columns: []*schema.Column{UserAllowedGroupsColumns[2]},
  1915. RefColumns: []*schema.Column{GroupsColumns[0]},
  1916. OnDelete: schema.NoAction,
  1917. },
  1918. },
  1919. Indexes: []*schema.Index{
  1920. {
  1921. Name: "userallowedgroup_group_id",
  1922. Unique: false,
  1923. Columns: []*schema.Column{UserAllowedGroupsColumns[2]},
  1924. },
  1925. },
  1926. }
  1927. // UserAttributeDefinitionsColumns holds the columns for the "user_attribute_definitions" table.
  1928. UserAttributeDefinitionsColumns = []*schema.Column{
  1929. {Name: "id", Type: field.TypeInt64, Increment: true},
  1930. {Name: "created_at", Type: field.TypeTime, SchemaType: map[string]string{"postgres": "timestamptz"}},
  1931. {Name: "updated_at", Type: field.TypeTime, SchemaType: map[string]string{"postgres": "timestamptz"}},
  1932. {Name: "deleted_at", Type: field.TypeTime, Nullable: true, SchemaType: map[string]string{"postgres": "timestamptz"}},
  1933. {Name: "key", Type: field.TypeString, Size: 100},
  1934. {Name: "name", Type: field.TypeString, Size: 255},
  1935. {Name: "description", Type: field.TypeString, Default: "", SchemaType: map[string]string{"postgres": "text"}},
  1936. {Name: "type", Type: field.TypeString, Size: 20},
  1937. {Name: "options", Type: field.TypeJSON, SchemaType: map[string]string{"postgres": "jsonb"}},
  1938. {Name: "required", Type: field.TypeBool, Default: false},
  1939. {Name: "validation", Type: field.TypeJSON, SchemaType: map[string]string{"postgres": "jsonb"}},
  1940. {Name: "placeholder", Type: field.TypeString, Size: 255, Default: ""},
  1941. {Name: "display_order", Type: field.TypeInt, Default: 0},
  1942. {Name: "enabled", Type: field.TypeBool, Default: true},
  1943. }
  1944. // UserAttributeDefinitionsTable holds the schema information for the "user_attribute_definitions" table.
  1945. UserAttributeDefinitionsTable = &schema.Table{
  1946. Name: "user_attribute_definitions",
  1947. Columns: UserAttributeDefinitionsColumns,
  1948. PrimaryKey: []*schema.Column{UserAttributeDefinitionsColumns[0]},
  1949. Indexes: []*schema.Index{
  1950. {
  1951. Name: "userattributedefinition_key",
  1952. Unique: false,
  1953. Columns: []*schema.Column{UserAttributeDefinitionsColumns[4]},
  1954. },
  1955. {
  1956. Name: "userattributedefinition_enabled",
  1957. Unique: false,
  1958. Columns: []*schema.Column{UserAttributeDefinitionsColumns[13]},
  1959. },
  1960. {
  1961. Name: "userattributedefinition_display_order",
  1962. Unique: false,
  1963. Columns: []*schema.Column{UserAttributeDefinitionsColumns[12]},
  1964. },
  1965. {
  1966. Name: "userattributedefinition_deleted_at",
  1967. Unique: false,
  1968. Columns: []*schema.Column{UserAttributeDefinitionsColumns[3]},
  1969. },
  1970. },
  1971. }
  1972. // UserAttributeValuesColumns holds the columns for the "user_attribute_values" table.
  1973. UserAttributeValuesColumns = []*schema.Column{
  1974. {Name: "id", Type: field.TypeInt64, Increment: true},
  1975. {Name: "created_at", Type: field.TypeTime, SchemaType: map[string]string{"postgres": "timestamptz"}},
  1976. {Name: "updated_at", Type: field.TypeTime, SchemaType: map[string]string{"postgres": "timestamptz"}},
  1977. {Name: "value", Type: field.TypeString, Size: 2147483647, Default: ""},
  1978. {Name: "user_id", Type: field.TypeInt64},
  1979. {Name: "attribute_id", Type: field.TypeInt64},
  1980. }
  1981. // UserAttributeValuesTable holds the schema information for the "user_attribute_values" table.
  1982. UserAttributeValuesTable = &schema.Table{
  1983. Name: "user_attribute_values",
  1984. Columns: UserAttributeValuesColumns,
  1985. PrimaryKey: []*schema.Column{UserAttributeValuesColumns[0]},
  1986. ForeignKeys: []*schema.ForeignKey{
  1987. {
  1988. Symbol: "user_attribute_values_users_attribute_values",
  1989. Columns: []*schema.Column{UserAttributeValuesColumns[4]},
  1990. RefColumns: []*schema.Column{UsersColumns[0]},
  1991. OnDelete: schema.NoAction,
  1992. },
  1993. {
  1994. Symbol: "user_attribute_values_user_attribute_definitions_values",
  1995. Columns: []*schema.Column{UserAttributeValuesColumns[5]},
  1996. RefColumns: []*schema.Column{UserAttributeDefinitionsColumns[0]},
  1997. OnDelete: schema.NoAction,
  1998. },
  1999. },
  2000. Indexes: []*schema.Index{
  2001. {
  2002. Name: "userattributevalue_user_id_attribute_id",
  2003. Unique: true,
  2004. Columns: []*schema.Column{UserAttributeValuesColumns[4], UserAttributeValuesColumns[5]},
  2005. },
  2006. {
  2007. Name: "userattributevalue_attribute_id",
  2008. Unique: false,
  2009. Columns: []*schema.Column{UserAttributeValuesColumns[5]},
  2010. },
  2011. },
  2012. }
  2013. // UserPlatformQuotasColumns holds the columns for the "user_platform_quotas" table.
  2014. UserPlatformQuotasColumns = []*schema.Column{
  2015. {Name: "id", Type: field.TypeInt64, Increment: true},
  2016. {Name: "created_at", Type: field.TypeTime, SchemaType: map[string]string{"postgres": "timestamptz"}},
  2017. {Name: "updated_at", Type: field.TypeTime, SchemaType: map[string]string{"postgres": "timestamptz"}},
  2018. {Name: "deleted_at", Type: field.TypeTime, Nullable: true, SchemaType: map[string]string{"postgres": "timestamptz"}},
  2019. {Name: "platform", Type: field.TypeString, Size: 32},
  2020. {Name: "daily_limit_usd", Type: field.TypeFloat64, Nullable: true, SchemaType: map[string]string{"postgres": "decimal(20,10)"}},
  2021. {Name: "weekly_limit_usd", Type: field.TypeFloat64, Nullable: true, SchemaType: map[string]string{"postgres": "decimal(20,10)"}},
  2022. {Name: "monthly_limit_usd", Type: field.TypeFloat64, Nullable: true, SchemaType: map[string]string{"postgres": "decimal(20,10)"}},
  2023. {Name: "daily_usage_usd", Type: field.TypeFloat64, Default: 0, SchemaType: map[string]string{"postgres": "decimal(20,10)"}},
  2024. {Name: "weekly_usage_usd", Type: field.TypeFloat64, Default: 0, SchemaType: map[string]string{"postgres": "decimal(20,10)"}},
  2025. {Name: "monthly_usage_usd", Type: field.TypeFloat64, Default: 0, SchemaType: map[string]string{"postgres": "decimal(20,10)"}},
  2026. {Name: "daily_window_start", Type: field.TypeTime, Nullable: true, SchemaType: map[string]string{"postgres": "timestamptz"}},
  2027. {Name: "weekly_window_start", Type: field.TypeTime, Nullable: true, SchemaType: map[string]string{"postgres": "timestamptz"}},
  2028. {Name: "monthly_window_start", Type: field.TypeTime, Nullable: true, SchemaType: map[string]string{"postgres": "timestamptz"}},
  2029. {Name: "user_id", Type: field.TypeInt64},
  2030. }
  2031. // UserPlatformQuotasTable holds the schema information for the "user_platform_quotas" table.
  2032. UserPlatformQuotasTable = &schema.Table{
  2033. Name: "user_platform_quotas",
  2034. Columns: UserPlatformQuotasColumns,
  2035. PrimaryKey: []*schema.Column{UserPlatformQuotasColumns[0]},
  2036. ForeignKeys: []*schema.ForeignKey{
  2037. {
  2038. Symbol: "user_platform_quotas_users_platform_quotas",
  2039. Columns: []*schema.Column{UserPlatformQuotasColumns[14]},
  2040. RefColumns: []*schema.Column{UsersColumns[0]},
  2041. OnDelete: schema.NoAction,
  2042. },
  2043. },
  2044. Indexes: []*schema.Index{
  2045. {
  2046. Name: "userplatformquota_user_id_platform",
  2047. Unique: true,
  2048. Columns: []*schema.Column{UserPlatformQuotasColumns[14], UserPlatformQuotasColumns[4]},
  2049. Annotation: &entsql.IndexAnnotation{
  2050. Where: "deleted_at IS NULL",
  2051. },
  2052. },
  2053. {
  2054. Name: "userplatformquota_user_id",
  2055. Unique: false,
  2056. Columns: []*schema.Column{UserPlatformQuotasColumns[14]},
  2057. },
  2058. },
  2059. }
  2060. // UserSubscriptionsColumns holds the columns for the "user_subscriptions" table.
  2061. UserSubscriptionsColumns = []*schema.Column{
  2062. {Name: "id", Type: field.TypeInt64, Increment: true},
  2063. {Name: "created_at", Type: field.TypeTime, SchemaType: map[string]string{"postgres": "timestamptz"}},
  2064. {Name: "updated_at", Type: field.TypeTime, SchemaType: map[string]string{"postgres": "timestamptz"}},
  2065. {Name: "deleted_at", Type: field.TypeTime, Nullable: true, SchemaType: map[string]string{"postgres": "timestamptz"}},
  2066. {Name: "starts_at", Type: field.TypeTime, SchemaType: map[string]string{"postgres": "timestamptz"}},
  2067. {Name: "expires_at", Type: field.TypeTime, SchemaType: map[string]string{"postgres": "timestamptz"}},
  2068. {Name: "status", Type: field.TypeString, Size: 20, Default: "active"},
  2069. {Name: "daily_window_start", Type: field.TypeTime, Nullable: true, SchemaType: map[string]string{"postgres": "timestamptz"}},
  2070. {Name: "weekly_window_start", Type: field.TypeTime, Nullable: true, SchemaType: map[string]string{"postgres": "timestamptz"}},
  2071. {Name: "monthly_window_start", Type: field.TypeTime, Nullable: true, SchemaType: map[string]string{"postgres": "timestamptz"}},
  2072. {Name: "daily_usage_usd", Type: field.TypeFloat64, Default: 0, SchemaType: map[string]string{"postgres": "decimal(20,10)"}},
  2073. {Name: "weekly_usage_usd", Type: field.TypeFloat64, Default: 0, SchemaType: map[string]string{"postgres": "decimal(20,10)"}},
  2074. {Name: "monthly_usage_usd", Type: field.TypeFloat64, Default: 0, SchemaType: map[string]string{"postgres": "decimal(20,10)"}},
  2075. {Name: "assigned_at", Type: field.TypeTime, SchemaType: map[string]string{"postgres": "timestamptz"}},
  2076. {Name: "notes", Type: field.TypeString, Nullable: true, SchemaType: map[string]string{"postgres": "text"}},
  2077. {Name: "group_id", Type: field.TypeInt64},
  2078. {Name: "user_id", Type: field.TypeInt64},
  2079. {Name: "assigned_by", Type: field.TypeInt64, Nullable: true},
  2080. }
  2081. // UserSubscriptionsTable holds the schema information for the "user_subscriptions" table.
  2082. UserSubscriptionsTable = &schema.Table{
  2083. Name: "user_subscriptions",
  2084. Columns: UserSubscriptionsColumns,
  2085. PrimaryKey: []*schema.Column{UserSubscriptionsColumns[0]},
  2086. ForeignKeys: []*schema.ForeignKey{
  2087. {
  2088. Symbol: "user_subscriptions_groups_subscriptions",
  2089. Columns: []*schema.Column{UserSubscriptionsColumns[15]},
  2090. RefColumns: []*schema.Column{GroupsColumns[0]},
  2091. OnDelete: schema.NoAction,
  2092. },
  2093. {
  2094. Symbol: "user_subscriptions_users_subscriptions",
  2095. Columns: []*schema.Column{UserSubscriptionsColumns[16]},
  2096. RefColumns: []*schema.Column{UsersColumns[0]},
  2097. OnDelete: schema.NoAction,
  2098. },
  2099. {
  2100. Symbol: "user_subscriptions_users_assigned_subscriptions",
  2101. Columns: []*schema.Column{UserSubscriptionsColumns[17]},
  2102. RefColumns: []*schema.Column{UsersColumns[0]},
  2103. OnDelete: schema.SetNull,
  2104. },
  2105. },
  2106. Indexes: []*schema.Index{
  2107. {
  2108. Name: "usersubscription_user_id",
  2109. Unique: false,
  2110. Columns: []*schema.Column{UserSubscriptionsColumns[16]},
  2111. },
  2112. {
  2113. Name: "usersubscription_group_id",
  2114. Unique: false,
  2115. Columns: []*schema.Column{UserSubscriptionsColumns[15]},
  2116. },
  2117. {
  2118. Name: "usersubscription_status",
  2119. Unique: false,
  2120. Columns: []*schema.Column{UserSubscriptionsColumns[6]},
  2121. },
  2122. {
  2123. Name: "usersubscription_expires_at",
  2124. Unique: false,
  2125. Columns: []*schema.Column{UserSubscriptionsColumns[5]},
  2126. },
  2127. {
  2128. Name: "usersubscription_user_id_status_expires_at",
  2129. Unique: false,
  2130. Columns: []*schema.Column{UserSubscriptionsColumns[16], UserSubscriptionsColumns[6], UserSubscriptionsColumns[5]},
  2131. },
  2132. {
  2133. Name: "usersubscription_assigned_by",
  2134. Unique: false,
  2135. Columns: []*schema.Column{UserSubscriptionsColumns[17]},
  2136. },
  2137. {
  2138. Name: "usersubscription_user_id_group_id",
  2139. Unique: false,
  2140. Columns: []*schema.Column{UserSubscriptionsColumns[16], UserSubscriptionsColumns[15]},
  2141. },
  2142. {
  2143. Name: "usersubscription_deleted_at",
  2144. Unique: false,
  2145. Columns: []*schema.Column{UserSubscriptionsColumns[3]},
  2146. },
  2147. },
  2148. }
  2149. // Tables holds all the tables in the schema.
  2150. Tables = []*schema.Table{
  2151. APIKeysTable,
  2152. AccountsTable,
  2153. AccountGroupsTable,
  2154. AnnouncementsTable,
  2155. AnnouncementReadsTable,
  2156. AuthIdentitiesTable,
  2157. AuthIdentityChannelsTable,
  2158. BatchImageEventsTable,
  2159. BatchImageItemsTable,
  2160. BatchImageJobsTable,
  2161. ChannelMonitorsTable,
  2162. ChannelMonitorDailyRollupsTable,
  2163. ChannelMonitorHistoriesTable,
  2164. ChannelMonitorRequestTemplatesTable,
  2165. CompositeModelRoutesTable,
  2166. ErrorPassthroughRulesTable,
  2167. GroupsTable,
  2168. IdempotencyRecordsTable,
  2169. IdentityAdoptionDecisionsTable,
  2170. PaymentAuditLogsTable,
  2171. PaymentOrdersTable,
  2172. PaymentProviderInstancesTable,
  2173. PendingAuthSessionsTable,
  2174. PromoCodesTable,
  2175. PromoCodeUsagesTable,
  2176. ProxiesTable,
  2177. RedeemCodesTable,
  2178. SecurityPolicyKeywordsTable,
  2179. SecuritySecretsTable,
  2180. SettingsTable,
  2181. SubscriptionPlansTable,
  2182. TLSFingerprintProfilesTable,
  2183. UsageCleanupTasksTable,
  2184. UsageLogsTable,
  2185. UsersTable,
  2186. UserAllowedGroupsTable,
  2187. UserAttributeDefinitionsTable,
  2188. UserAttributeValuesTable,
  2189. UserPlatformQuotasTable,
  2190. UserSubscriptionsTable,
  2191. }
  2192. )
  2193. func init() {
  2194. APIKeysTable.ForeignKeys[0].RefTable = GroupsTable
  2195. APIKeysTable.ForeignKeys[1].RefTable = UsersTable
  2196. APIKeysTable.Annotation = &entsql.Annotation{
  2197. Table: "api_keys",
  2198. }
  2199. AccountsTable.ForeignKeys[0].RefTable = ProxiesTable
  2200. AccountsTable.ForeignKeys[1].RefTable = AccountsTable
  2201. AccountsTable.Annotation = &entsql.Annotation{
  2202. Table: "accounts",
  2203. }
  2204. AccountGroupsTable.ForeignKeys[0].RefTable = AccountsTable
  2205. AccountGroupsTable.ForeignKeys[1].RefTable = GroupsTable
  2206. AccountGroupsTable.Annotation = &entsql.Annotation{
  2207. Table: "account_groups",
  2208. }
  2209. AnnouncementsTable.Annotation = &entsql.Annotation{
  2210. Table: "announcements",
  2211. }
  2212. AnnouncementReadsTable.ForeignKeys[0].RefTable = AnnouncementsTable
  2213. AnnouncementReadsTable.ForeignKeys[1].RefTable = UsersTable
  2214. AnnouncementReadsTable.Annotation = &entsql.Annotation{
  2215. Table: "announcement_reads",
  2216. }
  2217. AuthIdentitiesTable.ForeignKeys[0].RefTable = UsersTable
  2218. AuthIdentitiesTable.Annotation = &entsql.Annotation{
  2219. Table: "auth_identities",
  2220. }
  2221. AuthIdentityChannelsTable.ForeignKeys[0].RefTable = AuthIdentitiesTable
  2222. AuthIdentityChannelsTable.Annotation = &entsql.Annotation{
  2223. Table: "auth_identity_channels",
  2224. }
  2225. BatchImageEventsTable.Annotation = &entsql.Annotation{
  2226. Table: "batch_image_events",
  2227. }
  2228. BatchImageItemsTable.Annotation = &entsql.Annotation{
  2229. Table: "batch_image_items",
  2230. }
  2231. BatchImageJobsTable.Annotation = &entsql.Annotation{
  2232. Table: "batch_image_jobs",
  2233. }
  2234. ChannelMonitorsTable.ForeignKeys[0].RefTable = ChannelMonitorRequestTemplatesTable
  2235. ChannelMonitorsTable.Annotation = &entsql.Annotation{
  2236. Table: "channel_monitors",
  2237. }
  2238. ChannelMonitorDailyRollupsTable.ForeignKeys[0].RefTable = ChannelMonitorsTable
  2239. ChannelMonitorDailyRollupsTable.Annotation = &entsql.Annotation{
  2240. Table: "channel_monitor_daily_rollups",
  2241. }
  2242. ChannelMonitorHistoriesTable.ForeignKeys[0].RefTable = ChannelMonitorsTable
  2243. ChannelMonitorHistoriesTable.Annotation = &entsql.Annotation{
  2244. Table: "channel_monitor_histories",
  2245. }
  2246. ChannelMonitorRequestTemplatesTable.Annotation = &entsql.Annotation{
  2247. Table: "channel_monitor_request_templates",
  2248. }
  2249. CompositeModelRoutesTable.ForeignKeys[0].RefTable = GroupsTable
  2250. CompositeModelRoutesTable.Annotation = &entsql.Annotation{
  2251. Table: "composite_model_routes",
  2252. }
  2253. ErrorPassthroughRulesTable.Annotation = &entsql.Annotation{
  2254. Table: "error_passthrough_rules",
  2255. }
  2256. GroupsTable.Annotation = &entsql.Annotation{
  2257. Table: "groups",
  2258. }
  2259. IdempotencyRecordsTable.Annotation = &entsql.Annotation{
  2260. Table: "idempotency_records",
  2261. }
  2262. IdentityAdoptionDecisionsTable.ForeignKeys[0].RefTable = AuthIdentitiesTable
  2263. IdentityAdoptionDecisionsTable.ForeignKeys[1].RefTable = PendingAuthSessionsTable
  2264. IdentityAdoptionDecisionsTable.Annotation = &entsql.Annotation{
  2265. Table: "identity_adoption_decisions",
  2266. }
  2267. PaymentAuditLogsTable.Annotation = &entsql.Annotation{
  2268. Table: "payment_audit_logs",
  2269. }
  2270. PaymentOrdersTable.ForeignKeys[0].RefTable = UsersTable
  2271. PaymentOrdersTable.Annotation = &entsql.Annotation{
  2272. Table: "payment_orders",
  2273. }
  2274. PaymentProviderInstancesTable.Annotation = &entsql.Annotation{
  2275. Table: "payment_provider_instances",
  2276. }
  2277. PendingAuthSessionsTable.ForeignKeys[0].RefTable = UsersTable
  2278. PendingAuthSessionsTable.Annotation = &entsql.Annotation{
  2279. Table: "pending_auth_sessions",
  2280. }
  2281. PromoCodesTable.Annotation = &entsql.Annotation{
  2282. Table: "promo_codes",
  2283. }
  2284. PromoCodeUsagesTable.ForeignKeys[0].RefTable = PromoCodesTable
  2285. PromoCodeUsagesTable.ForeignKeys[1].RefTable = UsersTable
  2286. PromoCodeUsagesTable.Annotation = &entsql.Annotation{
  2287. Table: "promo_code_usages",
  2288. }
  2289. ProxiesTable.ForeignKeys[0].RefTable = ProxiesTable
  2290. ProxiesTable.Annotation = &entsql.Annotation{
  2291. Table: "proxies",
  2292. }
  2293. RedeemCodesTable.ForeignKeys[0].RefTable = GroupsTable
  2294. RedeemCodesTable.ForeignKeys[1].RefTable = UsersTable
  2295. RedeemCodesTable.Annotation = &entsql.Annotation{
  2296. Table: "redeem_codes",
  2297. }
  2298. SecurityPolicyKeywordsTable.ForeignKeys[0].RefTable = GroupsTable
  2299. SecurityPolicyKeywordsTable.Annotation = &entsql.Annotation{
  2300. Table: "security_policy_keywords",
  2301. }
  2302. SecuritySecretsTable.Annotation = &entsql.Annotation{
  2303. Table: "security_secrets",
  2304. }
  2305. SettingsTable.Annotation = &entsql.Annotation{
  2306. Table: "settings",
  2307. }
  2308. SubscriptionPlansTable.Annotation = &entsql.Annotation{
  2309. Table: "subscription_plans",
  2310. }
  2311. TLSFingerprintProfilesTable.Annotation = &entsql.Annotation{
  2312. Table: "tls_fingerprint_profiles",
  2313. }
  2314. UsageCleanupTasksTable.Annotation = &entsql.Annotation{
  2315. Table: "usage_cleanup_tasks",
  2316. }
  2317. UsageLogsTable.ForeignKeys[0].RefTable = APIKeysTable
  2318. UsageLogsTable.ForeignKeys[1].RefTable = AccountsTable
  2319. UsageLogsTable.ForeignKeys[2].RefTable = GroupsTable
  2320. UsageLogsTable.ForeignKeys[3].RefTable = UsersTable
  2321. UsageLogsTable.ForeignKeys[4].RefTable = UserSubscriptionsTable
  2322. UsageLogsTable.Annotation = &entsql.Annotation{
  2323. Table: "usage_logs",
  2324. }
  2325. UsersTable.Annotation = &entsql.Annotation{
  2326. Table: "users",
  2327. }
  2328. UserAllowedGroupsTable.ForeignKeys[0].RefTable = UsersTable
  2329. UserAllowedGroupsTable.ForeignKeys[1].RefTable = GroupsTable
  2330. UserAllowedGroupsTable.Annotation = &entsql.Annotation{
  2331. Table: "user_allowed_groups",
  2332. }
  2333. UserAttributeDefinitionsTable.Annotation = &entsql.Annotation{
  2334. Table: "user_attribute_definitions",
  2335. }
  2336. UserAttributeValuesTable.ForeignKeys[0].RefTable = UsersTable
  2337. UserAttributeValuesTable.ForeignKeys[1].RefTable = UserAttributeDefinitionsTable
  2338. UserAttributeValuesTable.Annotation = &entsql.Annotation{
  2339. Table: "user_attribute_values",
  2340. }
  2341. UserPlatformQuotasTable.ForeignKeys[0].RefTable = UsersTable
  2342. UserPlatformQuotasTable.Annotation = &entsql.Annotation{
  2343. Table: "user_platform_quotas",
  2344. }
  2345. UserSubscriptionsTable.ForeignKeys[0].RefTable = GroupsTable
  2346. UserSubscriptionsTable.ForeignKeys[1].RefTable = UsersTable
  2347. UserSubscriptionsTable.ForeignKeys[2].RefTable = UsersTable
  2348. UserSubscriptionsTable.Annotation = &entsql.Annotation{
  2349. Table: "user_subscriptions",
  2350. }
  2351. }