Skip to content

Commit a3c22ef

Browse files
committed
nextras/migrations installed
1 parent 7bb193f commit a3c22ef

File tree

9 files changed

+122
-33
lines changed

9 files changed

+122
-33
lines changed

.docker/php/Dockerfile

Lines changed: 10 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,20 +1,27 @@
11
FROM php:8.2-apache
22

3+
# Change default Apache config
34
ENV APACHE_DOCUMENT_ROOT /var/www/html/www
45

56
RUN sed -ri -e 's!/var/www/html!${APACHE_DOCUMENT_ROOT}!g' /etc/apache2/sites-available/*.conf
67
RUN sed -ri -e 's!/var/www/!${APACHE_DOCUMENT_ROOT}!g' /etc/apache2/apache2.conf /etc/apache2/conf-available/*.conf
78

9+
# Enable .htaccess
810
RUN a2enmod rewrite
911

10-
WORKDIR /var/www/html
11-
12+
# For managing PHP packages
1213
COPY --from=composer /usr/bin/composer /usr/bin/composer
1314

15+
# Install base (from Docker) extensions
1416
RUN docker-php-ext-install \
17+
# For accessing databases in PHP
1518
pdo \
1619
pdo_mysql \
1720
mysqli
1821

22+
# Install extra (from Debian) extensions
1923
RUN apt-get update && apt-get -y install \
20-
git
24+
# For repository actions
25+
git \
26+
# For reading ZIP compressed archives (required by nextras/migrations)
27+
zip

composer.json

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,8 @@
2020
"latte/latte": "^3.0",
2121
"tracy/tracy": "^2.9",
2222
"dibi/dibi": "^4.2",
23-
"contributte/console": "^0.9.3"
23+
"contributte/console": "^0.9.3",
24+
"nextras/migrations": "^3.2"
2425
},
2526
"require-dev": {
2627
"nette/tester": "^2.4",

composer.lock

Lines changed: 71 additions & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

config/common.neon

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -16,3 +16,4 @@ di:
1616
includes:
1717
- dibi.neon
1818
- contributte.neon
19+
- nextras.neon

config/nextras.neon

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
extensions:
2+
migrations: Nextras\Migrations\Bridges\NetteDI\MigrationsExtension
3+
4+
migrations:
5+
dir: %appDir%/../migrations
6+
driver: mysql
7+
dbal: dibi
8+
9+
# commands:
10+
# - migrations:create
11+
# - migrations:continue
12+
# - migrations:reset (never run on prod - data loss, use continue)
Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
INSERT INTO user (email, password) VALUES ('test@gmail.com', 'test');
Lines changed: 8 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,8 @@
1-
INSERT INTO event (title, event_time, event_place) VALUES ('Patecni grilovana zebra', '2023-10-26 10:38:10', 'Snyt - Vinohrady');
2-
INSERT INTO event (title, event_time, event_place) VALUES ('Patecni grilovana ryba', '2023-10-26 10:38:10', 'Snyt - Vinohrady');
3-
INSERT INTO event (title) VALUES ('Zahradka otevrena');
4-
INSERT INTO event (title, event_time, event_place) VALUES ('Patecni mega-rizek', '2023-10-26 10:38:10', 'Snyt - Vinohrady');
5-
INSERT INTO event (title) VALUES ('Na cepu nove Plzen 10');
6-
INSERT INTO event (title, event_time, event_place) VALUES ('Patecni grilovane kure', '2023-10-26 10:38:10', 'Snyt - Vinohrady');
7-
INSERT INTO event (title) VALUES ('Zahradka zavrena');
8-
INSERT INTO event (title) VALUES ('Hledame kuchare');
9-
10-
INSERT INTO user (email, password) VALUES ('test@gmail.com', 'test');
1+
INSERT INTO event (title, event_time, event_place) VALUES ('Patecni grilovana zebra', '2023-10-26 10:38:10', 'Snyt - Vinohrady');
2+
INSERT INTO event (title, event_time, event_place) VALUES ('Patecni grilovana ryba', '2023-10-26 10:38:10', 'Snyt - Vinohrady');
3+
INSERT INTO event (title) VALUES ('Zahradka otevrena');
4+
INSERT INTO event (title, event_time, event_place) VALUES ('Patecni mega-rizek', '2023-10-26 10:38:10', 'Snyt - Vinohrady');
5+
INSERT INTO event (title) VALUES ('Na cepu nove Plzen 10');
6+
INSERT INTO event (title, event_time, event_place) VALUES ('Patecni grilovane kure', '2023-10-26 10:38:10', 'Snyt - Vinohrady');
7+
INSERT INTO event (title) VALUES ('Zahradka zavrena');
8+
INSERT INTO event (title) VALUES ('Hledame kuchare');
Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
CREATE TABLE user (
2+
id INT UNSIGNED AUTO_INCREMENT NOT NULL,
3+
email VARCHAR(255) NOT NULL,
4+
password VARCHAR(255) NOT NULL,
5+
created_at TIMESTAMP DEFAULT CURRENT_TIMESTAMP ,
6+
updated_at DATETIME DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP,
7+
PRIMARY KEY(id)
8+
);
Lines changed: 9 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -1,18 +1,9 @@
1-
CREATE TABLE event (
2-
id INT UNSIGNED AUTO_INCREMENT NOT NULL,
3-
title VARCHAR(255) NOT NULL,
4-
event_time TIMESTAMP DEFAULT NULL,
5-
event_place VARCHAR(255) DEFAULT NULL,
6-
created_at TIMESTAMP DEFAULT CURRENT_TIMESTAMP ,
7-
updated_at DATETIME DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP,
8-
PRIMARY KEY(id)
9-
);
10-
11-
CREATE TABLE user (
12-
id INT UNSIGNED AUTO_INCREMENT NOT NULL,
13-
email VARCHAR(255) NOT NULL,
14-
password VARCHAR(255) NOT NULL,
15-
created_at TIMESTAMP DEFAULT CURRENT_TIMESTAMP ,
16-
updated_at DATETIME DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP,
17-
PRIMARY KEY(id)
18-
);
1+
CREATE TABLE event (
2+
id INT UNSIGNED AUTO_INCREMENT NOT NULL,
3+
title VARCHAR(255) NOT NULL,
4+
event_time TIMESTAMP DEFAULT NULL,
5+
event_place VARCHAR(255) DEFAULT NULL,
6+
created_at TIMESTAMP DEFAULT CURRENT_TIMESTAMP ,
7+
updated_at DATETIME DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP,
8+
PRIMARY KEY(id)
9+
);

0 commit comments

Comments
 (0)