---
description: Execute the Below in your Database and its all Done!!
---

# Installation Guide

***

## **Step 1: SQL Modifications**

You must execute the SQL code to set up the necessary database tables.

#### **Instructions**

1. Open your database management tool (e.g., phpMyAdmin or HeidiSQL).
2. Select Your Database.
3. Run the following SQL code to create the required tables:

```sql
CREATE TABLE `ammunationshops` (
	`location` INT(11) NOT NULL,
	`owned` INT(11) NULL DEFAULT NULL,
	`owner` VARCHAR(46) NULL DEFAULT NULL COLLATE 'utf8mb3_general_ci',
	`stash` LONGTEXT NULL DEFAULT '[]' COLLATE 'utf8mb3_general_ci',
	`price` INT(11) NULL DEFAULT NULL,
	`date_purchased` DATE NULL DEFAULT NULL,
	`level` INT(11) NULL DEFAULT '1',
	`name` VARCHAR(50) NULL DEFAULT NULL COLLATE 'utf8mb3_general_ci',
	`money` INT(11) NULL DEFAULT '0',
	`total_earnings` DECIMAL(15,2) NULL DEFAULT '0.00',
	`total_expenses` DECIMAL(15,2) NULL DEFAULT '0.00',
	PRIMARY KEY (`location`) USING BTREE
)
COLLATE='utf8mb3_general_ci'
ENGINE=InnoDB
;

CREATE TABLE `ammunation_employees` (
	`id` INT(11) NOT NULL AUTO_INCREMENT,
	`shop_id` VARCHAR(50) NOT NULL COLLATE 'utf8mb4_unicode_ci',
	`citizenid` VARCHAR(50) NOT NULL COLLATE 'utf8mb4_unicode_ci',
	`name` VARCHAR(100) NOT NULL COLLATE 'utf8mb4_unicode_ci',
	`grade` INT(11) NOT NULL DEFAULT '1',
	`salary` DECIMAL(10,2) NOT NULL DEFAULT '50.00',
	`hired_date` DATETIME NOT NULL DEFAULT current_timestamp(),
	`last_active` DATETIME NULL DEFAULT NULL,
	`status` ENUM('active','fired','inactive','suspended') NOT NULL DEFAULT 'active' COLLATE 'utf8mb4_unicode_ci',
	`total_earned` DECIMAL(15,2) NOT NULL DEFAULT '0.00',
	`hours_worked` INT(11) NOT NULL DEFAULT '0',
	`permissions` TEXT NULL DEFAULT NULL COLLATE 'utf8mb4_unicode_ci',
	`created_at` DATETIME NOT NULL DEFAULT current_timestamp(),
	`updated_at` DATETIME NOT NULL DEFAULT current_timestamp() ON UPDATE current_timestamp(),
	PRIMARY KEY (`id`) USING BTREE,
	UNIQUE INDEX `unique_shop_employee` (`shop_id`, `citizenid`) USING BTREE,
	INDEX `idx_shop_id` (`shop_id`) USING BTREE,
	INDEX `idx_citizenid` (`citizenid`) USING BTREE,
	INDEX `idx_status` (`status`) USING BTREE
)
COLLATE='utf8mb4_unicode_ci'
ENGINE=InnoDB
AUTO_INCREMENT=1
;

CREATE TABLE `ammunation_employee_logs` (
	`id` INT(11) NOT NULL AUTO_INCREMENT,
	`employee_id` INT(11) NOT NULL,
	`shop_id` VARCHAR(50) NOT NULL COLLATE 'utf8mb4_unicode_ci',
	`action_type` ENUM('clock_in','clock_out','payment','promotion','demotion','hire','fire','payment_request','payment_declined') NOT NULL COLLATE 'utf8mb4_unicode_ci',
	`hours_worked` DECIMAL(5,2) NULL DEFAULT NULL,
	`amount_paid` DECIMAL(10,2) NULL DEFAULT NULL,
	`old_grade` INT(11) NULL DEFAULT NULL,
	`new_grade` INT(11) NULL DEFAULT NULL,
	`notes` TEXT NULL DEFAULT NULL COLLATE 'utf8mb4_unicode_ci',
	`created_at` DATETIME NOT NULL DEFAULT current_timestamp(),
	PRIMARY KEY (`id`) USING BTREE,
	INDEX `idx_employee_id` (`employee_id`) USING BTREE,
	INDEX `idx_shop_id` (`shop_id`) USING BTREE,
	INDEX `idx_action_type` (`action_type`) USING BTREE,
	CONSTRAINT `ammunation_employee_logs_ibfk_1` FOREIGN KEY (`employee_id`) REFERENCES `ammunation_employees` (`id`) ON UPDATE CASCADE ON DELETE CASCADE
)
COLLATE='utf8mb4_unicode_ci'
ENGINE=InnoDB
AUTO_INCREMENT=1
;

CREATE TABLE `ammunation_transactions` (
	`id` INT(11) NOT NULL AUTO_INCREMENT,
	`shop_id` VARCHAR(50) NOT NULL COLLATE 'utf8mb4_general_ci',
	`transaction_type` ENUM('sale','expense','withdrawal','restock','upgrade','deposit') NOT NULL COLLATE 'utf8mb4_general_ci',
	`amount` DECIMAL(15,2) NOT NULL,
	`description` VARCHAR(255) NOT NULL COLLATE 'utf8mb4_general_ci',
	`customer_name` VARCHAR(100) NULL DEFAULT NULL COLLATE 'utf8mb4_general_ci',
	`category` VARCHAR(50) NOT NULL COLLATE 'utf8mb4_general_ci',
	`status` ENUM('completed','pending','failed') NULL DEFAULT 'completed' COLLATE 'utf8mb4_general_ci',
	`created_at` TIMESTAMP NOT NULL DEFAULT current_timestamp(),
	PRIMARY KEY (`id`) USING BTREE,
	INDEX `shop_id` (`shop_id`) USING BTREE,
	INDEX `transaction_type` (`transaction_type`) USING BTREE,
	INDEX `created_at` (`created_at`) USING BTREE
)
COLLATE='utf8mb4_general_ci'
ENGINE=InnoDB
AUTO_INCREMENT=80
;
```



***

## **Step 2:** Configure the `Config.lua` File

Customize the `Config.lua` file based on your preferences and requirements. Ensure the settings align with your server's intended functionality and features.

***
