wiki:DatabaseCreation

Version 6 (modified by 231141, 6 days ago) ( diff )

--

Home

Database Creation

DDL

  • Script: DdlScript Defines the database schema, including tables, relationships, constraints, and indexes.

DML

This DML script simulates the real behavior of the application over time, rather than inserting all data at once. The key idea is that several parts of the system are interdependent, especially offer pricing, badges, and reviews.

The price of each offer is not purely random—it depends on the worker’s badge in the corresponding category. As workers progress through badge levels over time based on their reviews, offer pricing must remain aligned with their current badge status. For this reason, data generation was performed in monthly batches, enabling periodic badge recalculation and corresponding updates to price ranges.

The badge itself is calculated based on the worker’s average ratings derived from reviews accumulated over time. In other words, there is a clear dependency chain:

  • reviews → badges → offer price

Because of this dependency, the data cannot be generated in a single step. Instead, the script simulates the application timeline, where data is created in a realistic order:

  1. TaskRequests are created first
  2. Offers are generated
  3. One offer per task is accepted and Tasks are created
  4. Tasks are completed
  5. Reviews are added
  6. Badges are recalculated

This process runs in monthly batches (e.g., February → March), allowing reviews to accumulate gradually and workers to progress naturally through badge levels.

For simplicity and performance reasons, badge recalculation is not triggered after every change (such as each new review). Instead, it is performed at the end of each month, which significantly reduces computational overhead while still preserving realistic system behavior.

Views

Note: See TracWiki for help on using the wiki.