File tree Expand file tree Collapse file tree 5 files changed +47
-3
lines changed
Expand file tree Collapse file tree 5 files changed +47
-3
lines changed Original file line number Diff line number Diff line change @@ -106,7 +106,7 @@ export const admin = new AdminForth({
106106 cars_MyS_resource ,
107107 cars_PG_resource ,
108108 cars_Mongo_resource ,
109- // cars_Ch_resource,
109+ //cars_Ch_resource,
110110 passkeysResource ,
111111 carsDescriptionImage ,
112112 translations ,
@@ -229,6 +229,23 @@ if (fileURLToPath(import.meta.url) === path.resolve(process.argv[1])) {
229229 } ;
230230 }
231231
232+ if ( await admin . resource ( 'cars_mysql' ) . count ( ) === 0 ) {
233+ for ( let i = 0 ; i < 100 ; i ++ ) {
234+ const engine_type = ENGINE_TYPES [ Math . floor ( Math . random ( ) * ENGINE_TYPES . length ) ] . value ;
235+ await admin . resource ( 'cars_mysql' ) . create ( {
236+ id : `${ i } ` ,
237+ model : `${ FICTIONAL_CAR_BRANDS [ Math . floor ( Math . random ( ) * FICTIONAL_CAR_BRANDS . length ) ] } ${ FICTIONAL_CAR_MODELS_BY_BRAND [ FICTIONAL_CAR_BRANDS [ Math . floor ( Math . random ( ) * FICTIONAL_CAR_BRANDS . length ) ] ] [ Math . floor ( Math . random ( ) * 4 ) ] } ` ,
238+ price : ( Math . random ( ) * 10000 ) . toFixed ( 2 ) ,
239+ engine_type : engine_type ,
240+ engine_power : engine_type === 'electric' ? null : Math . floor ( Math . random ( ) * 400 ) + 100 ,
241+ production_year : Math . floor ( Math . random ( ) * 31 ) + 1990 ,
242+ listed : i % 2 == 0 ,
243+ mileage : `${ Math . floor ( Math . random ( ) * 200000 ) } ` ,
244+ body_type : BODY_TYPES [ Math . floor ( Math . random ( ) * BODY_TYPES . length ) ] . value ,
245+ } ) ;
246+ } ;
247+ }
248+
232249 if ( await admin . resource ( 'cars_pg' ) . count ( ) === 0 ) {
233250 for ( let i = 0 ; i < 100 ; i ++ ) {
234251 const engine_type = ENGINE_TYPES [ Math . floor ( Math . random ( ) * ENGINE_TYPES . length ) ] . value ;
Original file line number Diff line number Diff line change 1717 "migrate:postgres" : " npm run _env:dev -- npx --yes prisma migrate deploy --schema=./prisma/postgres/schema.postgres.prisma" ,
1818
1919 "install-plugins" : " cd ../plugins && bash install-plugins.sh" ,
20- "install-adapters" : " cd ../adapters && bash install-adapters.sh"
20+ "install-adapters" : " cd ../adapters && bash install-adapters.sh" ,
21+
22+ "setup-dev-demo" : " npm run install-plugins && npm run install-adapters && npm install && npm run migrate:sqlite && npm run migrate:mysql && npm run migrate:postgres"
2123 },
2224 "author" : " " ,
2325 "license" : " ISC" ,
Original file line number Diff line number Diff line change 1+ -- CreateTable
2+ CREATE TABLE `cars ` (
3+ ` id` VARCHAR (191 ) NOT NULL ,
4+ ` model` VARCHAR (191 ) NOT NULL ,
5+ ` price` DOUBLE NOT NULL ,
6+ ` created_at` DATETIME(3 ) NOT NULL DEFAULT CURRENT_TIMESTAMP (3 ),
7+ ` engine_type` VARCHAR (191 ) NULL ,
8+ ` engine_power` INTEGER NULL ,
9+ ` production_year` INTEGER NULL ,
10+ ` description` VARCHAR (191 ) NULL ,
11+ ` listed` BOOLEAN NOT NULL DEFAULT false,
12+ ` mileage` DOUBLE NULL ,
13+ ` color` VARCHAR (191 ) NULL ,
14+ ` body_type` VARCHAR (191 ) NULL ,
15+ ` photos` VARCHAR (191 ) NULL ,
16+ ` seller_id` VARCHAR (191 ) NULL ,
17+ ` seller` VARCHAR (191 ) NULL ,
18+ ` promo_picture` VARCHAR (191 ) NULL ,
19+ ` generated_promo_picture` VARCHAR (191 ) NULL ,
20+
21+ PRIMARY KEY (` id` )
22+ ) DEFAULT CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci;
Original file line number Diff line number Diff line change 1+ # Please do not edit this file manually
2+ # It should be added in your version-control system (i.e. Git)
3+ provider = " mysql"
Original file line number Diff line number Diff line change @@ -19,7 +19,7 @@ import AdminForthAdapterS3Storage from '../../adapters/adminforth-storage-adapte
1919import AdminForthImageVisionAdapterOpenAi from '../../adapters/adminforth-image-vision-adapter-openai/index.js' ;
2020
2121export default {
22- dataSource : 'clikckhouse ' ,
22+ dataSource : 'clickhouse ' ,
2323 table : 'cars' ,
2424 resourceId : 'cars_ch' ,
2525 label : 'Cars' ,
You can’t perform that action at this time.
0 commit comments