Autosave: 20260517-153421
This commit is contained in:
parent
6ea9183450
commit
0c8e16aad5
BIN
assets/pasted-20260517-152417-55ebb5f9.jpg
Normal file
BIN
assets/pasted-20260517-152417-55ebb5f9.jpg
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 132 KiB |
58
db/database.sql
Normal file
58
db/database.sql
Normal file
@ -0,0 +1,58 @@
|
||||
-- database.sql
|
||||
-- Import file ini ke database yang sudah Anda buat di hosting / phpMyAdmin.
|
||||
-- Tidak memakai CREATE DATABASE supaya bisa dipakai untuk nama database apa pun.
|
||||
-- Setelah import, installer tinggal diisi sesuai host, port, nama database, username, dan password.
|
||||
|
||||
SET NAMES utf8mb4;
|
||||
SET time_zone = '+00:00';
|
||||
|
||||
CREATE TABLE IF NOT EXISTS backlink_posts (
|
||||
id INT UNSIGNED NOT NULL AUTO_INCREMENT,
|
||||
title VARCHAR(180) NOT NULL,
|
||||
slug VARCHAR(190) NOT NULL,
|
||||
category VARCHAR(80) NOT NULL DEFAULT 'Artikel',
|
||||
excerpt TEXT NOT NULL,
|
||||
content MEDIUMTEXT NOT NULL,
|
||||
cta_text VARCHAR(120) NOT NULL DEFAULT 'Kunjungi apknusa.com',
|
||||
cta_url VARCHAR(255) NOT NULL DEFAULT 'https://apknusa.com',
|
||||
featured TINYINT(1) NOT NULL DEFAULT 0,
|
||||
published_at DATETIME NOT NULL DEFAULT CURRENT_TIMESTAMP,
|
||||
created_at DATETIME NOT NULL DEFAULT CURRENT_TIMESTAMP,
|
||||
updated_at DATETIME NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP,
|
||||
PRIMARY KEY (id),
|
||||
UNIQUE KEY uniq_backlink_posts_slug (slug),
|
||||
KEY idx_backlink_posts_category (category),
|
||||
KEY idx_backlink_posts_published_at (published_at)
|
||||
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;
|
||||
|
||||
CREATE TABLE IF NOT EXISTS faqs (
|
||||
id INT UNSIGNED NOT NULL AUTO_INCREMENT,
|
||||
keywords VARCHAR(255) NOT NULL,
|
||||
answer TEXT NOT NULL,
|
||||
created_at DATETIME NOT NULL DEFAULT CURRENT_TIMESTAMP,
|
||||
updated_at DATETIME NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP,
|
||||
PRIMARY KEY (id),
|
||||
KEY idx_faqs_keywords (keywords)
|
||||
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;
|
||||
|
||||
CREATE TABLE IF NOT EXISTS messages (
|
||||
id BIGINT UNSIGNED NOT NULL AUTO_INCREMENT,
|
||||
user_message TEXT NOT NULL,
|
||||
ai_response MEDIUMTEXT NOT NULL,
|
||||
created_at DATETIME NOT NULL DEFAULT CURRENT_TIMESTAMP,
|
||||
PRIMARY KEY (id)
|
||||
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;
|
||||
|
||||
CREATE TABLE IF NOT EXISTS settings (
|
||||
id INT UNSIGNED NOT NULL AUTO_INCREMENT,
|
||||
setting_key VARCHAR(120) NOT NULL,
|
||||
setting_value TEXT NOT NULL,
|
||||
created_at DATETIME NOT NULL DEFAULT CURRENT_TIMESTAMP,
|
||||
updated_at DATETIME NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP,
|
||||
PRIMARY KEY (id),
|
||||
UNIQUE KEY uniq_settings_key (setting_key)
|
||||
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;
|
||||
|
||||
-- Catatan:
|
||||
-- 1) Isi tabel backlink_posts boleh dibiarkan kosong. Aplikasi akan mengisi contoh artikel default saat pertama dibuka.
|
||||
-- 2) Tabel faqs, messages, dan settings dipakai endpoint chat / Telegram jika nanti Anda aktifkan fitur itu.
|
||||
27
db/migrations/20260517_create_support_tables.sql
Normal file
27
db/migrations/20260517_create_support_tables.sql
Normal file
@ -0,0 +1,27 @@
|
||||
CREATE TABLE IF NOT EXISTS faqs (
|
||||
id INT UNSIGNED NOT NULL AUTO_INCREMENT,
|
||||
keywords VARCHAR(255) NOT NULL,
|
||||
answer TEXT NOT NULL,
|
||||
created_at DATETIME NOT NULL DEFAULT CURRENT_TIMESTAMP,
|
||||
updated_at DATETIME NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP,
|
||||
PRIMARY KEY (id),
|
||||
KEY idx_faqs_keywords (keywords)
|
||||
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;
|
||||
|
||||
CREATE TABLE IF NOT EXISTS messages (
|
||||
id BIGINT UNSIGNED NOT NULL AUTO_INCREMENT,
|
||||
user_message TEXT NOT NULL,
|
||||
ai_response MEDIUMTEXT NOT NULL,
|
||||
created_at DATETIME NOT NULL DEFAULT CURRENT_TIMESTAMP,
|
||||
PRIMARY KEY (id)
|
||||
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;
|
||||
|
||||
CREATE TABLE IF NOT EXISTS settings (
|
||||
id INT UNSIGNED NOT NULL AUTO_INCREMENT,
|
||||
setting_key VARCHAR(120) NOT NULL,
|
||||
setting_value TEXT NOT NULL,
|
||||
created_at DATETIME NOT NULL DEFAULT CURRENT_TIMESTAMP,
|
||||
updated_at DATETIME NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP,
|
||||
PRIMARY KEY (id),
|
||||
UNIQUE KEY uniq_settings_key (setting_key)
|
||||
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;
|
||||
@ -252,14 +252,22 @@ function init_blog_storage(): void
|
||||
return;
|
||||
}
|
||||
|
||||
$migrationFile = project_root_path('db/migrations/20260517_create_backlink_posts.sql');
|
||||
$sql = is_file($migrationFile) ? file_get_contents($migrationFile) : false;
|
||||
|
||||
if ($sql === false || trim($sql) === '') {
|
||||
throw new RuntimeException('Blog migration file not found.');
|
||||
$migrationFiles = glob(project_root_path('db/migrations/*.sql'));
|
||||
if ($migrationFiles === false || $migrationFiles === []) {
|
||||
throw new RuntimeException('Database migration files not found.');
|
||||
}
|
||||
|
||||
sort($migrationFiles, SORT_STRING);
|
||||
|
||||
foreach ($migrationFiles as $migrationFile) {
|
||||
$sql = file_get_contents($migrationFile);
|
||||
if ($sql === false || trim($sql) === '') {
|
||||
throw new RuntimeException('Database migration file is empty: ' . basename($migrationFile));
|
||||
}
|
||||
|
||||
db()->exec($sql);
|
||||
}
|
||||
|
||||
db()->exec($sql);
|
||||
$initialized = true;
|
||||
seed_default_posts();
|
||||
}
|
||||
|
||||
@ -2,13 +2,13 @@
|
||||
<urlset xmlns="http://www.sitemaps.org/schemas/sitemap/0.9">
|
||||
<url>
|
||||
<loc>https://baclink-apknusa-microsite-ad42.dev.flatlogic.app/</loc>
|
||||
<lastmod>2026-05-17T14:40:34+00:00</lastmod>
|
||||
<lastmod>2026-05-17T15:34:02+00:00</lastmod>
|
||||
<changefreq>daily</changefreq>
|
||||
<priority>1.0</priority>
|
||||
</url>
|
||||
<url>
|
||||
<loc>https://baclink-apknusa-microsite-ad42.dev.flatlogic.app/blog.php</loc>
|
||||
<lastmod>2026-05-17T14:40:34+00:00</lastmod>
|
||||
<lastmod>2026-05-17T15:34:02+00:00</lastmod>
|
||||
<changefreq>daily</changefreq>
|
||||
<priority>0.8</priority>
|
||||
</url>
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user