Add migrations and update config

This commit is contained in:
Ryan Prather 2024-11-28 11:33:09 -05:00
parent 60f4ccc66e
commit b8f51783e0
4 changed files with 177 additions and 47 deletions

View File

@ -1,39 +1,53 @@
security:
# https://symfony.com/doc/current/security.html#registering-the-user-hashing-passwords
password_hashers:
Symfony\Component\Security\Core\User\PasswordAuthenticatedUserInterface: 'auto'
# https://symfony.com/doc/current/security.html#loading-the-user-the-user-provider
providers:
users_in_memory: { memory: null }
firewalls:
dev:
pattern: ^/(_(profiler|wdt)|css|images|js)/
security: false
main:
lazy: true
provider: users_in_memory
# https://symfony.com/doc/current/security.html#registering-the-user-hashing-passwords
password_hashers:
Symfony\Component\Security\Core\User\PasswordAuthenticatedUserInterface: "auto"
# https://symfony.com/doc/current/security.html#loading-the-user-the-user-provider
providers:
# used to reload user from session & other features (e.g. switch_user)
app_user_provider:
entity:
class: App\Entity\User
property: username
# used to reload user from session & other features (e.g. switch_user)
firewalls:
dev:
pattern: ^/(_(profiler|wdt)|css|images|js)/
security: false
main:
lazy: true
provider: app_user_provider
form_login:
login_path: app_login
check_path: app_login
enable_csrf: false
default_target_path: app_dashboard
logout:
path: app_logout
# where to redirect after logout
# target: app_any_route
# activate different ways to authenticate
# https://symfony.com/doc/current/security.html#the-firewall
# activate different ways to authenticate
# https://symfony.com/doc/current/security.html#the-firewall
# https://symfony.com/doc/current/security/impersonating_user.html
# switch_user: true
# https://symfony.com/doc/current/security/impersonating_user.html
# switch_user: true
# Easy way to control access for large sections of your site
# Note: Only the *first* access control that matches will be used
access_control:
# - { path: ^/admin, roles: ROLE_ADMIN }
# - { path: ^/profile, roles: ROLE_USER }
# Easy way to control access for large sections of your site
# Note: Only the *first* access control that matches will be used
access_control:
# - { path: ^/admin, roles: ROLE_ADMIN }
# - { path: ^/profile, roles: ROLE_USER }
when@test:
security:
password_hashers:
# By default, password hashers are resource intensive and take time. This is
# important to generate secure password hashes. In tests however, secure hashes
# are not important, waste resources and increase test times. The following
# reduces the work factor to the lowest possible values.
Symfony\Component\Security\Core\User\PasswordAuthenticatedUserInterface:
algorithm: auto
cost: 4 # Lowest possible value for bcrypt
time_cost: 3 # Lowest possible value for argon
memory_cost: 10 # Lowest possible value for argon
security:
password_hashers:
# By default, password hashers are resource intensive and take time. This is
# important to generate secure password hashes. In tests however, secure hashes
# are not important, waste resources and increase test times. The following
# reduces the work factor to the lowest possible values.
Symfony\Component\Security\Core\User\PasswordAuthenticatedUserInterface:
algorithm: auto
cost: 4 # Lowest possible value for bcrypt
time_cost: 3 # Lowest possible value for argon
memory_cost: 10 # Lowest possible value for argon

View File

@ -6,19 +6,23 @@
parameters:
services:
# default configuration for services in *this* file
_defaults:
autowire: true # Automatically injects dependencies in your services.
autoconfigure: true # Automatically registers your services as commands, event subscribers, etc.
# default configuration for services in *this* file
_defaults:
autowire: true # Automatically injects dependencies in your services.
autoconfigure: true # Automatically registers your services as commands, event subscribers, etc.
# makes classes in src/ available to be used as services
# this creates a service per class whose id is the fully-qualified class name
App\:
resource: '../src/'
exclude:
- '../src/DependencyInjection/'
- '../src/Entity/'
- '../src/Kernel.php'
# makes classes in src/ available to be used as services
# this creates a service per class whose id is the fully-qualified class name
#App.flow.flow.registrationFlow:
# class: App\Bundle\Flow\RegistrationFlow
# autoconfigure: true
# add more service definitions when explicit configuration is needed
# please note that last definitions always *replace* previous ones
App\:
resource: "../src/"
exclude:
- "../src/DependencyInjection/"
- "../src/Entity/"
- "../src/Kernel.php"
# add more service definitions when explicit configuration is needed
# please note that last definitions always *replace* previous ones

View File

@ -0,0 +1,73 @@
<?php
declare(strict_types=1);
namespace DoctrineMigrations;
use Doctrine\DBAL\Schema\Schema;
use Doctrine\Migrations\AbstractMigration;
/**
* Auto-generated Migration: Please modify to your needs!
*/
final class Version20241119001243 extends AbstractMigration
{
public function getDescription(): string
{
return '';
}
public function up(Schema $schema): void
{
// this up() migration is auto-generated, please modify it to your needs
$this->addSql('CREATE TABLE case_location (id BINARY(16) NOT NULL COMMENT \'(DC2Type:uuid)\', origin_location_id BINARY(16) NOT NULL COMMENT \'(DC2Type:uuid)\', dest_location_id BINARY(16) NOT NULL COMMENT \'(DC2Type:uuid)\', date DATE NOT NULL, departure TIME DEFAULT NULL, arrival TIME DEFAULT NULL, case_mileage TINYINT(1) NOT NULL, INDEX IDX_C9E3F3B6E99C7F9 (origin_location_id), INDEX IDX_C9E3F3B6BF14A4AE (dest_location_id), PRIMARY KEY(id)) DEFAULT CHARACTER SET utf8mb4 COLLATE `utf8mb4_unicode_ci` ENGINE = InnoDB');
$this->addSql('CREATE TABLE case_note (id BINARY(16) NOT NULL COMMENT \'(DC2Type:uuid)\', case_id_id BINARY(16) NOT NULL COMMENT \'(DC2Type:uuid)\', report_id_id BINARY(16) DEFAULT NULL COMMENT \'(DC2Type:uuid)\', note_type VARCHAR(255) NOT NULL, file VARCHAR(255) DEFAULT NULL, INDEX IDX_4EA520A72DAD64BB (case_id_id), INDEX IDX_4EA520A75558992E (report_id_id), PRIMARY KEY(id)) DEFAULT CHARACTER SET utf8mb4 COLLATE `utf8mb4_unicode_ci` ENGINE = InnoDB');
$this->addSql('CREATE TABLE company (id BINARY(16) NOT NULL COMMENT \'(DC2Type:uuid)\', name VARCHAR(255) NOT NULL, address VARCHAR(255) NOT NULL, city VARCHAR(255) NOT NULL, state VARCHAR(10) NOT NULL, zip VARCHAR(15) NOT NULL, phone VARCHAR(15) NOT NULL, email VARCHAR(64) NOT NULL, poc VARCHAR(255) NOT NULL, url VARCHAR(255) DEFAULT NULL, PRIMARY KEY(id)) DEFAULT CHARACTER SET utf8mb4 COLLATE `utf8mb4_unicode_ci` ENGINE = InnoDB');
$this->addSql('CREATE TABLE location (id BINARY(16) NOT NULL COMMENT \'(DC2Type:uuid)\', name VARCHAR(45) NOT NULL, address VARCHAR(255) NOT NULL, cases LONGTEXT DEFAULT NULL COMMENT \'(DC2Type:array)\', lat NUMERIC(10, 6) DEFAULT NULL, lon NUMERIC(10, 6) DEFAULT NULL, PRIMARY KEY(id)) DEFAULT CHARACTER SET utf8mb4 COLLATE `utf8mb4_unicode_ci` ENGINE = InnoDB');
$this->addSql('CREATE TABLE location_options (id BINARY(16) NOT NULL COMMENT \'(DC2Type:uuid)\', name VARCHAR(45) NOT NULL, PRIMARY KEY(id)) DEFAULT CHARACTER SET utf8mb4 COLLATE `utf8mb4_unicode_ci` ENGINE = InnoDB');
$this->addSql('CREATE TABLE `member` (id BINARY(16) NOT NULL COMMENT \'(DC2Type:uuid)\', case_id_id BINARY(16) NOT NULL COMMENT \'(DC2Type:uuid)\', last_name VARCHAR(45) NOT NULL, first_name VARCHAR(45) NOT NULL, relationship VARCHAR(45) DEFAULT NULL, personal_id VARCHAR(45) DEFAULT NULL, gender VARCHAR(255) DEFAULT NULL, race VARCHAR(45) DEFAULT NULL, dob DATE NOT NULL, language VARCHAR(45) DEFAULT NULL, emergency_contact VARCHAR(45) DEFAULT NULL, phone VARCHAR(15) DEFAULT NULL, day_phone VARCHAR(15) DEFAULT NULL, evening_phone VARCHAR(15) DEFAULT NULL, cell_phone VARCHAR(15) DEFAULT NULL, email VARCHAR(45) DEFAULT NULL, school VARCHAR(255) DEFAULT NULL, address VARCHAR(64) DEFAULT NULL, city VARCHAR(45) DEFAULT NULL, state VARCHAR(15) DEFAULT NULL, zip VARCHAR(10) DEFAULT NULL, marital_status VARCHAR(45) DEFAULT NULL, is_child TINYINT(1) NOT NULL, is_parent TINYINT(1) NOT NULL, is_adult_child TINYINT(1) NOT NULL, is_legal_guardian TINYINT(1) NOT NULL, parents_live_together TINYINT(1) NOT NULL, INDEX IDX_70E4FA782DAD64BB (case_id_id), PRIMARY KEY(id)) DEFAULT CHARACTER SET utf8mb4 COLLATE `utf8mb4_unicode_ci` ENGINE = InnoDB');
$this->addSql('CREATE TABLE member_case (id BINARY(16) NOT NULL COMMENT \'(DC2Type:uuid)\', case_number VARCHAR(15) NOT NULL, hours DOUBLE PRECISION NOT NULL, end_date DATE NOT NULL, case_name VARCHAR(64) NOT NULL, service VARCHAR(45) NOT NULL, referral_number VARCHAR(45) NOT NULL, first_name VARCHAR(45) NOT NULL, last_name VARCHAR(45) NOT NULL, referral_type VARCHAR(45) NOT NULL, referral_source VARCHAR(45) NOT NULL, referral_source2 VARCHAR(45) DEFAULT NULL, admit_date DATE DEFAULT NULL, close_date DATE DEFAULT NULL, dcs_case_id VARCHAR(45) DEFAULT NULL, insurance VARCHAR(45) DEFAULT NULL, medicaid VARCHAR(45) DEFAULT NULL, fcm_email VARCHAR(64) DEFAULT NULL, case_email VARCHAR(45) DEFAULT NULL, address VARCHAR(64) DEFAULT NULL, city VARCHAR(45) DEFAULT NULL, state VARCHAR(15) DEFAULT NULL, zip VARCHAR(10) DEFAULT NULL, country VARCHAR(45) DEFAULT NULL, PRIMARY KEY(id)) DEFAULT CHARACTER SET utf8mb4 COLLATE `utf8mb4_unicode_ci` ENGINE = InnoDB');
$this->addSql('CREATE TABLE method_options (id BINARY(16) NOT NULL COMMENT \'(DC2Type:uuid)\', name VARCHAR(45) NOT NULL, rel VARCHAR(45) NOT NULL, idx INT NOT NULL, PRIMARY KEY(id)) DEFAULT CHARACTER SET utf8mb4 COLLATE `utf8mb4_unicode_ci` ENGINE = InnoDB');
$this->addSql('CREATE TABLE report (id BINARY(16) NOT NULL COMMENT \'(DC2Type:uuid)\', location_id BINARY(16) NOT NULL COMMENT \'(DC2Type:uuid)\', method_id BINARY(16) NOT NULL COMMENT \'(DC2Type:uuid)\', type VARCHAR(45) NOT NULL, start_time TIME NOT NULL, end_time TIME NOT NULL, case_number VARCHAR(45) NOT NULL, others_present JSON NOT NULL, note JSON NOT NULL, INDEX IDX_C42F778464D218E (location_id), INDEX IDX_C42F778419883967 (method_id), PRIMARY KEY(id)) DEFAULT CHARACTER SET utf8mb4 COLLATE `utf8mb4_unicode_ci` ENGINE = InnoDB');
$this->addSql('CREATE TABLE user (id BINARY(16) NOT NULL COMMENT \'(DC2Type:uuid)\', company_id BINARY(16) NOT NULL COMMENT \'(DC2Type:uuid)\', username VARCHAR(45) NOT NULL, roles JSON NOT NULL, password VARCHAR(255) NOT NULL, name VARCHAR(45) NOT NULL, email VARCHAR(45) NOT NULL, job VARCHAR(45) NOT NULL, rate_type VARCHAR(255) NOT NULL, rate NUMERIC(6, 2) NOT NULL, INDEX IDX_8D93D649979B1AD6 (company_id), UNIQUE INDEX UNIQ_IDENTIFIER_USERNAME (username), PRIMARY KEY(id)) DEFAULT CHARACTER SET utf8mb4 COLLATE `utf8mb4_unicode_ci` ENGINE = InnoDB');
$this->addSql('CREATE TABLE user_case (id BINARY(16) NOT NULL COMMENT \'(DC2Type:uuid)\', user_id_id BINARY(16) NOT NULL COMMENT \'(DC2Type:uuid)\', case_id_id BINARY(16) NOT NULL COMMENT \'(DC2Type:uuid)\', INDEX IDX_289D5CD9D86650F (user_id_id), INDEX IDX_289D5CD2DAD64BB (case_id_id), PRIMARY KEY(id)) DEFAULT CHARACTER SET utf8mb4 COLLATE `utf8mb4_unicode_ci` ENGINE = InnoDB');
$this->addSql('CREATE TABLE messenger_messages (id BIGINT AUTO_INCREMENT NOT NULL, body LONGTEXT NOT NULL, headers LONGTEXT NOT NULL, queue_name VARCHAR(190) NOT NULL, created_at DATETIME NOT NULL COMMENT \'(DC2Type:datetime_immutable)\', available_at DATETIME NOT NULL COMMENT \'(DC2Type:datetime_immutable)\', delivered_at DATETIME DEFAULT NULL COMMENT \'(DC2Type:datetime_immutable)\', INDEX IDX_75EA56E0FB7336F0 (queue_name), INDEX IDX_75EA56E0E3BD61CE (available_at), INDEX IDX_75EA56E016BA31DB (delivered_at), PRIMARY KEY(id)) DEFAULT CHARACTER SET utf8mb4 COLLATE `utf8mb4_unicode_ci` ENGINE = InnoDB');
$this->addSql('ALTER TABLE case_location ADD CONSTRAINT FK_C9E3F3B6E99C7F9 FOREIGN KEY (origin_location_id) REFERENCES location (id)');
$this->addSql('ALTER TABLE case_location ADD CONSTRAINT FK_C9E3F3B6BF14A4AE FOREIGN KEY (dest_location_id) REFERENCES location (id)');
$this->addSql('ALTER TABLE case_note ADD CONSTRAINT FK_4EA520A72DAD64BB FOREIGN KEY (case_id_id) REFERENCES member_case (id)');
$this->addSql('ALTER TABLE case_note ADD CONSTRAINT FK_4EA520A75558992E FOREIGN KEY (report_id_id) REFERENCES report (id)');
$this->addSql('ALTER TABLE `member` ADD CONSTRAINT FK_70E4FA782DAD64BB FOREIGN KEY (case_id_id) REFERENCES member_case (id)');
$this->addSql('ALTER TABLE report ADD CONSTRAINT FK_C42F778464D218E FOREIGN KEY (location_id) REFERENCES location_options (id)');
$this->addSql('ALTER TABLE report ADD CONSTRAINT FK_C42F778419883967 FOREIGN KEY (method_id) REFERENCES method_options (id)');
$this->addSql('ALTER TABLE user ADD CONSTRAINT FK_8D93D649979B1AD6 FOREIGN KEY (company_id) REFERENCES company (id)');
$this->addSql('ALTER TABLE user_case ADD CONSTRAINT FK_289D5CD9D86650F FOREIGN KEY (user_id_id) REFERENCES user (id)');
$this->addSql('ALTER TABLE user_case ADD CONSTRAINT FK_289D5CD2DAD64BB FOREIGN KEY (case_id_id) REFERENCES member_case (id)');
}
public function down(Schema $schema): void
{
// this down() migration is auto-generated, please modify it to your needs
$this->addSql('ALTER TABLE case_location DROP FOREIGN KEY FK_C9E3F3B6E99C7F9');
$this->addSql('ALTER TABLE case_location DROP FOREIGN KEY FK_C9E3F3B6BF14A4AE');
$this->addSql('ALTER TABLE case_note DROP FOREIGN KEY FK_4EA520A72DAD64BB');
$this->addSql('ALTER TABLE case_note DROP FOREIGN KEY FK_4EA520A75558992E');
$this->addSql('ALTER TABLE `member` DROP FOREIGN KEY FK_70E4FA782DAD64BB');
$this->addSql('ALTER TABLE report DROP FOREIGN KEY FK_C42F778464D218E');
$this->addSql('ALTER TABLE report DROP FOREIGN KEY FK_C42F778419883967');
$this->addSql('ALTER TABLE user DROP FOREIGN KEY FK_8D93D649979B1AD6');
$this->addSql('ALTER TABLE user_case DROP FOREIGN KEY FK_289D5CD9D86650F');
$this->addSql('ALTER TABLE user_case DROP FOREIGN KEY FK_289D5CD2DAD64BB');
$this->addSql('DROP TABLE case_location');
$this->addSql('DROP TABLE case_note');
$this->addSql('DROP TABLE company');
$this->addSql('DROP TABLE location');
$this->addSql('DROP TABLE location_options');
$this->addSql('DROP TABLE `member`');
$this->addSql('DROP TABLE member_case');
$this->addSql('DROP TABLE method_options');
$this->addSql('DROP TABLE report');
$this->addSql('DROP TABLE user');
$this->addSql('DROP TABLE user_case');
$this->addSql('DROP TABLE messenger_messages');
}
}

View File

@ -0,0 +1,39 @@
<?php
declare(strict_types=1);
namespace DoctrineMigrations;
use Doctrine\DBAL\Schema\Schema;
use Doctrine\Migrations\AbstractMigration;
/**
* Auto-generated Migration: Please modify to your needs!
*/
final class Version20241128014243 extends AbstractMigration
{
public function getDescription(): string
{
return '';
}
public function up(Schema $schema): void
{
// this up() migration is auto-generated, please modify it to your needs
$this->addSql('ALTER TABLE company ADD owner_id BINARY(16) NOT NULL COMMENT \'(DC2Type:uuid)\', DROP poc');
$this->addSql('ALTER TABLE company ADD CONSTRAINT FK_4FBF094F7E3C61F9 FOREIGN KEY (owner_id) REFERENCES user (id)');
$this->addSql('CREATE UNIQUE INDEX UNIQ_4FBF094F7E3C61F9 ON company (owner_id)');
$this->addSql('ALTER TABLE member_case ADD level VARCHAR(255) NOT NULL');
$this->addSql('ALTER TABLE user ADD level VARCHAR(255) NOT NULL, CHANGE company_id company_id BINARY(16) DEFAULT NULL COMMENT \'(DC2Type:uuid)\'');
}
public function down(Schema $schema): void
{
// this down() migration is auto-generated, please modify it to your needs
$this->addSql('ALTER TABLE company DROP FOREIGN KEY FK_4FBF094F7E3C61F9');
$this->addSql('DROP INDEX UNIQ_4FBF094F7E3C61F9 ON company');
$this->addSql('ALTER TABLE company ADD poc VARCHAR(255) NOT NULL, DROP owner_id');
$this->addSql('ALTER TABLE member_case DROP level');
$this->addSql('ALTER TABLE user DROP level, CHANGE company_id company_id BINARY(16) NOT NULL COMMENT \'(DC2Type:uuid)\'');
}
}