vaizard / glued-archived

1 stars 3 forks source link

Database mirgations #80

Closed killua-eu closed 5 years ago

killua-eu commented 5 years ago

Glued (still) doesn't implement a database installation/schema update mechanism and definitely needs one. There are some options out there, but for php https://phinx.org/ looked best, even though its rather heavy on syntax. Using phinx will:

Here also a video intro https://codecourse.com/watch/database-migrations-with-slim

pohadkar commented 5 years ago

instrukce pro instalaci databaze gluedu:

1) po nahrani na server si zeditovat soubor phinx.yml (je tam, kde je composer.json) napsat si tam pripojeni do db do kolonky production. heslo musi byt v jednoduchych uvozovkach

production:
    adapter: mysql
    host: localhost
    name: production_db
    user: root
    pass: ''
    port: 3306
    charset: utf8

2) v tom samem adresari se spusti phinx do production databaze

vendor/bin/phinx migrate -e production

pouzije to instalacni soubor z db/migrations je tam zatim jen jeden s create vsech tabulek a naplneni 4 tabulek defaultnimi daty.

samozrejme si bude muset i prepsat settings slimu a pripane nejaky zakladni majl, aby se mohlregistrovat ale to uz neni vec tohohle issue

pohadkar commented 5 years ago

do instalacniho souboru db byly pridany jeste autoincrementy, ktere tam chybely.

pohadkar commented 5 years ago

novy migracni soubor se zaklada prikazem vendor/bin/phinx create NoveUpravyMigrace velke pismena v nazvu jsou dulezite, protoze se pak nazev prevadi na soubor podle pravidla datum-nove-upravy-migrace

pohadkar commented 5 years ago

zalozil jsem novy migracni soubor, ktery do tabulky t_users pridava json sloupecek profile_data je treba otestovat instalaci jestli se tam skutecne prida, a jestli bude mit default null hodnotu