cdupland commited on
Commit
2f1dd95
·
1 Parent(s): d45ddf6

Add initial project setup with environment configuration, dependencies, and database schema

Browse files
.env.example ADDED
@@ -0,0 +1,16 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ APP_ENV=local
2
+ APP_DEBUG=true
3
+
4
+ # Supabase API
5
+ SUPABASE_URL=http://127.0.0.1:54321
6
+ SUPABASE_ANON_KEY=your_supabase_anon_key
7
+ SUPABASE_SERVICE_ROLE_KEY=your_supabase_service_role_key
8
+
9
+ # Prisma datasource URLs
10
+ # DATABASE_URL: used by the app at runtime (FastAPI/Prisma client queries).
11
+ # In Supabase cloud, this is typically the pooled connection (PgBouncer, often port 6543).
12
+ DATABASE_URL=postgresql://postgres:postgres@127.0.0.1:54322/postgres
13
+ #
14
+ # DIRECT_URL: used by Prisma for direct schema operations (introspection/migrations).
15
+ # In Supabase cloud, this should point to the direct Postgres connection (often port 5432).
16
+ DIRECT_URL=postgresql://postgres:postgres@127.0.0.1:54322/postgres
README.md CHANGED
@@ -1,2 +1,103 @@
1
  # afp_core
2
  Main application of AFP
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
  # afp_core
2
  Main application of AFP
3
+
4
+ ## Workflow Supabase + Prisma + dépendances (équipe)
5
+
6
+ Ce projet suit la convention suivante:
7
+
8
+ - **Source de vérité du schéma DB:** `supabase/migrations/*.sql`
9
+ - **Prisma:** introspection + client Python (`prisma db pull`, `prisma generate`)
10
+ - **FastAPI:** utilise le client Prisma généré
11
+
12
+ En pratique: on fait évoluer la base via **migrations Supabase**, puis on synchronise Prisma.
13
+
14
+ ## 1) Initialisation d'un nouveau poste
15
+
16
+ 1. Installer les dépendances Python:
17
+ - `pip install -r requirements.txt`
18
+ 2. Lancer Supabase local:
19
+ - `supabase start`
20
+ 3. Lier le repo au projet distant:
21
+ - `supabase login`
22
+ - `supabase link --project-ref <PROJECT_REF>`
23
+ 4. Synchroniser la base locale avec les migrations du repo:
24
+ - `supabase db reset`
25
+ 5. Synchroniser Prisma avec la DB locale:
26
+ - `prisma db pull`
27
+ - `prisma generate`
28
+
29
+ ## 2) Se mettre à jour (workflow quotidien)
30
+
31
+ Quand tu récupères des changements du repo:
32
+
33
+ 1. `git pull`
34
+ 2. `pip install -r requirements.lock.txt`
35
+ 3. `supabase db reset` (rejoue les migrations locales)
36
+ 4. `prisma db pull`
37
+ 5. `prisma generate`
38
+
39
+ Tu es alors aligné avec les migrations Supabase et le client Prisma.
40
+
41
+ ## 3) Faire évoluer le schéma (nouvelle migration)
42
+
43
+ ### Règles
44
+
45
+ - Ne pas modifier une migration déjà appliquée: créer une nouvelle migration.
46
+ - Éviter les changements de schéma faits uniquement dans le dashboard.
47
+ - Toujours versionner les SQL dans `supabase/migrations/`.
48
+
49
+ ### Étapes
50
+
51
+ 1. Faire tes changements de schéma en local (SQL Editor, scripts, etc.).
52
+ 2. Générer une migration depuis le diff local:
53
+ - `supabase db diff --linked -f <nom_migration>`
54
+ 3. Relire et nettoyer le SQL généré dans `supabase/migrations/`.
55
+ 4. Tester localement sur base propre:
56
+ - `supabase db reset`
57
+ 5. Synchroniser Prisma:
58
+ - `prisma db pull`
59
+ - `prisma generate`
60
+ 6. Vérifier les tests (au minimum les tests d'intégration Prisma).
61
+ 7. Commit des changements:
62
+ - migration SQL
63
+ - `prisma/schema.prisma`
64
+ - fichiers de tests impactés
65
+ 8. Après merge, appliquer les migrations vers le projet distant:
66
+ - `supabase db push`
67
+
68
+ ## 4) Gestion des dépendances Python (required)
69
+
70
+ Ce projet utilise deux fichiers:
71
+
72
+ - `requirements.txt`: dépendances directes maintenues à la main.
73
+ - `requirements.lock.txt`: snapshot exact (dépendances directes + transitives).
74
+
75
+ ### Workflow dépendances
76
+
77
+ 1. Installer en mode reproductible (recommandé):
78
+ - `pip install -r requirements.lock.txt`
79
+ 2. Installer/mettre à jour les dépendances directes (maintenance):
80
+ - `pip install -r requirements.txt`
81
+ 3. Si une dépendance change, régénérer le lock:
82
+ - `pip freeze > requirements.lock.txt`
83
+ 4. En CI/prod, installation stricte via lock:
84
+ - `pip install -r requirements.lock.txt`
85
+
86
+ ## 5) Commandes de référence
87
+
88
+ - Démarrer l'environnement local Supabase: `supabase start`
89
+ - Vérifier l'état local Supabase: `supabase status`
90
+ - Rejouer les migrations en local: `supabase db reset`
91
+ - Générer une migration depuis les changements locaux: `supabase db diff -f <nom_migration>`
92
+ - Appliquer les migrations vers le projet distant: `supabase db push`
93
+ - Lister l'état des migrations local/remote: `supabase migration list`
94
+ - Introspecter Prisma depuis la DB: `prisma db pull`
95
+ - Générer le client Prisma Python: `prisma generate`
96
+
97
+ ## 6) Dépannage courant
98
+
99
+ - Si `supabase db pull` échoue sur l'historique des migrations:
100
+ - vérifier d'abord `supabase migration list`
101
+ - aligner l'historique avant de continuer (`repair` uniquement après diagnostic)
102
+ - Si `prisma generate` échoue sur `Decimal`:
103
+ - vérifier dans `prisma/schema.prisma` que le generator Prisma Python active `enable_experimental_decimal = true`
prisma/schema.prisma ADDED
@@ -0,0 +1,381 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ generator client {
2
+ provider = "prisma-client-py"
3
+ interface = "asyncio"
4
+ enable_experimental_decimal = true
5
+ }
6
+
7
+ datasource db {
8
+ provider = "postgresql"
9
+ url = env("DATABASE_URL")
10
+ directUrl = env("DIRECT_URL")
11
+ }
12
+
13
+ /// This model contains row level security and requires additional setup for migrations. Visit https://pris.ly/d/row-level-security for more info.
14
+ model article_brand {
15
+ id String @id @default(dbgenerated("gen_random_uuid()")) @db.Uuid
16
+ article_id String? @db.Uuid
17
+ brand_id String? @db.Uuid
18
+ articles articles? @relation(fields: [article_id], references: [id], onDelete: Cascade, onUpdate: NoAction)
19
+ brand brand? @relation(fields: [brand_id], references: [id], onDelete: Cascade, onUpdate: NoAction)
20
+ }
21
+
22
+ /// This model contains row level security and requires additional setup for migrations. Visit https://pris.ly/d/row-level-security for more info.
23
+ model article_references {
24
+ id String @id @default(dbgenerated("gen_random_uuid()")) @db.Uuid
25
+ article_id String? @db.Uuid
26
+ reference_number String @db.VarChar(255)
27
+ main Boolean? @default(false)
28
+ started_on DateTime? @db.Date
29
+ stopped_on DateTime? @db.Date
30
+ articles articles? @relation(fields: [article_id], references: [id], onDelete: Cascade, onUpdate: NoAction)
31
+ }
32
+
33
+ /// This model contains row level security and requires additional setup for migrations. Visit https://pris.ly/d/row-level-security for more info.
34
+ model articles {
35
+ id String @id @default(dbgenerated("gen_random_uuid()")) @db.Uuid
36
+ label_fr String? @db.VarChar(255)
37
+ label_en String? @db.VarChar(255)
38
+ category_id String? @db.Uuid
39
+ article_brand article_brand[]
40
+ article_references article_references[]
41
+ categories categories? @relation(fields: [category_id], references: [id], onDelete: NoAction, onUpdate: NoAction)
42
+ cotation_lines cotation_lines[]
43
+ logistic logistic[]
44
+ prices prices[]
45
+ }
46
+
47
+ /// This model contains row level security and requires additional setup for migrations. Visit https://pris.ly/d/row-level-security for more info.
48
+ model brand {
49
+ id String @id @default(dbgenerated("gen_random_uuid()")) @db.Uuid
50
+ name String @db.VarChar(255)
51
+ article_brand article_brand[]
52
+ }
53
+
54
+ /// This model contains row level security and requires additional setup for migrations. Visit https://pris.ly/d/row-level-security for more info.
55
+ model categories {
56
+ id String @id @default(dbgenerated("gen_random_uuid()")) @db.Uuid
57
+ name String @db.VarChar(255)
58
+ index_id String? @db.Uuid
59
+ level Int?
60
+ articles articles[]
61
+ categories categories? @relation("categoriesTocategories", fields: [index_id], references: [id], onDelete: NoAction, onUpdate: NoAction)
62
+ other_categories categories[] @relation("categoriesTocategories")
63
+ }
64
+
65
+ /// This model contains row level security and requires additional setup for migrations. Visit https://pris.ly/d/row-level-security for more info.
66
+ model cotation_lines {
67
+ id String @id @default(dbgenerated("gen_random_uuid()")) @db.Uuid
68
+ article_id String? @db.Uuid
69
+ cotation_id String? @db.Uuid
70
+ final_unit_price Decimal? @db.Decimal(15, 2)
71
+ discount Float? @db.Real
72
+ validated Boolean? @default(false)
73
+ table_details Json? @db.Json
74
+ saved_at DateTime? @db.Timestamp(6)
75
+ quantity Int?
76
+ final_supplier_id String? @db.Uuid
77
+ articles articles? @relation(fields: [article_id], references: [id], onDelete: NoAction, onUpdate: NoAction)
78
+ cotations cotations? @relation(fields: [cotation_id], references: [id], onDelete: Cascade, onUpdate: NoAction)
79
+ suppliers suppliers? @relation(fields: [final_supplier_id], references: [id], onDelete: NoAction, onUpdate: NoAction)
80
+ supplier_discount_lines supplier_discount_lines[]
81
+ }
82
+
83
+ /// This model contains row level security and requires additional setup for migrations. Visit https://pris.ly/d/row-level-security for more info.
84
+ model cotations {
85
+ id String @id @default(dbgenerated("gen_random_uuid()")) @db.Uuid
86
+ user_id String? @db.Uuid
87
+ client_id String? @db.VarChar(20)
88
+ created_at DateTime? @default(now()) @db.Timestamp(6)
89
+ updated_at DateTime? @default(now()) @db.Timestamp(6)
90
+ cotation_lines cotation_lines[]
91
+ customer customer? @relation(fields: [client_id], references: [Id], onDelete: NoAction, onUpdate: NoAction)
92
+ }
93
+
94
+ /// This model contains row level security and requires additional setup for migrations. Visit https://pris.ly/d/row-level-security for more info.
95
+ model customer {
96
+ NeotouchSendingType Int @db.SmallInt
97
+ NeotouchDuplicateSendingType Int @db.SmallInt
98
+ SendReceiptByMail Int @db.SmallInt
99
+ LoyaltyOriginReportType Int @db.SmallInt
100
+ LoyaltyOriginReportValue Decimal @db.Decimal(28, 8)
101
+ LoyaltyValue Decimal @db.Decimal(28, 8)
102
+ ShowTechnicalSheetOnFront Boolean
103
+ AllowUsePersonnalDatas Boolean
104
+ AssortMaintenanceContractInvoices Boolean
105
+ LoyaltyCumulativeTurnoverReport Decimal @db.Decimal(28, 8)
106
+ LoyaltyCumulativeTurnover Decimal @db.Decimal(28, 8)
107
+ HeadOfficeAddress_UseCompanyAddressAsHeadOfficeAddress Boolean
108
+ ApplyItemOtherTax Boolean
109
+ PrintReceiptChoice Int @db.SmallInt
110
+ Id String @id @db.VarChar(20)
111
+ Name String @db.VarChar(60)
112
+ UseInvoicingAddressAsDeliveryAddress Boolean
113
+ UseInvoicingContactAsDeliveryContact Boolean
114
+ MainDeliveryAddress_Npai Boolean
115
+ MainInvoicingAddress_Npai Boolean
116
+ MainDeliveryContact_NaturalPerson Boolean
117
+ MainDeliveryContact_OptIn Boolean
118
+ MainInvoicingContact_NaturalPerson Boolean
119
+ MainInvoicingContact_OptIn Boolean
120
+ NaturalPerson Boolean
121
+ TerritorialityId String @db.Uuid
122
+ DiscountRate Decimal @db.Decimal(28, 8)
123
+ SecondDiscountRate Decimal @db.Decimal(28, 8)
124
+ AllowedAmount Decimal @db.Decimal(28, 8)
125
+ CurrentAmount Decimal @db.Decimal(28, 8)
126
+ InitialAmount Decimal @db.Decimal(28, 8)
127
+ ExceedAmount Decimal @db.Decimal(28, 8)
128
+ FinancialDiscountType Int @db.SmallInt
129
+ FinancialDiscountRate Decimal @db.Decimal(28, 8)
130
+ FinancialDiscountPaymentDelay Int @db.SmallInt
131
+ ActiveState Int @db.SmallInt
132
+ MustRetrieveCommitmentsFromAccounting Boolean
133
+ PriceWithTaxBased Boolean
134
+ MustBeReminder Boolean
135
+ DayNumberToFirstReminder Int
136
+ DayNumberToSecondReminder Int
137
+ DayNumberToThirdReminder Int
138
+ IsCustomerAccount Boolean
139
+ WebContactSendKind Int @db.SmallInt
140
+ SubjectToRE Boolean
141
+ UniqueId String @db.Uuid
142
+ ExtendedCurrentAmount Decimal @db.Decimal(28, 8)
143
+ ThresholdBeforeExceedAmount Decimal @db.Decimal(28, 8)
144
+ DisallowOrderAssort Boolean
145
+ DisallowDeliveryAssort Boolean
146
+ SendReminderToPayerThird Boolean
147
+ ThirdLanguage String @db.VarChar(3)
148
+ AutomaticStockBooking Boolean
149
+ CustomerToUseInCustomerProducts Int @db.SmallInt
150
+ InvoicingChargesAmount Decimal @db.Decimal(28, 8)
151
+ GenerateVCS Boolean
152
+ CheckExceedCommitmentDate Boolean
153
+ DueCommitmentsXDay Int
154
+ EffectOfTradeAmount Decimal @db.Decimal(28, 8)
155
+ CreatePosDeliveryOrderByDefault Boolean
156
+ AssortDeliveryByOrder Boolean
157
+ LoyaltyCardType String? @db.VarChar(10)
158
+ LoyaltyCardId String? @db.VarChar(20)
159
+ LoyaltyCardCreationDate DateTime? @db.Timestamp(6)
160
+ LoyaltyCardValidityDuration Int? @db.SmallInt
161
+ LoyaltyCardExpiryDate DateTime? @db.Timestamp(6)
162
+ LoyaltyCardRenewalDate DateTime? @db.Timestamp(6)
163
+ StorehouseId String? @db.Uuid
164
+ TravelExpenseId String? @db.VarChar(8)
165
+ InvoicingChargesVatId String? @db.Uuid
166
+ LastInvoicingDate DateTime? @db.Timestamp(6)
167
+ DocumentPrintMention String? @db.VarChar(255)
168
+ xx_ETIQUETTE_ARABE String?
169
+ xx_ETIQUETTE_ARABE_Clear String?
170
+ Accounts_BillOfExchangeAccountingAccount String? @db.VarChar(20)
171
+ TaxIds0 String? @db.Uuid
172
+ TaxIds1 String? @db.Uuid
173
+ TaxIds2 String? @db.Uuid
174
+ PaymentThirdId String? @db.VarChar(20)
175
+ InvoicingThirdId String? @db.VarChar(20)
176
+ sysRecordVersion Int?
177
+ sysRecordVersionId String? @db.Uuid
178
+ sysEditCounter Int?
179
+ SelectedReminderReport String? @db.Uuid
180
+ ShippingId String? @db.VarChar(8)
181
+ DocumentSerialId String? @db.VarChar(2)
182
+ IdentificationType Int? @db.SmallInt
183
+ AnalyticAccounting_GridId String? @db.VarChar(40)
184
+ Type Int? @db.SmallInt
185
+ CurrencyId String? @db.VarChar(3)
186
+ Group1 String? @db.Uuid
187
+ Group2 String? @db.Uuid
188
+ ColleagueId String? @db.VarChar(20)
189
+ Accounts_Account String? @db.VarChar(20)
190
+ FirstInvoicingDate DateTime? @db.Timestamp(6)
191
+ SettlementModeId String? @db.VarChar(6)
192
+ PaymentDate Int? @db.SmallInt
193
+ PriceListCategoryId String? @db.VarChar(8)
194
+ Siren String? @db.VarChar(20)
195
+ NAF String? @db.VarChar(8)
196
+ FamilyId String? @db.VarChar(10)
197
+ SubFamilyId String? @db.VarChar(10)
198
+ IntracommunityVATNumber String? @db.VarChar(20)
199
+ MainInvoicingContact_ExternalId_GoogleId String? @db.VarChar(255)
200
+ MainInvoicingContact_ExternalId_OutlookId String? @db.VarChar(255)
201
+ MainDeliveryContact_ExternalId_GoogleId String? @db.VarChar(255)
202
+ MainDeliveryContact_ExternalId_OutlookId String? @db.VarChar(255)
203
+ MainInvoicingContact_Civility String? @db.VarChar(25)
204
+ MainInvoicingContact_Name String? @db.VarChar(60)
205
+ MainInvoicingContact_FirstName String? @db.VarChar(60)
206
+ MainInvoicingContact_Phone String? @db.VarChar(20)
207
+ MainInvoicingContact_CellPhone String? @db.VarChar(20)
208
+ MainInvoicingContact_Fax String? @db.VarChar(20)
209
+ MainInvoicingContact_Email String? @db.VarChar(100)
210
+ MainInvoicingContact_Function String? @db.VarChar(40)
211
+ MainInvoicingContact_Department String? @db.VarChar(40)
212
+ MainInvoicingAddress_WebSite String? @db.VarChar(100)
213
+ MainInvoicingAddress_Longitude Decimal? @db.Decimal(20, 8)
214
+ MainInvoicingAddress_Latitude Decimal? @db.Decimal(20, 8)
215
+ MainDeliveryContact_Civility String? @db.VarChar(25)
216
+ MainDeliveryContact_Name String? @db.VarChar(60)
217
+ MainDeliveryContact_FirstName String? @db.VarChar(60)
218
+ MainDeliveryContact_Phone String? @db.VarChar(20)
219
+ MainDeliveryContact_CellPhone String? @db.VarChar(20)
220
+ MainDeliveryContact_Fax String? @db.VarChar(20)
221
+ MainDeliveryContact_Email String? @db.VarChar(100)
222
+ MainDeliveryContact_Function String? @db.VarChar(40)
223
+ MainDeliveryContact_Department String? @db.VarChar(40)
224
+ MainDeliveryAddress_WebSite String? @db.VarChar(100)
225
+ MainDeliveryAddress_Longitude Decimal? @db.Decimal(20, 8)
226
+ MainDeliveryAddress_Latitude Decimal? @db.Decimal(20, 8)
227
+ MainInvoicingAddress_Address1 String? @db.VarChar(40)
228
+ MainInvoicingAddress_Address2 String? @db.VarChar(40)
229
+ MainInvoicingAddress_Address3 String? @db.VarChar(40)
230
+ MainInvoicingAddress_Address4 String? @db.VarChar(40)
231
+ MainInvoicingAddress_ZipCode String? @db.VarChar(10)
232
+ MainInvoicingAddress_City String? @db.VarChar(35)
233
+ MainInvoicingAddress_State String? @db.VarChar(50)
234
+ MainInvoicingAddress_CountryIsoCode String? @db.VarChar(3)
235
+ MainInvoicingAddress_Description String? @db.VarChar(50)
236
+ MainInvoicingAddress_Civility String? @db.VarChar(25)
237
+ MainInvoicingAddress_ThirdName String? @db.VarChar(60)
238
+ MainDeliveryAddress_Address1 String? @db.VarChar(40)
239
+ MainDeliveryAddress_Address2 String? @db.VarChar(40)
240
+ MainDeliveryAddress_Address3 String? @db.VarChar(40)
241
+ MainDeliveryAddress_Address4 String? @db.VarChar(40)
242
+ MainDeliveryAddress_ZipCode String? @db.VarChar(10)
243
+ MainDeliveryAddress_City String? @db.VarChar(35)
244
+ MainDeliveryAddress_State String? @db.VarChar(50)
245
+ MainDeliveryAddress_CountryIsoCode String? @db.VarChar(3)
246
+ MainDeliveryAddress_Description String? @db.VarChar(50)
247
+ MainDeliveryAddress_Civility String? @db.VarChar(25)
248
+ MainDeliveryAddress_ThirdName String? @db.VarChar(60)
249
+ Civility String? @db.VarChar(25)
250
+ sysCreatedDate DateTime? @db.Timestamp(6)
251
+ sysCreatedUser String? @db.VarChar(255)
252
+ sysModifiedDate DateTime? @db.Timestamp(6)
253
+ sysModifiedUser String? @db.VarChar(255)
254
+ NotesClear String?
255
+ Notes String?
256
+ Accounts_AuxiliaryAccount String? @db.VarChar(20)
257
+ Accounts_DoubtfulAccount String? @db.VarChar(20)
258
+ SchedulerColor Int?
259
+ xx_Banque_AFP String? @db.VarChar(6)
260
+ MainDeliveryContact_Profession String? @db.VarChar(40)
261
+ MainInvoicingContact_Profession String? @db.VarChar(40)
262
+ UrssafId String? @db.VarChar(40)
263
+ CustomerTypology Int? @db.SmallInt
264
+ MainDeliveryAddress_CodeINSEE String? @db.VarChar(10)
265
+ MainDeliveryAddress_CityINSEE String? @db.VarChar(50)
266
+ MainInvoicingAddress_CodeINSEE String? @db.VarChar(10)
267
+ MainInvoicingAddress_CityINSEE String? @db.VarChar(50)
268
+ HeadOfficeAddress_CodeINSEE String? @db.VarChar(10)
269
+ HeadOfficeAddress_CityINSEE String? @db.VarChar(50)
270
+ GoCardLessThirdId String? @db.VarChar(30)
271
+ DefaultBankAccountId String? @db.Uuid
272
+ HeadOfficeAddress_Address1 String? @db.VarChar(40)
273
+ HeadOfficeAddress_Address2 String? @db.VarChar(40)
274
+ HeadOfficeAddress_Address3 String? @db.VarChar(40)
275
+ HeadOfficeAddress_Address4 String? @db.VarChar(40)
276
+ HeadOfficeAddress_ZipCode String? @db.VarChar(10)
277
+ HeadOfficeAddress_City String? @db.VarChar(35)
278
+ HeadOfficeAddress_State String? @db.VarChar(50)
279
+ HeadOfficeAddress_CountryIsoCode String? @db.VarChar(3)
280
+ HeadOfficeAddress_HeadOfficeName String? @db.VarChar(60)
281
+ Nic String? @db.VarChar(5)
282
+ DepositPercentage Decimal? @db.Decimal(28, 8)
283
+ BuyerReference String? @db.VarChar(100)
284
+ xx_CodeStock String? @db.VarChar(10)
285
+ TechnicalSheetClear String?
286
+ TechnicalSheet String?
287
+ MainDeliveryContact_AllowUsePersonnalDatas Boolean?
288
+ MainInvoicingContact_AllowUsePersonnalDatas Boolean?
289
+ BirthDate DateTime? @db.Timestamp(6)
290
+ IduCode String? @db.VarChar(14)
291
+ CnpsCode String? @db.VarChar(20)
292
+ NeotouchContactsIdForDuplicate String?
293
+ CnssCode String? @db.VarChar(20)
294
+ BusinessTaxCode String? @db.VarChar(20)
295
+ CnieCode String? @db.VarChar(20)
296
+ xx_Anglais_impression Boolean
297
+ xx_Incoterms String? @db.VarChar(100)
298
+ xx_Coface String? @db.VarChar(150)
299
+ xx_Coface_Date DateTime? @db.Timestamp(6)
300
+ cotations cotations[]
301
+ }
302
+
303
+ /// This model contains row level security and requires additional setup for migrations. Visit https://pris.ly/d/row-level-security for more info.
304
+ model imports {
305
+ id String @id @default(dbgenerated("gen_random_uuid()")) @db.Uuid
306
+ user_id String? @db.Uuid
307
+ path String? @db.VarChar(255)
308
+ model_name String? @db.VarChar(255)
309
+ description Json?
310
+ prices prices[]
311
+ }
312
+
313
+ /// This model contains row level security and requires additional setup for migrations. Visit https://pris.ly/d/row-level-security for more info.
314
+ model logistic {
315
+ id String @id @default(dbgenerated("gen_random_uuid()")) @db.Uuid
316
+ article_id String? @db.Uuid
317
+ moq Int? @default(1)
318
+ origin String? @db.VarChar(255)
319
+ articles articles? @relation(fields: [article_id], references: [id], onDelete: Cascade, onUpdate: NoAction)
320
+ }
321
+
322
+ /// This model contains row level security and requires additional setup for migrations. Visit https://pris.ly/d/row-level-security for more info.
323
+ model prices {
324
+ id String @id @default(dbgenerated("gen_random_uuid()")) @db.Uuid
325
+ article_id String? @db.Uuid
326
+ supplier_id String? @db.Uuid
327
+ gross_purchase_price Decimal? @db.Decimal(15, 4)
328
+ is_blacklisted Boolean? @default(false)
329
+ user_id String? @db.Uuid
330
+ import_id String? @db.Uuid
331
+ updated_at DateTime? @default(now()) @db.Timestamp(6)
332
+ articles articles? @relation(fields: [article_id], references: [id], onDelete: Cascade, onUpdate: NoAction)
333
+ imports imports? @relation(fields: [import_id], references: [id], onDelete: NoAction, onUpdate: NoAction)
334
+ suppliers suppliers? @relation(fields: [supplier_id], references: [id], onDelete: NoAction, onUpdate: NoAction)
335
+ }
336
+
337
+ /// This model contains row level security and requires additional setup for migrations. Visit https://pris.ly/d/row-level-security for more info.
338
+ model pricing_rules {
339
+ id String @id @default(dbgenerated("gen_random_uuid()")) @db.Uuid
340
+ name String? @db.VarChar(255)
341
+ supplier_id String? @db.Uuid
342
+ type String? @db.VarChar(50)
343
+ value Float? @db.Real
344
+ description String? @db.VarChar(255)
345
+ suppliers suppliers? @relation(fields: [supplier_id], references: [id], onDelete: NoAction, onUpdate: NoAction)
346
+ }
347
+
348
+ /// This model contains row level security and requires additional setup for migrations. Visit https://pris.ly/d/row-level-security for more info.
349
+ model supplier_discount {
350
+ id String @id @default(dbgenerated("gen_random_uuid()")) @db.Uuid
351
+ supplier_id String? @db.Uuid
352
+ created_at DateTime? @default(now()) @db.Timestamp(6)
353
+ updated_at DateTime? @default(now()) @db.Timestamp(6)
354
+ suppliers suppliers? @relation(fields: [supplier_id], references: [id], onDelete: NoAction, onUpdate: NoAction)
355
+ supplier_discount_lines supplier_discount_lines[]
356
+ }
357
+
358
+ /// This model contains row level security and requires additional setup for migrations. Visit https://pris.ly/d/row-level-security for more info.
359
+ model supplier_discount_lines {
360
+ id String @id @default(dbgenerated("gen_random_uuid()")) @db.Uuid
361
+ supplier_discount_id String? @db.Uuid
362
+ cotation_line_id String? @db.Uuid
363
+ discount_amount Float? @db.Real
364
+ discount_unit_amount Float? @db.Real
365
+ quantity Int?
366
+ send_at DateTime? @db.Timestamp(6)
367
+ created_at DateTime? @default(now()) @db.Timestamp(6)
368
+ updated_at DateTime? @default(now()) @db.Timestamp(6)
369
+ cotation_lines cotation_lines? @relation(fields: [cotation_line_id], references: [id], onDelete: NoAction, onUpdate: NoAction)
370
+ supplier_discount supplier_discount? @relation(fields: [supplier_discount_id], references: [id], onDelete: Cascade, onUpdate: NoAction)
371
+ }
372
+
373
+ /// This model contains row level security and requires additional setup for migrations. Visit https://pris.ly/d/row-level-security for more info.
374
+ model suppliers {
375
+ id String @id @default(dbgenerated("gen_random_uuid()")) @db.Uuid
376
+ name String @db.VarChar(255)
377
+ cotation_lines cotation_lines[]
378
+ prices prices[]
379
+ pricing_rules pricing_rules[]
380
+ supplier_discount supplier_discount[]
381
+ }
requirements.lock.txt ADDED
@@ -0,0 +1,136 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ aiofiles==23.2.1
2
+ aiohappyeyeballs==2.4.4
3
+ aiohttp==3.11.10
4
+ aiosignal==1.3.2
5
+ anaconda-anon-usage @ file:///croot/anaconda-anon-usage_1710965072196/work
6
+ annotated-types==0.7.0
7
+ anyio==4.7.0
8
+ archspec @ file:///croot/archspec_1709217642129/work
9
+ asyncer==0.0.7
10
+ attrs==24.3.0
11
+ bidict==0.23.1
12
+ boltons @ file:///work/perseverance-python-buildout/croot/boltons_1698851177130/work
13
+ Brotli @ file:///croot/brotli-split_1714483155106/work
14
+ certifi @ file:///croot/certifi_1725551672989/work/certifi
15
+ cffi @ file:///croot/cffi_1726856441404/work
16
+ chainlit==1.3.2
17
+ charset-normalizer @ file:///croot/charset-normalizer_1721748349566/work
18
+ chevron==0.14.0
19
+ click==8.1.7
20
+ conda @ file:///croot/conda_1729193882500/work
21
+ conda-content-trust @ file:///croot/conda-content-trust_1714483159009/work
22
+ conda-libmamba-solver @ file:///croot/conda-libmamba-solver_1727775630457/work/src
23
+ conda-package-handling @ file:///croot/conda-package-handling_1718138267740/work
24
+ conda_package_streaming @ file:///croot/conda-package-streaming_1718136078615/work
25
+ cryptography @ file:///croot/cryptography_1724940562255/work
26
+ dataclasses-json==0.6.7
27
+ Deprecated==1.2.15
28
+ distro @ file:///croot/distro_1714488253808/work
29
+ faiss-cpu==1.9.0.post1
30
+ fastapi==0.115.6
31
+ filelock==3.16.1
32
+ filetype==1.2.0
33
+ frozendict @ file:///croot/frozendict_1713194832637/work
34
+ frozenlist==1.5.0
35
+ fsspec==2024.10.0
36
+ googleapis-common-protos==1.66.0
37
+ gradio_client==1.5.2
38
+ greenlet==3.1.1
39
+ grpcio==1.68.1
40
+ h11==0.14.0
41
+ httpcore==1.0.7
42
+ httptools==0.7.1
43
+ httpx==0.28.1
44
+ httpx-sse==0.4.0
45
+ huggingface-hub==0.26.5
46
+ idna @ file:///croot/idna_1714398848350/work
47
+ importlib_metadata==8.5.0
48
+ iniconfig==2.3.0
49
+ Jinja2==3.1.6
50
+ jiter==0.8.2
51
+ jsonpatch @ file:///croot/jsonpatch_1714483231291/work
52
+ jsonpointer==2.1
53
+ langchain==0.3.12
54
+ langchain-community==0.3.12
55
+ langchain-core==0.3.25
56
+ langchain-mistralai==0.2.3
57
+ langchain-text-splitters==0.3.3
58
+ langsmith==0.2.3
59
+ Lazify==0.4.0
60
+ libmambapy @ file:///croot/mamba-split_1725563367192/work/libmambapy
61
+ literalai==0.0.623
62
+ MarkupSafe==3.0.3
63
+ marshmallow==3.23.1
64
+ menuinst @ file:///croot/menuinst_1723567589013/work
65
+ multidict==6.1.0
66
+ mypy-extensions==1.0.0
67
+ nest-asyncio==1.6.0
68
+ nodeenv==1.10.0
69
+ numpy==1.26.4
70
+ openai==1.57.4
71
+ opentelemetry-api==1.28.2
72
+ opentelemetry-exporter-otlp==1.28.2
73
+ opentelemetry-exporter-otlp-proto-common==1.28.2
74
+ opentelemetry-exporter-otlp-proto-grpc==1.28.2
75
+ opentelemetry-exporter-otlp-proto-http==1.28.2
76
+ opentelemetry-instrumentation==0.49b2
77
+ opentelemetry-proto==1.28.2
78
+ opentelemetry-sdk==1.28.2
79
+ opentelemetry-semantic-conventions==0.49b2
80
+ orjson==3.10.12
81
+ packaging==23.2
82
+ platformdirs @ file:///work/perseverance-python-buildout/croot/platformdirs_1701732573265/work
83
+ pluggy==1.6.0
84
+ prisma==0.15.0
85
+ propcache==0.2.1
86
+ protobuf==5.29.1
87
+ pycosat @ file:///croot/pycosat_1714510623388/work
88
+ pycparser @ file:///tmp/build/80754af9/pycparser_1636541352034/work
89
+ pydantic==2.10.3
90
+ pydantic-settings==2.7.0
91
+ pydantic_core==2.27.1
92
+ Pygments==2.20.0
93
+ PyJWT==2.10.1
94
+ pypdf==5.1.0
95
+ PyPDF2==3.0.1
96
+ PySocks @ file:///work/perseverance-python-buildout/croot/pysocks_1698845478203/work
97
+ pytest==9.0.3
98
+ pytest-asyncio==1.3.0
99
+ python-dotenv==1.0.1
100
+ python-engineio==4.10.1
101
+ python-multipart==0.0.9
102
+ python-socketio==5.11.4
103
+ PyYAML==6.0.2
104
+ regex==2024.11.6
105
+ requests @ file:///croot/requests_1721410876868/work
106
+ requests-toolbelt==1.0.0
107
+ ruamel.yaml @ file:///croot/ruamel.yaml_1727980156079/work
108
+ ruamel.yaml.clib @ file:///croot/ruamel.yaml.clib_1727769819935/work
109
+ setuptools==75.1.0
110
+ simple-websocket==1.1.0
111
+ sniffio==1.3.1
112
+ SQLAlchemy==2.0.36
113
+ starlette==0.41.3
114
+ syncer==2.0.3
115
+ tenacity==9.0.0
116
+ tiktoken==0.8.0
117
+ tokenizers==0.21.0
118
+ tomli==2.2.1
119
+ tomlkit==0.14.0
120
+ tqdm @ file:///croot/tqdm_1724853939799/work
121
+ truststore @ file:///work/perseverance-python-buildout/croot/truststore_1701735771625/work
122
+ typing-inspect==0.9.0
123
+ typing_extensions==4.12.2
124
+ uptrace==1.28.2
125
+ urllib3 @ file:///croot/urllib3_1727769808118/work
126
+ uvicorn==0.25.0
127
+ uvloop==0.22.1
128
+ watchfiles==0.20.0
129
+ websockets==14.1
130
+ wheel==0.44.0
131
+ wrapt==1.17.0
132
+ wsproto==1.2.0
133
+ yarl==1.18.3
134
+ yolk3k==0.9
135
+ zipp==3.21.0
136
+ zstandard @ file:///croot/zstandard_1728569189425/work
requirements.txt ADDED
@@ -0,0 +1,7 @@
 
 
 
 
 
 
 
 
1
+ fastapi
2
+ uvicorn[standard]
3
+ prisma
4
+ python-dotenv
5
+ pydantic-settings
6
+ pytest
7
+ pytest-asyncio
supabase/.gitignore ADDED
@@ -0,0 +1,8 @@
 
 
 
 
 
 
 
 
 
1
+ # Supabase
2
+ .branches
3
+ .temp
4
+
5
+ # dotenvx
6
+ .env.keys
7
+ .env.local
8
+ .env.*.local
supabase/config.toml ADDED
@@ -0,0 +1,406 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ # For detailed configuration reference documentation, visit:
2
+ # https://supabase.com/docs/guides/local-development/cli/config
3
+ # A string used to distinguish different Supabase projects on the same host. Defaults to the
4
+ # working directory name when running `supabase init`.
5
+ project_id = "afp_core"
6
+
7
+ [api]
8
+ enabled = true
9
+ # Port to use for the API URL.
10
+ port = 54321
11
+ # Schemas to expose in your API. Tables, views and stored procedures in this schema will get API
12
+ # endpoints. `public` and `graphql_public` schemas are included by default.
13
+ schemas = ["public", "graphql_public"]
14
+ # Extra schemas to add to the search_path of every request.
15
+ extra_search_path = ["public", "extensions"]
16
+ # The maximum number of rows returns from a view, table, or stored procedure. Limits payload size
17
+ # for accidental or malicious requests.
18
+ max_rows = 1000
19
+
20
+ [api.tls]
21
+ # Enable HTTPS endpoints locally using a self-signed certificate.
22
+ enabled = false
23
+ # Paths to self-signed certificate pair.
24
+ # cert_path = "../certs/my-cert.pem"
25
+ # key_path = "../certs/my-key.pem"
26
+
27
+ [db]
28
+ # Port to use for the local database URL.
29
+ port = 54322
30
+ # Port used by db diff command to initialize the shadow database.
31
+ shadow_port = 54320
32
+ # Maximum amount of time to wait for health check when starting the local database.
33
+ health_timeout = "2m"
34
+ # The database major version to use. This has to be the same as your remote database's. Run `SHOW
35
+ # server_version;` on the remote database to check.
36
+ major_version = 17
37
+
38
+ [db.pooler]
39
+ enabled = false
40
+ # Port to use for the local connection pooler.
41
+ port = 54329
42
+ # Specifies when a server connection can be reused by other clients.
43
+ # Configure one of the supported pooler modes: `transaction`, `session`.
44
+ pool_mode = "transaction"
45
+ # How many server connections to allow per user/database pair.
46
+ default_pool_size = 20
47
+ # Maximum number of client connections allowed.
48
+ max_client_conn = 100
49
+
50
+ # [db.vault]
51
+ # secret_key = "env(SECRET_VALUE)"
52
+
53
+ [db.migrations]
54
+ # If disabled, migrations will be skipped during a db push or reset.
55
+ enabled = true
56
+ # Specifies an ordered list of schema files that describe your database.
57
+ # Supports glob patterns relative to supabase directory: "./schemas/*.sql"
58
+ schema_paths = []
59
+
60
+ [db.seed]
61
+ # If enabled, seeds the database after migrations during a db reset.
62
+ enabled = true
63
+ # Specifies an ordered list of seed files to load during db reset.
64
+ # Supports glob patterns relative to supabase directory: "./seeds/*.sql"
65
+ sql_paths = ["./seed.sql"]
66
+
67
+ [db.network_restrictions]
68
+ # Enable management of network restrictions.
69
+ enabled = false
70
+ # List of IPv4 CIDR blocks allowed to connect to the database.
71
+ # Defaults to allow all IPv4 connections. Set empty array to block all IPs.
72
+ allowed_cidrs = ["0.0.0.0/0"]
73
+ # List of IPv6 CIDR blocks allowed to connect to the database.
74
+ # Defaults to allow all IPv6 connections. Set empty array to block all IPs.
75
+ allowed_cidrs_v6 = ["::/0"]
76
+
77
+ # Uncomment to reject non-secure connections to the database.
78
+ # [db.ssl_enforcement]
79
+ # enabled = true
80
+
81
+ [realtime]
82
+ enabled = true
83
+ # Bind realtime via either IPv4 or IPv6. (default: IPv4)
84
+ # ip_version = "IPv6"
85
+ # The maximum length in bytes of HTTP request headers. (default: 4096)
86
+ # max_header_length = 4096
87
+
88
+ [studio]
89
+ enabled = true
90
+ # Port to use for Supabase Studio.
91
+ port = 54323
92
+ # External URL of the API server that frontend connects to.
93
+ api_url = "http://127.0.0.1"
94
+ # OpenAI API Key to use for Supabase AI in the Supabase Studio.
95
+ openai_api_key = "env(OPENAI_API_KEY)"
96
+
97
+ # Email testing server. Emails sent with the local dev setup are not actually sent - rather, they
98
+ # are monitored, and you can view the emails that would have been sent from the web interface.
99
+ [inbucket]
100
+ enabled = true
101
+ # Port to use for the email testing server web interface.
102
+ port = 54324
103
+ # Uncomment to expose additional ports for testing user applications that send emails.
104
+ # smtp_port = 54325
105
+ # pop3_port = 54326
106
+ # admin_email = "admin@email.com"
107
+ # sender_name = "Admin"
108
+
109
+ [storage]
110
+ enabled = true
111
+ # The maximum file size allowed (e.g. "5MB", "500KB").
112
+ file_size_limit = "50MiB"
113
+
114
+ # Uncomment to configure local storage buckets
115
+ # [storage.buckets.images]
116
+ # public = false
117
+ # file_size_limit = "50MiB"
118
+ # allowed_mime_types = ["image/png", "image/jpeg"]
119
+ # objects_path = "./images"
120
+
121
+ # Allow connections via S3 compatible clients
122
+ [storage.s3_protocol]
123
+ enabled = true
124
+
125
+ # Image transformation API is available to Supabase Pro plan.
126
+ # [storage.image_transformation]
127
+ # enabled = true
128
+
129
+ # Store analytical data in S3 for running ETL jobs over Iceberg Catalog
130
+ # This feature is only available on the hosted platform.
131
+ [storage.analytics]
132
+ enabled = false
133
+ max_namespaces = 5
134
+ max_tables = 10
135
+ max_catalogs = 2
136
+
137
+ # Analytics Buckets is available to Supabase Pro plan.
138
+ # [storage.analytics.buckets.my-warehouse]
139
+
140
+ # Store vector embeddings in S3 for large and durable datasets
141
+ # This feature is only available on the hosted platform.
142
+ [storage.vector]
143
+ enabled = false
144
+ max_buckets = 10
145
+ max_indexes = 5
146
+
147
+ # Vector Buckets is available to Supabase Pro plan.
148
+ # [storage.vector.buckets.documents-openai]
149
+
150
+ [auth]
151
+ enabled = true
152
+ # The base URL of your website. Used as an allow-list for redirects and for constructing URLs used
153
+ # in emails.
154
+ site_url = "http://127.0.0.1:3000"
155
+ # A list of *exact* URLs that auth providers are permitted to redirect to post authentication.
156
+ additional_redirect_urls = ["https://127.0.0.1:3000"]
157
+ # How long tokens are valid for, in seconds. Defaults to 3600 (1 hour), maximum 604,800 (1 week).
158
+ jwt_expiry = 3600
159
+ # JWT issuer URL. If not set, defaults to the local API URL (http://127.0.0.1:<port>/auth/v1).
160
+ # jwt_issuer = ""
161
+ # Path to JWT signing key. DO NOT commit your signing keys file to git.
162
+ # signing_keys_path = "./signing_keys.json"
163
+ # If disabled, the refresh token will never expire.
164
+ enable_refresh_token_rotation = true
165
+ # Allows refresh tokens to be reused after expiry, up to the specified interval in seconds.
166
+ # Requires enable_refresh_token_rotation = true.
167
+ refresh_token_reuse_interval = 10
168
+ # Allow/disallow new user signups to your project.
169
+ enable_signup = true
170
+ # Allow/disallow anonymous sign-ins to your project.
171
+ enable_anonymous_sign_ins = false
172
+ # Allow/disallow testing manual linking of accounts
173
+ enable_manual_linking = false
174
+ # Passwords shorter than this value will be rejected as weak. Minimum 6, recommended 8 or more.
175
+ minimum_password_length = 6
176
+ # Passwords that do not meet the following requirements will be rejected as weak. Supported values
177
+ # are: `letters_digits`, `lower_upper_letters_digits`, `lower_upper_letters_digits_symbols`
178
+ password_requirements = ""
179
+
180
+ # Configure passkey sign-ins.
181
+ # [auth.passkey]
182
+ # enabled = false
183
+
184
+ # Configure WebAuthn relying party settings (required when passkey is enabled).
185
+ # [auth.webauthn]
186
+ # rp_display_name = "Supabase"
187
+ # rp_id = "localhost"
188
+ # rp_origins = ["http://127.0.0.1:3000"]
189
+
190
+ [auth.rate_limit]
191
+ # Number of emails that can be sent per hour. Requires auth.email.smtp to be enabled.
192
+ email_sent = 2
193
+ # Number of SMS messages that can be sent per hour. Requires auth.sms to be enabled.
194
+ sms_sent = 30
195
+ # Number of anonymous sign-ins that can be made per hour per IP address. Requires enable_anonymous_sign_ins = true.
196
+ anonymous_users = 30
197
+ # Number of sessions that can be refreshed in a 5 minute interval per IP address.
198
+ token_refresh = 150
199
+ # Number of sign up and sign-in requests that can be made in a 5 minute interval per IP address (excludes anonymous users).
200
+ sign_in_sign_ups = 30
201
+ # Number of OTP / Magic link verifications that can be made in a 5 minute interval per IP address.
202
+ token_verifications = 30
203
+ # Number of Web3 logins that can be made in a 5 minute interval per IP address.
204
+ web3 = 30
205
+
206
+ # Configure one of the supported captcha providers: `hcaptcha`, `turnstile`.
207
+ # [auth.captcha]
208
+ # enabled = true
209
+ # provider = "hcaptcha"
210
+ # secret = ""
211
+
212
+ [auth.email]
213
+ # Allow/disallow new user signups via email to your project.
214
+ enable_signup = true
215
+ # If enabled, a user will be required to confirm any email change on both the old, and new email
216
+ # addresses. If disabled, only the new email is required to confirm.
217
+ double_confirm_changes = true
218
+ # If enabled, users need to confirm their email address before signing in.
219
+ enable_confirmations = false
220
+ # If enabled, users will need to reauthenticate or have logged in recently to change their password.
221
+ secure_password_change = false
222
+ # Controls the minimum amount of time that must pass before sending another signup confirmation or password reset email.
223
+ max_frequency = "1s"
224
+ # Number of characters used in the email OTP.
225
+ otp_length = 6
226
+ # Number of seconds before the email OTP expires (defaults to 1 hour).
227
+ otp_expiry = 3600
228
+
229
+ # Use a production-ready SMTP server
230
+ # [auth.email.smtp]
231
+ # enabled = true
232
+ # host = "smtp.sendgrid.net"
233
+ # port = 587
234
+ # user = "apikey"
235
+ # pass = "env(SENDGRID_API_KEY)"
236
+ # admin_email = "admin@email.com"
237
+ # sender_name = "Admin"
238
+
239
+ # Uncomment to customize email template
240
+ # [auth.email.template.invite]
241
+ # subject = "You have been invited"
242
+ # content_path = "./supabase/templates/invite.html"
243
+
244
+ # Uncomment to customize notification email template
245
+ # [auth.email.notification.password_changed]
246
+ # enabled = true
247
+ # subject = "Your password has been changed"
248
+ # content_path = "./templates/password_changed_notification.html"
249
+
250
+ [auth.sms]
251
+ # Allow/disallow new user signups via SMS to your project.
252
+ enable_signup = false
253
+ # If enabled, users need to confirm their phone number before signing in.
254
+ enable_confirmations = false
255
+ # Template for sending OTP to users
256
+ template = "Your code is {{ .Code }}"
257
+ # Controls the minimum amount of time that must pass before sending another sms otp.
258
+ max_frequency = "5s"
259
+
260
+ # Use pre-defined map of phone number to OTP for testing.
261
+ # [auth.sms.test_otp]
262
+ # 4152127777 = "123456"
263
+
264
+ # Configure logged in session timeouts.
265
+ # [auth.sessions]
266
+ # Force log out after the specified duration.
267
+ # timebox = "24h"
268
+ # Force log out if the user has been inactive longer than the specified duration.
269
+ # inactivity_timeout = "8h"
270
+
271
+ # This hook runs before a new user is created and allows developers to reject the request based on the incoming user object.
272
+ # [auth.hook.before_user_created]
273
+ # enabled = true
274
+ # uri = "pg-functions://postgres/auth/before-user-created-hook"
275
+
276
+ # This hook runs before a token is issued and allows you to add additional claims based on the authentication method used.
277
+ # [auth.hook.custom_access_token]
278
+ # enabled = true
279
+ # uri = "pg-functions://<database>/<schema>/<hook_name>"
280
+
281
+ # Configure one of the supported SMS providers: `twilio`, `twilio_verify`, `messagebird`, `textlocal`, `vonage`.
282
+ [auth.sms.twilio]
283
+ enabled = false
284
+ account_sid = ""
285
+ message_service_sid = ""
286
+ # DO NOT commit your Twilio auth token to git. Use environment variable substitution instead:
287
+ auth_token = "env(SUPABASE_AUTH_SMS_TWILIO_AUTH_TOKEN)"
288
+
289
+ # Multi-factor-authentication is available to Supabase Pro plan.
290
+ [auth.mfa]
291
+ # Control how many MFA factors can be enrolled at once per user.
292
+ max_enrolled_factors = 10
293
+
294
+ # Control MFA via App Authenticator (TOTP)
295
+ [auth.mfa.totp]
296
+ enroll_enabled = false
297
+ verify_enabled = false
298
+
299
+ # Configure MFA via Phone Messaging
300
+ [auth.mfa.phone]
301
+ enroll_enabled = false
302
+ verify_enabled = false
303
+ otp_length = 6
304
+ template = "Your code is {{ .Code }}"
305
+ max_frequency = "5s"
306
+
307
+ # Configure MFA via WebAuthn
308
+ # [auth.mfa.web_authn]
309
+ # enroll_enabled = true
310
+ # verify_enabled = true
311
+
312
+ # Use an external OAuth provider. The full list of providers are: `apple`, `azure`, `bitbucket`,
313
+ # `discord`, `facebook`, `github`, `gitlab`, `google`, `keycloak`, `linkedin_oidc`, `notion`, `twitch`,
314
+ # `twitter`, `x`, `slack`, `spotify`, `workos`, `zoom`.
315
+ [auth.external.apple]
316
+ enabled = false
317
+ client_id = ""
318
+ # DO NOT commit your OAuth provider secret to git. Use environment variable substitution instead:
319
+ secret = "env(SUPABASE_AUTH_EXTERNAL_APPLE_SECRET)"
320
+ # Overrides the default auth redirectUrl.
321
+ redirect_uri = ""
322
+ # Overrides the default auth provider URL. Used to support self-hosted gitlab, single-tenant Azure,
323
+ # or any other third-party OIDC providers.
324
+ url = ""
325
+ # If enabled, the nonce check will be skipped. Required for local sign in with Google auth.
326
+ skip_nonce_check = false
327
+ # If enabled, it will allow the user to successfully authenticate when the provider does not return an email address.
328
+ email_optional = false
329
+
330
+ # Allow Solana wallet holders to sign in to your project via the Sign in with Solana (SIWS, EIP-4361) standard.
331
+ # You can configure "web3" rate limit in the [auth.rate_limit] section and set up [auth.captcha] if self-hosting.
332
+ [auth.web3.solana]
333
+ enabled = false
334
+
335
+ # Use Firebase Auth as a third-party provider alongside Supabase Auth.
336
+ [auth.third_party.firebase]
337
+ enabled = false
338
+ # project_id = "my-firebase-project"
339
+
340
+ # Use Auth0 as a third-party provider alongside Supabase Auth.
341
+ [auth.third_party.auth0]
342
+ enabled = false
343
+ # tenant = "my-auth0-tenant"
344
+ # tenant_region = "us"
345
+
346
+ # Use AWS Cognito (Amplify) as a third-party provider alongside Supabase Auth.
347
+ [auth.third_party.aws_cognito]
348
+ enabled = false
349
+ # user_pool_id = "my-user-pool-id"
350
+ # user_pool_region = "us-east-1"
351
+
352
+ # Use Clerk as a third-party provider alongside Supabase Auth.
353
+ [auth.third_party.clerk]
354
+ enabled = false
355
+ # Obtain from https://clerk.com/setup/supabase
356
+ # domain = "example.clerk.accounts.dev"
357
+
358
+ # OAuth server configuration
359
+ [auth.oauth_server]
360
+ # Enable OAuth server functionality
361
+ enabled = false
362
+ # Path for OAuth consent flow UI
363
+ authorization_url_path = "/oauth/consent"
364
+ # Allow dynamic client registration
365
+ allow_dynamic_registration = false
366
+
367
+ [edge_runtime]
368
+ enabled = true
369
+ # Supported request policies: `oneshot`, `per_worker`.
370
+ # `per_worker` (default) — enables hot reload during local development.
371
+ # `oneshot` — fallback mode if hot reload causes issues (e.g. in large repos or with symlinks).
372
+ policy = "per_worker"
373
+ # Port to attach the Chrome inspector for debugging edge functions.
374
+ inspector_port = 8083
375
+ # The Deno major version to use.
376
+ deno_version = 2
377
+
378
+ # [edge_runtime.secrets]
379
+ # secret_key = "env(SECRET_VALUE)"
380
+
381
+ [analytics]
382
+ enabled = true
383
+ port = 54327
384
+ # Configure one of the supported backends: `postgres`, `bigquery`.
385
+ backend = "postgres"
386
+
387
+ # Experimental features may be deprecated any time
388
+ [experimental]
389
+ # Configures Postgres storage engine to use OrioleDB (S3)
390
+ orioledb_version = ""
391
+ # Configures S3 bucket URL, eg. <bucket_name>.s3-<region>.amazonaws.com
392
+ s3_host = "env(S3_HOST)"
393
+ # Configures S3 bucket region, eg. us-east-1
394
+ s3_region = "env(S3_REGION)"
395
+ # Configures AWS_ACCESS_KEY_ID for S3 bucket
396
+ s3_access_key = "env(S3_ACCESS_KEY)"
397
+ # Configures AWS_SECRET_ACCESS_KEY for S3 bucket
398
+ s3_secret_key = "env(S3_SECRET_KEY)"
399
+
400
+ # [experimental.pgdelta]
401
+ # When enabled, pg-delta becomes the active engine for supported schema flows.
402
+ # enabled = false
403
+ # Directory under `supabase/` where declarative files are written.
404
+ # declarative_schema_path = "./database"
405
+ # JSON string passed through to pg-delta SQL formatting.
406
+ # format_options = "{\"keywordCase\":\"upper\",\"indent\":2,\"maxWidth\":80,\"commaStyle\":\"trailing\"}"
supabase/migrations/20260505212124_remote_schema.sql ADDED
@@ -0,0 +1,965 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+
2
+
3
+
4
+ SET statement_timeout = 0;
5
+ SET lock_timeout = 0;
6
+ SET idle_in_transaction_session_timeout = 0;
7
+ SET client_encoding = 'UTF8';
8
+ SET standard_conforming_strings = on;
9
+ SELECT pg_catalog.set_config('search_path', '', false);
10
+ SET check_function_bodies = false;
11
+ SET xmloption = content;
12
+ SET client_min_messages = warning;
13
+ SET row_security = off;
14
+
15
+
16
+ COMMENT ON SCHEMA "public" IS 'standard public schema';
17
+
18
+
19
+
20
+ CREATE EXTENSION IF NOT EXISTS "pg_stat_statements" WITH SCHEMA "extensions";
21
+
22
+
23
+
24
+
25
+
26
+
27
+ CREATE EXTENSION IF NOT EXISTS "pgcrypto" WITH SCHEMA "extensions";
28
+
29
+
30
+
31
+
32
+
33
+
34
+ CREATE EXTENSION IF NOT EXISTS "supabase_vault" WITH SCHEMA "vault";
35
+
36
+
37
+
38
+
39
+
40
+
41
+ CREATE EXTENSION IF NOT EXISTS "uuid-ossp" WITH SCHEMA "extensions";
42
+
43
+
44
+
45
+
46
+
47
+ SET default_tablespace = '';
48
+
49
+ SET default_table_access_method = "heap";
50
+
51
+
52
+ CREATE TABLE IF NOT EXISTS "public"."article_brand" (
53
+ "id" "uuid" DEFAULT "gen_random_uuid"() NOT NULL,
54
+ "article_id" "uuid",
55
+ "brand_id" "uuid"
56
+ );
57
+
58
+
59
+ ALTER TABLE "public"."article_brand" OWNER TO "postgres";
60
+
61
+
62
+ CREATE TABLE IF NOT EXISTS "public"."article_references" (
63
+ "id" "uuid" DEFAULT "gen_random_uuid"() NOT NULL,
64
+ "article_id" "uuid",
65
+ "reference_number" character varying(255) NOT NULL,
66
+ "main" boolean DEFAULT false,
67
+ "started_on" "date",
68
+ "stopped_on" "date"
69
+ );
70
+
71
+
72
+ ALTER TABLE "public"."article_references" OWNER TO "postgres";
73
+
74
+
75
+ CREATE TABLE IF NOT EXISTS "public"."articles" (
76
+ "id" "uuid" DEFAULT "gen_random_uuid"() NOT NULL,
77
+ "label_fr" character varying(255),
78
+ "label_en" character varying(255),
79
+ "category_id" "uuid"
80
+ );
81
+
82
+
83
+ ALTER TABLE "public"."articles" OWNER TO "postgres";
84
+
85
+
86
+ CREATE TABLE IF NOT EXISTS "public"."brand" (
87
+ "id" "uuid" DEFAULT "gen_random_uuid"() NOT NULL,
88
+ "name" character varying(255) NOT NULL
89
+ );
90
+
91
+
92
+ ALTER TABLE "public"."brand" OWNER TO "postgres";
93
+
94
+
95
+ CREATE TABLE IF NOT EXISTS "public"."categories" (
96
+ "id" "uuid" DEFAULT "gen_random_uuid"() NOT NULL,
97
+ "name" character varying(255) NOT NULL,
98
+ "index_id" "uuid",
99
+ "level" integer
100
+ );
101
+
102
+
103
+ ALTER TABLE "public"."categories" OWNER TO "postgres";
104
+
105
+
106
+ CREATE TABLE IF NOT EXISTS "public"."cotation_lines" (
107
+ "id" "uuid" DEFAULT "gen_random_uuid"() NOT NULL,
108
+ "article_id" "uuid",
109
+ "cotation_id" "uuid",
110
+ "final_unit_price" numeric(15,2),
111
+ "discount" real,
112
+ "validated" boolean DEFAULT false,
113
+ "table_details" json,
114
+ "saved_at" timestamp without time zone,
115
+ "quantity" integer,
116
+ "final_supplier_id" "uuid"
117
+ );
118
+
119
+
120
+ ALTER TABLE "public"."cotation_lines" OWNER TO "postgres";
121
+
122
+
123
+ CREATE TABLE IF NOT EXISTS "public"."cotations" (
124
+ "id" "uuid" DEFAULT "gen_random_uuid"() NOT NULL,
125
+ "user_id" "uuid",
126
+ "client_id" character varying(20),
127
+ "created_at" timestamp without time zone DEFAULT CURRENT_TIMESTAMP,
128
+ "updated_at" timestamp without time zone DEFAULT CURRENT_TIMESTAMP
129
+ );
130
+
131
+
132
+ ALTER TABLE "public"."cotations" OWNER TO "postgres";
133
+
134
+
135
+ CREATE TABLE IF NOT EXISTS "public"."customer" (
136
+ "NeotouchSendingType" smallint NOT NULL,
137
+ "NeotouchDuplicateSendingType" smallint NOT NULL,
138
+ "SendReceiptByMail" smallint NOT NULL,
139
+ "LoyaltyOriginReportType" smallint NOT NULL,
140
+ "LoyaltyOriginReportValue" numeric(28,8) NOT NULL,
141
+ "LoyaltyValue" numeric(28,8) NOT NULL,
142
+ "ShowTechnicalSheetOnFront" boolean NOT NULL,
143
+ "AllowUsePersonnalDatas" boolean NOT NULL,
144
+ "AssortMaintenanceContractInvoices" boolean NOT NULL,
145
+ "LoyaltyCumulativeTurnoverReport" numeric(28,8) NOT NULL,
146
+ "LoyaltyCumulativeTurnover" numeric(28,8) NOT NULL,
147
+ "HeadOfficeAddress_UseCompanyAddressAsHeadOfficeAddress" boolean NOT NULL,
148
+ "ApplyItemOtherTax" boolean NOT NULL,
149
+ "PrintReceiptChoice" smallint NOT NULL,
150
+ "Id" character varying(20) NOT NULL,
151
+ "Name" character varying(60) NOT NULL,
152
+ "UseInvoicingAddressAsDeliveryAddress" boolean NOT NULL,
153
+ "UseInvoicingContactAsDeliveryContact" boolean NOT NULL,
154
+ "MainDeliveryAddress_Npai" boolean NOT NULL,
155
+ "MainInvoicingAddress_Npai" boolean NOT NULL,
156
+ "MainDeliveryContact_NaturalPerson" boolean NOT NULL,
157
+ "MainDeliveryContact_OptIn" boolean NOT NULL,
158
+ "MainInvoicingContact_NaturalPerson" boolean NOT NULL,
159
+ "MainInvoicingContact_OptIn" boolean NOT NULL,
160
+ "NaturalPerson" boolean NOT NULL,
161
+ "TerritorialityId" "uuid" NOT NULL,
162
+ "DiscountRate" numeric(28,8) NOT NULL,
163
+ "SecondDiscountRate" numeric(28,8) NOT NULL,
164
+ "AllowedAmount" numeric(28,8) NOT NULL,
165
+ "CurrentAmount" numeric(28,8) NOT NULL,
166
+ "InitialAmount" numeric(28,8) NOT NULL,
167
+ "ExceedAmount" numeric(28,8) NOT NULL,
168
+ "FinancialDiscountType" smallint NOT NULL,
169
+ "FinancialDiscountRate" numeric(28,8) NOT NULL,
170
+ "FinancialDiscountPaymentDelay" smallint NOT NULL,
171
+ "ActiveState" smallint NOT NULL,
172
+ "MustRetrieveCommitmentsFromAccounting" boolean NOT NULL,
173
+ "PriceWithTaxBased" boolean NOT NULL,
174
+ "MustBeReminder" boolean NOT NULL,
175
+ "DayNumberToFirstReminder" integer NOT NULL,
176
+ "DayNumberToSecondReminder" integer NOT NULL,
177
+ "DayNumberToThirdReminder" integer NOT NULL,
178
+ "IsCustomerAccount" boolean NOT NULL,
179
+ "WebContactSendKind" smallint NOT NULL,
180
+ "SubjectToRE" boolean NOT NULL,
181
+ "UniqueId" "uuid" NOT NULL,
182
+ "ExtendedCurrentAmount" numeric(28,8) NOT NULL,
183
+ "ThresholdBeforeExceedAmount" numeric(28,8) NOT NULL,
184
+ "DisallowOrderAssort" boolean NOT NULL,
185
+ "DisallowDeliveryAssort" boolean NOT NULL,
186
+ "SendReminderToPayerThird" boolean NOT NULL,
187
+ "ThirdLanguage" character varying(3) NOT NULL,
188
+ "AutomaticStockBooking" boolean NOT NULL,
189
+ "CustomerToUseInCustomerProducts" smallint NOT NULL,
190
+ "InvoicingChargesAmount" numeric(28,8) NOT NULL,
191
+ "GenerateVCS" boolean NOT NULL,
192
+ "CheckExceedCommitmentDate" boolean NOT NULL,
193
+ "DueCommitmentsXDay" integer NOT NULL,
194
+ "EffectOfTradeAmount" numeric(28,8) NOT NULL,
195
+ "CreatePosDeliveryOrderByDefault" boolean NOT NULL,
196
+ "AssortDeliveryByOrder" boolean NOT NULL,
197
+ "LoyaltyCardType" character varying(10),
198
+ "LoyaltyCardId" character varying(20),
199
+ "LoyaltyCardCreationDate" timestamp without time zone,
200
+ "LoyaltyCardValidityDuration" smallint,
201
+ "LoyaltyCardExpiryDate" timestamp without time zone,
202
+ "LoyaltyCardRenewalDate" timestamp without time zone,
203
+ "StorehouseId" "uuid",
204
+ "TravelExpenseId" character varying(8),
205
+ "InvoicingChargesVatId" "uuid",
206
+ "LastInvoicingDate" timestamp without time zone,
207
+ "DocumentPrintMention" character varying(255),
208
+ "xx_ETIQUETTE_ARABE" "text",
209
+ "xx_ETIQUETTE_ARABE_Clear" "text",
210
+ "Accounts_BillOfExchangeAccountingAccount" character varying(20),
211
+ "TaxIds0" "uuid",
212
+ "TaxIds1" "uuid",
213
+ "TaxIds2" "uuid",
214
+ "PaymentThirdId" character varying(20),
215
+ "InvoicingThirdId" character varying(20),
216
+ "sysRecordVersion" integer,
217
+ "sysRecordVersionId" "uuid",
218
+ "sysEditCounter" integer,
219
+ "SelectedReminderReport" "uuid",
220
+ "ShippingId" character varying(8),
221
+ "DocumentSerialId" character varying(2),
222
+ "IdentificationType" smallint,
223
+ "AnalyticAccounting_GridId" character varying(40),
224
+ "Type" smallint,
225
+ "CurrencyId" character varying(3),
226
+ "Group1" "uuid",
227
+ "Group2" "uuid",
228
+ "ColleagueId" character varying(20),
229
+ "Accounts_Account" character varying(20),
230
+ "FirstInvoicingDate" timestamp without time zone,
231
+ "SettlementModeId" character varying(6),
232
+ "PaymentDate" smallint,
233
+ "PriceListCategoryId" character varying(8),
234
+ "Siren" character varying(20),
235
+ "NAF" character varying(8),
236
+ "FamilyId" character varying(10),
237
+ "SubFamilyId" character varying(10),
238
+ "IntracommunityVATNumber" character varying(20),
239
+ "MainInvoicingContact_ExternalId_GoogleId" character varying(255),
240
+ "MainInvoicingContact_ExternalId_OutlookId" character varying(255),
241
+ "MainDeliveryContact_ExternalId_GoogleId" character varying(255),
242
+ "MainDeliveryContact_ExternalId_OutlookId" character varying(255),
243
+ "MainInvoicingContact_Civility" character varying(25),
244
+ "MainInvoicingContact_Name" character varying(60),
245
+ "MainInvoicingContact_FirstName" character varying(60),
246
+ "MainInvoicingContact_Phone" character varying(20),
247
+ "MainInvoicingContact_CellPhone" character varying(20),
248
+ "MainInvoicingContact_Fax" character varying(20),
249
+ "MainInvoicingContact_Email" character varying(100),
250
+ "MainInvoicingContact_Function" character varying(40),
251
+ "MainInvoicingContact_Department" character varying(40),
252
+ "MainInvoicingAddress_WebSite" character varying(100),
253
+ "MainInvoicingAddress_Longitude" numeric(20,8),
254
+ "MainInvoicingAddress_Latitude" numeric(20,8),
255
+ "MainDeliveryContact_Civility" character varying(25),
256
+ "MainDeliveryContact_Name" character varying(60),
257
+ "MainDeliveryContact_FirstName" character varying(60),
258
+ "MainDeliveryContact_Phone" character varying(20),
259
+ "MainDeliveryContact_CellPhone" character varying(20),
260
+ "MainDeliveryContact_Fax" character varying(20),
261
+ "MainDeliveryContact_Email" character varying(100),
262
+ "MainDeliveryContact_Function" character varying(40),
263
+ "MainDeliveryContact_Department" character varying(40),
264
+ "MainDeliveryAddress_WebSite" character varying(100),
265
+ "MainDeliveryAddress_Longitude" numeric(20,8),
266
+ "MainDeliveryAddress_Latitude" numeric(20,8),
267
+ "MainInvoicingAddress_Address1" character varying(40),
268
+ "MainInvoicingAddress_Address2" character varying(40),
269
+ "MainInvoicingAddress_Address3" character varying(40),
270
+ "MainInvoicingAddress_Address4" character varying(40),
271
+ "MainInvoicingAddress_ZipCode" character varying(10),
272
+ "MainInvoicingAddress_City" character varying(35),
273
+ "MainInvoicingAddress_State" character varying(50),
274
+ "MainInvoicingAddress_CountryIsoCode" character varying(3),
275
+ "MainInvoicingAddress_Description" character varying(50),
276
+ "MainInvoicingAddress_Civility" character varying(25),
277
+ "MainInvoicingAddress_ThirdName" character varying(60),
278
+ "MainDeliveryAddress_Address1" character varying(40),
279
+ "MainDeliveryAddress_Address2" character varying(40),
280
+ "MainDeliveryAddress_Address3" character varying(40),
281
+ "MainDeliveryAddress_Address4" character varying(40),
282
+ "MainDeliveryAddress_ZipCode" character varying(10),
283
+ "MainDeliveryAddress_City" character varying(35),
284
+ "MainDeliveryAddress_State" character varying(50),
285
+ "MainDeliveryAddress_CountryIsoCode" character varying(3),
286
+ "MainDeliveryAddress_Description" character varying(50),
287
+ "MainDeliveryAddress_Civility" character varying(25),
288
+ "MainDeliveryAddress_ThirdName" character varying(60),
289
+ "Civility" character varying(25),
290
+ "sysCreatedDate" timestamp without time zone,
291
+ "sysCreatedUser" character varying(255),
292
+ "sysModifiedDate" timestamp without time zone,
293
+ "sysModifiedUser" character varying(255),
294
+ "NotesClear" "text",
295
+ "Notes" "text",
296
+ "Accounts_AuxiliaryAccount" character varying(20),
297
+ "Accounts_DoubtfulAccount" character varying(20),
298
+ "SchedulerColor" integer,
299
+ "xx_Banque_AFP" character varying(6),
300
+ "MainDeliveryContact_Profession" character varying(40),
301
+ "MainInvoicingContact_Profession" character varying(40),
302
+ "UrssafId" character varying(40),
303
+ "CustomerTypology" smallint,
304
+ "MainDeliveryAddress_CodeINSEE" character varying(10),
305
+ "MainDeliveryAddress_CityINSEE" character varying(50),
306
+ "MainInvoicingAddress_CodeINSEE" character varying(10),
307
+ "MainInvoicingAddress_CityINSEE" character varying(50),
308
+ "HeadOfficeAddress_CodeINSEE" character varying(10),
309
+ "HeadOfficeAddress_CityINSEE" character varying(50),
310
+ "GoCardLessThirdId" character varying(30),
311
+ "DefaultBankAccountId" "uuid",
312
+ "HeadOfficeAddress_Address1" character varying(40),
313
+ "HeadOfficeAddress_Address2" character varying(40),
314
+ "HeadOfficeAddress_Address3" character varying(40),
315
+ "HeadOfficeAddress_Address4" character varying(40),
316
+ "HeadOfficeAddress_ZipCode" character varying(10),
317
+ "HeadOfficeAddress_City" character varying(35),
318
+ "HeadOfficeAddress_State" character varying(50),
319
+ "HeadOfficeAddress_CountryIsoCode" character varying(3),
320
+ "HeadOfficeAddress_HeadOfficeName" character varying(60),
321
+ "Nic" character varying(5),
322
+ "DepositPercentage" numeric(28,8),
323
+ "BuyerReference" character varying(100),
324
+ "xx_CodeStock" character varying(10),
325
+ "TechnicalSheetClear" "text",
326
+ "TechnicalSheet" "text",
327
+ "MainDeliveryContact_AllowUsePersonnalDatas" boolean,
328
+ "MainInvoicingContact_AllowUsePersonnalDatas" boolean,
329
+ "BirthDate" timestamp without time zone,
330
+ "IduCode" character varying(14),
331
+ "CnpsCode" character varying(20),
332
+ "NeotouchContactsIdForDuplicate" "text",
333
+ "CnssCode" character varying(20),
334
+ "BusinessTaxCode" character varying(20),
335
+ "CnieCode" character varying(20),
336
+ "xx_Anglais_impression" boolean NOT NULL,
337
+ "xx_Incoterms" character varying(100),
338
+ "xx_Coface" character varying(150),
339
+ "xx_Coface_Date" timestamp without time zone
340
+ );
341
+
342
+
343
+ ALTER TABLE "public"."customer" OWNER TO "postgres";
344
+
345
+
346
+ CREATE TABLE IF NOT EXISTS "public"."imports" (
347
+ "id" "uuid" DEFAULT "gen_random_uuid"() NOT NULL,
348
+ "user_id" "uuid",
349
+ "path" character varying(255),
350
+ "model_name" character varying(255),
351
+ "description" "jsonb"
352
+ );
353
+
354
+
355
+ ALTER TABLE "public"."imports" OWNER TO "postgres";
356
+
357
+
358
+ CREATE TABLE IF NOT EXISTS "public"."logistic" (
359
+ "id" "uuid" DEFAULT "gen_random_uuid"() NOT NULL,
360
+ "article_id" "uuid",
361
+ "moq" integer DEFAULT 1,
362
+ "origin" character varying(255)
363
+ );
364
+
365
+
366
+ ALTER TABLE "public"."logistic" OWNER TO "postgres";
367
+
368
+
369
+ CREATE TABLE IF NOT EXISTS "public"."prices" (
370
+ "id" "uuid" DEFAULT "gen_random_uuid"() NOT NULL,
371
+ "article_id" "uuid",
372
+ "supplier_id" "uuid",
373
+ "gross_purchase_price" numeric(15,4),
374
+ "is_blacklisted" boolean DEFAULT false,
375
+ "user_id" "uuid",
376
+ "import_id" "uuid",
377
+ "updated_at" timestamp without time zone DEFAULT CURRENT_TIMESTAMP
378
+ );
379
+
380
+
381
+ ALTER TABLE "public"."prices" OWNER TO "postgres";
382
+
383
+
384
+ CREATE TABLE IF NOT EXISTS "public"."pricing_rules" (
385
+ "id" "uuid" DEFAULT "gen_random_uuid"() NOT NULL,
386
+ "name" character varying(255),
387
+ "supplier_id" "uuid",
388
+ "type" character varying(50),
389
+ "value" real,
390
+ "description" character varying(255)
391
+ );
392
+
393
+
394
+ ALTER TABLE "public"."pricing_rules" OWNER TO "postgres";
395
+
396
+
397
+ CREATE TABLE IF NOT EXISTS "public"."supplier_discount" (
398
+ "id" "uuid" DEFAULT "gen_random_uuid"() NOT NULL,
399
+ "supplier_id" "uuid",
400
+ "created_at" timestamp without time zone DEFAULT CURRENT_TIMESTAMP,
401
+ "updated_at" timestamp without time zone DEFAULT CURRENT_TIMESTAMP
402
+ );
403
+
404
+
405
+ ALTER TABLE "public"."supplier_discount" OWNER TO "postgres";
406
+
407
+
408
+ CREATE TABLE IF NOT EXISTS "public"."supplier_discount_lines" (
409
+ "id" "uuid" DEFAULT "gen_random_uuid"() NOT NULL,
410
+ "supplier_discount_id" "uuid",
411
+ "cotation_line_id" "uuid",
412
+ "discount_amount" real,
413
+ "discount_unit_amount" real,
414
+ "quantity" integer,
415
+ "send_at" timestamp without time zone,
416
+ "created_at" timestamp without time zone DEFAULT CURRENT_TIMESTAMP,
417
+ "updated_at" timestamp without time zone DEFAULT CURRENT_TIMESTAMP
418
+ );
419
+
420
+
421
+ ALTER TABLE "public"."supplier_discount_lines" OWNER TO "postgres";
422
+
423
+
424
+ CREATE TABLE IF NOT EXISTS "public"."suppliers" (
425
+ "id" "uuid" DEFAULT "gen_random_uuid"() NOT NULL,
426
+ "name" character varying(255) NOT NULL
427
+ );
428
+
429
+
430
+ ALTER TABLE "public"."suppliers" OWNER TO "postgres";
431
+
432
+
433
+ ALTER TABLE ONLY "public"."article_brand"
434
+ ADD CONSTRAINT "article_brand_pkey" PRIMARY KEY ("id");
435
+
436
+
437
+
438
+ ALTER TABLE ONLY "public"."article_references"
439
+ ADD CONSTRAINT "article_references_pkey" PRIMARY KEY ("id");
440
+
441
+
442
+
443
+ ALTER TABLE ONLY "public"."articles"
444
+ ADD CONSTRAINT "articles_pkey" PRIMARY KEY ("id");
445
+
446
+
447
+
448
+ ALTER TABLE ONLY "public"."brand"
449
+ ADD CONSTRAINT "brand_pkey" PRIMARY KEY ("id");
450
+
451
+
452
+
453
+ ALTER TABLE ONLY "public"."categories"
454
+ ADD CONSTRAINT "categories_pkey" PRIMARY KEY ("id");
455
+
456
+
457
+
458
+ ALTER TABLE ONLY "public"."cotation_lines"
459
+ ADD CONSTRAINT "cotation_lines_pkey" PRIMARY KEY ("id");
460
+
461
+
462
+
463
+ ALTER TABLE ONLY "public"."cotations"
464
+ ADD CONSTRAINT "cotations_pkey" PRIMARY KEY ("id");
465
+
466
+
467
+
468
+ ALTER TABLE ONLY "public"."customer"
469
+ ADD CONSTRAINT "customer_pkey" PRIMARY KEY ("Id");
470
+
471
+
472
+
473
+ ALTER TABLE ONLY "public"."imports"
474
+ ADD CONSTRAINT "imports_pkey" PRIMARY KEY ("id");
475
+
476
+
477
+
478
+ ALTER TABLE ONLY "public"."logistic"
479
+ ADD CONSTRAINT "logistic_pkey" PRIMARY KEY ("id");
480
+
481
+
482
+
483
+ ALTER TABLE ONLY "public"."prices"
484
+ ADD CONSTRAINT "prices_pkey" PRIMARY KEY ("id");
485
+
486
+
487
+
488
+ ALTER TABLE ONLY "public"."pricing_rules"
489
+ ADD CONSTRAINT "pricing_rules_pkey" PRIMARY KEY ("id");
490
+
491
+
492
+
493
+ ALTER TABLE ONLY "public"."supplier_discount_lines"
494
+ ADD CONSTRAINT "supplier_discount_lines_pkey" PRIMARY KEY ("id");
495
+
496
+
497
+
498
+ ALTER TABLE ONLY "public"."supplier_discount"
499
+ ADD CONSTRAINT "supplier_discount_pkey" PRIMARY KEY ("id");
500
+
501
+
502
+
503
+ ALTER TABLE ONLY "public"."suppliers"
504
+ ADD CONSTRAINT "suppliers_pkey" PRIMARY KEY ("id");
505
+
506
+
507
+
508
+ ALTER TABLE ONLY "public"."article_brand"
509
+ ADD CONSTRAINT "article_brand_article_id_fkey" FOREIGN KEY ("article_id") REFERENCES "public"."articles"("id") ON DELETE CASCADE;
510
+
511
+
512
+
513
+ ALTER TABLE ONLY "public"."article_brand"
514
+ ADD CONSTRAINT "article_brand_brand_id_fkey" FOREIGN KEY ("brand_id") REFERENCES "public"."brand"("id") ON DELETE CASCADE;
515
+
516
+
517
+
518
+ ALTER TABLE ONLY "public"."article_references"
519
+ ADD CONSTRAINT "article_references_article_id_fkey" FOREIGN KEY ("article_id") REFERENCES "public"."articles"("id") ON DELETE CASCADE;
520
+
521
+
522
+
523
+ ALTER TABLE ONLY "public"."articles"
524
+ ADD CONSTRAINT "articles_category_id_fkey" FOREIGN KEY ("category_id") REFERENCES "public"."categories"("id");
525
+
526
+
527
+
528
+ ALTER TABLE ONLY "public"."categories"
529
+ ADD CONSTRAINT "categories_index_id_fkey" FOREIGN KEY ("index_id") REFERENCES "public"."categories"("id");
530
+
531
+
532
+
533
+ ALTER TABLE ONLY "public"."cotation_lines"
534
+ ADD CONSTRAINT "cotation_lines_article_id_fkey" FOREIGN KEY ("article_id") REFERENCES "public"."articles"("id");
535
+
536
+
537
+
538
+ ALTER TABLE ONLY "public"."cotation_lines"
539
+ ADD CONSTRAINT "cotation_lines_cotation_id_fkey" FOREIGN KEY ("cotation_id") REFERENCES "public"."cotations"("id") ON DELETE CASCADE;
540
+
541
+
542
+
543
+ ALTER TABLE ONLY "public"."cotation_lines"
544
+ ADD CONSTRAINT "cotation_lines_final_supplier_id_fkey" FOREIGN KEY ("final_supplier_id") REFERENCES "public"."suppliers"("id");
545
+
546
+
547
+
548
+ ALTER TABLE ONLY "public"."cotations"
549
+ ADD CONSTRAINT "cotations_client_id_fkey" FOREIGN KEY ("client_id") REFERENCES "public"."customer"("Id");
550
+
551
+
552
+
553
+ ALTER TABLE ONLY "public"."logistic"
554
+ ADD CONSTRAINT "logistic_article_id_fkey" FOREIGN KEY ("article_id") REFERENCES "public"."articles"("id") ON DELETE CASCADE;
555
+
556
+
557
+
558
+ ALTER TABLE ONLY "public"."prices"
559
+ ADD CONSTRAINT "prices_article_id_fkey" FOREIGN KEY ("article_id") REFERENCES "public"."articles"("id") ON DELETE CASCADE;
560
+
561
+
562
+
563
+ ALTER TABLE ONLY "public"."prices"
564
+ ADD CONSTRAINT "prices_import_id_fkey" FOREIGN KEY ("import_id") REFERENCES "public"."imports"("id");
565
+
566
+
567
+
568
+ ALTER TABLE ONLY "public"."prices"
569
+ ADD CONSTRAINT "prices_supplier_id_fkey" FOREIGN KEY ("supplier_id") REFERENCES "public"."suppliers"("id");
570
+
571
+
572
+
573
+ ALTER TABLE ONLY "public"."pricing_rules"
574
+ ADD CONSTRAINT "pricing_rules_supplier_id_fkey" FOREIGN KEY ("supplier_id") REFERENCES "public"."suppliers"("id");
575
+
576
+
577
+
578
+ ALTER TABLE ONLY "public"."supplier_discount_lines"
579
+ ADD CONSTRAINT "supplier_discount_lines_cotation_line_id_fkey" FOREIGN KEY ("cotation_line_id") REFERENCES "public"."cotation_lines"("id");
580
+
581
+
582
+
583
+ ALTER TABLE ONLY "public"."supplier_discount_lines"
584
+ ADD CONSTRAINT "supplier_discount_lines_supplier_discount_id_fkey" FOREIGN KEY ("supplier_discount_id") REFERENCES "public"."supplier_discount"("id") ON DELETE CASCADE;
585
+
586
+
587
+
588
+ ALTER TABLE ONLY "public"."supplier_discount"
589
+ ADD CONSTRAINT "supplier_discount_supplier_id_fkey" FOREIGN KEY ("supplier_id") REFERENCES "public"."suppliers"("id");
590
+
591
+
592
+
593
+ ALTER TABLE "public"."article_brand" ENABLE ROW LEVEL SECURITY;
594
+
595
+
596
+ ALTER TABLE "public"."article_references" ENABLE ROW LEVEL SECURITY;
597
+
598
+
599
+ ALTER TABLE "public"."articles" ENABLE ROW LEVEL SECURITY;
600
+
601
+
602
+ ALTER TABLE "public"."brand" ENABLE ROW LEVEL SECURITY;
603
+
604
+
605
+ ALTER TABLE "public"."categories" ENABLE ROW LEVEL SECURITY;
606
+
607
+
608
+ ALTER TABLE "public"."cotation_lines" ENABLE ROW LEVEL SECURITY;
609
+
610
+
611
+ ALTER TABLE "public"."cotations" ENABLE ROW LEVEL SECURITY;
612
+
613
+
614
+ ALTER TABLE "public"."customer" ENABLE ROW LEVEL SECURITY;
615
+
616
+
617
+ ALTER TABLE "public"."imports" ENABLE ROW LEVEL SECURITY;
618
+
619
+
620
+ ALTER TABLE "public"."logistic" ENABLE ROW LEVEL SECURITY;
621
+
622
+
623
+ ALTER TABLE "public"."prices" ENABLE ROW LEVEL SECURITY;
624
+
625
+
626
+ ALTER TABLE "public"."pricing_rules" ENABLE ROW LEVEL SECURITY;
627
+
628
+
629
+ ALTER TABLE "public"."supplier_discount" ENABLE ROW LEVEL SECURITY;
630
+
631
+
632
+ ALTER TABLE "public"."supplier_discount_lines" ENABLE ROW LEVEL SECURITY;
633
+
634
+
635
+ ALTER TABLE "public"."suppliers" ENABLE ROW LEVEL SECURITY;
636
+
637
+
638
+
639
+
640
+ ALTER PUBLICATION "supabase_realtime" OWNER TO "postgres";
641
+
642
+
643
+ GRANT USAGE ON SCHEMA "public" TO "postgres";
644
+ GRANT USAGE ON SCHEMA "public" TO "anon";
645
+ GRANT USAGE ON SCHEMA "public" TO "authenticated";
646
+ GRANT USAGE ON SCHEMA "public" TO "service_role";
647
+
648
+
649
+
650
+
651
+
652
+
653
+
654
+
655
+
656
+
657
+
658
+
659
+
660
+
661
+
662
+
663
+
664
+
665
+
666
+
667
+
668
+
669
+
670
+
671
+
672
+
673
+
674
+
675
+
676
+
677
+
678
+
679
+
680
+
681
+
682
+
683
+
684
+
685
+
686
+
687
+
688
+
689
+
690
+
691
+
692
+
693
+
694
+
695
+
696
+
697
+
698
+
699
+
700
+
701
+
702
+
703
+
704
+
705
+
706
+
707
+
708
+
709
+
710
+
711
+
712
+
713
+
714
+
715
+
716
+
717
+
718
+
719
+
720
+
721
+
722
+
723
+
724
+
725
+
726
+
727
+
728
+
729
+
730
+
731
+
732
+
733
+
734
+
735
+
736
+
737
+
738
+
739
+
740
+
741
+
742
+
743
+
744
+
745
+
746
+
747
+
748
+
749
+
750
+
751
+
752
+
753
+
754
+
755
+
756
+
757
+
758
+
759
+
760
+
761
+
762
+
763
+
764
+
765
+
766
+
767
+
768
+
769
+
770
+
771
+
772
+
773
+
774
+
775
+
776
+
777
+
778
+
779
+
780
+
781
+
782
+
783
+
784
+
785
+
786
+
787
+
788
+
789
+
790
+
791
+
792
+
793
+
794
+
795
+
796
+
797
+
798
+
799
+
800
+
801
+
802
+
803
+
804
+
805
+
806
+
807
+
808
+
809
+
810
+
811
+
812
+ GRANT ALL ON TABLE "public"."article_brand" TO "anon";
813
+ GRANT ALL ON TABLE "public"."article_brand" TO "authenticated";
814
+ GRANT ALL ON TABLE "public"."article_brand" TO "service_role";
815
+
816
+
817
+
818
+ GRANT ALL ON TABLE "public"."article_references" TO "anon";
819
+ GRANT ALL ON TABLE "public"."article_references" TO "authenticated";
820
+ GRANT ALL ON TABLE "public"."article_references" TO "service_role";
821
+
822
+
823
+
824
+ GRANT ALL ON TABLE "public"."articles" TO "anon";
825
+ GRANT ALL ON TABLE "public"."articles" TO "authenticated";
826
+ GRANT ALL ON TABLE "public"."articles" TO "service_role";
827
+
828
+
829
+
830
+ GRANT ALL ON TABLE "public"."brand" TO "anon";
831
+ GRANT ALL ON TABLE "public"."brand" TO "authenticated";
832
+ GRANT ALL ON TABLE "public"."brand" TO "service_role";
833
+
834
+
835
+
836
+ GRANT ALL ON TABLE "public"."categories" TO "anon";
837
+ GRANT ALL ON TABLE "public"."categories" TO "authenticated";
838
+ GRANT ALL ON TABLE "public"."categories" TO "service_role";
839
+
840
+
841
+
842
+ GRANT ALL ON TABLE "public"."cotation_lines" TO "anon";
843
+ GRANT ALL ON TABLE "public"."cotation_lines" TO "authenticated";
844
+ GRANT ALL ON TABLE "public"."cotation_lines" TO "service_role";
845
+
846
+
847
+
848
+ GRANT ALL ON TABLE "public"."cotations" TO "anon";
849
+ GRANT ALL ON TABLE "public"."cotations" TO "authenticated";
850
+ GRANT ALL ON TABLE "public"."cotations" TO "service_role";
851
+
852
+
853
+
854
+ GRANT ALL ON TABLE "public"."customer" TO "anon";
855
+ GRANT ALL ON TABLE "public"."customer" TO "authenticated";
856
+ GRANT ALL ON TABLE "public"."customer" TO "service_role";
857
+
858
+
859
+
860
+ GRANT ALL ON TABLE "public"."imports" TO "anon";
861
+ GRANT ALL ON TABLE "public"."imports" TO "authenticated";
862
+ GRANT ALL ON TABLE "public"."imports" TO "service_role";
863
+
864
+
865
+
866
+ GRANT ALL ON TABLE "public"."logistic" TO "anon";
867
+ GRANT ALL ON TABLE "public"."logistic" TO "authenticated";
868
+ GRANT ALL ON TABLE "public"."logistic" TO "service_role";
869
+
870
+
871
+
872
+ GRANT ALL ON TABLE "public"."prices" TO "anon";
873
+ GRANT ALL ON TABLE "public"."prices" TO "authenticated";
874
+ GRANT ALL ON TABLE "public"."prices" TO "service_role";
875
+
876
+
877
+
878
+ GRANT ALL ON TABLE "public"."pricing_rules" TO "anon";
879
+ GRANT ALL ON TABLE "public"."pricing_rules" TO "authenticated";
880
+ GRANT ALL ON TABLE "public"."pricing_rules" TO "service_role";
881
+
882
+
883
+
884
+ GRANT ALL ON TABLE "public"."supplier_discount" TO "anon";
885
+ GRANT ALL ON TABLE "public"."supplier_discount" TO "authenticated";
886
+ GRANT ALL ON TABLE "public"."supplier_discount" TO "service_role";
887
+
888
+
889
+
890
+ GRANT ALL ON TABLE "public"."supplier_discount_lines" TO "anon";
891
+ GRANT ALL ON TABLE "public"."supplier_discount_lines" TO "authenticated";
892
+ GRANT ALL ON TABLE "public"."supplier_discount_lines" TO "service_role";
893
+
894
+
895
+
896
+ GRANT ALL ON TABLE "public"."suppliers" TO "anon";
897
+ GRANT ALL ON TABLE "public"."suppliers" TO "authenticated";
898
+ GRANT ALL ON TABLE "public"."suppliers" TO "service_role";
899
+
900
+
901
+
902
+
903
+
904
+
905
+
906
+
907
+
908
+ ALTER DEFAULT PRIVILEGES FOR ROLE "postgres" IN SCHEMA "public" GRANT ALL ON SEQUENCES TO "postgres";
909
+ ALTER DEFAULT PRIVILEGES FOR ROLE "postgres" IN SCHEMA "public" GRANT ALL ON SEQUENCES TO "anon";
910
+ ALTER DEFAULT PRIVILEGES FOR ROLE "postgres" IN SCHEMA "public" GRANT ALL ON SEQUENCES TO "authenticated";
911
+ ALTER DEFAULT PRIVILEGES FOR ROLE "postgres" IN SCHEMA "public" GRANT ALL ON SEQUENCES TO "service_role";
912
+
913
+
914
+
915
+
916
+
917
+
918
+ ALTER DEFAULT PRIVILEGES FOR ROLE "postgres" IN SCHEMA "public" GRANT ALL ON FUNCTIONS TO "postgres";
919
+ ALTER DEFAULT PRIVILEGES FOR ROLE "postgres" IN SCHEMA "public" GRANT ALL ON FUNCTIONS TO "anon";
920
+ ALTER DEFAULT PRIVILEGES FOR ROLE "postgres" IN SCHEMA "public" GRANT ALL ON FUNCTIONS TO "authenticated";
921
+ ALTER DEFAULT PRIVILEGES FOR ROLE "postgres" IN SCHEMA "public" GRANT ALL ON FUNCTIONS TO "service_role";
922
+
923
+
924
+
925
+
926
+
927
+
928
+ ALTER DEFAULT PRIVILEGES FOR ROLE "postgres" IN SCHEMA "public" GRANT ALL ON TABLES TO "postgres";
929
+ ALTER DEFAULT PRIVILEGES FOR ROLE "postgres" IN SCHEMA "public" GRANT ALL ON TABLES TO "anon";
930
+ ALTER DEFAULT PRIVILEGES FOR ROLE "postgres" IN SCHEMA "public" GRANT ALL ON TABLES TO "authenticated";
931
+ ALTER DEFAULT PRIVILEGES FOR ROLE "postgres" IN SCHEMA "public" GRANT ALL ON TABLES TO "service_role";
932
+
933
+
934
+
935
+
936
+
937
+
938
+
939
+
940
+
941
+
942
+
943
+
944
+
945
+
946
+
947
+
948
+
949
+
950
+
951
+
952
+
953
+
954
+
955
+
956
+
957
+
958
+
959
+
960
+
961
+
962
+
963
+ drop extension if exists "pg_net";
964
+
965
+
tests/integration/test_prisma_smoke.py ADDED
@@ -0,0 +1,46 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ import pytest
2
+ from prisma import Prisma
3
+ from uuid import uuid4
4
+
5
+
6
+ @pytest.mark.asyncio
7
+ async def test_prisma_connect_and_basic_query() -> None:
8
+ """
9
+ Smoke test Prisma connectivity against the local Supabase database.
10
+ """
11
+ db = Prisma()
12
+ await db.connect()
13
+ try:
14
+ count = await db.articles.count()
15
+ print(f"Count: {count}")
16
+ assert isinstance(count, int)
17
+ assert count >= 0
18
+ finally:
19
+ await db.disconnect()
20
+
21
+
22
+ @pytest.mark.asyncio
23
+ async def test_prisma_create_read_delete_brand() -> None:
24
+ """
25
+ CRUD smoke test on a simple model to validate Prisma write/read/delete flow.
26
+ """
27
+ db = Prisma()
28
+ created_id: str | None = None
29
+ unique_name = f"test-brand-{uuid4().hex[:12]}"
30
+
31
+ await db.connect()
32
+ try:
33
+ created = await db.brand.create(data={"name": unique_name})
34
+ created_id = created.id
35
+ assert created.name == unique_name
36
+
37
+ fetched = await db.brand.find_unique(where={"id": created_id})
38
+ assert fetched is not None
39
+ assert fetched.name == unique_name
40
+
41
+ await db.brand.delete(where={"id": created_id})
42
+ deleted = await db.brand.find_unique(where={"id": created_id})
43
+ assert deleted is None
44
+ created_id = None
45
+ finally:
46
+ await db.disconnect()