procbay-schema 1.0.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/LICENSE +21 -0
- package/README.md +189 -0
- package/package.json +77 -0
- package/prisma/.env +13 -0
- package/prisma/migrations/20250116142512_init_user_table/migration.sql +38 -0
- package/prisma/migrations/20250116142709_init_role_table/migration.sql +20 -0
- package/prisma/migrations/20250116143847_init_user_role_table/migration.sql +20 -0
- package/prisma/migrations/20250116144035_init_permission_table/migration.sql +21 -0
- package/prisma/migrations/20250116144140_init_role_permission_table/migration.sql +21 -0
- package/prisma/migrations/20250116144233_init_department_table/migration.sql +20 -0
- package/prisma/migrations/20250116144345_init_user_department_table/migration.sql +20 -0
- package/prisma/migrations/20250116152941_init_serial_number_table/migration.sql +17 -0
- package/prisma/migrations/20250116153048_init_category_table/migration.sql +22 -0
- package/prisma/migrations/20250116153415_init_attributes_table/migration.sql +28 -0
- package/prisma/migrations/20250116153628_init_attribute_values_table/migration.sql +27 -0
- package/prisma/migrations/20250116153900_init_purchase_intake_table/migration.sql +32 -0
- package/prisma/migrations/20250116154038_init_purchase_intake_item_table/migration.sql +15 -0
- package/prisma/migrations/20250120090355_added_reset_token_column_in_user_table/migration.sql +10 -0
- package/prisma/migrations/20250120100616_init_item_table/migration.sql +42 -0
- package/prisma/migrations/20250120123720_init_vendor_table/migration.sql +39 -0
- package/prisma/migrations/20250120124526_init_vendor_categories_table/migration.sql +20 -0
- package/prisma/migrations/20250122114935_added_email_template_and_smtp_config_table/migration.sql +41 -0
- package/prisma/migrations/20250123095637_chnages_in_vendr_table/migration.sql +3 -0
- package/prisma/migrations/20250123103705_added_delated_filed_in_email_template_table/migration.sql +4 -0
- package/prisma/migrations/20250123103810_added_delated_filed_in_smtp_config_table/migration.sql +13 -0
- package/prisma/migrations/20250127123900_create_approval_heirarchy_table/migration.sql +72 -0
- package/prisma/migrations/20250128054523_make_optional_role_and_user_in_approval_hierachy/migration.sql +3 -0
- package/prisma/migrations/20250129084223_item_table_chnages/migration.sql +151 -0
- package/prisma/migrations/20250130115331_chnages_in_item_table/migration.sql +9 -0
- package/prisma/migrations/20250131054132_added_approval_journey_table/migration.sql +22 -0
- package/prisma/migrations/20250131064653_added_default_for_product_id_in_item_table/migration.sql +2 -0
- package/prisma/migrations/20250204101253_chnages_in_approval_table/migration.sql +39 -0
- package/prisma/migrations/20250206091422_added_item_document_table/migration.sql +17 -0
- package/prisma/migrations/20250207113110_added_new_column_media/migration.sql +9 -0
- package/prisma/migrations/20250207125224_added_chnages_in_pr_table/migration.sql +12 -0
- package/prisma/migrations/20250212092048_vendor_contact_table/migration.sql +30 -0
- package/prisma/migrations/20250212133620_added_tamplate_master_table/migration.sql +43 -0
- package/prisma/migrations/20250213111908_created_faq_catgory_and_faq_table/migration.sql +58 -0
- package/prisma/migrations/20250214065142_chnages_in_uom_table/migration.sql +50 -0
- package/prisma/migrations/20250217061122_corrected_email_teamplate_table/migration.sql +11 -0
- package/prisma/migrations/20250218073530_init_events/migration.sql +120 -0
- package/prisma/migrations/20250218092119_corrected_table_name/migration.sql +37 -0
- package/prisma/migrations/20250218120935_chnages_in_event_table/migration.sql +5 -0
- package/prisma/migrations/20250219083326_added_new_table_for_event_startegy/migration.sql +60 -0
- package/prisma/migrations/20250219083416_added_cms_table/migration.sql +29 -0
- package/prisma/migrations/20250219092918_alter_event_table/migration.sql +5 -0
- package/prisma/migrations/20250219093046_alter_event_to_draft/migration.sql +2 -0
- package/prisma/migrations/20250220080337_altered_event_table/migration.sql +9 -0
- package/prisma/migrations/20250221105922_added_unique_to_email_in_user_table/migration.sql +8 -0
- package/prisma/migrations/20250225063838_created_vendor_kyc_table/migration.sql +23 -0
- package/prisma/migrations/20250227060646_template_field_types_added_enum/migration.sql +14 -0
- package/prisma/migrations/20250227110306_updated_event_items_and_event_vendor_table/migration.sql +7 -0
- package/prisma/migrations/20250228060440_added_country_code_in_vendor_contact_person/migration.sql +2 -0
- package/prisma/migrations/20250228095319_init_currencies_table/migration.sql +23 -0
- package/prisma/migrations/20250303082614_added_support_ticket_table/migration.sql +89 -0
- package/prisma/migrations/20250304050248_alter_support_ticket_relations/migration.sql +35 -0
- package/prisma/migrations/20250304050613_alter_support_ticket_realtions/migration.sql +36 -0
- package/prisma/migrations/20250304061954_init_support_category_table/migration.sql +261 -0
- package/prisma/migrations/20250304092346_alter_event_vendor_table/migration.sql +2 -0
- package/prisma/migrations/20250305065430_alter_vendor_kyc_table/migration.sql +2 -0
- package/prisma/migrations/20250305111735_alter_vendor_and_user_table/migration.sql +5 -0
- package/prisma/migrations/20250307033751_alter_token_version_in_user_and_vendor_token/migration.sql +5 -0
- package/prisma/migrations/20250307034907_alter_user_and_vendor_table/migration.sql +14 -0
- package/prisma/migrations/20250307064359_chnages_in_approval_herarcy_table/migration.sql +2 -0
- package/prisma/migrations/20250307105352_alter_itme_and_vendorkyc_table/migration.sql +21 -0
- package/prisma/migrations/20250310103914_init_vendor_status_table/migration.sql +21 -0
- package/prisma/migrations/20250310105209_alter_vendor_status_table/migration.sql +18 -0
- package/prisma/migrations/20250310105413_init_vendor_kyc_status_table/migration.sql +23 -0
- package/prisma/migrations/20250311090552_alter_vendor_kyc_status_table/migration.sql +2 -0
- package/prisma/migrations/20250312055258_alter_status_column_in_event_vendors/migration.sql +12 -0
- package/prisma/migrations/20250312072145_init_vendor_event_watchlist_table/migration.sql +26 -0
- package/prisma/migrations/20250312083842_alter_vendor_event_watchlisst_table/migration.sql +41 -0
- package/prisma/migrations/20250312134730_added_chnages_in_kyc_table/migration.sql +19 -0
- package/prisma/migrations/20250317040841_init_admin_and_vendor_tables/migration.sql +38 -0
- package/prisma/migrations/20250317044110_alter_event_vendor_table/migration.sql +2 -0
- package/prisma/migrations/20250317071807_alter_rejected_reason_in_approval_journey_and_purchase_intak_table/migration.sql +5 -0
- package/prisma/migrations/20250318085504_init_customer_notification_table/migration.sql +31 -0
- package/prisma/migrations/20250318085856_alter_purchase_intake_table/migration.sql +18 -0
- package/prisma/migrations/20250319085159_alter_purchase_intake_table/migration.sql +12 -0
- package/prisma/migrations/20250320093356_init_bid_and_bidlog_table/migration.sql +75 -0
- package/prisma/migrations/20250320095501_alter_email_template_table/migration.sql +2 -0
- package/prisma/migrations/20250321053926_alter_approval_journey_table/migration.sql +2 -0
- package/prisma/migrations/20250324040851_alter_bidlog_table/migration.sql +2 -0
- package/prisma/migrations/20250324091328_init_form_master_and_dynamic_form_table/migration.sql +53 -0
- package/prisma/migrations/20250324103742_alter_bidlog_table/migration.sql +5 -0
- package/prisma/migrations/20250325052714_alter_form_master_table/migration.sql +27 -0
- package/prisma/migrations/20250327011625_init_module_and_tenant_configuration_table/migration.sql +39 -0
- package/prisma/migrations/20250403054008_alter_purchase_intake_table/migration.sql +5 -0
- package/prisma/migrations/20250404115613_init_approval_level_user/migration.sql +98 -0
- package/prisma/migrations/20250410060521_alter_approval_journey_enums/migration.sql +12 -0
- package/prisma/migrations/20250410110823_alter_purchase_intake/migration.sql +2 -0
- package/prisma/migrations/20250411062955_alter_template_field_table/migration.sql +2 -0
- package/prisma/migrations/20250414065640_alter_template/migration.sql +2 -0
- package/prisma/migrations/20250414111856_alter_event_vendors/migration.sql +2 -0
- package/prisma/migrations/20250414125356_alter_event_vendor/migration.sql +9 -0
- package/prisma/migrations/20250415063558_alter_alert_type_enum/migration.sql +2 -0
- package/prisma/migrations/20250416062508_alter_purchase_intake_table/migration.sql +15 -0
- package/prisma/migrations/20250417090325_alter_purchase_intake_table_updated_enum/migration.sql +13 -0
- package/prisma/migrations/20250417111024_alter_purchase_intake_and_purchase_intake_item/migration.sql +16 -0
- package/prisma/migrations/20250421061732_init_quotation_and_quotation_log_tables/migration.sql +96 -0
- package/prisma/migrations/20250421112331_alter_item_table_added_unique_to_slug/migration.sql +8 -0
- package/prisma/migrations/20250422060655_init_user_activity_table/migration.sql +17 -0
- package/prisma/migrations/20250423053027_/migration.sql +9 -0
- package/prisma/migrations/20250423103233_alter_user_login_activity_table/migration.sql +5 -0
- package/prisma/migrations/20250423111141_init_location_tables/migration.sql +141 -0
- package/prisma/migrations/20250424120106_alter_event_table_added_user_relation/migration.sql +2 -0
- package/prisma/migrations/20250424141637_alter_states_table/migration.sql +11 -0
- package/prisma/migrations/20250425105131_alter_user_login_activity_table/migration.sql +9 -0
- package/prisma/migrations/20250428092626_alter_location_tables/migration.sql +34 -0
- package/prisma/migrations/20250428114301_alter_location_table/migration.sql +14 -0
- package/prisma/migrations/20250429103436_alter_event_vendor_table/migration.sql +14 -0
- package/prisma/migrations/20250429135621_alter_event_vendor_table/migration.sql +5 -0
- package/prisma/migrations/20250430094809_alter_form_master_table_added_user_relation/migration.sql +2 -0
- package/prisma/migrations/20250430103440_alter_event_table/migration.sql +3 -0
- package/prisma/migrations/20250501125411_alter_strategies_table/migration.sql +2 -0
- package/prisma/migrations/20250502065554_init_location_table/migration.sql +41 -0
- package/prisma/migrations/20250505104038_alter_bid_quotation_and_dynamic_form/migration.sql +22 -0
- package/prisma/migrations/20250505105253_alter_quotation/migration.sql +5 -0
- package/prisma/migrations/20250505124851_alter_alert_enum/migration.sql +56 -0
- package/prisma/migrations/20250505133250_init_sub_module_table/migration.sql +17 -0
- package/prisma/migrations/20250506054325_alter_event_vendor_bid_status/migration.sql +14 -0
- package/prisma/migrations/20250506102135_init_counter_offer_table/migration.sql +38 -0
- package/prisma/migrations/20250506103355_alter_bid_and_quotaion_table/migration.sql +5 -0
- package/prisma/migrations/20250506110309_alter_tenant_configuration_table/migration.sql +3 -0
- package/prisma/migrations/20250506123527_alter_vendor_kyu_infor_verification_status/migration.sql +2 -0
- package/prisma/migrations/20250507055536_alter_dynamic_form_table/migration.sql +2 -0
- package/prisma/migrations/20250507070518_alter_bid_log_and_quotation_log/migration.sql +15 -0
- package/prisma/migrations/20250507130834_alter_bid_status/migration.sql +10 -0
- package/prisma/migrations/20250508065503_alter_purchase_intake_item_table/migration.sql +16 -0
- package/prisma/migrations/20250508130119_alter_purchase_intake_item/migration.sql +13 -0
- package/prisma/migrations/20250512082244_altered_template_table_to_add_currency_id/migration.sql +12 -0
- package/prisma/migrations/20250512100817_alter_approval_journey_table/migration.sql +3 -0
- package/prisma/migrations/20250513083700_alter_item_table/migration.sql +2 -0
- package/prisma/migrations/20250514100915_alter_event_table_added_template_realtion/migration.sql +2 -0
- package/prisma/migrations/20250514103503_alter_vendor_table_added_is_kyc_approved_column/migration.sql +2 -0
- package/prisma/migrations/20250520131556_init_purchase_order_table/migration.sql +52 -0
- package/prisma/migrations/20250521113946_alter_purchase_order_status_enum/migration.sql +16 -0
- package/prisma/migrations/20250522083917_alter_event_vendor_bid_status_enum/migration.sql +17 -0
- package/prisma/migrations/20250522131610_updated_vendor_table/migration.sql +16 -0
- package/prisma/migrations/20250523051058_alter_vendor_kyc_verificaiton_status_enum/migration.sql +2 -0
- package/prisma/migrations/20250526072120_alter_vendor_table/migration.sql +16 -0
- package/prisma/migrations/20250527055351_init_purchase_order_activity_log/migration.sql +41 -0
- package/prisma/migrations/20250528060657_alter_item_tale/migration.sql +14 -0
- package/prisma/migrations/20250528061946_alter_event_item_table/migration.sql +5 -0
- package/prisma/migrations/20250528081337_alter_item_table/migration.sql +2 -0
- package/prisma/migrations/20250528081524_removed_item_id_from_item_table/migration.sql +11 -0
- package/prisma/migrations/20250528081843_alter_item_table/migration.sql +2 -0
- package/prisma/migrations/20250528094057_alter_alert_type_enum/migration.sql +11 -0
- package/prisma/migrations/20250529053721_alter_added_quantity_in_purchase_order/migration.sql +2 -0
- package/prisma/migrations/20250602055114_alter_approval_journey_parent_id_to_string/migration.sql +2 -0
- package/prisma/migrations/20250602055748_alter_event_configuration_added_rule_slug/migration.sql +2 -0
- package/prisma/migrations/20250602111042_init_user_vendor_socket_token_table/migration.sql +17 -0
- package/prisma/migrations/20250602125833_alter_bidlog_and_quoatationlog_tableto_add_json_field/migration.sql +5 -0
- package/prisma/migrations/20250603063501_alter_bid_and_quoatation_table/migration.sql +29 -0
- package/prisma/migrations/20250606015045_alter_quotation_log_table/migration.sql +2 -0
- package/prisma/migrations/20250606020918_alter_quotation_table/migration.sql +2 -0
- package/prisma/migrations/20250606022901_alter_quotation_log_table/migration.sql +3 -0
- package/prisma/migrations/20250606054914_init_event_activity_logs_table/migration.sql +35 -0
- package/prisma/migrations/20250606100634_alter_added_counter_offer_status/migration.sql +5 -0
- package/prisma/migrations/20250606100908_alter_counter_offer_table/migration.sql +2 -0
- package/prisma/migrations/20250610055710_alter_enum/migration.sql +16 -0
- package/prisma/migrations/20250610060558_alter_event_and_event_vendor_db/migration.sql +14 -0
- package/prisma/migrations/20250610091013_alter_purchase_intak_item_table/migration.sql +4 -0
- package/prisma/migrations/20250610100156_alter_purchase_intake_item_table/migration.sql +19 -0
- package/prisma/migrations/20250610125706_alter_event_table/migration.sql +6 -0
- package/prisma/migrations/20250610133613_added_timestamp/migration.sql +319 -0
- package/prisma/migrations/20250611090439_init_contact_us_table/migration.sql +23 -0
- package/prisma/migrations/20250611121005_alter_event_vendor_table/migration.sql +10 -0
- package/prisma/migrations/20250612064335_alter_tenant_configuration/migration.sql +3 -0
- package/prisma/migrations/20250612094643_alter_event_vendor_bid_status_enum/migration.sql +2 -0
- package/prisma/migrations/20250618074558_alter_updated_bid_status_and_quotation_status/migration.sql +21 -0
- package/prisma/migrations/20250618122242_alter_added_event_phase_closed/migration.sql +2 -0
- package/prisma/migrations/20250620054518_alter_event_phase/migration.sql +2 -0
- package/prisma/migrations/20250620062723_alter_event_phase/migration.sql +2 -0
- package/prisma/migrations/20250620063056_alter_event_phase/migration.sql +2 -0
- package/prisma/migrations/20250620100507_alter_event_phase/migration.sql +2 -0
- package/prisma/migrations/20250627104958_alter_counter_offer_status/migration.sql +2 -0
- package/prisma/migrations/20250702095923_alter_item_table/migration.sql +74 -0
- package/prisma/migrations/20250702120134_/migration.sql +14 -0
- package/prisma/migrations/20250702150717_alter_attribute_table/migration.sql +9 -0
- package/prisma/migrations/20250703090321_alter_item_table/migration.sql +2 -0
- package/prisma/migrations/20250707054625_alter_purchase_order_table/migration.sql +15 -0
- package/prisma/migrations/20250707111354_alter_purchase_order_table_and_init_purchase_order_item_table/migration.sql +39 -0
- package/prisma/migrations/20250707111522_alter_purchase_order_item_table/migration.sql +17 -0
- package/prisma/migrations/20250710054113_alter_bid_and_quotation_status/migration.sql +31 -0
- package/prisma/migrations/20250710070813_alter_event_status/migration.sql +2 -0
- package/prisma/migrations/20250710082332_alter_bid_and_quotations_table/migration.sql +36 -0
- package/prisma/migrations/20250714102325_init_upload_log_table/migration.sql +27 -0
- package/prisma/migrations/20250716061012_alter_event_activity_logs_to_activity_logs/migration.sql +48 -0
- package/prisma/migrations/20250716071839_init_chat_thread_chat_message_and_ai_models/migration.sql +56 -0
- package/prisma/migrations/20250716135548_alter_admin_alerts_enum/migration.sql +2 -0
- package/prisma/migrations/20250717100515_init_user_event_configuration/migration.sql +21 -0
- package/prisma/migrations/20250717101037_alter_user_event_configuration_table/migration.sql +19 -0
- package/prisma/migrations/20250718071630_alter_added_module_in_upload_logs_table/migration.sql +5 -0
- package/prisma/migrations/20250718071732_alter_module_enum/migration.sql +15 -0
- package/prisma/migrations/20250721054851_init_export_log_table/migration.sql +34 -0
- package/prisma/migrations/20250722054549_init_fiscal_year_table/migration.sql +22 -0
- package/prisma/migrations/20250722072051_alter_fiscal_year_table_added_uuid/migration.sql +14 -0
- package/prisma/migrations/20250722095259_alter_fiscal_table/migration.sql +9 -0
- package/prisma/migrations/20250723071050_alter_department_table/migration.sql +14 -0
- package/prisma/migrations/20250724071201_alter_export_upload_log_enum/migration.sql +8 -0
- package/prisma/migrations/20250725094759_new_migrate/migration.sql +2 -0
- package/prisma/migrations/20250725095012_alter_migration/migration.sql +2 -0
- package/prisma/migrations/20250728072402_init_budget_management_tables/migration.sql +80 -0
- package/prisma/migrations/migration_lock.toml +3 -0
- package/prisma/schema.prisma +2609 -0
- package/prisma/seeders/approval-hierarchy.seed.js +340 -0
- package/prisma/seeders/attribute-value.seed.js +64 -0
- package/prisma/seeders/attribute.seed.js +61 -0
- package/prisma/seeders/category.seed.js +133 -0
- package/prisma/seeders/city.seed.js +147 -0
- package/prisma/seeders/country.seed.js +282 -0
- package/prisma/seeders/currency.seed.js +41 -0
- package/prisma/seeders/customer-notification.seed.js +83 -0
- package/prisma/seeders/department.seed.js +38 -0
- package/prisma/seeders/docs/CORE_SEEDER_OPTIMIZATIONS.md +270 -0
- package/prisma/seeders/docs/GEOGRAPHIC_PERFORMANCE_OPTIMIZATIONS.md +175 -0
- package/prisma/seeders/dynamic-form.seed.js +135 -0
- package/prisma/seeders/email-template.seed.js +68 -0
- package/prisma/seeders/faq-category.seed.js +56 -0
- package/prisma/seeders/faq.seed.js +61 -0
- package/prisma/seeders/form-master.seed.js +55 -0
- package/prisma/seeders/item.seed.js +133 -0
- package/prisma/seeders/permission.seed.js +102 -0
- package/prisma/seeders/region.seed.js +78 -0
- package/prisma/seeders/role-permission.seed.js +70 -0
- package/prisma/seeders/role.seed.js +38 -0
- package/prisma/seeders/seed.js +553 -0
- package/prisma/seeders/serial-number-config.seed.js +58 -0
- package/prisma/seeders/smtp-config.seed.js +61 -0
- package/prisma/seeders/state.seed.js +170 -0
- package/prisma/seeders/strategies.seed.js +54 -0
- package/prisma/seeders/subregion.seed.js +88 -0
- package/prisma/seeders/support-category.seed.js +56 -0
- package/prisma/seeders/template.seed.js +87 -0
- package/prisma/seeders/test-core-seeders.js +276 -0
- package/prisma/seeders/user-department.seed.js +66 -0
- package/prisma/seeders/user-event-configuration.seed.js +47 -0
- package/prisma/seeders/user-role.seed.js +74 -0
- package/prisma/seeders/user.seed.js +114 -0
- package/prisma/seeders/utils/bulk-seeder.js +300 -0
- package/prisma/seeders/utils/config.js +103 -0
- package/prisma/seeders/utils/connection-manager.js +380 -0
- package/prisma/seeders/utils/content-seeder.js +472 -0
- package/prisma/seeders/utils/core-seeder.js +330 -0
- package/prisma/seeders/utils/json-loader.js +69 -0
- package/prisma/seeders/utils/performance-config.js +341 -0
- package/prisma/seeders/utils/performance-helpers.js +206 -0
- package/prisma/seeders/utils/progress-tracker.js +364 -0
- package/prisma/seeders/utils/seeder-config-mapper.js +316 -0
- package/scripts/seed-databases.js +873 -0
- package/scripts/sync-schemas.js +865 -0
- package/scripts/truncate-tables.js +1048 -0
- package/src/prisma/client.d.ts +1 -0
- package/src/prisma/client.js +4 -0
- package/src/prisma/default.d.ts +1 -0
- package/src/prisma/default.js +4 -0
- package/src/prisma/edge.d.ts +1 -0
- package/src/prisma/edge.js +2084 -0
- package/src/prisma/index-browser.js +2043 -0
- package/src/prisma/index.d.ts +202051 -0
- package/src/prisma/index.js +2113 -0
- package/src/prisma/libquery_engine-darwin.dylib.node +0 -0
- package/src/prisma/libquery_engine-darwin.dylib.node.tmp24628 +0 -0
- package/src/prisma/libquery_engine-darwin.dylib.node.tmp29464 +0 -0
- package/src/prisma/libquery_engine-debian-openssl-3.0.x.so.node +0 -0
- package/src/prisma/package.json +140 -0
- package/src/prisma/query_engine-windows.dll.node +0 -0
- package/src/prisma/query_engine-windows.dll.node.tmp4144 +0 -0
- package/src/prisma/runtime/edge-esm.js +34 -0
- package/src/prisma/runtime/edge.js +34 -0
- package/src/prisma/runtime/index-browser.d.ts +370 -0
- package/src/prisma/runtime/index-browser.js +16 -0
- package/src/prisma/runtime/library.d.ts +3647 -0
- package/src/prisma/runtime/library.js +146 -0
- package/src/prisma/runtime/react-native.js +83 -0
- package/src/prisma/runtime/wasm.js +35 -0
- package/src/prisma/schema.prisma +2609 -0
- package/src/prisma/wasm.d.ts +1 -0
- package/src/prisma/wasm.js +2043 -0
package/LICENSE
ADDED
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2025 Azhar Pathan
|
|
4
|
+
|
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
6
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
7
|
+
in the Software without restriction, including without limitation the rights
|
|
8
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
9
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
10
|
+
furnished to do so, subject to the following conditions:
|
|
11
|
+
|
|
12
|
+
The above copyright notice and this permission notice shall be included in all
|
|
13
|
+
copies or substantial portions of the Software.
|
|
14
|
+
|
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
17
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
18
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
19
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
20
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
21
|
+
SOFTWARE.
|
package/README.md
ADDED
|
@@ -0,0 +1,189 @@
|
|
|
1
|
+
# procbay-schema
|
|
2
|
+
|
|
3
|
+
A set of utilities for managing Prisma database schemas, seeding, and maintenance operations for the Procure-to-Pay system.
|
|
4
|
+
|
|
5
|
+
[](https://www.npmjs.com/package/procbay-schema)
|
|
6
|
+
[](https://opensource.org/licenses/MIT)
|
|
7
|
+
|
|
8
|
+
## Features
|
|
9
|
+
|
|
10
|
+
- **Schema Synchronization**: Easily synchronize your Prisma schema across multiple databases
|
|
11
|
+
- **Database Seeding**: Seed one or multiple databases with consistent data
|
|
12
|
+
- **Table Management**: Truncate specific tables with validation and safety features
|
|
13
|
+
- **Interactive Mode**: Select tables interactively for operations
|
|
14
|
+
- **Dry Run Support**: Preview changes before execution
|
|
15
|
+
- **Comprehensive Logging**: Clear, colorful console output with progress indicators
|
|
16
|
+
- **Error Handling**: Structured error handling with detailed feedback
|
|
17
|
+
|
|
18
|
+
## Installation
|
|
19
|
+
|
|
20
|
+
```bash
|
|
21
|
+
npm install procbay-schema
|
|
22
|
+
```
|
|
23
|
+
|
|
24
|
+
## Using Prisma Client
|
|
25
|
+
|
|
26
|
+
This package includes the full Prisma client generated from the schema, making it easy to use in your projects:
|
|
27
|
+
|
|
28
|
+
```javascript
|
|
29
|
+
import { PrismaClient } from "procbay-schema";
|
|
30
|
+
|
|
31
|
+
// Create a new Prisma client instance
|
|
32
|
+
const prisma = new PrismaClient();
|
|
33
|
+
|
|
34
|
+
async function main() {
|
|
35
|
+
// Example: Query all users
|
|
36
|
+
const users = await prisma.user.findMany({
|
|
37
|
+
include: {
|
|
38
|
+
user_roles: {
|
|
39
|
+
include: {
|
|
40
|
+
role: true,
|
|
41
|
+
},
|
|
42
|
+
},
|
|
43
|
+
},
|
|
44
|
+
});
|
|
45
|
+
|
|
46
|
+
// Example: Create a new user
|
|
47
|
+
const newUser = await prisma.user.create({
|
|
48
|
+
data: {
|
|
49
|
+
email_id: "john@example.com",
|
|
50
|
+
name: "John Doe",
|
|
51
|
+
first_name: "John",
|
|
52
|
+
last_name: "Doe",
|
|
53
|
+
status: "Active",
|
|
54
|
+
user_roles: {
|
|
55
|
+
create: {
|
|
56
|
+
role: {
|
|
57
|
+
connect: { id: 1 }, // Connect to an existing role
|
|
58
|
+
},
|
|
59
|
+
},
|
|
60
|
+
},
|
|
61
|
+
},
|
|
62
|
+
});
|
|
63
|
+
}
|
|
64
|
+
|
|
65
|
+
main()
|
|
66
|
+
.catch((e) => {
|
|
67
|
+
console.error(e);
|
|
68
|
+
process.exit(1);
|
|
69
|
+
})
|
|
70
|
+
.finally(async () => {
|
|
71
|
+
// Close the database connection when done
|
|
72
|
+
await prisma.$disconnect();
|
|
73
|
+
});
|
|
74
|
+
```
|
|
75
|
+
|
|
76
|
+
## CLI Usage
|
|
77
|
+
|
|
78
|
+
The package provides three main command-line utilities:
|
|
79
|
+
|
|
80
|
+
### Sync Database Schemas
|
|
81
|
+
|
|
82
|
+
Synchronize Prisma schema across multiple databases:
|
|
83
|
+
|
|
84
|
+
```bash
|
|
85
|
+
# Sync all databases
|
|
86
|
+
npx prisma-sync
|
|
87
|
+
|
|
88
|
+
# Sync a specific database
|
|
89
|
+
npx prisma-sync --db YOUR_DB_NAME
|
|
90
|
+
```
|
|
91
|
+
|
|
92
|
+
### Seed Databases
|
|
93
|
+
|
|
94
|
+
Seed one or multiple databases with data:
|
|
95
|
+
|
|
96
|
+
```bash
|
|
97
|
+
# Seed all databases
|
|
98
|
+
npx prisma-seed
|
|
99
|
+
|
|
100
|
+
# Seed a specific database
|
|
101
|
+
npx prisma-seed --db YOUR_DB_NAME
|
|
102
|
+
```
|
|
103
|
+
|
|
104
|
+
### Truncate Tables
|
|
105
|
+
|
|
106
|
+
Truncate specific tables in one or multiple databases:
|
|
107
|
+
|
|
108
|
+
```bash
|
|
109
|
+
# Truncate specific tables in all databases
|
|
110
|
+
npx prisma-truncate --tables table1,table2,table3
|
|
111
|
+
|
|
112
|
+
# Truncate specific tables in a single database
|
|
113
|
+
npx prisma-truncate --db YOUR_DB_NAME --tables table1,table2,table3
|
|
114
|
+
|
|
115
|
+
# Use interactive mode to select tables
|
|
116
|
+
npx prisma-truncate --db YOUR_DB_NAME --interactive
|
|
117
|
+
|
|
118
|
+
# Truncate all tables except specific ones
|
|
119
|
+
npx prisma-truncate --tables all --exclude _prisma_migrations,tenant_configurations
|
|
120
|
+
|
|
121
|
+
# Dry run (preview without executing)
|
|
122
|
+
npx prisma-truncate --db YOUR_DB_NAME --tables users,posts --dry-run
|
|
123
|
+
```
|
|
124
|
+
|
|
125
|
+
## API Usage
|
|
126
|
+
|
|
127
|
+
You can also use the package programmatically:
|
|
128
|
+
|
|
129
|
+
```javascript
|
|
130
|
+
import { syncDatabase, seedDatabase, truncateTables } from "procbay-schema";
|
|
131
|
+
|
|
132
|
+
// Sync schemas
|
|
133
|
+
syncDatabase({ db: "YOUR_DB_NAME" });
|
|
134
|
+
|
|
135
|
+
// Seed database
|
|
136
|
+
seedDatabase({ db: "YOUR_DB_NAME" });
|
|
137
|
+
|
|
138
|
+
// Truncate tables
|
|
139
|
+
truncateTables({
|
|
140
|
+
db: "YOUR_DB_NAME",
|
|
141
|
+
tables: ["users", "posts", "comments"],
|
|
142
|
+
exclude: ["migrations"],
|
|
143
|
+
dryRun: false,
|
|
144
|
+
noCascade: false,
|
|
145
|
+
noConfirm: true,
|
|
146
|
+
});
|
|
147
|
+
```
|
|
148
|
+
|
|
149
|
+
## Configuration
|
|
150
|
+
|
|
151
|
+
The package expects a standard Prisma configuration:
|
|
152
|
+
|
|
153
|
+
1. A `.env` file in your `prisma` directory containing database URLs in the format:
|
|
154
|
+
|
|
155
|
+
```
|
|
156
|
+
DATABASE_NAME_DATABASE_URL="postgresql://username:password@localhost:5432/database_name"
|
|
157
|
+
DEFAULT_DATABASE_URL="postgresql://username:password@localhost:5432/default_db"
|
|
158
|
+
```
|
|
159
|
+
|
|
160
|
+
2. A Prisma schema file at `prisma/schema.prisma`
|
|
161
|
+
|
|
162
|
+
## Schema Information
|
|
163
|
+
|
|
164
|
+
The Prisma schema included in this package contains models for a complete Procure-to-Pay system, including:
|
|
165
|
+
|
|
166
|
+
- User management (User, Role, Permission)
|
|
167
|
+
- Vendor management (Vendor, VendorCategory, VendorContactPerson)
|
|
168
|
+
- Purchase management (PurchaseIntake, PurchaseIntakeItem)
|
|
169
|
+
- Product catalog (Item, Category, Attribute)
|
|
170
|
+
- Approval workflows (ApprovalHierarchy, ApprovalLevel)
|
|
171
|
+
- And many more
|
|
172
|
+
|
|
173
|
+
## Environment Variables
|
|
174
|
+
|
|
175
|
+
- `LOG_LEVEL` - Set logging level (debug, info, warn, error, silent)
|
|
176
|
+
|
|
177
|
+
## Requirements
|
|
178
|
+
|
|
179
|
+
- Node.js >= 16.0.0
|
|
180
|
+
- Prisma >= 6.0.0
|
|
181
|
+
- PostgreSQL database
|
|
182
|
+
|
|
183
|
+
## License
|
|
184
|
+
|
|
185
|
+
MIT © Azhar Pathan
|
|
186
|
+
|
|
187
|
+
## Contributing
|
|
188
|
+
|
|
189
|
+
Contributions, issues, and feature requests are welcome! Feel free to check the [issues page](https://ntgitlab.novatechset.com/procure-2-pay/backend/schema/-/issues).
|
package/package.json
ADDED
|
@@ -0,0 +1,77 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "procbay-schema",
|
|
3
|
+
"version": "1.0.0",
|
|
4
|
+
"description": "A set of utilities for managing Prisma database schemas, seeding, and maintenance operations for the Procure-to-Pay system",
|
|
5
|
+
"main": "src/prisma/index.js",
|
|
6
|
+
"type": "module",
|
|
7
|
+
"bin": {
|
|
8
|
+
"prisma-sync": "scripts/sync-schemas.js",
|
|
9
|
+
"prisma-seed": "scripts/seed-databases.js",
|
|
10
|
+
"prisma-truncate": "scripts/truncate-tables.js"
|
|
11
|
+
},
|
|
12
|
+
"files": [
|
|
13
|
+
"prisma/seeders",
|
|
14
|
+
"prisma/migrations",
|
|
15
|
+
"prisma/.env",
|
|
16
|
+
"prisma/schema.prisma",
|
|
17
|
+
"src/prisma",
|
|
18
|
+
"package.json",
|
|
19
|
+
"README.md",
|
|
20
|
+
"LICENSE"
|
|
21
|
+
],
|
|
22
|
+
"devDependencies": {
|
|
23
|
+
"@types/bcrypt": "^5.0.2",
|
|
24
|
+
"@types/jest": "^30.0.0",
|
|
25
|
+
"eslint": "^9.30.1",
|
|
26
|
+
"husky": "^9.1.7",
|
|
27
|
+
"jest": "^29.7.0",
|
|
28
|
+
"lint-staged": "^16.1.2",
|
|
29
|
+
"prettier": "^3.6.2",
|
|
30
|
+
"prisma": "^6.7.0"
|
|
31
|
+
},
|
|
32
|
+
"dependencies": {
|
|
33
|
+
"@prisma/client": "^6.7.0",
|
|
34
|
+
"bcrypt": "^5.1.1",
|
|
35
|
+
"colors": "^1.4.0",
|
|
36
|
+
"dotenv": "^16.4.5",
|
|
37
|
+
"readline": "^1.3.0"
|
|
38
|
+
},
|
|
39
|
+
"prisma": {
|
|
40
|
+
"seed": "node prisma/seeders/seed.js"
|
|
41
|
+
},
|
|
42
|
+
"scripts": {
|
|
43
|
+
"sync-database": "node scripts/sync-schemas.js",
|
|
44
|
+
"seed-database": "node scripts/seed-databases.js",
|
|
45
|
+
"truncate-tables": "node scripts/truncate-tables.js",
|
|
46
|
+
"test": "echo \"Error: no test specified\" && exit 1",
|
|
47
|
+
"prepare": "prisma generate"
|
|
48
|
+
},
|
|
49
|
+
"keywords": [
|
|
50
|
+
"prisma",
|
|
51
|
+
"database",
|
|
52
|
+
"schema",
|
|
53
|
+
"seed",
|
|
54
|
+
"truncate",
|
|
55
|
+
"utilities",
|
|
56
|
+
"cli",
|
|
57
|
+
"postgresql",
|
|
58
|
+
"procure-to-pay",
|
|
59
|
+
"procbay"
|
|
60
|
+
],
|
|
61
|
+
"author": "Azhar Pathan <apathan@katalysttech.com>",
|
|
62
|
+
"license": "MIT",
|
|
63
|
+
"repository": {
|
|
64
|
+
"type": "gitlab",
|
|
65
|
+
"url": "https://ntgitlab.novatechset.com/procure-2-pay/backend/schema"
|
|
66
|
+
},
|
|
67
|
+
"bugs": {
|
|
68
|
+
"url": "https://ntgitlab.novatechset.com/procure-2-pay/backend/schema/-/issues"
|
|
69
|
+
},
|
|
70
|
+
"homepage": "https://ntgitlab.novatechset.com/procure-2-pay/backend/schema#readme",
|
|
71
|
+
"engines": {
|
|
72
|
+
"node": ">=16.0.0"
|
|
73
|
+
},
|
|
74
|
+
"publishConfig": {
|
|
75
|
+
"access": "public"
|
|
76
|
+
}
|
|
77
|
+
}
|
package/prisma/.env
ADDED
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
# Environment variables declared in this file are automatically made available to Prisma.
|
|
2
|
+
# See the documentation for more detail: https://pris.ly/d/prisma-schema#accessing-environment-variables-from-the-schema
|
|
3
|
+
|
|
4
|
+
# Prisma supports the native connection string format for PostgreSQL, MySQL, SQLite, SQL Server, MongoDB and CockroachDB.
|
|
5
|
+
# See the documentation for all the connection string options: https://pris.ly/d/connection-strings
|
|
6
|
+
|
|
7
|
+
DEFAULT_DATABASE_URL="postgresql://postgres:root@localhost:5432/procbay_db?schema=procbay_schema"
|
|
8
|
+
ARVIND_DATABASE_URL="postgresql://p2puser:dShd190AK0e@172.16.2.27:5432/arvind_procbay_db?schema=procbay_schema"
|
|
9
|
+
AZHAR_DATABASE_URL="postgresql://p2puser:dShd190AK0e@172.16.2.27:5432/azhar_procbay_db?schema=procbay_schema"
|
|
10
|
+
HARSH_DATABASE_URL="postgresql://p2puser:dShd190AK0e@172.16.2.27:5432/harsh_procbay_db?schema=procbay_schema"
|
|
11
|
+
VAIBHAV_DATABASE_URL="postgresql://p2puser:dShd190AK0e@172.16.2.27:5432/vaibhav_procbay_db?schema=procbay_schema"
|
|
12
|
+
DETAILED_LOGGING=true
|
|
13
|
+
LOG_LEVEL=info
|
|
@@ -0,0 +1,38 @@
|
|
|
1
|
+
-- CreateEnum
|
|
2
|
+
CREATE TYPE "StatusEnum" AS ENUM ('Active', 'InActive', 'Blocked');
|
|
3
|
+
|
|
4
|
+
-- CreateTable
|
|
5
|
+
CREATE TABLE "users" (
|
|
6
|
+
"id" SERIAL NOT NULL,
|
|
7
|
+
"unique_id" TEXT,
|
|
8
|
+
"name" TEXT,
|
|
9
|
+
"first_name" TEXT,
|
|
10
|
+
"middle_name" TEXT,
|
|
11
|
+
"last_name" TEXT,
|
|
12
|
+
"email_id" TEXT,
|
|
13
|
+
"password" TEXT,
|
|
14
|
+
"country_code" TEXT,
|
|
15
|
+
"mobile_number" TEXT,
|
|
16
|
+
"status" "StatusEnum" NOT NULL DEFAULT 'InActive',
|
|
17
|
+
"is_email_verified" BOOLEAN NOT NULL DEFAULT false,
|
|
18
|
+
"is_mobile_verified" BOOLEAN NOT NULL DEFAULT false,
|
|
19
|
+
"profile_picture" TEXT,
|
|
20
|
+
"invitation_status" BOOLEAN NOT NULL DEFAULT false,
|
|
21
|
+
"password_token" TEXT,
|
|
22
|
+
"is_logged_in" BOOLEAN NOT NULL DEFAULT false,
|
|
23
|
+
"created_at" TIMESTAMP(3) NOT NULL DEFAULT CURRENT_TIMESTAMP,
|
|
24
|
+
"created_by" INTEGER,
|
|
25
|
+
"updated_at" TIMESTAMP(3),
|
|
26
|
+
"updated_by" INTEGER,
|
|
27
|
+
"is_deleted" BOOLEAN NOT NULL DEFAULT false,
|
|
28
|
+
"deleted_at" TIMESTAMP(3),
|
|
29
|
+
"deleted_by" INTEGER,
|
|
30
|
+
|
|
31
|
+
CONSTRAINT "users_pkey" PRIMARY KEY ("id")
|
|
32
|
+
);
|
|
33
|
+
|
|
34
|
+
-- CreateIndex
|
|
35
|
+
CREATE UNIQUE INDEX "users_unique_id_key" ON "users"("unique_id");
|
|
36
|
+
|
|
37
|
+
-- CreateIndex
|
|
38
|
+
CREATE UNIQUE INDEX "users_mobile_number_key" ON "users"("mobile_number");
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
-- CreateTable
|
|
2
|
+
CREATE TABLE "roles" (
|
|
3
|
+
"id" SERIAL NOT NULL,
|
|
4
|
+
"role_name" TEXT,
|
|
5
|
+
"slug" TEXT NOT NULL,
|
|
6
|
+
"description" TEXT,
|
|
7
|
+
"is_active" BOOLEAN NOT NULL DEFAULT false,
|
|
8
|
+
"created_at" TIMESTAMP(3) NOT NULL DEFAULT CURRENT_TIMESTAMP,
|
|
9
|
+
"created_by" INTEGER,
|
|
10
|
+
"updated_at" TIMESTAMP(3),
|
|
11
|
+
"updated_by" INTEGER,
|
|
12
|
+
"is_deleted" BOOLEAN NOT NULL DEFAULT false,
|
|
13
|
+
"deleted_at" TIMESTAMP(3),
|
|
14
|
+
"deleted_by" INTEGER,
|
|
15
|
+
|
|
16
|
+
CONSTRAINT "roles_pkey" PRIMARY KEY ("id")
|
|
17
|
+
);
|
|
18
|
+
|
|
19
|
+
-- CreateIndex
|
|
20
|
+
CREATE UNIQUE INDEX "roles_slug_key" ON "roles"("slug");
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
-- CreateTable
|
|
2
|
+
CREATE TABLE "user_roles" (
|
|
3
|
+
"id" SERIAL NOT NULL,
|
|
4
|
+
"user_id" INTEGER NOT NULL,
|
|
5
|
+
"role_id" INTEGER NOT NULL,
|
|
6
|
+
"created_at" TIMESTAMP(3) NOT NULL DEFAULT CURRENT_TIMESTAMP,
|
|
7
|
+
"created_by" INTEGER,
|
|
8
|
+
"updated_at" TIMESTAMP(3),
|
|
9
|
+
"updated_by" INTEGER,
|
|
10
|
+
"deleted_at" TIMESTAMP(3),
|
|
11
|
+
"deleted_by" INTEGER,
|
|
12
|
+
|
|
13
|
+
CONSTRAINT "user_roles_pkey" PRIMARY KEY ("id")
|
|
14
|
+
);
|
|
15
|
+
|
|
16
|
+
-- AddForeignKey
|
|
17
|
+
ALTER TABLE "user_roles" ADD CONSTRAINT "user_roles_user_id_fkey" FOREIGN KEY ("user_id") REFERENCES "users"("id") ON DELETE CASCADE ON UPDATE CASCADE;
|
|
18
|
+
|
|
19
|
+
-- AddForeignKey
|
|
20
|
+
ALTER TABLE "user_roles" ADD CONSTRAINT "user_roles_role_id_fkey" FOREIGN KEY ("role_id") REFERENCES "roles"("id") ON DELETE CASCADE ON UPDATE CASCADE;
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
-- CreateTable
|
|
2
|
+
CREATE TABLE "permissions" (
|
|
3
|
+
"id" SERIAL NOT NULL,
|
|
4
|
+
"permissions_name" TEXT,
|
|
5
|
+
"slug" TEXT NOT NULL,
|
|
6
|
+
"description" TEXT,
|
|
7
|
+
"model" TEXT,
|
|
8
|
+
"is_active" BOOLEAN NOT NULL DEFAULT false,
|
|
9
|
+
"is_deleted" BOOLEAN NOT NULL DEFAULT false,
|
|
10
|
+
"created_at" TIMESTAMP(3) NOT NULL DEFAULT CURRENT_TIMESTAMP,
|
|
11
|
+
"created_by" INTEGER,
|
|
12
|
+
"updated_at" TIMESTAMP(3),
|
|
13
|
+
"updated_by" INTEGER,
|
|
14
|
+
"deleted_at" TIMESTAMP(3),
|
|
15
|
+
"deleted_by" INTEGER,
|
|
16
|
+
|
|
17
|
+
CONSTRAINT "permissions_pkey" PRIMARY KEY ("id")
|
|
18
|
+
);
|
|
19
|
+
|
|
20
|
+
-- CreateIndex
|
|
21
|
+
CREATE UNIQUE INDEX "permissions_slug_key" ON "permissions"("slug");
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
-- CreateTable
|
|
2
|
+
CREATE TABLE "role_permissions" (
|
|
3
|
+
"id" SERIAL NOT NULL,
|
|
4
|
+
"permission_id" INTEGER NOT NULL,
|
|
5
|
+
"role_id" INTEGER NOT NULL,
|
|
6
|
+
"created_at" TIMESTAMP(3) NOT NULL DEFAULT CURRENT_TIMESTAMP,
|
|
7
|
+
"created_by" INTEGER,
|
|
8
|
+
"updated_at" TIMESTAMP(3),
|
|
9
|
+
"updated_by" INTEGER,
|
|
10
|
+
"is_deleted" BOOLEAN NOT NULL DEFAULT false,
|
|
11
|
+
"deleted_at" TIMESTAMP(3),
|
|
12
|
+
"deleted_by" INTEGER,
|
|
13
|
+
|
|
14
|
+
CONSTRAINT "role_permissions_pkey" PRIMARY KEY ("id")
|
|
15
|
+
);
|
|
16
|
+
|
|
17
|
+
-- AddForeignKey
|
|
18
|
+
ALTER TABLE "role_permissions" ADD CONSTRAINT "role_permissions_permission_id_fkey" FOREIGN KEY ("permission_id") REFERENCES "permissions"("id") ON DELETE CASCADE ON UPDATE CASCADE;
|
|
19
|
+
|
|
20
|
+
-- AddForeignKey
|
|
21
|
+
ALTER TABLE "role_permissions" ADD CONSTRAINT "role_permissions_role_id_fkey" FOREIGN KEY ("role_id") REFERENCES "roles"("id") ON DELETE CASCADE ON UPDATE CASCADE;
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
-- CreateTable
|
|
2
|
+
CREATE TABLE "departments" (
|
|
3
|
+
"id" SERIAL NOT NULL,
|
|
4
|
+
"department_name" TEXT NOT NULL,
|
|
5
|
+
"department_slug" TEXT NOT NULL,
|
|
6
|
+
"description" TEXT,
|
|
7
|
+
"is_active" BOOLEAN NOT NULL DEFAULT false,
|
|
8
|
+
"created_at" TIMESTAMP(3) NOT NULL DEFAULT CURRENT_TIMESTAMP,
|
|
9
|
+
"created_by" INTEGER,
|
|
10
|
+
"updated_at" TIMESTAMP(3),
|
|
11
|
+
"updated_by" INTEGER,
|
|
12
|
+
"is_deleted" BOOLEAN NOT NULL DEFAULT false,
|
|
13
|
+
"deleted_at" TIMESTAMP(3),
|
|
14
|
+
"deleted_by" INTEGER,
|
|
15
|
+
|
|
16
|
+
CONSTRAINT "departments_pkey" PRIMARY KEY ("id")
|
|
17
|
+
);
|
|
18
|
+
|
|
19
|
+
-- CreateIndex
|
|
20
|
+
CREATE UNIQUE INDEX "departments_department_slug_key" ON "departments"("department_slug");
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
-- CreateTable
|
|
2
|
+
CREATE TABLE "user_departments" (
|
|
3
|
+
"id" SERIAL NOT NULL,
|
|
4
|
+
"user_id" INTEGER NOT NULL,
|
|
5
|
+
"department_id" INTEGER NOT NULL,
|
|
6
|
+
"created_at" TIMESTAMP(3) NOT NULL DEFAULT CURRENT_TIMESTAMP,
|
|
7
|
+
"created_by" INTEGER,
|
|
8
|
+
"updated_at" TIMESTAMP(3),
|
|
9
|
+
"updated_by" INTEGER,
|
|
10
|
+
"deleted_at" TIMESTAMP(3),
|
|
11
|
+
"deleted_by" INTEGER,
|
|
12
|
+
|
|
13
|
+
CONSTRAINT "user_departments_pkey" PRIMARY KEY ("id")
|
|
14
|
+
);
|
|
15
|
+
|
|
16
|
+
-- AddForeignKey
|
|
17
|
+
ALTER TABLE "user_departments" ADD CONSTRAINT "user_departments_user_id_fkey" FOREIGN KEY ("user_id") REFERENCES "users"("id") ON DELETE CASCADE ON UPDATE CASCADE;
|
|
18
|
+
|
|
19
|
+
-- AddForeignKey
|
|
20
|
+
ALTER TABLE "user_departments" ADD CONSTRAINT "user_departments_department_id_fkey" FOREIGN KEY ("department_id") REFERENCES "departments"("id") ON DELETE CASCADE ON UPDATE CASCADE;
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
-- CreateTable
|
|
2
|
+
CREATE TABLE "serial_number_configurations" (
|
|
3
|
+
"id" SERIAL NOT NULL,
|
|
4
|
+
"module" TEXT,
|
|
5
|
+
"alias" TEXT,
|
|
6
|
+
"initial_number" INTEGER,
|
|
7
|
+
"current_number" INTEGER,
|
|
8
|
+
"created_at" TIMESTAMP(3) DEFAULT CURRENT_TIMESTAMP,
|
|
9
|
+
|
|
10
|
+
CONSTRAINT "serial_number_configurations_pkey" PRIMARY KEY ("id")
|
|
11
|
+
);
|
|
12
|
+
|
|
13
|
+
-- CreateIndex
|
|
14
|
+
CREATE UNIQUE INDEX "serial_number_configurations_module_key" ON "serial_number_configurations"("module");
|
|
15
|
+
|
|
16
|
+
-- CreateIndex
|
|
17
|
+
CREATE INDEX "serial_number_configurations_module_idx" ON "serial_number_configurations"("module");
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
-- CreateTable
|
|
2
|
+
CREATE TABLE "categories" (
|
|
3
|
+
"id" SERIAL NOT NULL,
|
|
4
|
+
"name" TEXT,
|
|
5
|
+
"slug" TEXT,
|
|
6
|
+
"is_active" BOOLEAN NOT NULL DEFAULT true,
|
|
7
|
+
"parent_id" INTEGER NOT NULL DEFAULT 0,
|
|
8
|
+
"description" TEXT,
|
|
9
|
+
"image_url" TEXT,
|
|
10
|
+
"created_by" INTEGER,
|
|
11
|
+
"created_at" TIMESTAMP(3) NOT NULL DEFAULT CURRENT_TIMESTAMP,
|
|
12
|
+
"updated_by" INTEGER,
|
|
13
|
+
"updated_at" TIMESTAMP(3) NOT NULL,
|
|
14
|
+
"is_deleted" BOOLEAN NOT NULL DEFAULT false,
|
|
15
|
+
"deleted_by" INTEGER,
|
|
16
|
+
"deleted_at" TIMESTAMP(3),
|
|
17
|
+
|
|
18
|
+
CONSTRAINT "categories_pkey" PRIMARY KEY ("id")
|
|
19
|
+
);
|
|
20
|
+
|
|
21
|
+
-- CreateIndex
|
|
22
|
+
CREATE UNIQUE INDEX "categories_name_key" ON "categories"("name");
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
-- CreateTable
|
|
2
|
+
CREATE TABLE "attributes" (
|
|
3
|
+
"id" SERIAL NOT NULL,
|
|
4
|
+
"uuid" TEXT,
|
|
5
|
+
"category_id" INTEGER,
|
|
6
|
+
"attribute_name" TEXT,
|
|
7
|
+
"is_eequired" BOOLEAN DEFAULT false,
|
|
8
|
+
"is_active" BOOLEAN DEFAULT true,
|
|
9
|
+
"slug" TEXT,
|
|
10
|
+
"created_at" TIMESTAMP(3) DEFAULT CURRENT_TIMESTAMP,
|
|
11
|
+
"created_by" INTEGER,
|
|
12
|
+
"updated_at" TIMESTAMP(3),
|
|
13
|
+
"updated_by" INTEGER,
|
|
14
|
+
"is_deleted" BOOLEAN DEFAULT false,
|
|
15
|
+
"deleted_at" TIMESTAMP(3),
|
|
16
|
+
"deleted_by" INTEGER,
|
|
17
|
+
|
|
18
|
+
CONSTRAINT "attributes_pkey" PRIMARY KEY ("id")
|
|
19
|
+
);
|
|
20
|
+
|
|
21
|
+
-- CreateIndex
|
|
22
|
+
CREATE UNIQUE INDEX "attributes_uuid_key" ON "attributes"("uuid");
|
|
23
|
+
|
|
24
|
+
-- CreateIndex
|
|
25
|
+
CREATE UNIQUE INDEX "attributes_category_id_attribute_name_key" ON "attributes"("category_id", "attribute_name");
|
|
26
|
+
|
|
27
|
+
-- AddForeignKey
|
|
28
|
+
ALTER TABLE "attributes" ADD CONSTRAINT "attributes_category_id_fkey" FOREIGN KEY ("category_id") REFERENCES "categories"("id") ON DELETE SET NULL ON UPDATE CASCADE;
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
-- CreateTable
|
|
2
|
+
CREATE TABLE "attribute_values" (
|
|
3
|
+
"id" SERIAL NOT NULL,
|
|
4
|
+
"uuid" TEXT,
|
|
5
|
+
"attribute_id" INTEGER,
|
|
6
|
+
"attribute_value_name" TEXT,
|
|
7
|
+
"is_active" BOOLEAN NOT NULL DEFAULT true,
|
|
8
|
+
"slug" TEXT,
|
|
9
|
+
"created_at" TIMESTAMP(3) DEFAULT CURRENT_TIMESTAMP,
|
|
10
|
+
"created_by" INTEGER,
|
|
11
|
+
"updated_at" TIMESTAMP(3),
|
|
12
|
+
"updated_by" INTEGER,
|
|
13
|
+
"is_deleted" BOOLEAN DEFAULT false,
|
|
14
|
+
"deleted_at" TIMESTAMP(3),
|
|
15
|
+
"deleted_by" INTEGER,
|
|
16
|
+
|
|
17
|
+
CONSTRAINT "attribute_values_pkey" PRIMARY KEY ("id")
|
|
18
|
+
);
|
|
19
|
+
|
|
20
|
+
-- CreateIndex
|
|
21
|
+
CREATE UNIQUE INDEX "attribute_values_uuid_key" ON "attribute_values"("uuid");
|
|
22
|
+
|
|
23
|
+
-- CreateIndex
|
|
24
|
+
CREATE UNIQUE INDEX "attribute_values_attribute_id_attribute_value_name_key" ON "attribute_values"("attribute_id", "attribute_value_name");
|
|
25
|
+
|
|
26
|
+
-- AddForeignKey
|
|
27
|
+
ALTER TABLE "attribute_values" ADD CONSTRAINT "attribute_values_attribute_id_fkey" FOREIGN KEY ("attribute_id") REFERENCES "attributes"("id") ON DELETE SET NULL ON UPDATE CASCADE;
|
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
-- CreateEnum
|
|
2
|
+
CREATE TYPE "PurchaseIntakePriorityEnum" AS ENUM ('Urgent', 'High', 'Medium', 'Low');
|
|
3
|
+
|
|
4
|
+
-- CreateEnum
|
|
5
|
+
CREATE TYPE "PurchaseIntakeStatusEnum" AS ENUM ('Approved', 'InProgress', 'Pending', 'Rejected', 'Completed');
|
|
6
|
+
|
|
7
|
+
-- CreateTable
|
|
8
|
+
CREATE TABLE "purchase_intakes" (
|
|
9
|
+
"id" SERIAL NOT NULL,
|
|
10
|
+
"name_of_requestor" TEXT NOT NULL,
|
|
11
|
+
"department" TEXT NOT NULL,
|
|
12
|
+
"request_date" TIMESTAMP(3) NOT NULL DEFAULT CURRENT_TIMESTAMP,
|
|
13
|
+
"items_or_services_description" TEXT NOT NULL,
|
|
14
|
+
"quantity" INTEGER NOT NULL,
|
|
15
|
+
"priority" "PurchaseIntakePriorityEnum" NOT NULL,
|
|
16
|
+
"estimated_budget" DOUBLE PRECISION NOT NULL,
|
|
17
|
+
"pr_number" TEXT NOT NULL,
|
|
18
|
+
"status" "PurchaseIntakeStatusEnum" NOT NULL DEFAULT 'Pending',
|
|
19
|
+
"attachments" BYTEA,
|
|
20
|
+
"if_yes_attach_quotations" BYTEA,
|
|
21
|
+
"others" JSONB,
|
|
22
|
+
"is_active" BOOLEAN NOT NULL DEFAULT true,
|
|
23
|
+
"created_at" TIMESTAMP(3) NOT NULL DEFAULT CURRENT_TIMESTAMP,
|
|
24
|
+
"created_by" INTEGER,
|
|
25
|
+
"updated_by" INTEGER,
|
|
26
|
+
"updated_at" TIMESTAMP(3),
|
|
27
|
+
"is_deleted" BOOLEAN NOT NULL DEFAULT false,
|
|
28
|
+
"deleted_at" TIMESTAMP(3),
|
|
29
|
+
"deleted_by" INTEGER,
|
|
30
|
+
|
|
31
|
+
CONSTRAINT "purchase_intakes_pkey" PRIMARY KEY ("id")
|
|
32
|
+
);
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
-- CreateTable
|
|
2
|
+
CREATE TABLE "purchase_intakes_items" (
|
|
3
|
+
"id" SERIAL NOT NULL,
|
|
4
|
+
"purchase_intakes_id" INTEGER NOT NULL,
|
|
5
|
+
"item_id" INTEGER NOT NULL,
|
|
6
|
+
"quantity" INTEGER NOT NULL,
|
|
7
|
+
"unit_of_measurement" TEXT NOT NULL,
|
|
8
|
+
"location" TEXT NOT NULL,
|
|
9
|
+
"created_at" TIMESTAMP(3) NOT NULL DEFAULT CURRENT_TIMESTAMP,
|
|
10
|
+
|
|
11
|
+
CONSTRAINT "purchase_intakes_items_pkey" PRIMARY KEY ("id")
|
|
12
|
+
);
|
|
13
|
+
|
|
14
|
+
-- AddForeignKey
|
|
15
|
+
ALTER TABLE "purchase_intakes_items" ADD CONSTRAINT "purchase_intakes_items_purchase_intakes_id_fkey" FOREIGN KEY ("purchase_intakes_id") REFERENCES "purchase_intakes"("id") ON DELETE CASCADE ON UPDATE CASCADE;
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
/*
|
|
2
|
+
Warnings:
|
|
3
|
+
|
|
4
|
+
- You are about to drop the column `password_token` on the `users` table. All the data in the column will be lost.
|
|
5
|
+
|
|
6
|
+
*/
|
|
7
|
+
-- AlterTable
|
|
8
|
+
ALTER TABLE "users" DROP COLUMN "password_token",
|
|
9
|
+
ADD COLUMN "reset_token" TEXT,
|
|
10
|
+
ADD COLUMN "reset_token_expiry" TIMESTAMP(3);
|
|
@@ -0,0 +1,42 @@
|
|
|
1
|
+
-- CreateTable
|
|
2
|
+
CREATE TABLE "item" (
|
|
3
|
+
"id" SERIAL NOT NULL,
|
|
4
|
+
"uuid" TEXT,
|
|
5
|
+
"item_id" TEXT NOT NULL,
|
|
6
|
+
"category_id" INTEGER,
|
|
7
|
+
"item_code" TEXT NOT NULL,
|
|
8
|
+
"item_name" TEXT,
|
|
9
|
+
"slug" TEXT,
|
|
10
|
+
"description" TEXT,
|
|
11
|
+
"notes" TEXT,
|
|
12
|
+
"terms_and_conditions" TEXT[],
|
|
13
|
+
"keywords" TEXT[],
|
|
14
|
+
"is_active" BOOLEAN NOT NULL DEFAULT true,
|
|
15
|
+
"created_by" INTEGER,
|
|
16
|
+
"created_at" TIMESTAMP(3) NOT NULL DEFAULT CURRENT_TIMESTAMP,
|
|
17
|
+
"updated_by" INTEGER,
|
|
18
|
+
"updated_at" TIMESTAMP(3) NOT NULL,
|
|
19
|
+
"is_deleted" BOOLEAN NOT NULL DEFAULT false,
|
|
20
|
+
"deleted_by" INTEGER,
|
|
21
|
+
"deleted_at" TIMESTAMP(3),
|
|
22
|
+
|
|
23
|
+
CONSTRAINT "item_pkey" PRIMARY KEY ("id")
|
|
24
|
+
);
|
|
25
|
+
|
|
26
|
+
-- CreateIndex
|
|
27
|
+
CREATE UNIQUE INDEX "item_uuid_key" ON "item"("uuid");
|
|
28
|
+
|
|
29
|
+
-- CreateIndex
|
|
30
|
+
CREATE UNIQUE INDEX "item_item_id_key" ON "item"("item_id");
|
|
31
|
+
|
|
32
|
+
-- CreateIndex
|
|
33
|
+
CREATE UNIQUE INDEX "item_item_code_key" ON "item"("item_code");
|
|
34
|
+
|
|
35
|
+
-- CreateIndex
|
|
36
|
+
CREATE UNIQUE INDEX "item_item_name_key" ON "item"("item_name");
|
|
37
|
+
|
|
38
|
+
-- AddForeignKey
|
|
39
|
+
ALTER TABLE "item" ADD CONSTRAINT "item_category_id_fkey" FOREIGN KEY ("category_id") REFERENCES "categories"("id") ON DELETE SET NULL ON UPDATE CASCADE;
|
|
40
|
+
|
|
41
|
+
-- AddForeignKey
|
|
42
|
+
ALTER TABLE "purchase_intakes_items" ADD CONSTRAINT "purchase_intakes_items_item_id_fkey" FOREIGN KEY ("item_id") REFERENCES "item"("id") ON DELETE CASCADE ON UPDATE CASCADE;
|