-- phpMyAdmin SQL Dump
-- version 5.1.0
-- https://www.phpmyadmin.net/
--
-- Host: localhost:3306
-- Generation Time: Oct 14, 2025 at 12:54 PM
-- Server version: 8.0.42-0ubuntu0.20.04.1
-- PHP Version: 8.0.13

SET SQL_MODE = "NO_AUTO_VALUE_ON_ZERO";
START TRANSACTION;
SET time_zone = "+00:00";


/*!40101 SET @OLD_CHARACTER_SET_CLIENT=@@CHARACTER_SET_CLIENT */;
/*!40101 SET @OLD_CHARACTER_SET_RESULTS=@@CHARACTER_SET_RESULTS */;
/*!40101 SET @OLD_COLLATION_CONNECTION=@@COLLATION_CONNECTION */;
/*!40101 SET NAMES utf8mb4 */;

--
-- Database: `proff`
--

-- --------------------------------------------------------

--
-- Table structure for table `api_usage`
--

CREATE TABLE `api_usage` (
                             `id` int NOT NULL,
                             `portal_id` bigint DEFAULT NULL,
                             `token` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_0900_ai_ci DEFAULT NULL,
                             `calllimit_per_minute` int DEFAULT '0',
                             `calllimit_per_hour` int DEFAULT '0',
                             `calllimit_per_day` int DEFAULT '0',
                             `calllimit_per_month` int DEFAULT '0',
                             `calllimit_per_year` int DEFAULT '0',
                             `calllimit_per_period` int DEFAULT '0',
                             `calls_last_minute` int DEFAULT '0',
                             `calls_last_hour` int DEFAULT '0',
                             `calls_last_day` int DEFAULT '0',
                             `calls_last_month` int DEFAULT '0',
                             `calls_last_year` int DEFAULT '0',
                             `period_start` date DEFAULT NULL,
                             `period_end` date DEFAULT NULL,
                             `period_calls` int DEFAULT '0',
                             `created_at` timestamp NULL DEFAULT CURRENT_TIMESTAMP,
                             `updated_at` timestamp NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_0900_ai_ci;

-- --------------------------------------------------------

--
-- Table structure for table `error_log`
--

CREATE TABLE `error_log` (
                             `id` int NOT NULL,
                             `type` text,
                             `description` text,
                             `friendly` text,
                             `endpoint` text CHARACTER SET utf8mb4 COLLATE utf8mb4_0900_ai_ci,
                             `portal_id` int DEFAULT NULL,
                             `created` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_0900_ai_ci;

-- --------------------------------------------------------

--
-- Table structure for table `no_businesscategories`
--

CREATE TABLE `no_businesscategories` (
                                         `id` int NOT NULL,
                                         `name` text CHARACTER SET utf8mb4 COLLATE utf8mb4_0900_ai_ci
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_0900_ai_ci;

-- --------------------------------------------------------

--
-- Table structure for table `no_cash_flow_codes`
--

CREATE TABLE `no_cash_flow_codes` (
                                      `id` int NOT NULL,
                                      `api_code` text,
                                      `no_description` text,
                                      `en_description` text
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_0900_ai_ci;

-- --------------------------------------------------------

--
-- Table structure for table `no_changes`
--

CREATE TABLE `no_changes` (
                              `id` int NOT NULL,
                              `p_id` bigint DEFAULT NULL,
                              `patch` text,
                              `createdDate` bigint DEFAULT NULL,
                              `readableCreateDate` datetime DEFAULT NULL,
                              `patchId` text,
                              `created` datetime NOT NULL DEFAULT CURRENT_TIMESTAMP
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_0900_ai_ci;

-- --------------------------------------------------------

--
-- Table structure for table `no_financial_codes`
--

CREATE TABLE `no_financial_codes` (
                                      `id` int NOT NULL,
                                      `api_code` text,
                                      `no_description` text,
                                      `en_description` text
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_0900_ai_ci;

-- --------------------------------------------------------

--
-- Table structure for table `no_nace_businesscategories`
--

CREATE TABLE `no_nace_businesscategories` (
                                              `id` int NOT NULL,
                                              `businessCategoryType` text,
                                              `countryId` text,
                                              `groupId` text,
                                              `groupText` text,
                                              `bc_id` text,
                                              `text` text
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_0900_ai_ci;

-- --------------------------------------------------------

--
-- Table structure for table `no_proff_properties`
--

CREATE TABLE `no_proff_properties` (
                                       `id` int NOT NULL,
                                       `name` text,
                                       `description` text
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_0900_ai_ci;

-- --------------------------------------------------------

--
-- Table structure for table `portal_settings`
--

CREATE TABLE `portal_settings` (
                                   `id` int NOT NULL,
                                   `portal_id` int DEFAULT NULL,
                                   `settings` text,
                                   `properties` text,
                                   `created` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_0900_ai_ci;

-- --------------------------------------------------------

--
-- Table structure for table `portal_usage`
--

CREATE TABLE `portal_usage` (
                                `id` int NOT NULL,
                                `update_company_id` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_0900_ai_ci DEFAULT NULL,
                                `update_company_name` text CHARACTER SET utf8mb4 COLLATE utf8mb4_0900_ai_ci,
                                `update_company_org_nr` varchar(255) DEFAULT NULL,
                                `user_email` text,
                                `portal_id` int DEFAULT NULL,
                                `created` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_0900_ai_ci;

-- --------------------------------------------------------

--
-- Table structure for table `stripe_users`
--

CREATE TABLE `stripe_users` (
                                `id` bigint UNSIGNED NOT NULL,
                                `email` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_0900_ai_ci DEFAULT NULL,
                                `name` varchar(255) DEFAULT NULL,
                                `stripe_customer_id` varchar(64) DEFAULT NULL,
                                `created_at` timestamp NULL DEFAULT CURRENT_TIMESTAMP,
                                `updated_at` timestamp NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_0900_ai_ci;

-- --------------------------------------------------------

--
-- Table structure for table `stripe_webhook_events`
--

CREATE TABLE `stripe_webhook_events` (
                                         `id` bigint UNSIGNED NOT NULL,
                                         `event_id` varchar(64) NOT NULL,
                                         `type` varchar(128) NOT NULL,
                                         `livemode` tinyint(1) NOT NULL,
                                         `payload_json` json NOT NULL,
                                         `processed` tinyint(1) NOT NULL DEFAULT '0',
                                         `processed_at` datetime DEFAULT NULL,
                                         `created_at` timestamp NULL DEFAULT CURRENT_TIMESTAMP
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_0900_ai_ci;

-- --------------------------------------------------------

--
-- Table structure for table `success_log`
--

CREATE TABLE `success_log` (
                               `id` int NOT NULL,
                               `type` text CHARACTER SET utf8mb4 COLLATE utf8mb4_0900_ai_ci,
                               `description` text CHARACTER SET utf8mb4 COLLATE utf8mb4_0900_ai_ci,
                               `portal_id` int DEFAULT NULL,
                               `endpoint` varchar(255) DEFAULT NULL,
                               `created` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_0900_ai_ci;

-- --------------------------------------------------------

--
-- Table structure for table `system_log`
--

CREATE TABLE `system_log` (
                              `id` int NOT NULL,
                              `type` text,
                              `description` text,
                              `endpoint` varchar(255) DEFAULT NULL,
                              `portal_id` varchar(255) DEFAULT NULL,
                              `created` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_0900_ai_ci;

-- --------------------------------------------------------

--
-- Table structure for table `tokens`
--

CREATE TABLE `tokens` (
                          `id` int NOT NULL,
                          `code` text,
                          `portal_id` int DEFAULT NULL,
                          `access_token` varchar(300) DEFAULT NULL,
                          `refresh_token` varchar(300) DEFAULT NULL,
                          `expires_in` int DEFAULT NULL,
                          `created` timestamp NULL DEFAULT CURRENT_TIMESTAMP
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_0900_ai_ci;

-- --------------------------------------------------------

--
-- Table structure for table `webhook_log`
--

CREATE TABLE `webhook_log` (
                               `id` int NOT NULL,
                               `type` varchar(255) DEFAULT NULL,
                               `data` text,
                               `portal_id` varchar(255) DEFAULT NULL,
                               `system` varchar(255) DEFAULT NULL,
                               `created` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_0900_ai_ci;

--
-- Indexes for dumped tables
--

--
-- Indexes for table `api_usage`
--
ALTER TABLE `api_usage`
    ADD PRIMARY KEY (`id`);

--
-- Indexes for table `error_log`
--
ALTER TABLE `error_log`
    ADD PRIMARY KEY (`id`);

--
-- Indexes for table `no_businesscategories`
--
ALTER TABLE `no_businesscategories`
    ADD PRIMARY KEY (`id`);

--
-- Indexes for table `no_cash_flow_codes`
--
ALTER TABLE `no_cash_flow_codes`
    ADD PRIMARY KEY (`id`);

--
-- Indexes for table `no_changes`
--
ALTER TABLE `no_changes`
    ADD PRIMARY KEY (`id`),
  ADD UNIQUE KEY `p_id` (`p_id`);

--
-- Indexes for table `no_financial_codes`
--
ALTER TABLE `no_financial_codes`
    ADD PRIMARY KEY (`id`);

--
-- Indexes for table `no_nace_businesscategories`
--
ALTER TABLE `no_nace_businesscategories`
    ADD PRIMARY KEY (`id`);

--
-- Indexes for table `no_proff_properties`
--
ALTER TABLE `no_proff_properties`
    ADD PRIMARY KEY (`id`);

--
-- Indexes for table `portal_settings`
--
ALTER TABLE `portal_settings`
    ADD PRIMARY KEY (`id`);

--
-- Indexes for table `portal_usage`
--
ALTER TABLE `portal_usage`
    ADD PRIMARY KEY (`id`);

--
-- Indexes for table `stripe_users`
--
ALTER TABLE `stripe_users`
    ADD PRIMARY KEY (`id`),
  ADD UNIQUE KEY `email` (`email`),
  ADD UNIQUE KEY `stripe_customer_id` (`stripe_customer_id`);

--
-- Indexes for table `stripe_webhook_events`
--
ALTER TABLE `stripe_webhook_events`
    ADD PRIMARY KEY (`id`),
  ADD UNIQUE KEY `event_id` (`event_id`);

--
-- Indexes for table `success_log`
--
ALTER TABLE `success_log`
    ADD PRIMARY KEY (`id`);

--
-- Indexes for table `system_log`
--
ALTER TABLE `system_log`
    ADD PRIMARY KEY (`id`);

--
-- Indexes for table `tokens`
--
ALTER TABLE `tokens`
    ADD PRIMARY KEY (`id`);

--
-- Indexes for table `webhook_log`
--
ALTER TABLE `webhook_log`
    ADD PRIMARY KEY (`id`);

--
-- AUTO_INCREMENT for dumped tables
--

--
-- AUTO_INCREMENT for table `api_usage`
--
ALTER TABLE `api_usage`
    MODIFY `id` int NOT NULL AUTO_INCREMENT;

--
-- AUTO_INCREMENT for table `error_log`
--
ALTER TABLE `error_log`
    MODIFY `id` int NOT NULL AUTO_INCREMENT;

--
-- AUTO_INCREMENT for table `no_businesscategories`
--
ALTER TABLE `no_businesscategories`
    MODIFY `id` int NOT NULL AUTO_INCREMENT;

--
-- AUTO_INCREMENT for table `no_cash_flow_codes`
--
ALTER TABLE `no_cash_flow_codes`
    MODIFY `id` int NOT NULL AUTO_INCREMENT;

--
-- AUTO_INCREMENT for table `no_changes`
--
ALTER TABLE `no_changes`
    MODIFY `id` int NOT NULL AUTO_INCREMENT;

--
-- AUTO_INCREMENT for table `no_financial_codes`
--
ALTER TABLE `no_financial_codes`
    MODIFY `id` int NOT NULL AUTO_INCREMENT;

--
-- AUTO_INCREMENT for table `no_nace_businesscategories`
--
ALTER TABLE `no_nace_businesscategories`
    MODIFY `id` int NOT NULL AUTO_INCREMENT;

--
-- AUTO_INCREMENT for table `no_proff_properties`
--
ALTER TABLE `no_proff_properties`
    MODIFY `id` int NOT NULL AUTO_INCREMENT;

--
-- AUTO_INCREMENT for table `portal_settings`
--
ALTER TABLE `portal_settings`
    MODIFY `id` int NOT NULL AUTO_INCREMENT;

--
-- AUTO_INCREMENT for table `portal_usage`
--
ALTER TABLE `portal_usage`
    MODIFY `id` int NOT NULL AUTO_INCREMENT;

--
-- AUTO_INCREMENT for table `stripe_users`
--
ALTER TABLE `stripe_users`
    MODIFY `id` bigint UNSIGNED NOT NULL AUTO_INCREMENT;

--
-- AUTO_INCREMENT for table `stripe_webhook_events`
--
ALTER TABLE `stripe_webhook_events`
    MODIFY `id` bigint UNSIGNED NOT NULL AUTO_INCREMENT;

--
-- AUTO_INCREMENT for table `success_log`
--
ALTER TABLE `success_log`
    MODIFY `id` int NOT NULL AUTO_INCREMENT;

--
-- AUTO_INCREMENT for table `system_log`
--
ALTER TABLE `system_log`
    MODIFY `id` int NOT NULL AUTO_INCREMENT;

--
-- AUTO_INCREMENT for table `tokens`
--
ALTER TABLE `tokens`
    MODIFY `id` int NOT NULL AUTO_INCREMENT;

--
-- AUTO_INCREMENT for table `webhook_log`
--
ALTER TABLE `webhook_log`
    MODIFY `id` int NOT NULL AUTO_INCREMENT;
COMMIT;

/*!40101 SET CHARACTER_SET_CLIENT=@OLD_CHARACTER_SET_CLIENT */;
/*!40101 SET CHARACTER_SET_RESULTS=@OLD_CHARACTER_SET_RESULTS */;
/*!40101 SET COLLATION_CONNECTION=@OLD_COLLATION_CONNECTION */;
