Skip to content

Commit d7e4a30

Browse files
authored
Merge pull request #15 from LexaFrontDev/dev
Dev
2 parents 7307d01 + 2cc4321 commit d7e4a30

32 files changed

Lines changed: 442 additions & 437 deletions

File tree

.dockerignore

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -25,8 +25,9 @@ public/bundles/
2525
tests/
2626
var/
2727
vendor/
28+
node_modules/
2829
.editorconfig
29-
#.env.*.local
30-
#.env.local
31-
#.env.local.php
32-
#.env.test
30+
.env.*.local
31+
.env.local
32+
.env.local.php
33+
.env.test

Makefile

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,12 @@ COMPOSER = $(PHP_CONT) composer
1010
SYMFONY = $(PHP) bin/console
1111
PHPUNIT = $(PHP) bin/phpunit
1212

13+
14+
# Node.js / npm
15+
NODE = $(PHP_CONT) node
16+
NPM = $(PHP_CONT) npm
17+
18+
1319
# Misc
1420
.DEFAULT_GOAL = help
1521
.PHONY : help build up start down logs sh composer vendor sf cc
@@ -48,6 +54,15 @@ logs: ## Show live logs
4854
sh: ## Connect to the PHP FPM container
4955
@$(PHP_CONT) sh
5056

57+
node: ## Check Node.js version inside container
58+
@$(NODE) -v
59+
60+
npm: ## Check npm version inside container
61+
@$(NPM) -v
62+
63+
npm-install: ## Run npm install inside container
64+
@$(NODE_CONT) npm install
65+
5166
perms: ## Connect to the PHP FPM container
5267
@$(PHP_CONT) chown www-data ./var/cache -R
5368
@$(PHP_CONT) chmod 0777 ./var/cache -R

docker/php/Dockerfile

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -63,6 +63,12 @@ RUN set -eux; \
6363
chmod +x bin/console; sync; \
6464
fi
6565

66+
# --- Node.js & npm ---
67+
RUN apk add --no-cache nodejs npm
68+
COPY package.json package-lock.json ./
69+
RUN npm install
70+
71+
6672
COPY --link docker/php/healthcheck.sh /usr/local/bin/healthcheck
6773
RUN chmod +x bin/phpunit; sync;
6874
RUN chmod +x healthcheck; sync;
@@ -89,4 +95,4 @@ RUN composer dump-env dev;
8995

9096
RUN install-php-extensions \
9197
xdebug \
92-
;
98+
;

migrations/v1_database_scheme/Different/Version20250627101043_create_storage_table.php

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -21,16 +21,16 @@ public function up(Schema $schema): void
2121
if (!$sm->tablesExist(['storage'])) {
2222
$this->addSql(<<<'SQL'
2323
CREATE TABLE storage (
24-
id INT GENERATED BY DEFAULT AS IDENTITY PRIMARY KEY,
24+
id SERIAL PRIMARY KEY,
2525
full_path VARCHAR(255) NOT NULL,
2626
type VARCHAR(50) NOT NULL,
2727
uid VARCHAR(100) NOT NULL,
2828
file_type VARCHAR(20) NOT NULL,
29-
created_at DATETIME NOT NULL,
30-
PRIMARY KEY(id)
31-
) DEFAULT CHARACTER SET utf8mb4 COLLATE `utf8mb4_unicode_ci` ENGINE = InnoDB
29+
created_at TIMESTAMP NOT NULL
30+
)
3231
SQL);
3332
}
33+
3434
}
3535

3636
public function down(Schema $schema): void

migrations/v1_database_scheme/Different/Version20250701024108_update_storage.php

Lines changed: 20 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -11,50 +11,50 @@ final class Version20250701024108Updatestorage extends AbstractMigration
1111
{
1212
public function getDescription(): string
1313
{
14-
return 'Обновление таблиц storage и tasks: удаление uid, task_type; добавление полей с датами и временем';
14+
return 'Обновление таблиц storage и tasks: удаление uid, task_type; добавление полей с датами и временем (PostgreSQL совместимость)';
1515
}
1616

1717
public function up(Schema $schema): void
1818
{
1919
$sm = $this->connection->createSchemaManager();
2020

2121
if ($sm->tablesExist(['storage']) && $sm->introspectTable('storage')->hasColumn('uid')) {
22-
$this->addSql('ALTER TABLE storage DROP uid');
22+
$this->addSql('ALTER TABLE storage DROP COLUMN uid');
2323
}
2424

2525
if ($sm->tablesExist(['tasks'])) {
2626
$columns = $sm->introspectTable('tasks')->getColumns();
2727

2828
if (isset($columns['task_type'])) {
29-
$this->addSql('ALTER TABLE tasks DROP task_type');
29+
$this->addSql('ALTER TABLE tasks DROP COLUMN task_type');
3030
}
3131

3232
$addColumnsSql = [];
3333

3434
if (!isset($columns['date'])) {
35-
$addColumnsSql[] = 'ADD date VARCHAR(255) DEFAULT NULL';
35+
$addColumnsSql[] = 'ADD COLUMN date TEXT DEFAULT NULL';
3636
}
3737
if (!isset($columns['time'])) {
38-
$addColumnsSql[] = 'ADD time VARCHAR(255) DEFAULT NULL';
38+
$addColumnsSql[] = 'ADD COLUMN time TEXT DEFAULT NULL';
3939
}
4040
if (!isset($columns['start_date'])) {
41-
$addColumnsSql[] = 'ADD start_date VARCHAR(255) DEFAULT NULL';
41+
$addColumnsSql[] = 'ADD COLUMN start_date TEXT DEFAULT NULL';
4242
}
4343
if (!isset($columns['start_time'])) {
44-
$addColumnsSql[] = 'ADD start_time VARCHAR(255) DEFAULT NULL';
44+
$addColumnsSql[] = 'ADD COLUMN start_time TEXT DEFAULT NULL';
4545
}
4646
if (!isset($columns['end_date'])) {
47-
$addColumnsSql[] = 'ADD end_date VARCHAR(255) DEFAULT NULL';
47+
$addColumnsSql[] = 'ADD COLUMN end_date TEXT DEFAULT NULL';
4848
}
4949
if (!isset($columns['end_time'])) {
50-
$addColumnsSql[] = 'ADD end_time VARCHAR(255) DEFAULT NULL';
50+
$addColumnsSql[] = 'ADD COLUMN end_time TEXT DEFAULT NULL';
5151
}
5252
if (!isset($columns['repeat'])) {
53-
$addColumnsSql[] = 'ADD `repeat` VARCHAR(255) DEFAULT NULL';
53+
$addColumnsSql[] = 'ADD COLUMN "repeat" TEXT DEFAULT NULL';
5454
}
5555

5656
if (!empty($addColumnsSql)) {
57-
$this->addSql('ALTER TABLE tasks '.implode(', ', $addColumnsSql));
57+
$this->addSql('ALTER TABLE tasks ' . implode(', ', $addColumnsSql));
5858
}
5959
}
6060
}
@@ -66,19 +66,19 @@ public function down(Schema $schema): void
6666
if ($sm->tablesExist(['tasks'])) {
6767
$this->addSql(<<<'SQL'
6868
ALTER TABLE tasks
69-
ADD task_type VARCHAR(255) NOT NULL,
70-
DROP date,
71-
DROP time,
72-
DROP start_date,
73-
DROP start_time,
74-
DROP end_date,
75-
DROP end_time,
76-
DROP `repeat`
69+
ADD COLUMN task_type VARCHAR(255) NOT NULL,
70+
DROP COLUMN date,
71+
DROP COLUMN time,
72+
DROP COLUMN start_date,
73+
DROP COLUMN start_time,
74+
DROP COLUMN end_date,
75+
DROP COLUMN end_time,
76+
DROP COLUMN "repeat"
7777
SQL);
7878
}
7979

8080
if ($sm->tablesExist(['storage']) && ! $sm->introspectTable('storage')->hasColumn('uid')) {
81-
$this->addSql('ALTER TABLE storage ADD uid VARCHAR(100) NOT NULL');
81+
$this->addSql('ALTER TABLE storage ADD COLUMN uid VARCHAR(100) NOT NULL');
8282
}
8383
}
8484
}

migrations/v1_database_scheme/Different/Version20250701030209_remove_legacy_notification.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -44,10 +44,10 @@ public function down(Schema $schema): void
4444
$table = $schema->getTable('tasks');
4545
$adds = [];
4646
if (!$table->hasColumn('notification_id')) {
47-
$adds[] = 'ADD notification_id INT DEFAULT NULL';
47+
$adds[] = 'ADD notification_id INTEGER DEFAULT NULL';
4848
}
4949
if (!$table->hasColumn('due_date')) {
50-
$adds[] = 'ADD due_date DATETIME DEFAULT NULL';
50+
$adds[] = 'ADD due_date TIMESTAMP DEFAULT NULL';
5151
}
5252
if (!$table->hasColumn('date')) {
5353
$adds[] = 'ADD date VARCHAR(255) DEFAULT NULL';

migrations/v1_database_scheme/Different/Version20250706023331_create_languages_tables.php

Lines changed: 11 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@ final class Version20250706023331Createlanguagestables extends AbstractMigration
1414
{
1515
public function getDescription(): string
1616
{
17-
return 'Creates language and language_page_translation tables for multilingual page support.';
17+
return 'Creates language and language_page_translation tables for multilingual page support (PostgreSQL).';
1818
}
1919

2020
public function up(Schema $schema): void
@@ -24,31 +24,26 @@ public function up(Schema $schema): void
2424
if (!$sm->tablesExist(['language'])) {
2525
$this->addSql(<<<'SQL'
2626
CREATE TABLE language (
27-
id INT GENERATED BY DEFAULT AS IDENTITY PRIMARY KEY,
27+
id SERIAL PRIMARY KEY,
2828
prefix VARCHAR(10) NOT NULL,
29-
name VARCHAR(100) NOT NULL,
30-
PRIMARY KEY(id)
31-
) DEFAULT CHARACTER SET utf8mb4 COLLATE `utf8mb4_unicode_ci` ENGINE = InnoDB
29+
name VARCHAR(100) NOT NULL
30+
)
3231
SQL);
3332
}
3433

3534
if (!$sm->tablesExist(['language_page_translation'])) {
3635
$this->addSql(<<<'SQL'
3736
CREATE TABLE language_page_translation (
38-
id INT GENERATED BY DEFAULT AS IDENTITY PRIMARY KEY,
39-
language_id INT NOT NULL,
37+
id SERIAL PRIMARY KEY,
38+
language_id INTEGER NOT NULL,
4039
page_name VARCHAR(100) NOT NULL,
41-
page_translate JSON NOT NULL,
42-
INDEX IDX_AFF4D9D182F1BAF4 (language_id),
43-
PRIMARY KEY(id)
44-
) DEFAULT CHARACTER SET utf8mb4 COLLATE `utf8mb4_unicode_ci` ENGINE = InnoDB
40+
page_translate JSONB NOT NULL,
41+
CONSTRAINT fk_language FOREIGN KEY (language_id) REFERENCES language (id) ON DELETE CASCADE
42+
)
4543
SQL);
4644

47-
$this->addSql(<<<'SQL'
48-
ALTER TABLE language_page_translation
49-
ADD CONSTRAINT FK_AFF4D9D182F1BAF4
50-
FOREIGN KEY (language_id) REFERENCES language (id)
51-
SQL);
45+
// Индекс для ускорения поиска по language_id
46+
$this->addSql('CREATE INDEX idx_language_translation_language_id ON language_page_translation (language_id)');
5247
}
5348
}
5449

@@ -57,9 +52,6 @@ public function down(Schema $schema): void
5752
$sm = $this->connection->createSchemaManager();
5853

5954
if ($sm->tablesExist(['language_page_translation'])) {
60-
$this->addSql(<<<'SQL'
61-
ALTER TABLE language_page_translation DROP FOREIGN KEY FK_AFF4D9D182F1BAF4
62-
SQL);
6355
$this->addSql('DROP TABLE language_page_translation');
6456
}
6557

migrations/v1_database_scheme/Different/Version20250710023600_add_created_at_updated_at_deleted_in_tables.php

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -52,14 +52,14 @@ public function up(Schema $schema): void
5252
foreach ($tables as $table) {
5353
if ($this->tableExists($schema, $table)) {
5454
if (!$this->columnExists($schema, $table, 'created_at')) {
55-
$this->addSql("ALTER TABLE {$table} ADD created_at DATETIME DEFAULT NULL");
55+
$this->addSql("ALTER TABLE {$table} ADD created_at TIMESTAMP DEFAULT NULL");
5656
}
5757
if (!$this->columnExists($schema, $table, 'updated_at')) {
58-
$default = 'storage' === $table ? "DATETIME DEFAULT NULL" : 'DATETIME DEFAULT NULL';
58+
$default = 'storage' === $table ? "TIMESTAMP DEFAULT NULL" : 'TIMESTAMP DEFAULT NULL';
5959
$this->addSql("ALTER TABLE {$table} ADD updated_at {$default}");
6060
}
6161
if (!$this->columnExists($schema, $table, 'is_delete')) {
62-
$this->addSql("ALTER TABLE {$table} ADD is_delete TINYINT(1) NOT NULL");
62+
$this->addSql("ALTER TABLE {$table} ADD is_delete BOOLEAN NOT NULL");
6363
}
6464
}
6565
}

0 commit comments

Comments
 (0)