Merge pull request #619 from coollabsio/next

v3.10.3
This commit is contained in:
Andras Bacsai 2022-09-11 17:01:22 +02:00 committed by GitHub
commit ad80e7f48b
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with 132 additions and 75 deletions

View File

@ -21,7 +21,7 @@ import { scheduler } from './scheduler';
import { supportedServiceTypesAndVersions } from './services/supportedVersions'; import { supportedServiceTypesAndVersions } from './services/supportedVersions';
import { includeServices } from './services/common'; import { includeServices } from './services/common';
export const version = '3.10.2'; export const version = '3.10.3';
export const isDev = process.env.NODE_ENV === 'development'; export const isDev = process.env.NODE_ENV === 'development';
const algorithm = 'aes-256-ctr'; const algorithm = 'aes-256-ctr';

View File

@ -1006,79 +1006,136 @@ async function startUmamiService(request: FastifyRequest<ServiceStartStop>) {
} }
const initDbSQL = ` const initDbSQL = `
drop table if exists event; -- CreateTable
drop table if exists pageview; CREATE TABLE "account" (
drop table if exists session; "user_id" SERIAL NOT NULL,
drop table if exists website; "username" VARCHAR(255) NOT NULL,
drop table if exists account; "password" VARCHAR(60) NOT NULL,
"is_admin" BOOLEAN NOT NULL DEFAULT false,
create table account ( "created_at" TIMESTAMPTZ(6) DEFAULT CURRENT_TIMESTAMP,
user_id serial primary key, "updated_at" TIMESTAMPTZ(6) DEFAULT CURRENT_TIMESTAMP,
username varchar(255) unique not null,
password varchar(60) not null, PRIMARY KEY ("user_id")
is_admin bool not null default false, );
created_at timestamp with time zone default current_timestamp,
updated_at timestamp with time zone default current_timestamp -- CreateTable
); CREATE TABLE "event" (
"event_id" SERIAL NOT NULL,
create table website ( "website_id" INTEGER NOT NULL,
website_id serial primary key, "session_id" INTEGER NOT NULL,
website_uuid uuid unique not null, "created_at" TIMESTAMPTZ(6) DEFAULT CURRENT_TIMESTAMP,
user_id int not null references account(user_id) on delete cascade, "url" VARCHAR(500) NOT NULL,
name varchar(100) not null, "event_type" VARCHAR(50) NOT NULL,
domain varchar(500), "event_value" VARCHAR(50) NOT NULL,
share_id varchar(64) unique,
created_at timestamp with time zone default current_timestamp PRIMARY KEY ("event_id")
); );
create table session ( -- CreateTable
session_id serial primary key, CREATE TABLE "pageview" (
session_uuid uuid unique not null, "view_id" SERIAL NOT NULL,
website_id int not null references website(website_id) on delete cascade, "website_id" INTEGER NOT NULL,
created_at timestamp with time zone default current_timestamp, "session_id" INTEGER NOT NULL,
hostname varchar(100), "created_at" TIMESTAMPTZ(6) DEFAULT CURRENT_TIMESTAMP,
browser varchar(20), "url" VARCHAR(500) NOT NULL,
os varchar(20), "referrer" VARCHAR(500),
device varchar(20),
screen varchar(11), PRIMARY KEY ("view_id")
language varchar(35), );
country char(2)
); -- CreateTable
CREATE TABLE "session" (
create table pageview ( "session_id" SERIAL NOT NULL,
view_id serial primary key, "session_uuid" UUID NOT NULL,
website_id int not null references website(website_id) on delete cascade, "website_id" INTEGER NOT NULL,
session_id int not null references session(session_id) on delete cascade, "created_at" TIMESTAMPTZ(6) DEFAULT CURRENT_TIMESTAMP,
created_at timestamp with time zone default current_timestamp, "hostname" VARCHAR(100),
url varchar(500) not null, "browser" VARCHAR(20),
referrer varchar(500) "os" VARCHAR(20),
); "device" VARCHAR(20),
"screen" VARCHAR(11),
create table event ( "language" VARCHAR(35),
event_id serial primary key, "country" CHAR(2),
website_id int not null references website(website_id) on delete cascade,
session_id int not null references session(session_id) on delete cascade, PRIMARY KEY ("session_id")
created_at timestamp with time zone default current_timestamp, );
url varchar(500) not null,
event_type varchar(50) not null, -- CreateTable
event_value varchar(50) not null CREATE TABLE "website" (
); "website_id" SERIAL NOT NULL,
"website_uuid" UUID NOT NULL,
create index website_user_id_idx on website(user_id); "user_id" INTEGER NOT NULL,
"name" VARCHAR(100) NOT NULL,
create index session_created_at_idx on session(created_at); "domain" VARCHAR(500),
create index session_website_id_idx on session(website_id); "share_id" VARCHAR(64),
"created_at" TIMESTAMPTZ(6) DEFAULT CURRENT_TIMESTAMP,
create index pageview_created_at_idx on pageview(created_at);
create index pageview_website_id_idx on pageview(website_id); PRIMARY KEY ("website_id")
create index pageview_session_id_idx on pageview(session_id); );
create index pageview_website_id_created_at_idx on pageview(website_id, created_at);
create index pageview_website_id_session_id_created_at_idx on pageview(website_id, session_id, created_at); -- CreateIndex
CREATE UNIQUE INDEX "account.username_unique" ON "account"("username");
create index event_created_at_idx on event(created_at);
create index event_website_id_idx on event(website_id); -- CreateIndex
create index event_session_id_idx on event(session_id); CREATE INDEX "event_created_at_idx" ON "event"("created_at");
-- CreateIndex
CREATE INDEX "event_session_id_idx" ON "event"("session_id");
-- CreateIndex
CREATE INDEX "event_website_id_idx" ON "event"("website_id");
-- CreateIndex
CREATE INDEX "pageview_created_at_idx" ON "pageview"("created_at");
-- CreateIndex
CREATE INDEX "pageview_session_id_idx" ON "pageview"("session_id");
-- CreateIndex
CREATE INDEX "pageview_website_id_created_at_idx" ON "pageview"("website_id", "created_at");
-- CreateIndex
CREATE INDEX "pageview_website_id_idx" ON "pageview"("website_id");
-- CreateIndex
CREATE INDEX "pageview_website_id_session_id_created_at_idx" ON "pageview"("website_id", "session_id", "created_at");
-- CreateIndex
CREATE UNIQUE INDEX "session.session_uuid_unique" ON "session"("session_uuid");
-- CreateIndex
CREATE INDEX "session_created_at_idx" ON "session"("created_at");
-- CreateIndex
CREATE INDEX "session_website_id_idx" ON "session"("website_id");
-- CreateIndex
CREATE UNIQUE INDEX "website.website_uuid_unique" ON "website"("website_uuid");
-- CreateIndex
CREATE UNIQUE INDEX "website.share_id_unique" ON "website"("share_id");
-- CreateIndex
CREATE INDEX "website_user_id_idx" ON "website"("user_id");
-- 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;
insert into account (username, password, is_admin) values ('admin', '${bcrypt.hashSync( insert into account (username, password, is_admin) values ('admin', '${bcrypt.hashSync(
umamiAdminPassword, umamiAdminPassword,
10 10

View File

@ -1,7 +1,7 @@
{ {
"name": "coolify", "name": "coolify",
"description": "An open-source & self-hostable Heroku / Netlify alternative.", "description": "An open-source & self-hostable Heroku / Netlify alternative.",
"version": "3.10.2", "version": "3.10.3",
"license": "Apache-2.0", "license": "Apache-2.0",
"repository": "github:coollabsio/coolify", "repository": "github:coollabsio/coolify",
"scripts": { "scripts": {