Merge branch 'mikecao:master' into master

This commit is contained in:
Didier Krux 2022-06-28 13:42:56 +01:00 committed by GitHub
commit d3d000f4ea
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
13 changed files with 176 additions and 213 deletions

View file

@ -1,4 +1,4 @@
name: Create docker images
name: Create docker images (manual)
on:
workflow_dispatch:
@ -7,10 +7,6 @@ on:
type: string
description: Version
required: true
add-latest:
type: boolean
description: Add latest tag
required: false
jobs:
build:
@ -28,8 +24,7 @@ jobs:
name: Build & push Docker image for ${{ matrix.db-type }}
with:
image: umami
tags: ${{ matrix.db-type }}-${{ inputs.version }}
addLatest: ${{ inputs.add-latest }}
tags: ${{ matrix.db-type }}-${{ inputs.version }}, ${{ matrix.db-type }}-latest
buildArgs: DATABASE_TYPE=${{ matrix.db-type }}
registry: ghcr.io/${{ github.actor }}
username: ${{ github.actor }}

View file

@ -37,13 +37,14 @@ RUN addgroup --system --gid 1001 nodejs
RUN adduser --system --uid 1001 nextjs
RUN yarn global add prisma
RUN yarn add npm-run-all dotenv
# You only need to copy next.config.js if you are NOT using the default configuration
COPY --from=builder /app/next.config.js ./
COPY --from=builder /app/next.config.js .
COPY --from=builder /app/public ./public
COPY --from=builder /app/package.json ./package.json
COPY --from=builder /app/prisma/schema.prisma ./prisma/schema.prisma
COPY --from=builder /app/prisma/migrations ./prisma/migrations
COPY --from=builder /app/prisma ./prisma
COPY --from=builder /app/scripts ./scripts
# Automatically leverage output traces to reduce image size
# https://nextjs.org/docs/advanced-features/output-file-tracing

View file

@ -0,0 +1,99 @@
-- CreateTable
CREATE TABLE `account` (
`user_id` INTEGER UNSIGNED NOT NULL AUTO_INCREMENT,
`username` VARCHAR(255) NOT NULL,
`password` VARCHAR(60) NOT NULL,
`is_admin` BOOLEAN NOT NULL DEFAULT false,
`created_at` TIMESTAMP(0) NULL DEFAULT CURRENT_TIMESTAMP(0),
`updated_at` TIMESTAMP(0) NULL DEFAULT CURRENT_TIMESTAMP(0),
UNIQUE INDEX `username`(`username`),
PRIMARY KEY (`user_id`)
) DEFAULT CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci;
-- CreateTable
CREATE TABLE `event` (
`event_id` INTEGER UNSIGNED NOT NULL AUTO_INCREMENT,
`website_id` INTEGER UNSIGNED NOT NULL,
`session_id` INTEGER UNSIGNED NOT NULL,
`created_at` TIMESTAMP(0) NULL DEFAULT CURRENT_TIMESTAMP(0),
`url` VARCHAR(500) NOT NULL,
`event_type` VARCHAR(50) NOT NULL,
`event_value` VARCHAR(50) NOT NULL,
INDEX `event_created_at_idx`(`created_at`),
INDEX `event_session_id_idx`(`session_id`),
INDEX `event_website_id_idx`(`website_id`),
PRIMARY KEY (`event_id`)
) DEFAULT CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci;
-- CreateTable
CREATE TABLE `pageview` (
`view_id` INTEGER UNSIGNED NOT NULL AUTO_INCREMENT,
`website_id` INTEGER UNSIGNED NOT NULL,
`session_id` INTEGER UNSIGNED NOT NULL,
`created_at` TIMESTAMP(0) NULL DEFAULT CURRENT_TIMESTAMP(0),
`url` VARCHAR(500) NOT NULL,
`referrer` VARCHAR(500) NULL,
INDEX `pageview_created_at_idx`(`created_at`),
INDEX `pageview_session_id_idx`(`session_id`),
INDEX `pageview_website_id_created_at_idx`(`website_id`, `created_at`),
INDEX `pageview_website_id_idx`(`website_id`),
INDEX `pageview_website_id_session_id_created_at_idx`(`website_id`, `session_id`, `created_at`),
PRIMARY KEY (`view_id`)
) DEFAULT CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci;
-- CreateTable
CREATE TABLE `session` (
`session_id` INTEGER UNSIGNED NOT NULL AUTO_INCREMENT,
`session_uuid` VARCHAR(36) NOT NULL,
`website_id` INTEGER UNSIGNED NOT NULL,
`created_at` TIMESTAMP(0) NULL DEFAULT CURRENT_TIMESTAMP(0),
`hostname` VARCHAR(100) NULL,
`browser` VARCHAR(20) NULL,
`os` VARCHAR(20) NULL,
`device` VARCHAR(20) NULL,
`screen` VARCHAR(11) NULL,
`language` VARCHAR(35) NULL,
`country` CHAR(2) NULL,
UNIQUE INDEX `session_uuid`(`session_uuid`),
INDEX `session_created_at_idx`(`created_at`),
INDEX `session_website_id_idx`(`website_id`),
PRIMARY KEY (`session_id`)
) DEFAULT CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci;
-- CreateTable
CREATE TABLE `website` (
`website_id` INTEGER UNSIGNED NOT NULL AUTO_INCREMENT,
`website_uuid` VARCHAR(36) NOT NULL,
`user_id` INTEGER UNSIGNED NOT NULL,
`name` VARCHAR(100) NOT NULL,
`domain` VARCHAR(500) NULL,
`share_id` VARCHAR(64) NULL,
`created_at` TIMESTAMP(0) NULL DEFAULT CURRENT_TIMESTAMP(0),
UNIQUE INDEX `website_uuid`(`website_uuid`),
UNIQUE INDEX `share_id`(`share_id`),
INDEX `website_user_id_idx`(`user_id`),
PRIMARY KEY (`website_id`)
) DEFAULT CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci;
-- AddForeignKey
ALTER TABLE `event` ADD CONSTRAINT `event_ibfk_2` FOREIGN KEY (`session_id`) REFERENCES `session`(`session_id`) ON DELETE CASCADE ON UPDATE NO ACTION;
-- AddForeignKey
ALTER TABLE `event` ADD CONSTRAINT `event_ibfk_1` FOREIGN KEY (`website_id`) REFERENCES `website`(`website_id`) ON DELETE CASCADE ON UPDATE NO ACTION;
-- AddForeignKey
ALTER TABLE `pageview` ADD CONSTRAINT `pageview_ibfk_2` FOREIGN KEY (`session_id`) REFERENCES `session`(`session_id`) ON DELETE CASCADE ON UPDATE NO ACTION;
-- AddForeignKey
ALTER TABLE `pageview` ADD CONSTRAINT `pageview_ibfk_1` FOREIGN KEY (`website_id`) REFERENCES `website`(`website_id`) ON DELETE CASCADE ON UPDATE NO ACTION;
-- AddForeignKey
ALTER TABLE `session` ADD CONSTRAINT `session_ibfk_1` FOREIGN KEY (`website_id`) REFERENCES `website`(`website_id`) ON DELETE CASCADE ON UPDATE NO ACTION;
-- AddForeignKey
ALTER TABLE `website` ADD CONSTRAINT `website_ibfk_1` FOREIGN KEY (`user_id`) REFERENCES `account`(`user_id`) ON DELETE CASCADE ON UPDATE NO ACTION;

View file

@ -1,102 +0,0 @@
-- CreateTable
CREATE TABLE `account` (
`user_id` INTEGER UNSIGNED NOT NULL AUTO_INCREMENT,
`username` VARCHAR(255) NOT NULL,
`password` VARCHAR(60) NOT NULL,
`is_admin` BOOLEAN NOT NULL DEFAULT false,
`created_at` TIMESTAMP(0) DEFAULT CURRENT_TIMESTAMP(0),
`updated_at` TIMESTAMP(0) DEFAULT CURRENT_TIMESTAMP(0),
UNIQUE INDEX `account.username_unique`(`username`),
PRIMARY KEY (`user_id`)
) DEFAULT CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci;
-- CreateTable
CREATE TABLE `event` (
`event_id` INTEGER UNSIGNED NOT NULL AUTO_INCREMENT,
`website_id` INTEGER UNSIGNED NOT NULL,
`session_id` INTEGER UNSIGNED NOT NULL,
`created_at` TIMESTAMP(0) DEFAULT CURRENT_TIMESTAMP(0),
`url` VARCHAR(500) NOT NULL,
`event_type` VARCHAR(50) NOT NULL,
`event_value` VARCHAR(50) NOT NULL,
INDEX `event_created_at_idx`(`created_at`),
INDEX `event_session_id_idx`(`session_id`),
INDEX `event_website_id_idx`(`website_id`),
PRIMARY KEY (`event_id`)
) DEFAULT CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci;
-- CreateTable
CREATE TABLE `pageview` (
`view_id` INTEGER UNSIGNED NOT NULL AUTO_INCREMENT,
`website_id` INTEGER UNSIGNED NOT NULL,
`session_id` INTEGER UNSIGNED NOT NULL,
`created_at` TIMESTAMP(0) DEFAULT CURRENT_TIMESTAMP(0),
`url` VARCHAR(500) NOT NULL,
`referrer` VARCHAR(500),
INDEX `pageview_created_at_idx`(`created_at`),
INDEX `pageview_session_id_idx`(`session_id`),
INDEX `pageview_website_id_created_at_idx`(`website_id`, `created_at`),
INDEX `pageview_website_id_idx`(`website_id`),
INDEX `pageview_website_id_session_id_created_at_idx`(`website_id`, `session_id`, `created_at`),
PRIMARY KEY (`view_id`)
) DEFAULT CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci;
-- CreateTable
CREATE TABLE `session` (
`session_id` INTEGER UNSIGNED NOT NULL AUTO_INCREMENT,
`session_uuid` VARCHAR(36) NOT NULL,
`website_id` INTEGER UNSIGNED NOT NULL,
`created_at` TIMESTAMP(0) DEFAULT CURRENT_TIMESTAMP(0),
`hostname` VARCHAR(100),
`browser` VARCHAR(20),
`os` VARCHAR(20),
`device` VARCHAR(20),
`screen` VARCHAR(11),
`language` VARCHAR(35),
`country` CHAR(2),
UNIQUE INDEX `session.session_uuid_unique`(`session_uuid`),
INDEX `session_created_at_idx`(`created_at`),
INDEX `session_website_id_idx`(`website_id`),
PRIMARY KEY (`session_id`)
) DEFAULT CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci;
-- CreateTable
CREATE TABLE `website` (
`website_id` INTEGER UNSIGNED NOT NULL AUTO_INCREMENT,
`website_uuid` VARCHAR(36) NOT NULL,
`user_id` INTEGER UNSIGNED NOT NULL,
`name` VARCHAR(100) NOT NULL,
`domain` VARCHAR(500),
`share_id` VARCHAR(64),
`created_at` TIMESTAMP(0) DEFAULT CURRENT_TIMESTAMP(0),
UNIQUE INDEX `website.website_uuid_unique`(`website_uuid`),
UNIQUE INDEX `website.share_id_unique`(`share_id`),
INDEX `website_user_id_idx`(`user_id`),
PRIMARY KEY (`website_id`)
) DEFAULT CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci;
-- AddForeignKey
ALTER TABLE `event` ADD FOREIGN KEY (`session_id`) REFERENCES `session`(`session_id`) ON DELETE CASCADE ON UPDATE CASCADE;
-- AddForeignKey
ALTER TABLE `event` ADD FOREIGN KEY (`website_id`) REFERENCES `website`(`website_id`) ON DELETE CASCADE ON UPDATE CASCADE;
-- AddForeignKey
ALTER TABLE `pageview` ADD FOREIGN KEY (`session_id`) REFERENCES `session`(`session_id`) ON DELETE CASCADE ON UPDATE CASCADE;
-- AddForeignKey
ALTER TABLE `pageview` ADD FOREIGN KEY (`website_id`) REFERENCES `website`(`website_id`) ON DELETE CASCADE ON UPDATE CASCADE;
-- AddForeignKey
ALTER TABLE `session` ADD FOREIGN KEY (`website_id`) REFERENCES `website`(`website_id`) ON DELETE CASCADE ON UPDATE CASCADE;
-- AddForeignKey
ALTER TABLE `website` ADD FOREIGN KEY (`user_id`) REFERENCES `account`(`user_id`) ON DELETE CASCADE ON UPDATE CASCADE;
-- CreateAdminUser
INSERT INTO account (username, password, is_admin) values ('admin', '$2b$10$BUli0c.muyCW1ErNJc3jL.vFRFtFJWrT8/GcR4A.sUdCznaXiqFXa', true);

View file

@ -9,7 +9,7 @@ datasource db {
model account {
user_id Int @id @default(autoincrement()) @db.UnsignedInt
username String @unique @db.VarChar(255)
username String @unique(map: "username") @db.VarChar(255)
password String @db.VarChar(60)
is_admin Boolean @default(false)
created_at DateTime? @default(now()) @db.Timestamp(0)
@ -25,12 +25,12 @@ model event {
url String @db.VarChar(500)
event_type String @db.VarChar(50)
event_value String @db.VarChar(50)
session session @relation(fields: [session_id], references: [session_id])
website website @relation(fields: [website_id], references: [website_id])
session session @relation(fields: [session_id], references: [session_id], onDelete: Cascade, onUpdate: NoAction, map: "event_ibfk_2")
website website @relation(fields: [website_id], references: [website_id], onDelete: Cascade, onUpdate: NoAction, map: "event_ibfk_1")
@@index([created_at], name: "event_created_at_idx")
@@index([session_id], name: "event_session_id_idx")
@@index([website_id], name: "event_website_id_idx")
@@index([created_at])
@@index([session_id])
@@index([website_id])
}
model pageview {
@ -40,19 +40,19 @@ model pageview {
created_at DateTime? @default(now()) @db.Timestamp(0)
url String @db.VarChar(500)
referrer String? @db.VarChar(500)
session session @relation(fields: [session_id], references: [session_id])
website website @relation(fields: [website_id], references: [website_id])
session session @relation(fields: [session_id], references: [session_id], onDelete: Cascade, onUpdate: NoAction, map: "pageview_ibfk_2")
website website @relation(fields: [website_id], references: [website_id], onDelete: Cascade, onUpdate: NoAction, map: "pageview_ibfk_1")
@@index([created_at], name: "pageview_created_at_idx")
@@index([session_id], name: "pageview_session_id_idx")
@@index([website_id, created_at], name: "pageview_website_id_created_at_idx")
@@index([website_id], name: "pageview_website_id_idx")
@@index([website_id, session_id, created_at], name: "pageview_website_id_session_id_created_at_idx")
@@index([created_at])
@@index([session_id])
@@index([website_id, created_at])
@@index([website_id])
@@index([website_id, session_id, created_at])
}
model session {
session_id Int @id @default(autoincrement()) @db.UnsignedInt
session_uuid String @unique @db.VarChar(36)
session_uuid String @unique(map: "session_uuid") @db.VarChar(36)
website_id Int @db.UnsignedInt
created_at DateTime? @default(now()) @db.Timestamp(0)
hostname String? @db.VarChar(100)
@ -62,26 +62,26 @@ model session {
screen String? @db.VarChar(11)
language String? @db.VarChar(35)
country String? @db.Char(2)
website website @relation(fields: [website_id], references: [website_id])
website website @relation(fields: [website_id], references: [website_id], onDelete: Cascade, onUpdate: NoAction, map: "session_ibfk_1")
event event[]
pageview pageview[]
@@index([created_at], name: "session_created_at_idx")
@@index([website_id], name: "session_website_id_idx")
@@index([created_at])
@@index([website_id])
}
model website {
website_id Int @id @default(autoincrement()) @db.UnsignedInt
website_uuid String @unique @db.VarChar(36)
website_uuid String @unique(map: "website_uuid") @db.VarChar(36)
user_id Int @db.UnsignedInt
name String @db.VarChar(100)
domain String? @db.VarChar(500)
share_id String? @unique @db.VarChar(64)
share_id String? @unique(map: "share_id") @db.VarChar(64)
created_at DateTime? @default(now()) @db.Timestamp(0)
account account @relation(fields: [user_id], references: [user_id])
account account @relation(fields: [user_id], references: [user_id], onDelete: Cascade, onUpdate: NoAction, map: "website_ibfk_1")
event event[]
pageview pageview[]
session session[]
@@index([user_id], name: "website_user_id_idx")
@@index([user_id])
}

View file

@ -9,7 +9,7 @@ datasource db {
model account {
user_id Int @id @default(autoincrement())
username String @unique @db.VarChar(255)
username String @unique(map: "account.username_unique") @db.VarChar(255)
password String @db.VarChar(60)
is_admin Boolean @default(false)
created_at DateTime? @default(now()) @db.Timestamptz(6)
@ -25,12 +25,12 @@ model event {
url String @db.VarChar(500)
event_type String @db.VarChar(50)
event_value String @db.VarChar(50)
session session @relation(fields: [session_id], references: [session_id])
website website @relation(fields: [website_id], references: [website_id])
session session @relation(fields: [session_id], references: [session_id], onDelete: Cascade)
website website @relation(fields: [website_id], references: [website_id], onDelete: Cascade)
@@index([created_at], name: "event_created_at_idx")
@@index([session_id], name: "event_session_id_idx")
@@index([website_id], name: "event_website_id_idx")
@@index([created_at])
@@index([session_id])
@@index([website_id])
}
model pageview {
@ -40,19 +40,19 @@ model pageview {
created_at DateTime? @default(now()) @db.Timestamptz(6)
url String @db.VarChar(500)
referrer String? @db.VarChar(500)
session session @relation(fields: [session_id], references: [session_id])
website website @relation(fields: [website_id], references: [website_id])
session session @relation(fields: [session_id], references: [session_id], onDelete: Cascade)
website website @relation(fields: [website_id], references: [website_id], onDelete: Cascade)
@@index([created_at], name: "pageview_created_at_idx")
@@index([session_id], name: "pageview_session_id_idx")
@@index([website_id, created_at], name: "pageview_website_id_created_at_idx")
@@index([website_id], name: "pageview_website_id_idx")
@@index([website_id, session_id, created_at], name: "pageview_website_id_session_id_created_at_idx")
@@index([created_at])
@@index([session_id])
@@index([website_id, created_at])
@@index([website_id])
@@index([website_id, session_id, created_at])
}
model session {
session_id Int @id @default(autoincrement())
session_uuid String @unique @db.Uuid
session_uuid String @unique(map: "session.session_uuid_unique") @db.Uuid
website_id Int
created_at DateTime? @default(now()) @db.Timestamptz(6)
hostname String? @db.VarChar(100)
@ -62,26 +62,26 @@ model session {
screen String? @db.VarChar(11)
language String? @db.VarChar(35)
country String? @db.Char(2)
website website @relation(fields: [website_id], references: [website_id])
website website @relation(fields: [website_id], references: [website_id], onDelete: Cascade)
event event[]
pageview pageview[]
@@index([created_at], name: "session_created_at_idx")
@@index([website_id], name: "session_website_id_idx")
@@index([created_at])
@@index([website_id])
}
model website {
website_id Int @id @default(autoincrement())
website_uuid String @unique @db.Uuid
website_uuid String @unique(map: "website.website_uuid_unique") @db.Uuid
user_id Int
name String @db.VarChar(100)
domain String? @db.VarChar(500)
share_id String? @unique @db.VarChar(64)
share_id String? @unique(map: "website.share_id_unique") @db.VarChar(64)
created_at DateTime? @default(now()) @db.Timestamptz(6)
account account @relation(fields: [user_id], references: [user_id])
account account @relation(fields: [user_id], references: [user_id], onDelete: Cascade)
event event[]
pageview pageview[]
session session[]
@@index([user_id], name: "website_user_id_idx")
}
@@index([user_id])
}

View file

@ -18,9 +18,9 @@
"label.date-range": "Phạm vi ngày",
"label.default-date-range": "Khoảng thời gian mặc định",
"label.delete": "Xoá",
"label.delete-account": "X tài khoản",
"label.delete-website": "Xáo website",
"label.dismiss": "Laoị trừ",
"label.delete-account": "Xóa tài khoản",
"label.delete-website": "Xóa website",
"label.dismiss": "Loại trừ",
"label.domain": "Tên miền",
"label.edit": "Chỉnh sửa",
"label.edit-account": "Chỉnh sửa tài khoản",
@ -37,7 +37,7 @@
"label.more": "Thêm",
"label.name": "Tên",
"label.new-password": "Mật khẩu mới",
"label.owner": "Chủ nhân",
"label.owner": "Chủ sở hữu",
"label.password": "Mật khẩu",
"label.passwords-dont-match": "Mật khẩu không đồng nhất",
"label.profile": "Hồ sơ",
@ -51,7 +51,7 @@
"label.settings": "Cài đặt",
"label.share-url": "Chia sẻ URL",
"label.single-day": "Trong ngày",
"label.theme": "Theme",
"label.theme": "Giao diện",
"label.this-month": "Tháng này",
"label.this-week": "Tuần này",
"label.this-year": "Năm nay",
@ -65,19 +65,19 @@
"message.active-users": "{x} hiện tại {x, plural, one {một} other {trên}}",
"message.confirm-delete": "Bạn có chắc chắn muốn xoá {target}?",
"message.confirm-reset": "Bạn có chắc chắn muốn tái thiết lập thống kê {target}?",
"message.copied": "Đã copy!",
"message.copied": "Đã sao chép!",
"message.delete-warning": "Tất cả các dữ liệu liên quan cũng sẽ bị xoá.",
"message.failure": "Đã xảy ra lỗi.",
"message.get-share-url": "Lấy URL chia sẻ",
"message.get-tracking-code": "Lấy mã theo dõi",
"message.go-to-settings": "Đến cài đặt",
"message.go-to-settings": "Chuyển tới cài đặt",
"message.incorrect-username-password": "Sai tên đăng nhập/mật khẩu.",
"message.log.visitor": "Khách từ {country} đang dùng {browser} trên {os} {device}",
"message.new-version-available": "Có một phiên bản mới của umami!",
"message.no-data-available": "Không có dữ liệu.",
"message.no-websites-configured": "Bạn chưa có bất cứ website nào.",
"message.page-not-found": "Trang không tìm thấy.",
"message.powered-by": "Bản quyền bởi {name}",
"message.powered-by": "Bản quyền thuộc về {name}",
"message.reset-warning": "Tất cả số liệu thống kê của website này sẽ bị xoá, nhưng mã theo dõi sẽ vẫn giữ nguyên.",
"message.save-success": "Đã lưu thành công.",
"message.share-url": "Đây là đường dẫn URL cho {target}.",
@ -99,7 +99,7 @@
"metrics.filter.combined": "Kết hợp",
"metrics.filter.domain-only": "Chỉ tên miền",
"metrics.filter.raw": "Gốc",
"metrics.languages": "Ngôn ngũ",
"metrics.languages": "Ngôn ng",
"metrics.operating-systems": "Hệ điều hành",
"metrics.page-views": "Lượt xem",
"metrics.pages": "Trang",

View file

@ -1,6 +1,6 @@
{
"name": "umami",
"version": "1.33.0",
"version": "1.33.1",
"description": "A simple, fast, privacy-focused alternative to Google Analytics.",
"author": "Mike Cao <mike@mikecao.com>",
"license": "MIT",
@ -14,7 +14,7 @@
"build": "npm-run-all build-tracker build-geo build-db build-app",
"start": "npm-run-all check-db start-next",
"start-docker": "npm-run-all check-db start-server",
"start-env": "node -r dotenv/config scripts/start-env.js",
"start-env": "node scripts/start-env.js",
"start-server": "node server.js",
"start-next": "next start",
"build-app": "next build",
@ -68,7 +68,6 @@
"del": "^6.0.0",
"detect-browser": "^5.2.0",
"dotenv": "^10.0.0",
"dotenv-cli": "^4.0.0",
"formik": "^2.2.9",
"fs-extra": "^10.0.1",
"immer": "^9.0.12",

View file

@ -116,19 +116,19 @@
"label.delete-account": [
{
"type": 0,
"value": "X tài khoản"
"value": "Xóa tài khoản"
}
],
"label.delete-website": [
{
"type": 0,
"value": "Xáo website"
"value": "Xóa website"
}
],
"label.dismiss": [
{
"type": 0,
"value": "Laoị trừ"
"value": "Loại trừ"
}
],
"label.domain": [
@ -242,7 +242,7 @@
"label.owner": [
{
"type": 0,
"value": "Chủ nhân"
"value": "Chủ sở hữu"
}
],
"label.password": [
@ -326,7 +326,7 @@
"label.theme": [
{
"type": 0,
"value": "Theme"
"value": "Giao diện"
}
],
"label.this-month": [
@ -454,7 +454,7 @@
"message.copied": [
{
"type": 0,
"value": "Đã copy!"
"value": "Đã sao chép!"
}
],
"message.delete-warning": [
@ -484,7 +484,7 @@
"message.go-to-settings": [
{
"type": 0,
"value": "Đến cài đặt"
"value": "Chuyển tới cài đặt"
}
],
"message.incorrect-username-password": [
@ -554,7 +554,7 @@
"message.powered-by": [
{
"type": 0,
"value": "Bản quyền bởi "
"value": "Bản quyền thuộc về "
},
{
"type": 1,
@ -730,7 +730,7 @@
"metrics.languages": [
{
"type": 0,
"value": "Ngôn ngũ"
"value": "Ngôn ng"
}
],
"metrics.operating-systems": [

View file

@ -3,13 +3,9 @@ const { PrismaClient } = require('@prisma/client');
const prisma = new PrismaClient();
const chalk = require('chalk');
const spawn = require('cross-spawn');
const { execSync } = require('child_process');
let message = '';
const updateMessage = `To update your database, you need to run:\n${chalk.bold.whiteBright(
'yarn update-db',
)}`;
const baselineMessage = cmd =>
`You need to update your database by running:\n${chalk.bold.whiteBright(cmd)}`;
function success(msg) {
console.log(chalk.greenBright(`${msg}`));
@ -39,9 +35,9 @@ async function checkTables() {
success('Database tables found.');
} catch (e) {
message = updateMessage;
console.log('Adding tables...');
throw new Error('Database tables not found.');
console.log(execSync('prisma migrate deploy').toString());
}
}
@ -66,16 +62,10 @@ async function checkMigrations() {
const missingMigrations = output.includes('Following migration have not yet been applied');
const notManaged = output.includes('The current database is not managed');
if (notManaged) {
const cmd = output.match(/yarn prisma migrate resolve --applied ".*"/g);
if (notManaged || missingMigrations) {
console.log('Running update...');
message = baselineMessage(cmd[0]);
throw new Error('Database is out of date.');
} else if (missingMigrations) {
message = updateMessage;
throw new Error('Database is out of date.');
console.log(execSync('prisma migrate resolve --applied "01_init"').toString());
}
success('Database is up to date.');

View file

@ -1,3 +1,4 @@
require('dotenv').config();
const cli = require('next/dist/cli/next-start');
cli.nextStart(['-p', process.env.PORT || 3000, '-H', process.env.HOSTNAME || '0.0.0.0']);

View file

@ -2785,31 +2785,11 @@ domutils@^2.8.0:
domelementtype "^2.2.0"
domhandler "^4.2.0"
dotenv-cli@^4.0.0:
version "4.1.1"
resolved "https://registry.yarnpkg.com/dotenv-cli/-/dotenv-cli-4.1.1.tgz#26a59fbb25876008985a15fa366b416607e8372c"
integrity sha512-XvKv1pa+UBrsr3CtLGBsR6NdsoS7znqaHUf4Knj0eZO+gOI/hjj9KgWDP+KjpfEbj6wAba1UpbhaP9VezNkWhg==
dependencies:
cross-spawn "^7.0.1"
dotenv "^8.1.0"
dotenv-expand "^5.1.0"
minimist "^1.1.3"
dotenv-expand@^5.1.0:
version "5.1.0"
resolved "https://registry.yarnpkg.com/dotenv-expand/-/dotenv-expand-5.1.0.tgz#3fbaf020bfd794884072ea26b1e9791d45a629f0"
integrity sha512-YXQl1DSa4/PQyRfgrv6aoNjhasp/p4qs9FjJ4q4cQk+8m4r6k4ZSiEyytKG8f8W9gi8WsQtIObNmKd+tMzNTmA==
dotenv@^10.0.0:
version "10.0.0"
resolved "https://registry.yarnpkg.com/dotenv/-/dotenv-10.0.0.tgz#3d4227b8fb95f81096cdd2b66653fb2c7085ba81"
integrity sha512-rlBi9d8jpv9Sf1klPjNfFAuWDjKLwTIJJ/VxtoTwIR6hnZxcEOQCZg2oIL3MWBYw5GpUDKOEnND7LXTbIpQ03Q==
dotenv@^8.1.0:
version "8.6.0"
resolved "https://registry.yarnpkg.com/dotenv/-/dotenv-8.6.0.tgz#061af664d19f7f4d8fc6e4ff9b584ce237adcb8b"
integrity sha512-IrPdXQsk2BbzvCBGBOTmmSH5SodmqZNt4ERAZDmW4CT+tL8VtvinqywuANaFu4bOMWki16nqf0e4oC0QIaDr/g==
electron-to-chromium@^1.4.118, electron-to-chromium@^1.4.84:
version "1.4.143"
resolved "https://registry.yarnpkg.com/electron-to-chromium/-/electron-to-chromium-1.4.143.tgz#10f1bb595ad6cd893c05097039c685dcf5c8e30c"
@ -4314,7 +4294,7 @@ minimist-options@4.1.0, minimist-options@^4.0.2:
is-plain-obj "^1.1.0"
kind-of "^6.0.3"
minimist@^1.1.3, minimist@^1.2.0, minimist@^1.2.5, minimist@^1.2.6:
minimist@^1.2.0, minimist@^1.2.5, minimist@^1.2.6:
version "1.2.6"
resolved "https://registry.yarnpkg.com/minimist/-/minimist-1.2.6.tgz#8637a5b759ea0d6e98702cfb3a9283323c93af44"
integrity sha512-Jsjnk4bw3YJqYzbdyBiNsPWHPfO++UGG749Cxs6peCu5Xg4nrena6OVxOYxrQTqww0Jmwt+Ref8rggumkTLz9Q==